Skip to content

Update ethereum/tests fixtures to v6.0.0-beta.2 + fix revealed consensus failures #1579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -108,6 +108,12 @@ jobs:
- image: circleci/python:3.5
environment:
TOXENV: py35-native-blockchain-byzantium
py35-native-blockchain-constantinople:
<<: *common
docker:
- image: circleci/python:3.5
environment:
TOXENV: py35-native-blockchain-constantinople
py35-native-blockchain-frontier:
<<: *common
docker:
@@ -175,6 +181,12 @@ jobs:
- image: circleci/python:3.6
environment:
TOXENV: py36-native-blockchain-byzantium
py36-native-blockchain-constantinople:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-native-blockchain-constantinople
py36-native-blockchain-frontier:
<<: *common
docker:
@@ -211,6 +223,12 @@ jobs:
- image: circleci/python:3.6
environment:
TOXENV: py36-rpc-state-byzantium
py36-rpc-state-constantinople:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-rpc-state-constantinople
py36-rpc-state-frontier:
<<: *common
docker:
@@ -340,12 +358,14 @@ workflows:
- py37-beacon

- py36-native-blockchain-byzantium
- py36-native-blockchain-constantinople
- py36-native-blockchain-frontier
- py36-native-blockchain-homestead
- py36-native-blockchain-eip150
- py36-native-blockchain-eip158
- py36-native-blockchain-transition
- py36-rpc-state-byzantium
- py36-rpc-state-constantinople
- py36-rpc-state-frontier
- py36-rpc-state-homestead
- py36-rpc-state-eip150
@@ -364,6 +384,7 @@ workflows:
- py36-beacon

- py35-native-blockchain-byzantium
- py35-native-blockchain-constantinople
- py35-native-blockchain-frontier
- py35-native-blockchain-homestead
- py35-native-blockchain-eip150
2 changes: 1 addition & 1 deletion eth/__init__.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
#
# Ensure we can reach 1024 frames of recursion
#
EVM_RECURSION_LIMIT = 1024 * 10
EVM_RECURSION_LIMIT = 1024 * 12
sys.setrecursionlimit(max(EVM_RECURSION_LIMIT, sys.getrecursionlimit()))


5 changes: 5 additions & 0 deletions eth/tools/fixtures/helpers.py
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@
BaseVM,
)
from eth.vm.forks import (
ConstantinopleVM,
ByzantiumVM,
TangerineWhistleVM,
FrontierVM,
@@ -123,6 +124,10 @@ def chain_vm_configuration(fixture: Dict[str, Any]) -> Iterable[Tuple[int, Type[
return (
(0, ByzantiumVM),
)
elif network == 'Constantinople':
return (
(0, ConstantinopleVM),
)
elif network == 'FrontierToHomesteadAt5':
HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
return (
5 changes: 3 additions & 2 deletions eth/vm/forks/constantinople/opcodes.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,8 @@
opcode_values,
)
from eth.vm.forks.byzantium.opcodes import (
BYZANTIUM_OPCODES
BYZANTIUM_OPCODES,
ensure_no_static
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could possibly be moved "out" of any fork-specific file.

)
from eth.vm.forks.constantinople.constants import (
GAS_EXTCODEHASH_EIP1052
@@ -56,7 +57,7 @@
gas_cost=constants.GAS_CREATE,
)(),
opcode_values.SSTORE: as_opcode(
logic_fn=sstore_eip1283,
logic_fn=ensure_no_static(sstore_eip1283),
mnemonic=mnemonics.SSTORE,
gas_cost=constants.GAS_NULL,
),
33 changes: 26 additions & 7 deletions eth/vm/logic/system.py
Original file line number Diff line number Diff line change
@@ -20,12 +20,9 @@
ceil32,
)
from eth.vm import mnemonics
from eth.vm.computation import (
BaseComputation
)
from eth.vm.opcode import (
Opcode,
)
from eth.vm.computation import BaseComputation
from eth.vm.message import Message
from eth.vm.opcode import Opcode

from .call import max_child_gas_eip150

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

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

if child_computation.is_error:
computation.stack_push(0)
else:
computation.stack_push(contract_address)
computation.stack_push(child_msg.storage_address)

computation.return_gas(child_computation.get_gas_remaining())


@@ -240,3 +240,22 @@ def generate_contract_address(self,
stack_data.salt,
call_data
)

def apply_create_message(self, computation: BaseComputation, child_msg: Message) -> None:
# We need to ensure that creation operates on empty storage **and**
# that if the initialization code fails that we revert the account back
# to its original state root.
snapshot = computation.state.snapshot()

computation.state.account_db.delete_storage(child_msg.storage_address)

child_computation = computation.apply_child_computation(child_msg)

if child_computation.is_error:
computation.state.revert(snapshot)
computation.stack_push(0)
else:
computation.state.commit(snapshot)
computation.stack_push(child_msg.storage_address)

computation.return_gas(child_computation.get_gas_remaining())
2 changes: 1 addition & 1 deletion fixtures
Submodule fixtures updated 1040 files
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -23,10 +23,13 @@
# Uncomment this to have logs from tests written to a file. This is useful for
# debugging when you need to dump the VM output from test runs.
"""
import datetime
import logging
import os
from eth.tools.logging import TRACE_LEVEL_NUM

@pytest.yield_fixture(autouse=True)
def _file_logging(request):
import datetime
import os

logger = logging.getLogger('eth')

Loading