some simplification and cleanup

This commit is contained in:
Dustin Brody 2018-10-01 12:12:14 -07:00 committed by tersec
parent 4f04332205
commit 7aa0c386dd
5 changed files with 16 additions and 21 deletions

View File

@ -320,7 +320,7 @@ OK: 0/58 Fail: 15/58 Skip: 43/58
OK: 0/58 Fail: 58/58 Skip: 0/58 OK: 0/58 Fail: 58/58 Skip: 0/58
## stChangedEIP150 ## stChangedEIP150
```diff ```diff
Call1024BalanceTooLow.json Skip - Call1024BalanceTooLow.json Fail
- Call1024PreCalls.json Fail - Call1024PreCalls.json Fail
- Callcode1024BalanceTooLow.json Fail - Callcode1024BalanceTooLow.json Fail
+ callcall_00_OOGE_1.json OK + callcall_00_OOGE_1.json OK
@ -351,12 +351,12 @@ OK: 0/58 Fail: 58/58 Skip: 0/58
+ contractCreationMakeCallThatAskMoreGasThenTransactionProvided.jsonOK + contractCreationMakeCallThatAskMoreGasThenTransactionProvided.jsonOK
- createInitFail_OOGduringInit.json Fail - createInitFail_OOGduringInit.json Fail
``` ```
OK: 4/30 Fail: 24/30 Skip: 2/30 OK: 4/30 Fail: 25/30 Skip: 1/30
## stCodeCopyTest ## stCodeCopyTest
```diff ```diff
ExtCodeCopyTests.json Skip - ExtCodeCopyTests.json Fail
``` ```
OK: 0/1 Fail: 0/1 Skip: 1/1 OK: 0/1 Fail: 1/1 Skip: 0/1
## stCodeSizeLimit ## stCodeSizeLimit
```diff ```diff
- codesizeInit.json Fail - codesizeInit.json Fail
@ -400,7 +400,7 @@ OK: 2/3 Fail: 1/3 Skip: 0/3
OK: 0/30 Fail: 22/30 Skip: 8/30 OK: 0/30 Fail: 22/30 Skip: 8/30
## stDelegatecallTestHomestead ## stDelegatecallTestHomestead
```diff ```diff
Call1024BalanceTooLow.json Skip - Call1024BalanceTooLow.json Fail
- Call1024OOG.json Fail - Call1024OOG.json Fail
- Call1024PreCalls.json Fail - Call1024PreCalls.json Fail
- CallLoseGasOOG.json Fail - CallLoseGasOOG.json Fail
@ -435,7 +435,7 @@ OK: 0/30 Fail: 22/30 Skip: 8/30
- delegatecodeDynamicCode.json Fail - delegatecodeDynamicCode.json Fail
- delegatecodeDynamicCode2SelfCall.json Fail - delegatecodeDynamicCode2SelfCall.json Fail
``` ```
OK: 3/34 Fail: 30/34 Skip: 1/34 OK: 3/34 Fail: 31/34 Skip: 0/34
## stEIP150Specific ## stEIP150Specific
```diff ```diff
CallAndCallcodeConsumeMoreGasThenTransactionHas.json Skip CallAndCallcodeConsumeMoreGasThenTransactionHas.json Skip

View File

@ -49,12 +49,12 @@ proc setupComputation*(header: BlockHeader, vmState: var BaseVMState, transactio
result.precompiles = initTable[string, Opcode]() result.precompiles = initTable[string, Opcode]()
doAssert result.isOriginComputation doAssert result.isOriginComputation
proc execComputation*(computation: var BaseComputation, vmState: BaseVMState): bool = proc execComputation*(computation: var BaseComputation): bool =
try: try:
computation.executeOpcodes() computation.executeOpcodes()
#[vmState.mutateStateDB: computation.vmState.mutateStateDB:
for deletedAccount in computation.getAccountsForDeletion: for deletedAccount in computation.getAccountsForDeletion:
db.deleteAccount deletedAccount]# db.deleteAccount deletedAccount
result = not computation.isError result = not computation.isError
except ValueError: except ValueError:
@ -74,7 +74,7 @@ proc applyCreateTransaction*(db: var AccountStateDB, t: Transaction, head: Block
createAddress = contractAddress)) createAddress = contractAddress))
var c = newBaseComputation(vmState, head.blockNumber, msg) var c = newBaseComputation(vmState, head.blockNumber, msg)
if execComputation(c, vmState): if execComputation(c):
db.addBalance(contractAddress, t.value) db.addBalance(contractAddress, t.value)
# XXX: copy/pasted from GST fixture # XXX: copy/pasted from GST fixture

View File

@ -526,5 +526,7 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"pointAdd.json", "pointAdd.json",
"pointAddTrunc.json", "pointAddTrunc.json",
"pointMulAdd.json", "pointMulAdd.json",
"pointMulAdd2.json"] "pointMulAdd2.json",
"Call1024BalanceTooLow.json",
"ExtCodeCopyTests.json"]
name in allowedFailingGeneralStateTests name in allowedFailingGeneralStateTests

View File

@ -66,7 +66,7 @@ proc testFixtureIndexes(header: BlockHeader, pre: JsonNode, transaction: Transac
db.addBalance(transaction.to, transaction.value) db.addBalance(transaction.to, transaction.value)
# What remains is call and/or value transfer # What remains is call and/or value transfer
if execComputation(computation, vmState): if execComputation(computation):
let let
gasRemaining = computation.gasMeter.gasRemaining.u256 gasRemaining = computation.gasMeter.gasRemaining.u256
gasRefunded = computation.gasMeter.gasRefunded.u256 gasRefunded = computation.gasMeter.gasRefunded.u256
@ -75,8 +75,6 @@ proc testFixtureIndexes(header: BlockHeader, pre: JsonNode, transaction: Transac
gasRefundAmount = (gasRefund + gasRemaining) * transaction.gasPrice.u256 gasRefundAmount = (gasRefund + gasRemaining) * transaction.gasPrice.u256
vmState.mutateStateDB: vmState.mutateStateDB:
for deletedAccount in computation.getAccountsForDeletion:
db.deleteAccount deletedAccount
# TODO if the balance/etc calls were gated on gAFD or similar, # TODO if the balance/etc calls were gated on gAFD or similar,
# that would simplify/combine codepaths # that would simplify/combine codepaths
if header.coinbase notin computation.getAccountsForDeletion: if header.coinbase notin computation.getAccountsForDeletion:

View File

@ -86,10 +86,7 @@ func failIn32Bits(folder, name: string): bool =
func validTest*(folder: string, name: string): bool = func validTest*(folder: string, name: string): bool =
# tests we want to skip or which segfault will be skipped here # tests we want to skip or which segfault will be skipped here
result = (folder != "vmPerformance" or "loop" notin name) and result = (folder != "vmPerformance" or "loop" notin name) and
(not slowTest(folder, name) and not slowTest(folder, name)
# TODO: check whether these are still useful
name notin @["static_Call1024BalanceTooLow.json",
"Call1024BalanceTooLow.json", "ExtCodeCopyTests.json"])
proc lacksHomesteadPostStates*(filename: string): bool = proc lacksHomesteadPostStates*(filename: string): bool =
# XXX: Until Nimbus supports Byzantine or newer forks, as opposed # XXX: Until Nimbus supports Byzantine or newer forks, as opposed
@ -198,8 +195,6 @@ proc verifyStateDB*(wantedState: JsonNode, stateDB: AccountStateDB) =
wantedValue = UInt256.fromHex value.getStr wantedValue = UInt256.fromHex value.getStr
let (actualValue, found) = stateDB.getStorage(account, slotId) let (actualValue, found) = stateDB.getStorage(account, slotId)
# echo "FOUND ", found
# echo "ACTUAL VALUE ", actualValue.toHex
doAssert found doAssert found
doAssert actualValue == wantedValue, &"{actualValue.toHex} != {wantedValue.toHex}" doAssert actualValue == wantedValue, &"{actualValue.toHex} != {wantedValue.toHex}"
@ -228,7 +223,7 @@ proc getFixtureTransaction*(j: JsonNode, dataIndex, gasIndex, valueIndex: int):
result.gasLimit = j["gasLimit"][gasIndex].getStr.parseHexInt result.gasLimit = j["gasLimit"][gasIndex].getStr.parseHexInt
# TODO: there are a couple fixtures which appear to distinguish between # TODO: there are a couple fixtures which appear to distinguish between
# empty and 0 transaction.to. # empty and 0 transaction.to; check/verify whether correct conditions.
let rawTo = j["to"].getStr let rawTo = j["to"].getStr
if rawTo == "": if rawTo == "":
result.to = "0x".parseAddress result.to = "0x".parseAddress