fixes 'collectTouchedAccounts' for Istanbul
This commit is contained in:
parent
6b053d8a89
commit
0d743dc468
|
@ -1685,11 +1685,11 @@ OK: 38/38 Fail: 0/38 Skip: 0/38
|
||||||
+ RevertOpcodeMultipleSubCalls.json OK
|
+ RevertOpcodeMultipleSubCalls.json OK
|
||||||
+ RevertOpcodeReturn.json OK
|
+ RevertOpcodeReturn.json OK
|
||||||
+ RevertOpcodeWithBigOutputInInit.json OK
|
+ RevertOpcodeWithBigOutputInInit.json OK
|
||||||
RevertPrecompiledTouch.json Skip
|
+ RevertPrecompiledTouch.json OK
|
||||||
RevertPrecompiledTouchExactOOG.json Skip
|
+ RevertPrecompiledTouchExactOOG.json OK
|
||||||
+ RevertPrecompiledTouch_nonce.json OK
|
+ RevertPrecompiledTouch_nonce.json OK
|
||||||
+ RevertPrecompiledTouch_noncestorage.json OK
|
+ RevertPrecompiledTouch_noncestorage.json OK
|
||||||
RevertPrecompiledTouch_storage.json Skip
|
+ RevertPrecompiledTouch_storage.json OK
|
||||||
+ RevertPrefound.json OK
|
+ RevertPrefound.json OK
|
||||||
+ RevertPrefoundCall.json OK
|
+ RevertPrefoundCall.json OK
|
||||||
+ RevertPrefoundCallOOG.json OK
|
+ RevertPrefoundCallOOG.json OK
|
||||||
|
@ -1706,7 +1706,7 @@ OK: 38/38 Fail: 0/38 Skip: 0/38
|
||||||
+ TouchToEmptyAccountRevert2.json OK
|
+ TouchToEmptyAccountRevert2.json OK
|
||||||
+ TouchToEmptyAccountRevert3.json OK
|
+ TouchToEmptyAccountRevert3.json OK
|
||||||
```
|
```
|
||||||
OK: 36/45 Fail: 0/45 Skip: 9/45
|
OK: 39/45 Fail: 0/45 Skip: 6/45
|
||||||
## stSLoadTest
|
## stSLoadTest
|
||||||
```diff
|
```diff
|
||||||
+ sloadGasCost.json OK
|
+ sloadGasCost.json OK
|
||||||
|
@ -2625,4 +2625,4 @@ OK: 133/133 Fail: 0/133 Skip: 0/133
|
||||||
OK: 130/130 Fail: 0/130 Skip: 0/130
|
OK: 130/130 Fail: 0/130 Skip: 0/130
|
||||||
|
|
||||||
---TOTAL---
|
---TOTAL---
|
||||||
OK: 2300/2411 Fail: 0/2411 Skip: 111/2411
|
OK: 2303/2411 Fail: 0/2411 Skip: 108/2411
|
||||||
|
|
|
@ -282,18 +282,23 @@ proc getGasRemaining*(c: BaseComputation): GasInt =
|
||||||
else:
|
else:
|
||||||
result = c.gasMeter.gasRemaining
|
result = c.gasMeter.gasRemaining
|
||||||
|
|
||||||
proc collectTouchedAccounts*(c: BaseComputation, output: var HashSet[EthAddress]) =
|
proc collectTouchedAccounts*(c: BaseComputation, output: var HashSet[EthAddress], ancestorHadError: bool = false) =
|
||||||
## Collect all of the accounts that *may* need to be deleted based on EIP161:
|
## Collect all of the accounts that *may* need to be deleted based on EIP161:
|
||||||
## https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md
|
## https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md
|
||||||
## also see: https://github.com/ethereum/EIPs/issues/716
|
## also see: https://github.com/ethereum/EIPs/issues/716
|
||||||
|
|
||||||
proc cmpThree(address: EthAddress): bool =
|
proc cmpThree(address: EthAddress): bool =
|
||||||
|
# looking for RIPEMD160
|
||||||
for i in 0..18:
|
for i in 0..18:
|
||||||
if address[i] != 0: return
|
if address[i] != 0: return
|
||||||
result = address[19] == byte(3)
|
result = address[19] == byte(3)
|
||||||
|
|
||||||
|
let isIstanbul = c.getFork >= FkIstanbul
|
||||||
|
let condition = if isIstanbul: c.isError or ancestorHadError
|
||||||
|
else: c.isError and c.isOriginComputation
|
||||||
|
|
||||||
for _, beneficiary in c.accountsToDelete:
|
for _, beneficiary in c.accountsToDelete:
|
||||||
if c.isError and c.isOriginComputation:
|
if condition:
|
||||||
# Special case to account for geth+parity bug
|
# Special case to account for geth+parity bug
|
||||||
# https://github.com/ethereum/EIPs/issues/716
|
# https://github.com/ethereum/EIPs/issues/716
|
||||||
if beneficiary.cmpThree:
|
if beneficiary.cmpThree:
|
||||||
|
@ -303,7 +308,7 @@ proc collectTouchedAccounts*(c: BaseComputation, output: var HashSet[EthAddress]
|
||||||
output.incl beneficiary
|
output.incl beneficiary
|
||||||
|
|
||||||
if not c.msg.isCreate:
|
if not c.msg.isCreate:
|
||||||
if c.isError and c.isOriginComputation:
|
if condition:
|
||||||
# Special case to account for geth+parity bug
|
# Special case to account for geth+parity bug
|
||||||
# https://github.com/ethereum/EIPs/issues/716
|
# https://github.com/ethereum/EIPs/issues/716
|
||||||
if cmpThree(c.msg.storageAddress):
|
if cmpThree(c.msg.storageAddress):
|
||||||
|
@ -311,9 +316,10 @@ proc collectTouchedAccounts*(c: BaseComputation, output: var HashSet[EthAddress]
|
||||||
else:
|
else:
|
||||||
output.incl c.msg.storageAddress
|
output.incl c.msg.storageAddress
|
||||||
|
|
||||||
if not c.isError:
|
if c.isSuccess or isIstanbul:
|
||||||
|
# recurse into nested computations (even errored ones, since looking for RIPEMD160)
|
||||||
for child in c.children:
|
for child in c.children:
|
||||||
child.collectTouchedAccounts(output)
|
child.collectTouchedAccounts(output, c.isError or ancestorHadError)
|
||||||
|
|
||||||
proc tracingEnabled*(c: BaseComputation): bool =
|
proc tracingEnabled*(c: BaseComputation): bool =
|
||||||
c.vmState.tracingEnabled
|
c.vmState.tracingEnabled
|
||||||
|
|
|
@ -28,9 +28,5 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
|
||||||
"RevertInCreateInInit.json",
|
"RevertInCreateInInit.json",
|
||||||
"RevertInCreateInInitCreate2.json",
|
"RevertInCreateInInitCreate2.json",
|
||||||
"InitCollision.json",
|
"InitCollision.json",
|
||||||
|
|
||||||
"RevertPrecompiledTouch.json",
|
|
||||||
"RevertPrecompiledTouchExactOOG.json",
|
|
||||||
"RevertPrecompiledTouch_storage.json",
|
|
||||||
]
|
]
|
||||||
result = name in allowedFailingGeneralStateTests
|
result = name in allowedFailingGeneralStateTests
|
||||||
|
|
Loading…
Reference in New Issue