diff --git a/fixtures b/fixtures index 6b85703b56..cfbcd15f91 160000 --- a/fixtures +++ b/fixtures @@ -1 +1 @@ -Subproject commit 6b85703b568f4456582a00665d8a3e5c3b20b484 +Subproject commit cfbcd15f91d4d6e1785d9cae5c5c37f47e8bad46 diff --git a/newsfragments/1255.feature.rst b/newsfragments/1255.feature.rst new file mode 100644 index 0000000000..74cb2a32a7 --- /dev/null +++ b/newsfragments/1255.feature.rst @@ -0,0 +1,2 @@ +Upgrade to Py-EVM ``0.3.0a8`` adding the planned Istanbul block for mainnet. See all the +`other changes in the latest py-evm `_ \ No newline at end of file diff --git a/setup.py b/setup.py index dbaca0a122..adda2f27f0 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import re from setuptools import setup, find_packages -PYEVM_DEPENDENCY = "py-evm==0.3.0a7" +PYEVM_DEPENDENCY = "py-evm==0.3.0a8" deps = { diff --git a/tests/json-fixtures-over-rpc/test_rpc_fixtures.py b/tests/json-fixtures-over-rpc/test_rpc_fixtures.py index 2bee6445d9..fd2a9a1fa5 100644 --- a/tests/json-fixtures-over-rpc/test_rpc_fixtures.py +++ b/tests/json-fixtures-over-rpc/test_rpc_fixtures.py @@ -14,6 +14,7 @@ from eth_utils import ( add_0x_prefix, + encode_hex, is_address, is_hex, is_integer, @@ -25,6 +26,9 @@ apply_formatter_if, ) +from eth.constants import ( + EMPTY_UNCLE_HASH, +) from eth.chains.mainnet import ( MainnetChain, ) @@ -54,21 +58,20 @@ BASE_FIXTURE_PATH = os.path.join(ROOT_PROJECT_DIR, 'fixtures', 'BlockchainTests') SLOW_TESTS = ( + 'bcExploitTest/SuicideIssue.json', 'Call1024PreCalls_d0g0v0', 'ContractCreationSpam_d0g0v0_Homestead', 'ContractCreationSpam_d0g0v0_Frontier', 'Create2Recursive_d0g0v0', 'Create2Recursive_d0g1v0', + 'DelegateCallSpam', 'ForkStressTest', - 'stQuadraticComplexityTest/Call50000_d0g1v0.json', - 'stQuadraticComplexityTest/QuadraticComplexitySolidity_CallDataCopy_d0g1v0.json', - 'stQuadraticComplexityTest/Return50000_2_d0g1v0.json', - 'stQuadraticComplexityTest/Return50000_d0g1v0.json', - 'stQuadraticComplexityTest/Callcode50000_d0g1v0.json', - 'stQuadraticComplexityTest/Call50000_sha256_d0g1v0.json', - 'stQuadraticComplexityTest/Call50000_ecrec_d0g1v0.json', - 'walletReorganizeOwners', - 'bcExploitTest/SuicideIssue.json', + 'randomStatetest94_Homestead', + 'randomStatetest94_Byzantium', + 'randomStatetest94_Constantinople', + 'randomStatetest94_ConstantinopleFix', + 'ShanghaiLove_Homestead', + 'ShanghaiLove_Frontier', 'static_Call1024PreCalls_d1g0v0', 'static_Call1024PreCalls2_d0g0v0', 'static_Call1024PreCalls2_d1g0v0', @@ -91,15 +94,20 @@ 'static_LoopCallsThenRevert_d0g0v0', 'static_LoopCallsThenRevert_d0g1v0', 'static_Return50000_2_d0g0v0', + 'stQuadraticComplexityTest/Call50000_d0g1v0.json', + 'stQuadraticComplexityTest/QuadraticComplexitySolidity_CallDataCopy_d0g1v0.json', + 'stQuadraticComplexityTest/Return50000_2_d0g1v0.json', + 'stQuadraticComplexityTest/Return50000_d0g1v0.json', + 'stQuadraticComplexityTest/Callcode50000_d0g1v0.json', + 'stQuadraticComplexityTest/Call50000_sha256_d0g1v0.json', + 'stQuadraticComplexityTest/Call50000_ecrec_d0g1v0.json', 'stQuadraticComplexityTest/Call50000_identity2_d0g1v0.json', 'stQuadraticComplexityTest/Call50000_identity_d0g1v0.json', 'stQuadraticComplexityTest/Call50000_rip160_d0g1v0.json', 'stQuadraticComplexityTest/Call50000bytesContract50_1_d0g1v0.json', 'stQuadraticComplexityTest/Call50000bytesContract50_2_d0g1v0.json', 'stQuadraticComplexityTest/Create1000_d0g1v0.json', - 'ShanghaiLove_Homestead', - 'ShanghaiLove_Frontier', - 'DelegateCallSpam', + 'walletReorganizeOwners', ) # These are tests that are thought to be incorrect or buggy upstream, @@ -330,6 +338,10 @@ def is_by_hash(at_block): raise ValueError("Unrecognized 'at_block' value: %r" % at_block) +def has_uncles(block_fixture): + return block_fixture['blockHeader']['uncleHash'] != encode_hex(EMPTY_UNCLE_HASH) + + async def validate_transaction_count(rpc, block_fixture, at_block): if is_by_hash(at_block): rpc_method = 'eth_getBlockTransactionCountByHash' @@ -398,11 +410,14 @@ async def validate_uncle_count(rpc, block_fixture, at_block): else: rpc_method = 'eth_getUncleCountByBlockNumber' - num_uncles = len(block_fixture['uncleHeaders']) + num_uncles = len(block_fixture['uncleHeaders']) if has_uncles(block_fixture) else 0 await assert_rpc_result(rpc, rpc_method, [at_block], hex(num_uncles)) async def validate_uncle_headers(rpc, block_fixture, at_block): + if not has_uncles(block_fixture): + return + if is_by_hash(at_block): rpc_method = 'eth_getUncleByBlockHashAndIndex' else: @@ -466,6 +481,10 @@ async def test_rpc_against_fixtures(event_bus, chain_fixture, fixture_data): if get_in(['blockHeader', 'hash'], block_fixture) == chain_fixture['lastblockhash']: await validate_last_block(rpc, block_fixture) - await validate_accounts(rpc, chain_fixture['postState']) + # Fixtures do not include the `postState` field when its size would be past a certain limit. + # https://github.com/ethereum/tests/issues/637#issuecomment-534072897 + if chain_fixture.get('postState', None): + await validate_accounts(rpc, chain_fixture['postState']) + await validate_accounts(rpc, chain_fixture['pre'], 'earliest') await validate_accounts(rpc, chain_fixture['pre'], 0) diff --git a/trinity/_utils/eip1085.py b/trinity/_utils/eip1085.py index c8f9175433..b46872a15e 100644 --- a/trinity/_utils/eip1085.py +++ b/trinity/_utils/eip1085.py @@ -173,11 +173,8 @@ def _filter_vm_config(vm_config: VMConfiguration) -> Iterable[VMFork]: ByzantiumVM, ConstantinopleVM, PetersburgVM, + IstanbulVM, ) -ALL_VMS_BY_FORK = { - vm_class.fork: vm_class - for vm_class in ALL_VMS -} @to_tuple diff --git a/trinity/assets/eip1085.schema.json b/trinity/assets/eip1085.schema.json index fed4b3adf4..a6cf18e49c 100644 --- a/trinity/assets/eip1085.schema.json +++ b/trinity/assets/eip1085.schema.json @@ -77,6 +77,11 @@ "type": "string", "pattern": "^0x([0-9a-fA-F])+$" }, + "istanbulForkBlock": { + "title": "Block number for the Istanbul fork", + "type": "string", + "pattern": "^0x([0-9a-fA-F])+$" + }, "chainId": { "title": "The EIP155 chain ID", "type": "string", diff --git a/trinity/assets/eip1085/mainnet.json b/trinity/assets/eip1085/mainnet.json index 18c9b45bf8..719a7862c6 100644 --- a/trinity/assets/eip1085/mainnet.json +++ b/trinity/assets/eip1085/mainnet.json @@ -14,6 +14,7 @@ "EIP158ForkBlock":"0x28d138", "byzantiumForkBlock":"0x42ae50", "petersburgForkBlock":"0x6f1580", + "istanbulForkBlock": "0x8a61c8", "chainId":"0x1", "homesteadForkBlock":"0x118c30", "miningMethod":"ethash" diff --git a/trinity/tools/chain.py b/trinity/tools/chain.py index 8def202bd0..7f45ae26bb 100644 --- a/trinity/tools/chain.py +++ b/trinity/tools/chain.py @@ -4,7 +4,7 @@ ) from eth.constants import GENESIS_BLOCK_NUMBER from eth.vm.forks.byzantium import ByzantiumVM -from eth.vm.forks.petersburg import PetersburgVM +from eth.vm.forks.istanbul import IstanbulVM from trinity.chains.coro import AsyncChainMixin from trinity.chains.full import FullChain @@ -27,7 +27,7 @@ class LatestTestChain(FullChain): A test chain that uses the most recent mainnet VM from block 0. That means the VM will explicitly change when a new network upgrade is locked in. """ - vm_configuration = ((GENESIS_BLOCK_NUMBER, PetersburgVM),) + vm_configuration = ((GENESIS_BLOCK_NUMBER, IstanbulVM),) network_id = 999