Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
18d415a
update upstream tests for Istanbul
voith Sep 18, 2019
0ff7cc0
updated fixtures and handle case when postState is a string
voith Sep 22, 2019
9ce8a9a
add more gas for sstore_uint64 tests
voith Sep 22, 2019
7194e9d
change ByzantiumToConstantinopleAt5 to ByzantiumToConstantinopleFixAt5
voith Sep 22, 2019
e5cea08
update gas for create_empty_contract
voith Sep 22, 2019
a96d9c6
mark randomStatetest94 as slow tests
voith Sep 23, 2019
427c0f5
add istanbul blockchain tests to CI
voith Sep 23, 2019
d6c61c6
Some fixtures do not have post state. Added a normalizer `normalize_p…
voith Sep 26, 2019
01deb50
mark some tests as incorrect
voith Oct 2, 2019
b62018f
fixtures: switch to tag v7.0.0-beta.1.
veox Oct 4, 2019
1bb3f2d
EIP-161 collect_touched_accounts(): relax to geth's level.
veox Oct 4, 2019
aa86fc3
EIP-161: don't collect if nested computation errored.
veox Oct 5, 2019
86524e1
EIP-161 collect_touched_accounts(): clean up.
veox Oct 5, 2019
414a7e2
EIP-161 collect_touched_accounts(): remove computation.is_origin_comp…
veox Oct 5, 2019
758554d
tests: regenerate SLOWEST_TESTS.
veox Oct 3, 2019
6f6ec2c
misc: add "newsfragment".
veox Oct 9, 2019
d55b1b8
tests: transition to correct VM (Petersburg, not Constantinople) in h…
veox Oct 17, 2019
376e4ff
setup,tests: use eth-typing v2.2.0 and fork definitions from it.
veox Oct 31, 2019
913b2a2
eth/chains: set Istanbul mainnet block number to proper value.
veox Nov 4, 2019
70bfec0
misc: move "newsfragment" to `bugfix` section + update it.
veox Nov 4, 2019
f1651af
eth/chains: add Goerli Istanbul block number.
veox Nov 4, 2019
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
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ jobs:
- image: circleci/python:3.6
environment:
TOXENV: py36-native-blockchain-homestead
py36-native-blockchain-istanbul:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-native-blockchain-istanbul
py36-native-blockchain-petersburg:
<<: *common
docker:
Expand Down Expand Up @@ -171,6 +177,7 @@ workflows:
- py36-native-blockchain-constantinople
- py36-native-blockchain-frontier
- py36-native-blockchain-homestead
- py36-native-blockchain-istanbul
- py36-native-blockchain-petersburg
- py36-native-blockchain-tangerine_whistle
- py36-native-blockchain-spurious_dragon
Expand Down
5 changes: 5 additions & 0 deletions eth/chains/goerli/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
# Petersburg
#
PETERSBURG_GOERLI_BLOCK = BlockNumber(0)

#
# Istanbul
#
ISTANBUL_GOERLI_BLOCK = BlockNumber(1561651)
4 changes: 4 additions & 0 deletions eth/chains/mainnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
MAINNET_CHAIN_ID,
BYZANTIUM_MAINNET_BLOCK,
PETERSBURG_MAINNET_BLOCK,
ISTANBUL_MAINNET_BLOCK,
TANGERINE_WHISTLE_MAINNET_BLOCK,
HOMESTEAD_MAINNET_BLOCK,
SPURIOUS_DRAGON_MAINNET_BLOCK,
Expand All @@ -34,6 +35,7 @@
ByzantiumVM,
FrontierVM,
HomesteadVM,
IstanbulVM,
PetersburgVM,
SpuriousDragonVM,
TangerineWhistleVM,
Expand Down Expand Up @@ -80,6 +82,7 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
SPURIOUS_DRAGON_MAINNET_BLOCK,
BYZANTIUM_MAINNET_BLOCK,
PETERSBURG_MAINNET_BLOCK,
ISTANBUL_MAINNET_BLOCK,
)
MAINNET_VMS = (
FrontierVM,
Expand All @@ -88,6 +91,7 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
SpuriousDragonVM,
ByzantiumVM,
PetersburgVM,
IstanbulVM,
)

MAINNET_VM_CONFIGURATION = tuple(zip(MAINNET_FORK_BLOCKS, MAINNET_VMS))
Expand Down
5 changes: 5 additions & 0 deletions eth/chains/mainnet/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@
# Petersburg Block
#
PETERSBURG_MAINNET_BLOCK = BlockNumber(7280000)

#
# Istanbul Block
#
ISTANBUL_MAINNET_BLOCK = BlockNumber(9069000)
15 changes: 12 additions & 3 deletions eth/tools/_utils/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,17 @@ def normalize_account_state(account_state: FixtureAccountState) -> AccountState:
}


def normalize_post_state(postate: FixtureAccountState) -> AccountState:
# poststate might not be present in some fixtures
# https://github.com/ethereum/tests/issues/637#issuecomment-534072897
if postate is None:
return {}
else:
return normalize_account_state(postate)


@to_dict
def normalize_post_state(post_state: Dict[str, Any]) -> Iterable[Tuple[str, bytes]]:
def normalize_post_state_hash(post_state: Dict[str, Any]) -> Iterable[Tuple[str, bytes]]:
yield 'hash', decode_hex(post_state['hash'])
if 'logs' in post_state:
yield 'logs', decode_hex(post_state['logs'])
Expand All @@ -391,7 +400,7 @@ def normalize_statetest_fixture(fixture: Dict[str, Any],
normalized_fixture = {
'env': normalize_environment(fixture['env']),
'pre': normalize_account_state(fixture['pre']),
'post': normalize_post_state(post_state),
'post': normalize_post_state_hash(post_state),
'transaction': normalize_unsigned_transaction(
fixture['transaction'],
post_state['indexes'],
Expand Down Expand Up @@ -538,7 +547,7 @@ def normalize_blockchain_fixtures(fixture: Dict[str, Any]) -> Dict[str, Any]:
'genesisBlockHeader': normalize_block_header(fixture['genesisBlockHeader']),
'lastblockhash': decode_hex(fixture['lastblockhash']),
'pre': normalize_account_state(fixture['pre']),
'postState': normalize_account_state(fixture['postState']),
'postState': normalize_post_state(fixture.get('postState')),
'network': fixture['network'],
}

Expand Down
9 changes: 7 additions & 2 deletions eth/tools/fixtures/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
FrontierVM,
HomesteadVM as BaseHomesteadVM,
SpuriousDragonVM,
IstanbulVM,
)


Expand Down Expand Up @@ -121,6 +122,10 @@ def chain_vm_configuration(fixture: Dict[str, Any]) -> Iterable[Tuple[int, Type[
return (
(0, PetersburgVM),
)
elif network == 'Istanbul':
return (
(0, IstanbulVM),
)
elif network == 'FrontierToHomesteadAt5':
HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
return (
Expand All @@ -146,10 +151,10 @@ def chain_vm_configuration(fixture: Dict[str, Any]) -> Iterable[Tuple[int, Type[
(0, SpuriousDragonVM),
(5, ByzantiumVM),
)
elif network == 'ByzantiumToConstantinopleAt5':
elif network == 'ByzantiumToConstantinopleFixAt5':
return (
(0, ByzantiumVM),
(5, ConstantinopleVM),
(5, PetersburgVM),
)
else:
raise ValueError(f"Network {network} does not match any known VM rules")
Expand Down
21 changes: 12 additions & 9 deletions eth/vm/forks/spurious_dragon/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@


@to_set
def collect_touched_accounts(computation: BaseComputation) -> Iterable[Address]:
def collect_touched_accounts(computation: BaseComputation,
ancestor_had_error: bool = False) -> Iterable[Address]:
"""
Collect all of the accounts that *may* need to be deleted based on
`EIP-161 <https://eips.ethereum.org/EIPS/eip-161>`_.
Expand All @@ -32,7 +33,7 @@ def collect_touched_accounts(computation: BaseComputation) -> Iterable[Address]:

# collect those explicitly marked for deletion ("beneficiary" is of SELFDESTRUCT)
for beneficiary in sorted(set(computation.accounts_to_delete.values())):
if computation.is_error and computation.is_origin_computation:
if computation.is_error or ancestor_had_error:
# Special case to account for geth+parity bug
# https://github.com/ethereum/EIPs/issues/716
if beneficiary == THREE:
Expand All @@ -43,15 +44,17 @@ def collect_touched_accounts(computation: BaseComputation) -> Iterable[Address]:

# collect account directly addressed
if computation.msg.to != constants.CREATE_CONTRACT_ADDRESS:
if computation.is_error and computation.is_origin_computation:
# Special case to account for geth+parity bug
# https://github.com/ethereum/EIPs/issues/716
if computation.is_error or ancestor_had_error:
# collect RIPEMD160 precompile even if ancestor computation had error;
# otherwise, skip collection from children of errored-out computations;
# if there were no special-casing for RIPEMD160, we'd simply `pass` here
if computation.msg.to == THREE:
yield computation.msg.to
else:
yield computation.msg.to

# recurse into nested computations if this one was successful
if not computation.is_error:
for child in computation.children:
yield from collect_touched_accounts(child)
# recurse into nested computations (even errored ones, since looking for RIPEMD160)
for child in computation.children:
yield from collect_touched_accounts(
child,
ancestor_had_error=(computation.is_error or ancestor_had_error))
2 changes: 1 addition & 1 deletion fixtures
5 changes: 5 additions & 0 deletions newsfragments/1858.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Update upstream test fixtures to `v7.0.0 beta.1 <https://github.com/ethereum/tests/releases/tag/v7.0.0-beta.1>`_
and address the two arising disagreements on what accounts should be collected for state trie clearing (as per
`EIP-161 <https://eips.ethereum.org/EIPS/eip-161>`_) if a nested call frame had an error.
Also, set Istanbul block number for mainnet to 9069000, and for Görli to 1561651, as per
`EIP-1679 <https://eips.ethereum.org/EIPS/eip-1679#activation>`_.
4 changes: 2 additions & 2 deletions scripts/benchmark/checks/deploy_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
)

FIRST_TX_GAS_LIMIT = 367724
SECOND_TX_GAS_LIMIT = 62050
THIRD_TX_GAS_LIMIT = 104789
SECOND_TX_GAS_LIMIT = 63042
THIRD_TX_GAS_LIMIT = 105781
FORTH_TX_GAS_LIMIT = 21272
FIFTH_TX_GAS_LIMIT = 21272

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"cached-property>=1.5.1,<2",
"eth-bloom>=1.0.3,<2.0.0",
"eth-keys>=0.2.1,<0.3.0",
"eth-typing>=2.0.0,<3.0.0",
"eth-typing>=2.2.0,<3.0.0",
"eth-utils>=1.7.0,<2.0.0",
"lru-dict>=1.1.6",
"mypy_extensions>=0.4.1,<1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import datetime
import logging
import os
from eth.tools.logging import DEBUG2_LEVEL_NUM
from eth_utils.logging import DEBUG2_LEVEL_NUM

@pytest.yield_fixture(autouse=True)
def _file_logging(request):
Expand Down
11 changes: 11 additions & 0 deletions tests/core/chain-object/test_contract_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ByzantiumVM,
ConstantinopleVM,
PetersburgVM,
IstanbulVM,
)


Expand Down Expand Up @@ -212,6 +213,16 @@ def test_get_transaction_result(
'useLotsOfGas()',
OutOfGas,
),
(
IstanbulVM,
'doRevert()',
Revert,
),
(
IstanbulVM,
'useLotsOfGas()',
OutOfGas,
),
),
)
def test_get_transaction_result_revert(
Expand Down
7 changes: 5 additions & 2 deletions tests/core/tester/test_generate_vm_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Forks(enum.Enum):
Byzantium = 'Byzantium'
Constantinople = 'Constantinople'
Petersburg = 'Petersburg'
Istanbul = 'Istanbul'


class CustomFrontierVM(FrontierVM):
Expand All @@ -29,7 +30,7 @@ class CustomFrontierVM(FrontierVM):
(
tuple(),
{},
((0, Forks.Petersburg),),
((0, Forks.Istanbul),),
),
(
((0, 'tangerine-whistle'), (1, 'spurious-dragon')),
Expand Down Expand Up @@ -116,7 +117,8 @@ class CustomFrontierVM(FrontierVM):
(1, 'homestead'),
(2, 'tangerine-whistle'),
(3, 'byzantium'),
(5, 'petersburg')
(5, 'petersburg'),
(6, 'istanbul'),
),
{},
(
Expand All @@ -125,6 +127,7 @@ class CustomFrontierVM(FrontierVM):
(2, Forks.TangerineWhistle),
(3, Forks.Byzantium),
(5, Forks.Petersburg),
(6, Forks.Istanbul)
),
),
),
Expand Down
Loading