fixes coinBase suicide

This commit is contained in:
andri lim 2019-09-25 18:43:16 +07:00 committed by zah
parent e63a43ee9f
commit 12960c27ce
5 changed files with 49 additions and 48 deletions

View File

@ -228,7 +228,7 @@ OK: 86/96 Fail: 0/96 Skip: 10/96
+ OverflowGasRequire.json OK + OverflowGasRequire.json OK
+ RefundOverflow.json OK + RefundOverflow.json OK
+ RefundOverflow2.json OK + RefundOverflow2.json OK
SuicidesMixingCoinbase.json Skip + SuicidesMixingCoinbase.json OK
TransactionFromCoinbaseHittingBlockGasLimit1.json Skip TransactionFromCoinbaseHittingBlockGasLimit1.json Skip
+ TransactionFromCoinbaseNotEnoughFounds.json OK + TransactionFromCoinbaseNotEnoughFounds.json OK
+ TransactionNonceCheck.json OK + TransactionNonceCheck.json OK
@ -259,13 +259,13 @@ OK: 86/96 Fail: 0/96 Skip: 10/96
+ extCodeHashOfDeletedAccountDynamic.json OK + extCodeHashOfDeletedAccountDynamic.json OK
+ multimpleBalanceInstruction.json OK + multimpleBalanceInstruction.json OK
randomStatetest123.json Skip randomStatetest123.json Skip
randomStatetest136.json Skip + randomStatetest136.json OK
randomStatetest160.json Skip randomStatetest160.json Skip
randomStatetest170.json Skip randomStatetest170.json Skip
randomStatetest223.json Skip randomStatetest223.json Skip
randomStatetest229.json Skip randomStatetest229.json Skip
randomStatetest241.json Skip randomStatetest241.json Skip
randomStatetest324.json Skip + randomStatetest324.json OK
randomStatetest328.json Skip randomStatetest328.json Skip
randomStatetest375.json Skip randomStatetest375.json Skip
randomStatetest377.json Skip randomStatetest377.json Skip
@ -277,8 +277,8 @@ OK: 86/96 Fail: 0/96 Skip: 10/96
randomStatetest619.json Skip randomStatetest619.json Skip
randomStatetest94.json Skip randomStatetest94.json Skip
+ simpleSuicide.json OK + simpleSuicide.json OK
suicideCoinbase.json Skip + suicideCoinbase.json OK
suicideCoinbaseState.json Skip + suicideCoinbaseState.json OK
+ suicideStorageCheck.json OK + suicideStorageCheck.json OK
+ suicideStorageCheckVCreate.json OK + suicideStorageCheckVCreate.json OK
+ suicideStorageCheckVCreate2.json OK + suicideStorageCheckVCreate2.json OK
@ -286,7 +286,7 @@ OK: 86/96 Fail: 0/96 Skip: 10/96
+ transactionFromNotExistingAccount.json OK + transactionFromNotExistingAccount.json OK
+ txCost-sec73.json OK + txCost-sec73.json OK
``` ```
OK: 45/67 Fail: 0/67 Skip: 22/67 OK: 50/67 Fail: 0/67 Skip: 17/67
## bcTotalDifficultyTest ## bcTotalDifficultyTest
```diff ```diff
+ lotsOfBranchesOverrideAtTheEnd.json OK + lotsOfBranchesOverrideAtTheEnd.json OK
@ -404,4 +404,4 @@ OK: 20/20 Fail: 0/20 Skip: 0/20
OK: 5/5 Fail: 0/5 Skip: 0/5 OK: 5/5 Fail: 0/5 Skip: 0/5
---TOTAL--- ---TOTAL---
OK: 285/318 Fail: 0/318 Skip: 33/318 OK: 290/318 Fail: 0/318 Skip: 28/318

View File

@ -1068,7 +1068,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest120.json OK + randomStatetest120.json OK
+ randomStatetest121.json OK + randomStatetest121.json OK
+ randomStatetest122.json OK + randomStatetest122.json OK
+ randomStatetest123.json OK randomStatetest123.json Skip
+ randomStatetest124.json OK + randomStatetest124.json OK
+ randomStatetest125.json OK + randomStatetest125.json OK
+ randomStatetest126.json OK + randomStatetest126.json OK
@ -1079,7 +1079,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest133.json OK + randomStatetest133.json OK
+ randomStatetest134.json OK + randomStatetest134.json OK
+ randomStatetest135.json OK + randomStatetest135.json OK
+ randomStatetest136.json OK randomStatetest136.json Skip
+ randomStatetest137.json OK + randomStatetest137.json OK
+ randomStatetest138.json OK + randomStatetest138.json OK
+ randomStatetest139.json OK + randomStatetest139.json OK
@ -1103,7 +1103,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest158.json OK + randomStatetest158.json OK
+ randomStatetest159.json OK + randomStatetest159.json OK
+ randomStatetest16.json OK + randomStatetest16.json OK
+ randomStatetest160.json OK randomStatetest160.json Skip
+ randomStatetest161.json OK + randomStatetest161.json OK
+ randomStatetest162.json OK + randomStatetest162.json OK
+ randomStatetest163.json OK + randomStatetest163.json OK
@ -1112,7 +1112,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest167.json OK + randomStatetest167.json OK
+ randomStatetest169.json OK + randomStatetest169.json OK
+ randomStatetest17.json OK + randomStatetest17.json OK
+ randomStatetest170.json OK randomStatetest170.json Skip
+ randomStatetest171.json OK + randomStatetest171.json OK
+ randomStatetest172.json OK + randomStatetest172.json OK
+ randomStatetest173.json OK + randomStatetest173.json OK
@ -1163,12 +1163,12 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest220.json OK + randomStatetest220.json OK
+ randomStatetest221.json OK + randomStatetest221.json OK
+ randomStatetest222.json OK + randomStatetest222.json OK
+ randomStatetest223.json OK randomStatetest223.json Skip
+ randomStatetest225.json OK + randomStatetest225.json OK
+ randomStatetest226.json OK + randomStatetest226.json OK
+ randomStatetest227.json OK + randomStatetest227.json OK
+ randomStatetest228.json OK + randomStatetest228.json OK
+ randomStatetest229.json OK randomStatetest229.json Skip
+ randomStatetest23.json OK + randomStatetest23.json OK
+ randomStatetest230.json OK + randomStatetest230.json OK
+ randomStatetest231.json OK + randomStatetest231.json OK
@ -1178,7 +1178,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest237.json OK + randomStatetest237.json OK
+ randomStatetest238.json OK + randomStatetest238.json OK
+ randomStatetest24.json OK + randomStatetest24.json OK
+ randomStatetest241.json OK randomStatetest241.json Skip
+ randomStatetest242.json OK + randomStatetest242.json OK
+ randomStatetest243.json OK + randomStatetest243.json OK
+ randomStatetest244.json OK + randomStatetest244.json OK
@ -1258,11 +1258,11 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest321.json OK + randomStatetest321.json OK
+ randomStatetest322.json OK + randomStatetest322.json OK
+ randomStatetest323.json OK + randomStatetest323.json OK
+ randomStatetest324.json OK randomStatetest324.json Skip
+ randomStatetest325.json OK + randomStatetest325.json OK
+ randomStatetest326.json OK + randomStatetest326.json OK
+ randomStatetest327.json OK + randomStatetest327.json OK
+ randomStatetest328.json OK randomStatetest328.json Skip
+ randomStatetest329.json OK + randomStatetest329.json OK
+ randomStatetest33.json OK + randomStatetest33.json OK
+ randomStatetest332.json OK + randomStatetest332.json OK
@ -1307,12 +1307,12 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest370.json OK + randomStatetest370.json OK
+ randomStatetest371.json OK + randomStatetest371.json OK
+ randomStatetest372.json OK + randomStatetest372.json OK
+ randomStatetest375.json OK randomStatetest375.json Skip
+ randomStatetest376.json OK + randomStatetest376.json OK
+ randomStatetest377.json OK randomStatetest377.json Skip
+ randomStatetest378.json OK + randomStatetest378.json OK
+ randomStatetest379.json OK + randomStatetest379.json OK
+ randomStatetest38.json OK randomStatetest38.json Skip
+ randomStatetest380.json OK + randomStatetest380.json OK
+ randomStatetest381.json OK + randomStatetest381.json OK
+ randomStatetest382.json OK + randomStatetest382.json OK
@ -1323,7 +1323,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest42.json OK + randomStatetest42.json OK
+ randomStatetest43.json OK + randomStatetest43.json OK
+ randomStatetest45.json OK + randomStatetest45.json OK
+ randomStatetest46.json OK randomStatetest46.json Skip
+ randomStatetest47.json OK + randomStatetest47.json OK
+ randomStatetest48.json OK + randomStatetest48.json OK
+ randomStatetest49.json OK + randomStatetest49.json OK
@ -1364,13 +1364,13 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest9.json OK + randomStatetest9.json OK
+ randomStatetest90.json OK + randomStatetest90.json OK
+ randomStatetest92.json OK + randomStatetest92.json OK
+ randomStatetest94.json OK randomStatetest94.json Skip
+ randomStatetest95.json OK + randomStatetest95.json OK
+ randomStatetest96.json OK + randomStatetest96.json OK
+ randomStatetest97.json OK + randomStatetest97.json OK
+ randomStatetest98.json OK + randomStatetest98.json OK
``` ```
OK: 323/327 Fail: 0/327 Skip: 4/327 OK: 309/327 Fail: 0/327 Skip: 18/327
## stRandom2 ## stRandom2
```diff ```diff
+ 201503110226PYTHON_DUP6.json OK + 201503110226PYTHON_DUP6.json OK
@ -1423,7 +1423,7 @@ OK: 323/327 Fail: 0/327 Skip: 4/327
+ randomStatetest438.json OK + randomStatetest438.json OK
+ randomStatetest439.json OK + randomStatetest439.json OK
+ randomStatetest440.json OK + randomStatetest440.json OK
+ randomStatetest441.json OK randomStatetest441.json Skip
+ randomStatetest442.json OK + randomStatetest442.json OK
+ randomStatetest443.json OK + randomStatetest443.json OK
+ randomStatetest444.json OK + randomStatetest444.json OK
@ -1519,7 +1519,7 @@ OK: 323/327 Fail: 0/327 Skip: 4/327
+ randomStatetest546.json OK + randomStatetest546.json OK
+ randomStatetest547.json OK + randomStatetest547.json OK
+ randomStatetest548.json OK + randomStatetest548.json OK
+ randomStatetest549.json OK randomStatetest549.json Skip
+ randomStatetest550.json OK + randomStatetest550.json OK
+ randomStatetest552.json OK + randomStatetest552.json OK
+ randomStatetest553.json OK + randomStatetest553.json OK
@ -1556,7 +1556,7 @@ OK: 323/327 Fail: 0/327 Skip: 4/327
+ randomStatetest588.json OK + randomStatetest588.json OK
+ randomStatetest589.json OK + randomStatetest589.json OK
+ randomStatetest592.json OK + randomStatetest592.json OK
+ randomStatetest594.json OK randomStatetest594.json Skip
+ randomStatetest596.json OK + randomStatetest596.json OK
+ randomStatetest597.json OK + randomStatetest597.json OK
+ randomStatetest599.json OK + randomStatetest599.json OK
@ -1575,7 +1575,7 @@ OK: 323/327 Fail: 0/327 Skip: 4/327
+ randomStatetest615.json OK + randomStatetest615.json OK
+ randomStatetest616.json OK + randomStatetest616.json OK
+ randomStatetest618.json OK + randomStatetest618.json OK
+ randomStatetest619.json OK randomStatetest619.json Skip
+ randomStatetest620.json OK + randomStatetest620.json OK
+ randomStatetest621.json OK + randomStatetest621.json OK
+ randomStatetest624.json OK + randomStatetest624.json OK
@ -1601,7 +1601,7 @@ OK: 323/327 Fail: 0/327 Skip: 4/327
+ randomStatetest646.json OK + randomStatetest646.json OK
+ randomStatetest647.json OK + randomStatetest647.json OK
``` ```
OK: 225/227 Fail: 0/227 Skip: 2/227 OK: 221/227 Fail: 0/227 Skip: 6/227
## stRecursiveCreate ## stRecursiveCreate
```diff ```diff
+ recursiveCreate.json OK + recursiveCreate.json OK
@ -2201,14 +2201,14 @@ OK: 271/284 Fail: 0/284 Skip: 13/284
+ suicideCaller.json OK + suicideCaller.json OK
+ suicideCallerAddresTooBigLeft.json OK + suicideCallerAddresTooBigLeft.json OK
+ suicideCallerAddresTooBigRight.json OK + suicideCallerAddresTooBigRight.json OK
+ suicideCoinbase.json OK suicideCoinbase.json Skip
+ suicideNotExistingAccount.json OK + suicideNotExistingAccount.json OK
+ suicideOrigin.json OK + suicideOrigin.json OK
+ suicideSendEtherPostDeath.json OK + suicideSendEtherPostDeath.json OK
+ suicideSendEtherToMe.json OK + suicideSendEtherToMe.json OK
+ testRandomTest.json OK + testRandomTest.json OK
``` ```
OK: 57/67 Fail: 0/67 Skip: 10/67 OK: 56/67 Fail: 0/67 Skip: 11/67
## stTransactionTest ## stTransactionTest
```diff ```diff
+ ContractStoreClearsOOG.json OK + ContractStoreClearsOOG.json OK
@ -2239,11 +2239,11 @@ OK: 57/67 Fail: 0/67 Skip: 10/67
+ SuicidesAndInternlCallSuicidesOOG.json OK + SuicidesAndInternlCallSuicidesOOG.json OK
+ SuicidesAndInternlCallSuicidesSuccess.json OK + SuicidesAndInternlCallSuicidesSuccess.json OK
+ SuicidesAndSendMoneyToItselfEtherDestroyed.json OK + SuicidesAndSendMoneyToItselfEtherDestroyed.json OK
+ SuicidesMixingCoinbase.json OK SuicidesMixingCoinbase.json Skip
+ SuicidesStopAfterSuicide.json OK + SuicidesStopAfterSuicide.json OK
+ TransactionDataCosts652.json OK + TransactionDataCosts652.json OK
+ TransactionFromCoinbaseHittingBlockGasLimit.json OK + TransactionFromCoinbaseHittingBlockGasLimit.json OK
+ TransactionFromCoinbaseHittingBlockGasLimit1.json OK TransactionFromCoinbaseHittingBlockGasLimit1.json Skip
+ TransactionFromCoinbaseNotEnoughFounds.json OK + TransactionFromCoinbaseNotEnoughFounds.json OK
+ TransactionNonceCheck.json OK + TransactionNonceCheck.json OK
+ TransactionNonceCheck2.json OK + TransactionNonceCheck2.json OK
@ -2256,7 +2256,7 @@ OK: 57/67 Fail: 0/67 Skip: 10/67
+ UserTransactionZeroCost.json OK + UserTransactionZeroCost.json OK
+ UserTransactionZeroCostWithData.json OK + UserTransactionZeroCostWithData.json OK
``` ```
OK: 44/44 Fail: 0/44 Skip: 0/44 OK: 42/44 Fail: 0/44 Skip: 2/44
## stTransitionTest ## stTransitionTest
```diff ```diff
+ createNameRegistratorPerTxsAfter.json OK + createNameRegistratorPerTxsAfter.json OK
@ -2645,4 +2645,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: 2343/2447 Fail: 0/2447 Skip: 104/2447 OK: 2322/2447 Fail: 0/2447 Skip: 125/2447

View File

@ -17,6 +17,7 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
vmState.touchedAccounts.incl(vmState.blockHeader.coinbase) vmState.touchedAccounts.incl(vmState.blockHeader.coinbase)
var gasUsed = tx.gasLimit var gasUsed = tx.gasLimit
var coinBaseSuicide = false
block: block:
if vmState.cumulativeGasUsed + gasUsed > vmState.blockHeader.gasLimit: if vmState.cumulativeGasUsed + gasUsed > vmState.blockHeader.gasLimit:
@ -48,14 +49,14 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
if not computation.shouldBurnGas: if not computation.shouldBurnGas:
gasUsed = computation.refundGas(tx, sender) gasUsed = computation.refundGas(tx, sender)
if computation.isSuicided(vmState.blockHeader.coinbase): coinBaseSuicide = computation.isSuicided(vmState.blockHeader.coinbase)
gasUsed = 0
vmState.cumulativeGasUsed += gasUsed vmState.cumulativeGasUsed += gasUsed
# miner fee # miner fee
let txFee = gasUsed.u256 * tx.gasPrice.u256
vmState.mutateStateDB: vmState.mutateStateDB:
if not coinBaseSuicide:
let txFee = gasUsed.u256 * tx.gasPrice.u256
db.addBalance(vmState.blockHeader.coinbase, txFee) db.addBalance(vmState.blockHeader.coinbase, txFee)
# EIP158 state clearing # EIP158 state clearing

View File

@ -549,9 +549,13 @@ proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var Tes
let shouldBeGoodBlock = testerBlock.blockHeader.isSome let shouldBeGoodBlock = testerBlock.blockHeader.isSome
if shouldBeGoodBlock: if shouldBeGoodBlock:
try:
let (preminedBlock, minedBlock, blockRlp) = tester.applyFixtureBlockToChain( let (preminedBlock, minedBlock, blockRlp) = tester.applyFixtureBlockToChain(
testerBlock, chainDB, checkSeal, validation = false) # we manually validate below testerBlock, chainDB, checkSeal, validation = false) # we manually validate below
check validateBlock(chainDB, preminedBlock, checkSeal) == true check validateBlock(chainDB, preminedBlock, checkSeal) == true
except:
debugEcho "FATAL ERROR(WE HAVE BUG): ", getCurrentExceptionMsg()
else: else:
var noError = true var noError = true
try: try:
@ -639,9 +643,10 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = fal
except ValidationError as E: except ValidationError as E:
echo "ERROR: ", E.msg echo "ERROR: ", E.msg
success = false success = false
finally:
if tester.debugMode: if tester.debugMode:
tester.dumpDebugData(fixture, fixtureName, fixtureIndex, success) tester.dumpDebugData(fixture, fixtureName, fixtureIndex, success)
fixtureTested = true fixtureTested = true
check success == true check success == true

View File

@ -23,16 +23,13 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"create2noCash.json", "create2noCash.json",
# bcStateTests # bcStateTests
"SuicidesMixingCoinbase.json",
"TransactionFromCoinbaseHittingBlockGasLimit1.json", "TransactionFromCoinbaseHittingBlockGasLimit1.json",
"randomStatetest123.json", "randomStatetest123.json",
"randomStatetest136.json",
"randomStatetest160.json", "randomStatetest160.json",
"randomStatetest170.json", "randomStatetest170.json",
"randomStatetest223.json", "randomStatetest223.json",
"randomStatetest229.json", "randomStatetest229.json",
"randomStatetest241.json", "randomStatetest241.json",
"randomStatetest324.json",
"randomStatetest328.json", "randomStatetest328.json",
"randomStatetest375.json", "randomStatetest375.json",
"randomStatetest377.json", "randomStatetest377.json",
@ -43,8 +40,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"randomStatetest594.json", "randomStatetest594.json",
"randomStatetest619.json", "randomStatetest619.json",
"randomStatetest94.json", "randomStatetest94.json",
"suicideCoinbase.json",
"suicideCoinbaseState.json",
# bcRandomBlockhashTest # bcRandomBlockhashTest
"randomStatetest127BC.json", "randomStatetest127BC.json",