From 7733bf5d29d0c1a7c7c7028412c4c5e3129ddd13 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 30 Aug 2021 20:02:01 -0700 Subject: [PATCH 01/10] Run London fork tests --- .circleci/config.yml | 7 +++++++ tox.ini | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 82338dd7b1..3d818a85da 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,6 +82,12 @@ jobs: - image: circleci/python:3.6 environment: TOXENV: py36-native-blockchain-istanbul + py36-native-blockchain-london: + <<: *common + docker: + - image: circleci/python:3.6 + environment: + TOXENV: py36-native-blockchain-london py36-native-blockchain-petersburg: <<: *common docker: @@ -247,6 +253,7 @@ workflows: - py36-native-blockchain-frontier - py36-native-blockchain-homestead - py36-native-blockchain-istanbul + - py36-native-blockchain-london - py36-native-blockchain-petersburg - py36-native-blockchain-tangerine_whistle - py36-native-blockchain-spurious_dragon diff --git a/tox.ini b/tox.ini index 90a2388e09..3cf422ede1 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ envlist= py{36,37,38,39}-{core,database,transactions,vm} py36-benchmark - py36-native-blockchain-{frontier,homestead,tangerine_whistle,spurious_dragon,byzantium,constantinople,petersburg,istanbul,berlin,metropolis,transition} + py36-native-blockchain-{frontier,homestead,tangerine_whistle,spurious_dragon,byzantium,constantinople,petersburg,istanbul,berlin,london,metropolis,transition} py{36,37,38,39}-lint py36-docs @@ -35,6 +35,7 @@ commands= native-blockchain-petersburg: pytest {posargs:tests/json-fixtures/blockchain/test_blockchain.py --fork ConstantinopleFix} native-blockchain-istanbul: pytest {posargs:tests/json-fixtures/blockchain/test_blockchain.py --fork Istanbul} native-blockchain-berlin: pytest {posargs:tests/json-fixtures/blockchain/test_blockchain.py --fork Berlin} + native-blockchain-london: pytest {posargs:tests/json-fixtures/blockchain/test_blockchain.py --fork London} native-blockchain-metropolis: pytest {posargs:tests/json-fixtures/blockchain/test_blockchain.py --fork Metropolis} native-blockchain-transition: pytest {posargs:tests/json-fixtures/blockchain/test_blockchain.py -k TransitionTests --tx '2*popen//execmodel=eventlet'} lint: flake8 {toxinidir}/eth {toxinidir}/tests {toxinidir}/scripts From a839a1a0229638dd7d32c861021a92218d00b438 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 10 Sep 2021 15:31:23 -0700 Subject: [PATCH 02/10] Skip some slow tests Exploit tests seem to have moved in a way that caused our previous skipping to fail. We only skipped tests that started with bcExploitTest, now we skip them if that is the name of a folder anywhere in the test path. --- .../blockchain/test_blockchain.py | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/json-fixtures/blockchain/test_blockchain.py b/tests/json-fixtures/blockchain/test_blockchain.py index 0162611ffc..773774cbe4 100644 --- a/tests/json-fixtures/blockchain/test_blockchain.py +++ b/tests/json-fixtures/blockchain/test_blockchain.py @@ -41,9 +41,12 @@ SLOWEST_TESTS = { ('GeneralStateTests/stAttackTest/ContractCreationSpam.json', 'ContractCreationSpam_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stAttackTest/ContractCreationSpam.json', 'ContractCreationSpam_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stAttackTest/ContractCreationSpam.json', 'ContractCreationSpam_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stCallCreateCallCodeTest/Call1024BalanceTooLow.json', 'Call1024BalanceTooLow_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCallCreateCallCodeTest/Call1024PreCalls.json', 'Call1024PreCalls_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCallCreateCallCodeTest/Call1024PreCalls.json', 'Call1024PreCalls_d0g1v0_Istanbul'), # noqa: E501 + ('GeneralStateTests/stCallCreateCallCodeTest/Call1024PreCalls.json', 'Call1024PreCalls_d0g0v0_London'), # noqa: E501 + ('GeneralStateTests/stCallCreateCallCodeTest/Call1024PreCalls.json', 'Call1024PreCalls_d0g1v0_London'), # noqa: E501 ('GeneralStateTests/stCallCreateCallCodeTest/CallRecursiveBombPreCall.json', 'CallRecursiveBombPreCall_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCallCreateCallCodeTest/Callcode1024BalanceTooLow.json', 'Callcode1024BalanceTooLow_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stChangedEIP150/Call1024BalanceTooLow.json', 'Call1024BalanceTooLow_d0g0v0_Istanbul'), # noqa: E501 @@ -53,8 +56,10 @@ ('GeneralStateTests/stCreate2/Create2OnDepth1024.json', 'Create2OnDepth1024_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCreate2/Create2Recursive.json', 'Create2Recursive_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCreate2/Create2Recursive.json', 'Create2Recursive_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stCreate2/Create2Recursive.json', 'Create2Recursive_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stCreate2/Create2Recursive.json', 'Create2Recursive_d0g1v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCreate2/Create2Recursive.json', 'Create2Recursive_d0g1v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stCreate2/Create2Recursive.json', 'Create2Recursive_d0g1v0_London'), # noqa: E501 ('GeneralStateTests/stDelegatecallTestHomestead/Call1024BalanceTooLow.json', 'Call1024BalanceTooLow_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stDelegatecallTestHomestead/Call1024PreCalls.json', 'Call1024PreCalls_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stDelegatecallTestHomestead/Call1024PreCalls.json', 'Call1024PreCalls_d0g1v0_Istanbul'), # noqa: E501 @@ -69,8 +74,10 @@ ('GeneralStateTests/stRevertTest/LoopCallsDepthThenRevert3.json', 'LoopCallsDepthThenRevert3_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert_d0g1v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert_d0g1v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert_d0g1v0_London'), # noqa: E501 ('GeneralStateTests/stShift/shiftCombinations.json', 'shiftCombinations_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call1024BalanceTooLow.json', 'static_Call1024BalanceTooLow_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call1024BalanceTooLow2.json', 'static_Call1024BalanceTooLow2_d1g0v0_Istanbul'), # noqa: E501 @@ -79,26 +86,38 @@ ('GeneralStateTests/stStaticCall/static_Call1024PreCalls2.json', 'static_Call1024PreCalls2_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call1024PreCalls3.json', 'static_Call1024PreCalls3_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call1MB1024Calldepth.json', 'static_Call1MB1024Calldepth_d1g0v0_Istanbul'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call1MB1024Calldepth.json', 'static_Call1MB1024Calldepth_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call1MB1024Calldepth.json', 'static_Call1MB1024Calldepth_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000.json', 'static_Call50000_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000.json', 'static_Call50000_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000.json', 'static_Call50000_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000.json', 'static_Call50000_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000.json', 'static_Call50000_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000.json', 'static_Call50000_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000bytesContract50_1.json', 'static_Call50000bytesContract50_1_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000bytesContract50_1.json', 'static_Call50000bytesContract50_1_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Call50000bytesContract50_2.json', 'static_Call50000bytesContract50_2_d0g0v0_Istanbul'), # noqa: E501 @@ -107,17 +126,23 @@ ('GeneralStateTests/stStaticCall/static_LoopCallsDepthThenRevert3.json', 'static_LoopCallsDepthThenRevert3_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert_d0g1v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert_d0g1v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert_d0g1v0_London'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Return50000_2.json', 'static_Return50000_2_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stStaticCall/static_Return50000_2.json', 'static_Return50000_2_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stStaticCall/static_Return50000_2.json', 'static_Return50000_2_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stSystemOperationsTest/CallRecursiveBomb0_OOG_atMaxCallDepth.json', 'CallRecursiveBomb0_OOG_atMaxCallDepth_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stTimeConsuming/CALLBlake2f_MaxRounds.json', 'CALLBlake2f_MaxRounds_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stTimeConsuming/CALLBlake2f_MaxRounds.json', 'CALLBlake2f_MaxRounds_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stTimeConsuming/CALLBlake2f_MaxRounds.json', 'CALLBlake2f_MaxRounds_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stTimeConsuming/static_Call50000_sha256.json', 'static_Call50000_sha256_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stTimeConsuming/static_Call50000_sha256.json', 'static_Call50000_sha256_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stTimeConsuming/static_Call50000_sha256.json', 'static_Call50000_sha256_d0g0v0_London'), # noqa: E501 ('GeneralStateTests/stTimeConsuming/static_Call50000_sha256.json', 'static_Call50000_sha256_d1g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stTimeConsuming/static_Call50000_sha256.json', 'static_Call50000_sha256_d1g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stTimeConsuming/static_Call50000_sha256.json', 'static_Call50000_sha256_d1g0v0_London'), # noqa: E501 ('GeneralStateTests/stZeroKnowledge/ecpairing_one_point_fail.json', 'ecpairing_one_point_fail_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stZeroKnowledge/ecpairing_three_point_fail_1.json', 'ecpairing_three_point_fail_1_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stZeroKnowledge/ecpairing_three_point_match_1.json', 'ecpairing_three_point_match_1_d0g0v0_Istanbul'), # noqa: E501 @@ -157,12 +182,22 @@ ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d12g0v0_Berlin'), ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d13g0v0_Berlin'), ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d14g0v0_Berlin'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d8g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d9g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d10g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d11g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d12g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d13g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopExp.json', 'loopExp_d14g0v0_London'), ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d0g0v0_Istanbul'), ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d1g0v0_Istanbul'), ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d2g0v0_Istanbul'), ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d0g0v0_Berlin'), ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d1g0v0_Berlin'), ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d2g0v0_Berlin'), + ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d0g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d1g0v0_London'), + ('GeneralStateTests/VMTests/vmPerformance/loopMul.json', 'loopMul_d2g0v0_London'), ('InvalidBlocks/bcForgedTest/bcForkBlockTest.json', 'BlockWrongResetGas'), # noqa: E501 ('InvalidBlocks/bcForgedTest/bcInvalidRLPTest.json', 'BLOCK_difficulty_TooLarge'), # noqa: E501 ('InvalidBlocks/bcMultiChainTest/UncleFromSideChain.json', 'UncleFromSideChain_Constantinople'), # noqa: E501 @@ -180,22 +215,31 @@ ('ValidBlocks/bcStateTests/randomStatetest94.json', 'randomStatetest94_Istanbul'), # noqa: E501 ('ValidBlocks/VMTests/vmPerformance/loop-add-10M.json', 'loop-add-10M_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-add-10M.json', 'loop-add-10M_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-add-10M.json', 'loop-add-10M_London'), ('ValidBlocks/VMTests/vmPerformance/loop-divadd-10M.json', 'loop-divadd-10M_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-divadd-10M.json', 'loop-divadd-10M_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-divadd-10M.json', 'loop-divadd-10M_London'), ('ValidBlocks/VMTests/vmPerformance/loop-divadd-unr100-10M.json', 'loop-divadd-unr100-10M_Istanbul'), # noqa: E501 ('ValidBlocks/VMTests/vmPerformance/loop-divadd-unr100-10M.json', 'loop-divadd-unr100-10M_Berlin'), # noqa: E501 + ('ValidBlocks/VMTests/vmPerformance/loop-divadd-unr100-10M.json', 'loop-divadd-unr100-10M_London'), # noqa: E501 ('ValidBlocks/VMTests/vmPerformance/loop-exp-16b-100k.json', 'loop-exp-16b-100k_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-16b-100k.json', 'loop-exp-16b-100k_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-exp-16b-100k.json', 'loop-exp-16b-100k_London'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-1b-1M.json', 'loop-exp-1b-1M_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-1b-1M.json', 'loop-exp-1b-1M_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-exp-1b-1M.json', 'loop-exp-1b-1M_London'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-32b-100k.json', 'loop-exp-32b-100k_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-32b-100k.json', 'loop-exp-32b-100k_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-exp-32b-100k.json', 'loop-exp-32b-100k_London'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-nop-1M.json', 'loop-exp-nop-1M_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-exp-nop-1M.json', 'loop-exp-nop-1M_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-exp-nop-1M.json', 'loop-exp-nop-1M_London'), ('ValidBlocks/VMTests/vmPerformance/loop-mul.json', 'loop-mul_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-mul.json', 'loop-mul_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-mul.json', 'loop-mul_London'), ('ValidBlocks/VMTests/vmPerformance/loop-mulmod-2M.json', 'loop-mulmod-2M_Istanbul'), ('ValidBlocks/VMTests/vmPerformance/loop-mulmod-2M.json', 'loop-mulmod-2M_Berlin'), + ('ValidBlocks/VMTests/vmPerformance/loop-mulmod-2M.json', 'loop-mulmod-2M_London'), } @@ -251,7 +295,7 @@ def blockchain_fixture_mark_fn(fixture_path, fixture_name, fixture_fork): fixture_id = (fixture_path, fixture_name) - if fixture_path.startswith('bcExploitTest'): + if 'bcExploitTest/' in fixture_path: return pytest.mark.skip("Exploit tests are slow") elif fixture_path.startswith('bcForkStressTest/ForkStressTest.json'): return pytest.mark.skip("Fork stress tests are slow.") From 4420efdf50dcfeb745aca2a064b2803aeb3f3a31 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 20 Sep 2021 15:48:47 -0700 Subject: [PATCH 03/10] Skip non-consensus-relevant London tests that fail For example: InitCollision_d0g0v0_London --- tests/json-fixtures/blockchain/test_blockchain.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/json-fixtures/blockchain/test_blockchain.py b/tests/json-fixtures/blockchain/test_blockchain.py index 773774cbe4..576ac8f04d 100644 --- a/tests/json-fixtures/blockchain/test_blockchain.py +++ b/tests/json-fixtures/blockchain/test_blockchain.py @@ -258,6 +258,7 @@ ('GeneralStateTests/stRevertTest/RevertInCreateInInit_d0g0v0.json', 'RevertInCreateInInit_d0g0v0_ConstantinopleFix'), # noqa: E501 ('GeneralStateTests/stRevertTest/RevertInCreateInInit.json', 'RevertInCreateInInit_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stRevertTest/RevertInCreateInInit.json', 'RevertInCreateInInit_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stRevertTest/RevertInCreateInInit.json', 'RevertInCreateInInit_d0g0v0_London'), # noqa: E501 # The CREATE2 variant seems to have been derived from the one above - it, too, # has a "synthetic" state, on which py-evm flips. @@ -266,6 +267,7 @@ ('GeneralStateTests/stCreate2/RevertInCreateInInitCreate2_d0g0v0.json', 'RevertInCreateInInitCreate2_d0g0v0_ConstantinopleFix'), # noqa: E501 ('GeneralStateTests/stCreate2/RevertInCreateInInitCreate2.json', 'RevertInCreateInInitCreate2_d0g0v0_Istanbul'), # noqa: E501 ('GeneralStateTests/stCreate2/RevertInCreateInInitCreate2.json', 'RevertInCreateInInitCreate2_d0g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stCreate2/RevertInCreateInInitCreate2.json', 'RevertInCreateInInitCreate2_d0g0v0_London'), # noqa: E501 # Four variants have been specifically added to test a collision type # like the above; therefore, they fail in the same manner. @@ -289,6 +291,10 @@ ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d1g0v0_Berlin'), # noqa: E501 ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d2g0v0_Berlin'), # noqa: E501 ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d3g0v0_Berlin'), # noqa: E501 + ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d0g0v0_London'), # noqa: E501 + ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d1g0v0_London'), # noqa: E501 + ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d2g0v0_London'), # noqa: E501 + ('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d3g0v0_London'), # noqa: E501 } From fddce69e5b133a5be4c61ed8de88001734c8951c Mon Sep 17 00:00:00 2001 From: Felipe Selmo Date: Thu, 23 Sep 2021 21:21:33 -0600 Subject: [PATCH 04/10] reset return data on contract collision --- eth/vm/logic/system.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eth/vm/logic/system.py b/eth/vm/logic/system.py index d0b8c5b58b..214346f49b 100644 --- a/eth/vm/logic/system.py +++ b/eth/vm/logic/system.py @@ -163,10 +163,15 @@ def __call__(self, computation: ComputationAPI) -> None: computation.stack_push_int(0) computation.return_data = b'' if insufficient_funds: - err_msg = f"Insufficient Funds: {storage_address_balance} < {stack_data.endowment}" + self.logger.debug2( + "%s failure: %s", + self.mnemonic, + f"Insufficient Funds: {storage_address_balance} < {stack_data.endowment}" + ) elif stack_too_deep: - err_msg = "Stack limit reached" - self.logger.debug2("%s failure: %s", self.mnemonic, err_msg,) + self.logger.debug2("%s failure: %s", self.mnemonic, "Stack limit reached") + else: + raise RuntimeError("Invariant: error must be insufficient funds or stack too deep") return call_data = computation.memory_read_bytes( @@ -183,11 +188,12 @@ def __call__(self, computation: ComputationAPI) -> None: is_collision = computation.state.has_code_or_nonce(contract_address) if is_collision: + computation.stack_push_int(0) + computation.return_data = b'' self.logger.debug2( "Address collision while creating contract: %s", encode_hex(contract_address), ) - computation.stack_push_int(0) return child_msg = computation.prepare_child_message( From ff9494afe3e706ec515ae286df3f592c3b699f4a Mon Sep 17 00:00:00 2001 From: Felipe Selmo Date: Tue, 28 Sep 2021 12:26:00 -0600 Subject: [PATCH 05/10] tweak blockchain test validation and fix gas_limit check - We have an 'expectException' flag we can reference for validating should_be_good_block for blockchain tests. These changes tweak blockchain test validation to use this flag since some block fixtures for tests have both good and bad blocks in them now. - If the gas limit is AT 1/1024th of the parent gas limit, this is also unacceptable. These changes add equal-to signs when comparing the gas limit to the parent. This passes currently-failing ethereum tests >= London. --- eth/tools/_utils/normalization.py | 2 ++ eth/validation.py | 4 ++-- tests/json-fixtures/blockchain/test_blockchain.py | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/eth/tools/_utils/normalization.py b/eth/tools/_utils/normalization.py index d70f5eedb8..34b678e278 100644 --- a/eth/tools/_utils/normalization.py +++ b/eth/tools/_utils/normalization.py @@ -567,6 +567,8 @@ def normalize_block(block: Dict[str, Any]) -> Dict[str, Any]: for transaction in block['transactions'] ] + if 'expectException' in block: + normalized_block['expectException'] = block['expectException'] return normalized_block diff --git a/eth/validation.py b/eth/validation.py index 8594e10da5..b78bd7cf45 100644 --- a/eth/validation.py +++ b/eth/validation.py @@ -230,11 +230,11 @@ def validate_vm_configuration(vm_configuration: Tuple[Tuple[int, Type[VirtualMac def validate_gas_limit(gas_limit: int, parent_gas_limit: int) -> None: low_bound, high_bound = compute_gas_limit_bounds(parent_gas_limit) - if gas_limit < low_bound: + if gas_limit <= low_bound: raise ValidationError( f"The gas limit {gas_limit} is too low. It must be at least {low_bound}" ) - elif gas_limit > high_bound: + elif gas_limit >= high_bound: raise ValidationError( f"The gas limit {gas_limit} is too high. It must be at most {high_bound}" ) diff --git a/tests/json-fixtures/blockchain/test_blockchain.py b/tests/json-fixtures/blockchain/test_blockchain.py index 576ac8f04d..44b0e75cc1 100644 --- a/tests/json-fixtures/blockchain/test_blockchain.py +++ b/tests/json-fixtures/blockchain/test_blockchain.py @@ -371,6 +371,11 @@ def assert_imported_genesis_header_unchanged(genesis_fields, genesis_header): ) +EXPECTED_BAD_BLOCK_EXCEPTIONS = ( + TypeError, rlp.DecodingError, rlp.DeserializationError, ValidationError, AssertionError, +) + + def test_blockchain_fixtures(fixture_data, fixture): try: chain = new_chain_from_fixture(fixture) @@ -403,7 +408,7 @@ def test_blockchain_fixtures(fixture_data, fixture): # 4 - check that all previous blocks were valid for block_fixture in fixture['blocks']: - should_be_good_block = 'blockHeader' in block_fixture + should_be_good_block = 'expectException' not in block_fixture if 'rlp_error' in block_fixture: assert not should_be_good_block @@ -420,7 +425,7 @@ def test_blockchain_fixtures(fixture_data, fixture): else: try: apply_fixture_block_to_chain(block_fixture, chain) - except (TypeError, rlp.DecodingError, rlp.DeserializationError, ValidationError): + except EXPECTED_BAD_BLOCK_EXCEPTIONS: # failure is expected on this bad block pass else: From a2477ae127208063191f18c23ebe5979dfddba8d Mon Sep 17 00:00:00 2001 From: Felipe Selmo Date: Tue, 28 Sep 2021 16:24:21 -0600 Subject: [PATCH 06/10] bugfix: the gas_limit has to be above or below 1/1024th of the parent The gas_limit was improperly allowed to be 1/1024th of the parent gas limit. However, this is an exclusive limit that the new gas limit must be inside of, therefore requiring +1 or -1 from the bound as the inclusive, allowable values. --- eth/_utils/headers.py | 15 ++++++++++----- eth/validation.py | 4 ++-- eth/vm/base.py | 1 + tests/core/vm/test_london.py | 4 ++-- tests/core/vm/test_vm.py | 12 ++++++------ 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/eth/_utils/headers.py b/eth/_utils/headers.py index 90712d232b..98b8cb94bb 100644 --- a/eth/_utils/headers.py +++ b/eth/_utils/headers.py @@ -105,9 +105,12 @@ def compute_gas_limit_bounds(previous_limit: int) -> Tuple[int, int]: Compute the boundaries for the block gas limit based on the parent block. """ boundary_range = previous_limit // GAS_LIMIT_ADJUSTMENT_FACTOR - upper_bound = min(GAS_LIMIT_MAXIMUM, previous_limit + boundary_range) - lower_bound = max(GAS_LIMIT_MINIMUM, previous_limit - boundary_range) - return lower_bound, upper_bound + + # the boundary range is the exclusive limit, therefore the inclusive bounds are + # (boundary_range - 1) and (boundary_range + 1) for upper and lower bounds, respectively + upper_bound_inclusive = min(GAS_LIMIT_MAXIMUM, previous_limit + boundary_range - 1) + lower_bound_inclusive = max(GAS_LIMIT_MINIMUM, previous_limit - boundary_range + 1) + return lower_bound_inclusive, upper_bound_inclusive def compute_gas_limit(parent_header: BlockHeaderAPI, genesis_gas_limit: int) -> int: @@ -152,12 +155,14 @@ def compute_gas_limit(parent_header: BlockHeaderAPI, genesis_gas_limit: int) -> gas_limit = max( GAS_LIMIT_MINIMUM, - parent_header.gas_limit - decay + usage_increase + # + 1 because the decay is an exclusive limit we have to remain inside of + (parent_header.gas_limit - decay + 1) + usage_increase ) if gas_limit < GAS_LIMIT_MINIMUM: return GAS_LIMIT_MINIMUM elif gas_limit < genesis_gas_limit: - return parent_header.gas_limit + decay + # - 1 because the decay is an exclusive limit we have to remain inside of + return parent_header.gas_limit + decay - 1 else: return gas_limit diff --git a/eth/validation.py b/eth/validation.py index b78bd7cf45..8594e10da5 100644 --- a/eth/validation.py +++ b/eth/validation.py @@ -230,11 +230,11 @@ def validate_vm_configuration(vm_configuration: Tuple[Tuple[int, Type[VirtualMac def validate_gas_limit(gas_limit: int, parent_gas_limit: int) -> None: low_bound, high_bound = compute_gas_limit_bounds(parent_gas_limit) - if gas_limit <= low_bound: + if gas_limit < low_bound: raise ValidationError( f"The gas limit {gas_limit} is too low. It must be at least {low_bound}" ) - elif gas_limit >= high_bound: + elif gas_limit > high_bound: raise ValidationError( f"The gas limit {gas_limit} is too high. It must be at most {high_bound}" ) diff --git a/eth/vm/base.py b/eth/vm/base.py index a80f5c9f9e..8d01e20f7f 100644 --- a/eth/vm/base.py +++ b/eth/vm/base.py @@ -668,6 +668,7 @@ def validate_uncle(cls, f"Uncle's gas usage ({uncle.gas_used}) is above " f"the limit ({uncle.gas_limit})" ) + validate_gas_limit(uncle.gas_limit, uncle_parent.gas_limit) # # State diff --git a/tests/core/vm/test_london.py b/tests/core/vm/test_london.py index 1ab1dfdb69..af7387173f 100644 --- a/tests/core/vm/test_london.py +++ b/tests/core/vm/test_london.py @@ -222,7 +222,7 @@ def test_state_revert_on_reserved_0xEF_byte_for_create_transaction_post_london( block_import, _, computations = chain.mine_all( [create_successful_contract_transaction], - gas_limit=84082, + gas_limit=84081, ) successful_create_computation = computations[0] successful_create_computation_state = successful_create_computation.state @@ -336,7 +336,7 @@ def test_state_does_not_revert_on_reserved_0xEF_byte_for_create_transaction_pre_ block_import, _, computations = chain.mine_all( [create_contract_txn_0xef_byte], - gas_limit=99903 + gas_limit=99904 ) computation = computations[0] diff --git a/tests/core/vm/test_vm.py b/tests/core/vm/test_vm.py index 8be14c4f9e..74610f6bcd 100644 --- a/tests/core/vm/test_vm.py +++ b/tests/core/vm/test_vm.py @@ -133,7 +133,7 @@ def test_validate_gas_limit_almost_too_low(noproof_consensus_chain): block1 = noproof_consensus_chain.mine_block() block2 = noproof_consensus_chain.mine_block() - max_reduction = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR + max_reduction = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR - 1 barely_valid_low_gas_limit = block1.header.gas_limit - max_reduction barely_valid_header = block2.header.copy(gas_limit=barely_valid_low_gas_limit) @@ -146,8 +146,8 @@ def test_validate_gas_limit_too_low(noproof_consensus_chain): block1 = noproof_consensus_chain.mine_block() block2 = noproof_consensus_chain.mine_block() - max_reduction = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR - invalid_low_gas_limit = block1.header.gas_limit - max_reduction - 1 + exclusive_decrease_limit = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR + invalid_low_gas_limit = block1.header.gas_limit - exclusive_decrease_limit invalid_header = block2.header.copy(gas_limit=invalid_low_gas_limit) vm = noproof_consensus_chain.get_vm(block2.header) @@ -160,7 +160,7 @@ def test_validate_gas_limit_almost_too_high(noproof_consensus_chain): block1 = noproof_consensus_chain.mine_block() block2 = noproof_consensus_chain.mine_block() - max_increase = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR + max_increase = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR - 1 barely_valid_high_gas_limit = block1.header.gas_limit + max_increase barely_valid_header = block2.header.copy(gas_limit=barely_valid_high_gas_limit) @@ -173,8 +173,8 @@ def test_validate_gas_limit_too_high(noproof_consensus_chain): block1 = noproof_consensus_chain.mine_block() block2 = noproof_consensus_chain.mine_block() - max_increase = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR - invalid_high_gas_limit = block1.header.gas_limit + max_increase + 1 + exclusive_increase_limit = block1.header.gas_limit // constants.GAS_LIMIT_ADJUSTMENT_FACTOR + invalid_high_gas_limit = block1.header.gas_limit + exclusive_increase_limit invalid_header = block2.header.copy(gas_limit=invalid_high_gas_limit) vm = noproof_consensus_chain.get_vm(block2.header) From 6b14d6532ae1340f29df7090237a8bc91fc366e1 Mon Sep 17 00:00:00 2001 From: Felipe Selmo Date: Wed, 29 Sep 2021 09:20:35 -0600 Subject: [PATCH 07/10] validate uncles appropriately across berlin -> london transition --- eth/vm/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eth/vm/base.py b/eth/vm/base.py index 8d01e20f7f..826131367a 100644 --- a/eth/vm/base.py +++ b/eth/vm/base.py @@ -668,7 +668,13 @@ def validate_uncle(cls, f"Uncle's gas usage ({uncle.gas_used}) is above " f"the limit ({uncle.gas_limit})" ) - validate_gas_limit(uncle.gas_limit, uncle_parent.gas_limit) + + uncle_parent_gas_limit = uncle_parent.gas_limit + if not hasattr(uncle_parent, 'base_fee_per_gas') and hasattr(uncle, 'base_fee_per_gas'): + # if Berlin -> London transition, double the parent limit for validation + uncle_parent_gas_limit *= 2 + + validate_gas_limit(uncle.gas_limit, uncle_parent_gas_limit) # # State From 04e13b8a066db996607d71183a7a3f11b2d355ea Mon Sep 17 00:00:00 2001 From: Felipe Selmo Date: Wed, 29 Sep 2021 11:00:18 -0600 Subject: [PATCH 08/10] doc updates due to sphinx update errors --- docs/guides/quickstart.rst | 25 ++++++------------- .../understanding_the_mining_process.rst | 2 +- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/docs/guides/quickstart.rst b/docs/guides/quickstart.rst index 1fb4c444e8..0e15e2f3e8 100644 --- a/docs/guides/quickstart.rst +++ b/docs/guides/quickstart.rst @@ -8,8 +8,8 @@ This guide teaches how to use Py-EVM as a library. For contributors, please chec :doc:`Contributing Guide ` which explains how to set everything up for development. -Installing on Ubuntu --------------------- +Installing Python on Ubuntu +--------------------------- Py-EVM requires Python 3.6 as well as some tools to compile its dependencies. On Ubuntu, the ``python3.6-dev`` package contains everything we need. Run the following command to install it. @@ -25,23 +25,9 @@ we need to install the ``python3-pip`` package through the following command. apt-get install python3-pip -.. note:: - .. include:: /fragments/virtualenv_explainer.rst - -Then, we need make to sure you have the latest version of ``pip`` so that all dependencies can be installed correctly: - -.. code:: sh - - pip3 install -U pip -Finally, we can install the ``py-evm`` package via pip. - -.. code:: sh - - pip3 install -U py-evm - -Installing on macOS -------------------- +Installing Python on macOS +-------------------------- First, install Python 3 with brew: @@ -49,6 +35,9 @@ First, install Python 3 with brew: brew install python3 +Installing py-evm +----------------- + .. note:: .. include:: /fragments/virtualenv_explainer.rst diff --git a/docs/guides/understanding_the_mining_process.rst b/docs/guides/understanding_the_mining_process.rst index 5e8f7b884a..c206a3cf0d 100644 --- a/docs/guides/understanding_the_mining_process.rst +++ b/docs/guides/understanding_the_mining_process.rst @@ -380,4 +380,4 @@ zero value transfer transaction. ... ) >>> chain.mine_block(mix_hash=mix_hash, nonce=nonce) - + From 0e74b1742f71f2709891be3ef0d0e6e2bf5389ab Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 30 Sep 2021 10:22:09 -0700 Subject: [PATCH 09/10] Improve readability of fixture block import fails --- eth/_utils/rlp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/_utils/rlp.py b/eth/_utils/rlp.py index 862ef1b7d1..f737dd83b9 100644 --- a/eth/_utils/rlp.py +++ b/eth/_utils/rlp.py @@ -106,6 +106,6 @@ def validate_rlp_equal(obj_a: BaseBlock, validate_imported_block_unchanged = validate_rlp_equal( - obj_a_name="block", - obj_b_name="imported block", + obj_a_name="locally executed block", + obj_b_name="proposed block", ) From 92095ebba47f481feee98851d124bbc76a5ace05 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 30 Sep 2021 10:31:28 -0700 Subject: [PATCH 10/10] Add release notes for PR #2021, issue #2017 --- newsfragments/2017.feature.rst | 1 + newsfragments/2021.bugfix.rst | 2 ++ newsfragments/2021.doc.rst | 1 + 3 files changed, 4 insertions(+) create mode 100644 newsfragments/2017.feature.rst create mode 100644 newsfragments/2021.bugfix.rst create mode 100644 newsfragments/2021.doc.rst diff --git a/newsfragments/2017.feature.rst b/newsfragments/2017.feature.rst new file mode 100644 index 0000000000..00797779d9 --- /dev/null +++ b/newsfragments/2017.feature.rst @@ -0,0 +1 @@ +Pass all London tests from the ethereum/tests repo diff --git a/newsfragments/2021.bugfix.rst b/newsfragments/2021.bugfix.rst new file mode 100644 index 0000000000..46bbe04183 --- /dev/null +++ b/newsfragments/2021.bugfix.rst @@ -0,0 +1,2 @@ +- Make header gas limit more restrictive. Was too permissive by one gas. Tightened the bounds. +- Validate uncle gas limits are within bounds. This was previously not validated at all. diff --git a/newsfragments/2021.doc.rst b/newsfragments/2021.doc.rst new file mode 100644 index 0000000000..ed1775857f --- /dev/null +++ b/newsfragments/2021.doc.rst @@ -0,0 +1 @@ +Squash sphinx warnings with a small documentation reorg.