fix not enough gas, GST +5

This commit is contained in:
andri lim 2019-03-16 22:23:15 +07:00
parent 433ccba15f
commit 990bc44c65
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 17 additions and 15 deletions

View File

@ -522,8 +522,8 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ CallRecursiveContract.json OK
+ CallTheContractToCreateEmptyContract.json OK
+ NotEnoughCashContractCreation.json OK
OutOfGasContractCreation.json Skip
OutOfGasPrefundedContractCreation.json Skip
+ OutOfGasContractCreation.json OK
+ OutOfGasPrefundedContractCreation.json OK
+ ReturnTest.json OK
+ ReturnTest2.json OK
+ StackUnderFlowContractCreation.json OK
@ -532,7 +532,7 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ TransactionCreateStopInInitcode.json OK
+ TransactionCreateSuicideInInitcode.json OK
```
OK: 16/18 Fail: 0/18 Skip: 2/18
OK: 18/18 Fail: 0/18 Skip: 0/18
## stLogTests
```diff
+ log0_emptyMem.json OK
@ -2137,14 +2137,14 @@ OK: 41/44 Fail: 0/44 Skip: 3/44
+ createNameRegistratorPerTxsAfter.json OK
+ createNameRegistratorPerTxsAt.json OK
+ createNameRegistratorPerTxsBefore.json OK
createNameRegistratorPerTxsNotEnoughGasAfter.json Skip
createNameRegistratorPerTxsNotEnoughGasAt.json Skip
createNameRegistratorPerTxsNotEnoughGasBefore.json Skip
+ createNameRegistratorPerTxsNotEnoughGasAfter.json OK
+ createNameRegistratorPerTxsNotEnoughGasAt.json OK
+ createNameRegistratorPerTxsNotEnoughGasBefore.json OK
delegatecallAfterTransition.json Skip
delegatecallAtTransition.json Skip
delegatecallBeforeTransition.json Skip
```
OK: 3/9 Fail: 0/9 Skip: 6/9
OK: 6/9 Fail: 0/9 Skip: 3/9
## stWalletTest
```diff
+ dayLimitConstruction.json OK
@ -2520,4 +2520,4 @@ OK: 0/133 Fail: 0/133 Skip: 133/133
OK: 0/130 Fail: 0/130 Skip: 130/130
---TOTAL---
OK: 1234/2334 Fail: 0/2334 Skip: 1100/2334
OK: 1239/2334 Fail: 0/2334 Skip: 1095/2334

View File

@ -29,6 +29,10 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
if balance < upfrontGasCost:
return tx.gasLimit
var computation = setupComputation(vmState, tx, sender, forkOverride)
if computation.isNil:
return 0
vmState.mutateStateDB:
db.incNonce(sender)
db.subBalance(sender, upfrontGasCost)
@ -36,7 +40,6 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
var snapshot = vmState.snapshot()
defer: snapshot.dispose()
var computation = setupComputation(vmState, tx, sender, forkOverride)
var contractOK = true
result = tx.gasLimit

View File

@ -48,6 +48,10 @@ proc setupComputation*(vmState: BaseVMState, tx: Transaction, sender: EthAddress
data = tx.payload
code = vmState.readOnlyStateDB.getCode(tx.to).toSeq
if gas < 0:
debug "not enough gas to perform calculation", gas=gas
return
let msg = newMessage(
gas = gas,
gasPrice = tx.gasPrice,

View File

@ -46,8 +46,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"delegatecallValueCheck.json",
"delegatecodeDynamicCode.json",
"delegatecodeDynamicCode2SelfCall.json",
"OutOfGasContractCreation.json",
"OutOfGasPrefundedContractCreation.json",
"CALLCODEEcrecoverV_prefixedf0.json",
"randomStatetest14.json",
"randomStatetest184.json",
@ -65,9 +63,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"Opcodes_TransactionInit.json",
"SuicidesMixingCoinbase.json",
"TransactionFromCoinbaseHittingBlockGasLimit1.json",
"createNameRegistratorPerTxsNotEnoughGasAfter.json",
"createNameRegistratorPerTxsNotEnoughGasAt.json",
"createNameRegistratorPerTxsNotEnoughGasBefore.json",
"delegatecallAfterTransition.json",
"delegatecallAtTransition.json",
"delegatecallBeforeTransition.json",