From 97095259168e5fa58c40c616bd685656d74ae08b Mon Sep 17 00:00:00 2001 From: jangko Date: Wed, 13 Jan 2021 08:08:56 +0700 Subject: [PATCH] fix byzantium bug related to revertPrecompileTouched --- BlockchainTests.md | 12 ++++++------ GeneralStateTests.md | 8 ++++---- newGeneralStateTests.md | 8 ++++---- nimbus/vm/computation.nim | 2 +- tests/test_allowed_to_fail.nim | 12 ------------ 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/BlockchainTests.md b/BlockchainTests.md index b3f15962a..0de7d213f 100644 --- a/BlockchainTests.md +++ b/BlockchainTests.md @@ -3001,10 +3001,10 @@ OK: 45/45 Fail: 0/45 Skip: 0/45 + RevertPrecompiledTouchExactOOG_d8g1v0.json OK + RevertPrecompiledTouchExactOOG_d9g0v0.json OK + RevertPrecompiledTouchExactOOG_d9g1v0.json OK - RevertPrecompiledTouch_d0g0v0.json Skip ++ RevertPrecompiledTouch_d0g0v0.json OK + RevertPrecompiledTouch_d1g0v0.json OK + RevertPrecompiledTouch_d2g0v0.json OK - RevertPrecompiledTouch_d3g0v0.json Skip ++ RevertPrecompiledTouch_d3g0v0.json OK + RevertPrecompiledTouch_nonce_d0g0v0.json OK + RevertPrecompiledTouch_nonce_d1g0v0.json OK + RevertPrecompiledTouch_nonce_d2g0v0.json OK @@ -3013,10 +3013,10 @@ OK: 45/45 Fail: 0/45 Skip: 0/45 + RevertPrecompiledTouch_noncestorage_d1g0v0.json OK + RevertPrecompiledTouch_noncestorage_d2g0v0.json OK + RevertPrecompiledTouch_noncestorage_d3g0v0.json OK - RevertPrecompiledTouch_storage_d0g0v0.json Skip ++ RevertPrecompiledTouch_storage_d0g0v0.json OK + RevertPrecompiledTouch_storage_d1g0v0.json OK + RevertPrecompiledTouch_storage_d2g0v0.json OK - RevertPrecompiledTouch_storage_d3g0v0.json Skip ++ RevertPrecompiledTouch_storage_d3g0v0.json OK + RevertPrefoundCallOOG_d0g0v0.json OK + RevertPrefoundCall_d0g0v0.json OK + RevertPrefoundEmptyCallOOG_d0g0v0.json OK @@ -3045,7 +3045,7 @@ OK: 45/45 Fail: 0/45 Skip: 0/45 + TouchToEmptyAccountRevert3_d0g1v0.json OK + TouchToEmptyAccountRevert_d0g0v0.json OK ``` -OK: 207/211 Fail: 0/211 Skip: 4/211 +OK: 211/211 Fail: 0/211 Skip: 0/211 ## stSStoreTest ```diff + InitCollisionNonZeroNonce_d0g0v0.json OK @@ -11169,4 +11169,4 @@ OK: 804/804 Fail: 0/804 Skip: 0/804 OK: 519/519 Fail: 0/519 Skip: 0/519 ---TOTAL--- -OK: 10900/10907 Fail: 0/10907 Skip: 7/10907 +OK: 10904/10907 Fail: 0/10907 Skip: 3/10907 diff --git a/GeneralStateTests.md b/GeneralStateTests.md index 486582a24..fd1b99dca 100644 --- a/GeneralStateTests.md +++ b/GeneralStateTests.md @@ -1674,11 +1674,11 @@ OK: 38/38 Fail: 0/38 Skip: 0/38 + RevertOpcodeMultipleSubCalls.json OK + RevertOpcodeReturn.json OK + RevertOpcodeWithBigOutputInInit.json OK - RevertPrecompiledTouch.json Skip ++ RevertPrecompiledTouch.json OK + RevertPrecompiledTouchExactOOG.json OK + RevertPrecompiledTouch_nonce.json OK + RevertPrecompiledTouch_noncestorage.json OK - RevertPrecompiledTouch_storage.json Skip ++ RevertPrecompiledTouch_storage.json OK + RevertPrefound.json OK + RevertPrefoundCall.json OK + RevertPrefoundCallOOG.json OK @@ -1695,7 +1695,7 @@ OK: 38/38 Fail: 0/38 Skip: 0/38 + TouchToEmptyAccountRevert2.json OK + TouchToEmptyAccountRevert3.json OK ``` -OK: 38/45 Fail: 0/45 Skip: 7/45 +OK: 40/45 Fail: 0/45 Skip: 5/45 ## stSStoreTest ```diff + InitCollision.json OK @@ -2593,4 +2593,4 @@ OK: 133/133 Fail: 0/133 Skip: 0/133 OK: 130/130 Fail: 0/130 Skip: 0/130 ---TOTAL--- -OK: 2287/2391 Fail: 0/2391 Skip: 104/2391 +OK: 2289/2391 Fail: 0/2391 Skip: 102/2391 diff --git a/newGeneralStateTests.md b/newGeneralStateTests.md index e09cd23b3..ad50c98a8 100644 --- a/newGeneralStateTests.md +++ b/newGeneralStateTests.md @@ -1685,11 +1685,11 @@ OK: 38/38 Fail: 0/38 Skip: 0/38 + RevertOpcodeMultipleSubCalls.json OK + RevertOpcodeReturn.json OK + RevertOpcodeWithBigOutputInInit.json OK - RevertPrecompiledTouch.json Skip ++ RevertPrecompiledTouch.json OK + RevertPrecompiledTouchExactOOG.json OK + RevertPrecompiledTouch_nonce.json OK + RevertPrecompiledTouch_noncestorage.json OK - RevertPrecompiledTouch_storage.json Skip ++ RevertPrecompiledTouch_storage.json OK + RevertPrefound.json OK + RevertPrefoundCall.json OK + RevertPrefoundCallOOG.json OK @@ -1706,7 +1706,7 @@ OK: 38/38 Fail: 0/38 Skip: 0/38 + TouchToEmptyAccountRevert2.json OK + TouchToEmptyAccountRevert3.json OK ``` -OK: 38/45 Fail: 0/45 Skip: 7/45 +OK: 40/45 Fail: 0/45 Skip: 5/45 ## stSLoadTest ```diff + sloadGasCost.json OK @@ -2641,4 +2641,4 @@ OK: 133/133 Fail: 0/133 Skip: 0/133 OK: 130/130 Fail: 0/130 Skip: 0/130 ---TOTAL--- -OK: 2317/2423 Fail: 0/2423 Skip: 106/2423 +OK: 2319/2423 Fail: 0/2423 Skip: 104/2423 diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index 65f9e3e83..3016188a7 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -243,7 +243,7 @@ proc execCall*(c: Computation) = ## https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md ## also see: https://github.com/ethereum/EIPs/issues/716 - if c.isError or c.fork >= FKIstanbul: + if c.isError or c.fork >= FKByzantium: if c.msg.contractAddress == ripemdAddr: # Special case to account for geth+parity bug c.vmState.touchedAccounts.incl c.msg.contractAddress diff --git a/tests/test_allowed_to_fail.nim b/tests/test_allowed_to_fail.nim index 8d526cb72..c67244fc7 100644 --- a/tests/test_allowed_to_fail.nim +++ b/tests/test_allowed_to_fail.nim @@ -95,12 +95,6 @@ func skipGSTTests*(folder: string, name: string): bool = if slowGSTTests(folder, name): return true - name in @[ - # bugs related to ethereum/tests/b1248cd40809d219197ff01eb547170bfaaf1bf1 - "RevertPrecompiledTouch.json", - "RevertPrecompiledTouch_storage.json", - ] - func skipNewGSTTests*(folder: string, name: string): bool = # share the same slow and failing tests if skipGSTTests(folder, name): @@ -122,12 +116,6 @@ func skipBCTests*(folder: string, name: string): bool = # BC huge memory consumption "randomStatetest94.json", "DelegateCallSpam.json", - - # bugs related to ethereum/tests/b1248cd40809d219197ff01eb547170bfaaf1bf1 - "RevertPrecompiledTouch_d0g0v0.json", - "RevertPrecompiledTouch_d3g0v0.json", - "RevertPrecompiledTouch_storage_d0g0v0.json", - "RevertPrecompiledTouch_storage_d3g0v0.json", ] func skipNewBCTests*(folder: string, name: string): bool =