Skip to content

Commit 55845dd

Browse files
authored
Merge pull request #1579 from veox/update-fixtures-to-v6.0.0-beta.2
Update ethereum/tests fixtures to v6.0.0-beta.2 + fix revealed consensus failures
2 parents f111c8b + fd537be commit 55845dd

File tree

10 files changed

+162
-78
lines changed

10 files changed

+162
-78
lines changed

.circleci/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ jobs:
108108
- image: circleci/python:3.5
109109
environment:
110110
TOXENV: py35-native-blockchain-byzantium
111+
py35-native-blockchain-constantinople:
112+
<<: *common
113+
docker:
114+
- image: circleci/python:3.5
115+
environment:
116+
TOXENV: py35-native-blockchain-constantinople
111117
py35-native-blockchain-frontier:
112118
<<: *common
113119
docker:
@@ -175,6 +181,12 @@ jobs:
175181
- image: circleci/python:3.6
176182
environment:
177183
TOXENV: py36-native-blockchain-byzantium
184+
py36-native-blockchain-constantinople:
185+
<<: *common
186+
docker:
187+
- image: circleci/python:3.6
188+
environment:
189+
TOXENV: py36-native-blockchain-constantinople
178190
py36-native-blockchain-frontier:
179191
<<: *common
180192
docker:
@@ -211,6 +223,12 @@ jobs:
211223
- image: circleci/python:3.6
212224
environment:
213225
TOXENV: py36-rpc-state-byzantium
226+
py36-rpc-state-constantinople:
227+
<<: *common
228+
docker:
229+
- image: circleci/python:3.6
230+
environment:
231+
TOXENV: py36-rpc-state-constantinople
214232
py36-rpc-state-frontier:
215233
<<: *common
216234
docker:
@@ -340,12 +358,14 @@ workflows:
340358
- py37-beacon
341359

342360
- py36-native-blockchain-byzantium
361+
- py36-native-blockchain-constantinople
343362
- py36-native-blockchain-frontier
344363
- py36-native-blockchain-homestead
345364
- py36-native-blockchain-eip150
346365
- py36-native-blockchain-eip158
347366
- py36-native-blockchain-transition
348367
- py36-rpc-state-byzantium
368+
- py36-rpc-state-constantinople
349369
- py36-rpc-state-frontier
350370
- py36-rpc-state-homestead
351371
- py36-rpc-state-eip150
@@ -364,6 +384,7 @@ workflows:
364384
- py36-beacon
365385

366386
- py35-native-blockchain-byzantium
387+
- py35-native-blockchain-constantinople
367388
- py35-native-blockchain-frontier
368389
- py35-native-blockchain-homestead
369390
- py35-native-blockchain-eip150

eth/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#
2222
# Ensure we can reach 1024 frames of recursion
2323
#
24-
EVM_RECURSION_LIMIT = 1024 * 10
24+
EVM_RECURSION_LIMIT = 1024 * 12
2525
sys.setrecursionlimit(max(EVM_RECURSION_LIMIT, sys.getrecursionlimit()))
2626

2727

eth/tools/fixtures/helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
BaseVM,
4141
)
4242
from eth.vm.forks import (
43+
ConstantinopleVM,
4344
ByzantiumVM,
4445
TangerineWhistleVM,
4546
FrontierVM,
@@ -123,6 +124,10 @@ def chain_vm_configuration(fixture: Dict[str, Any]) -> Iterable[Tuple[int, Type[
123124
return (
124125
(0, ByzantiumVM),
125126
)
127+
elif network == 'Constantinople':
128+
return (
129+
(0, ConstantinopleVM),
130+
)
126131
elif network == 'FrontierToHomesteadAt5':
127132
HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
128133
return (

eth/vm/forks/constantinople/opcodes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
opcode_values,
1212
)
1313
from eth.vm.forks.byzantium.opcodes import (
14-
BYZANTIUM_OPCODES
14+
BYZANTIUM_OPCODES,
15+
ensure_no_static
1516
)
1617
from eth.vm.forks.constantinople.constants import (
1718
GAS_EXTCODEHASH_EIP1052
@@ -56,7 +57,7 @@
5657
gas_cost=constants.GAS_CREATE,
5758
)(),
5859
opcode_values.SSTORE: as_opcode(
59-
logic_fn=sstore_eip1283,
60+
logic_fn=ensure_no_static(sstore_eip1283),
6061
mnemonic=mnemonics.SSTORE,
6162
gas_cost=constants.GAS_NULL,
6263
),

eth/vm/logic/system.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020
ceil32,
2121
)
2222
from eth.vm import mnemonics
23-
from eth.vm.computation import (
24-
BaseComputation
25-
)
26-
from eth.vm.opcode import (
27-
Opcode,
28-
)
23+
from eth.vm.computation import BaseComputation
24+
from eth.vm.message import Message
25+
from eth.vm.opcode import Opcode
2926

3027
from .call import max_child_gas_eip150
3128

@@ -193,13 +190,16 @@ def __call__(self, computation: BaseComputation) -> None:
193190
code=call_data,
194191
create_address=contract_address,
195192
)
193+
self.apply_create_message(computation, child_msg)
196194

195+
def apply_create_message(self, computation: BaseComputation, child_msg: Message) -> None:
197196
child_computation = computation.apply_child_computation(child_msg)
198197

199198
if child_computation.is_error:
200199
computation.stack_push(0)
201200
else:
202-
computation.stack_push(contract_address)
201+
computation.stack_push(child_msg.storage_address)
202+
203203
computation.return_gas(child_computation.get_gas_remaining())
204204

205205

@@ -240,3 +240,22 @@ def generate_contract_address(self,
240240
stack_data.salt,
241241
call_data
242242
)
243+
244+
def apply_create_message(self, computation: BaseComputation, child_msg: Message) -> None:
245+
# We need to ensure that creation operates on empty storage **and**
246+
# that if the initialization code fails that we revert the account back
247+
# to its original state root.
248+
snapshot = computation.state.snapshot()
249+
250+
computation.state.account_db.delete_storage(child_msg.storage_address)
251+
252+
child_computation = computation.apply_child_computation(child_msg)
253+
254+
if child_computation.is_error:
255+
computation.state.revert(snapshot)
256+
computation.stack_push(0)
257+
else:
258+
computation.state.commit(snapshot)
259+
computation.stack_push(child_msg.storage_address)
260+
261+
computation.return_gas(child_computation.get_gas_remaining())

fixtures

Submodule fixtures updated 1040 files

tests/conftest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
# Uncomment this to have logs from tests written to a file. This is useful for
2424
# debugging when you need to dump the VM output from test runs.
2525
"""
26+
import datetime
27+
import logging
28+
import os
29+
from eth.tools.logging import TRACE_LEVEL_NUM
30+
2631
@pytest.yield_fixture(autouse=True)
2732
def _file_logging(request):
28-
import datetime
29-
import os
3033
3134
logger = logging.getLogger('eth')
3235

0 commit comments

Comments
 (0)