From e51725d13bd7b842687bc8cc1ae8f4c28e3725c6 Mon Sep 17 00:00:00 2001 From: andri lim Date: Wed, 8 May 2019 17:33:25 +0700 Subject: [PATCH] fix extCodeHash --- GeneralStateTests.md | 14 +++++++------- nimbus/vm/interpreter/opcodes_impl.nim | 4 ++++ tests/test_generalstate_failing.nim | 6 ------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/GeneralStateTests.md b/GeneralStateTests.md index 117e0aca7..24642cfde 100644 --- a/GeneralStateTests.md +++ b/GeneralStateTests.md @@ -555,7 +555,7 @@ OK: 7/7 Fail: 0/7 Skip: 0/7 OK: 1/1 Fail: 0/1 Skip: 0/1 ## stExtCodeHash ```diff - codeCopyZero.json Skip ++ codeCopyZero.json OK + dynamicAccountOverwriteEmpty.json OK + extCodeCopyBounds.json OK + extCodeHashAccountWithoutCode.json OK @@ -572,19 +572,19 @@ OK: 1/1 Fail: 0/1 Skip: 0/1 + extCodeHashDeletedAccount2.json OK + extCodeHashDeletedAccount3.json OK + extCodeHashDeletedAccount4.json OK - extCodeHashDynamicArgument.json Skip ++ extCodeHashDynamicArgument.json OK + extCodeHashInInitCode.json OK + extCodeHashMaxCodeSize.json OK + extCodeHashNewAccount.json OK - extCodeHashNonExistingAccount.json Skip - extCodeHashPrecompiles.json Skip ++ extCodeHashNonExistingAccount.json OK ++ extCodeHashPrecompiles.json OK + extCodeHashSTATICCALL.json OK + extCodeHashSelf.json OK + extCodeHashSelfInInit.json OK - extCodeHashSubcallOOG.json Skip ++ extCodeHashSubcallOOG.json OK + extCodeHashSubcallSuicide.json OK ``` -OK: 23/28 Fail: 0/28 Skip: 5/28 +OK: 28/28 Fail: 0/28 Skip: 0/28 ## stHomesteadSpecific ```diff + contractCreationOOGdontLeaveEmptyContract.json OK @@ -2645,4 +2645,4 @@ OK: 133/133 Fail: 0/133 Skip: 0/133 OK: 130/130 Fail: 0/130 Skip: 0/130 ---TOTAL--- -OK: 2333/2447 Fail: 0/2447 Skip: 114/2447 +OK: 2338/2447 Fail: 0/2447 Skip: 109/2447 diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 907f7bb1e..de0961e6c 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -920,6 +920,10 @@ op sarOp, inline = true: op extCodeHash, inline = true: let address = computation.stack.popAddress() + if not computation.vmState.readOnlyStateDB.accountExists(address): + push: 0 + return + if computation.vmState.readOnlyStateDB.isEmptyAccount(address): push: 0 else: diff --git a/tests/test_generalstate_failing.nim b/tests/test_generalstate_failing.nim index 6dae2b0ea..e0453d575 100644 --- a/tests/test_generalstate_failing.nim +++ b/tests/test_generalstate_failing.nim @@ -21,13 +21,7 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool = "create2InitCodes.json", "create2noCash.json", - "extCodeHashSubcallOOG.json", - "extCodeHashNonExistingAccount.json", - "extCodeHashPrecompiles.json", - "extCodeHashDynamicArgument.json", - "badOpcodes.json", - "codeCopyZero.json", # all these tests below actually pass # but they are very slow