fix accountsForDeletion iterator, GST +2

This commit is contained in:
andri lim 2019-04-18 13:23:04 +07:00
parent 1883472104
commit ec918602bc
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 14 additions and 45 deletions

View File

@ -2066,8 +2066,8 @@ OK: 1/284 Fail: 0/284 Skip: 283/284
+ createNameRegistratorZeroMemExpansion.json OK
+ createWithInvalidOpcode.json OK
+ currentAccountBalance.json OK
doubleSelfdestructTest.json Skip
doubleSelfdestructTest2.json Skip
+ doubleSelfdestructTest.json OK
+ doubleSelfdestructTest2.json OK
+ extcodecopy.json OK
+ return0.json OK
+ return1.json OK
@ -2083,7 +2083,7 @@ OK: 1/284 Fail: 0/284 Skip: 283/284
+ suicideSendEtherToMe.json OK
+ testRandomTest.json OK
```
OK: 63/67 Fail: 0/67 Skip: 4/67
OK: 65/67 Fail: 0/67 Skip: 2/67
## stTransactionTest
```diff
+ ContractStoreClearsOOG.json OK
@ -2520,4 +2520,4 @@ OK: 5/133 Fail: 0/133 Skip: 128/133
OK: 0/130 Fail: 0/130 Skip: 130/130
---TOTAL---
OK: 1510/2334 Fail: 0/2334 Skip: 824/2334
OK: 1512/2334 Fail: 0/2334 Skip: 822/2334

View File

@ -237,8 +237,6 @@ proc addChildComputation*(computation: BaseComputation, child: BaseComputation)
computation.returnData = @[]
else:
computation.returnData = child.output
for k, v in child.accountsToDelete:
computation.accountsToDelete[k] = v
computation.logEntries.add child.logEntries
if not child.shouldBurnGas:
@ -258,9 +256,16 @@ proc addLogEntry*(c: BaseComputation, log: Log) {.inline.} =
# many methods are basically TODO, but they still return valid values
# in order to test some existing code
iterator accountsForDeletion*(c: BaseComputation): EthAddress =
if not c.isError:
for account in c.accountsToDelete.keys:
yield account
var stack = @[c]
var deletedAccounts = initSet[EthAddress]()
while stack.len > 0:
let comp = stack.pop()
if comp.isError: continue
for account in comp.accountsToDelete.keys:
if account notin deletedAccounts:
deletedAccounts.incl account
yield account
stack.add comp.children
proc getGasRefund*(c: BaseComputation): GasInt =
if c.isError:

View File

@ -16,42 +16,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"randomStatetest14.json", # SHA3 offset
"randomStatetest85.json", # CALL* memoffset
# Tangerine failed GST
"doubleSelfdestructTest.json",
"doubleSelfdestructTest2.json",
# Spurious Dragon failed GST
#"CallContractToCreateContractOOG.json",
#"failed_tx_xcf416c53.json",
#"TransactionSendingToZero.json"
#"OutOfGasContractCreation.json",
#"OutOfGasPrefundedContractCreation.json",
#"RevertOpcodeInInit.json",
#"RevertOpcodeWithBigOutputInInit.json",
#"createNameRegistratorPerTxsNotEnoughGasAfter.json",
#"createNameRegistratorPerTxsNotEnoughGasAt.json",
#"createNameRegistratorPerTxsNotEnoughGasBefore.json",
#"ZeroValue_CALLCODE_ToEmpty.json",
#"ZeroValue_CALLCODE_ToOneStorageKey.json",
#"NonZeroValue_CALLCODE_ToEmpty.json",
#"NonZeroValue_CALLCODE_ToOneStorageKey.json",
#"suicideCoinbase.json",
#"EmptyTransaction2.json",
#"SuicidesMixingCoinbase.json",
#"UserTransactionZeroCost.json",
#"UserTransactionZeroCostWithData.json",
#"NotEnoughCashContractCreation.json",
#"201503110226PYTHON_DUP6.json",
#"CreateTransactionReverted.json",
#"EmptyTransaction.json",
#"OverflowGasRequire.json",
#"RefundOverflow.json",
#"RefundOverflow2.json",
#"TransactionNonceCheck.json",
#"TransactionNonceCheck2.json",
#"TransactionToItselfNotEnoughFounds.json",
#"UserTransactionGasLimitIsTooLowWhenZeroCost.json",
# Homestead recursives
#["ContractCreationSpam.json",
"Call1024OOG.json",