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 + CallRecursiveContract.json OK
+ CallTheContractToCreateEmptyContract.json OK + CallTheContractToCreateEmptyContract.json OK
+ NotEnoughCashContractCreation.json OK + NotEnoughCashContractCreation.json OK
OutOfGasContractCreation.json Skip + OutOfGasContractCreation.json OK
OutOfGasPrefundedContractCreation.json Skip + OutOfGasPrefundedContractCreation.json OK
+ ReturnTest.json OK + ReturnTest.json OK
+ ReturnTest2.json OK + ReturnTest2.json OK
+ StackUnderFlowContractCreation.json OK + StackUnderFlowContractCreation.json OK
@ -532,7 +532,7 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ TransactionCreateStopInInitcode.json OK + TransactionCreateStopInInitcode.json OK
+ TransactionCreateSuicideInInitcode.json OK + TransactionCreateSuicideInInitcode.json OK
``` ```
OK: 16/18 Fail: 0/18 Skip: 2/18 OK: 18/18 Fail: 0/18 Skip: 0/18
## stLogTests ## stLogTests
```diff ```diff
+ log0_emptyMem.json OK + log0_emptyMem.json OK
@ -2137,14 +2137,14 @@ OK: 41/44 Fail: 0/44 Skip: 3/44
+ createNameRegistratorPerTxsAfter.json OK + createNameRegistratorPerTxsAfter.json OK
+ createNameRegistratorPerTxsAt.json OK + createNameRegistratorPerTxsAt.json OK
+ createNameRegistratorPerTxsBefore.json OK + createNameRegistratorPerTxsBefore.json OK
createNameRegistratorPerTxsNotEnoughGasAfter.json Skip + createNameRegistratorPerTxsNotEnoughGasAfter.json OK
createNameRegistratorPerTxsNotEnoughGasAt.json Skip + createNameRegistratorPerTxsNotEnoughGasAt.json OK
createNameRegistratorPerTxsNotEnoughGasBefore.json Skip + createNameRegistratorPerTxsNotEnoughGasBefore.json OK
delegatecallAfterTransition.json Skip delegatecallAfterTransition.json Skip
delegatecallAtTransition.json Skip delegatecallAtTransition.json Skip
delegatecallBeforeTransition.json Skip delegatecallBeforeTransition.json Skip
``` ```
OK: 3/9 Fail: 0/9 Skip: 6/9 OK: 6/9 Fail: 0/9 Skip: 3/9
## stWalletTest ## stWalletTest
```diff ```diff
+ dayLimitConstruction.json OK + 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 OK: 0/130 Fail: 0/130 Skip: 130/130
---TOTAL--- ---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: if balance < upfrontGasCost:
return tx.gasLimit return tx.gasLimit
var computation = setupComputation(vmState, tx, sender, forkOverride)
if computation.isNil:
return 0
vmState.mutateStateDB: vmState.mutateStateDB:
db.incNonce(sender) db.incNonce(sender)
db.subBalance(sender, upfrontGasCost) db.subBalance(sender, upfrontGasCost)
@ -36,7 +40,6 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
var snapshot = vmState.snapshot() var snapshot = vmState.snapshot()
defer: snapshot.dispose() defer: snapshot.dispose()
var computation = setupComputation(vmState, tx, sender, forkOverride)
var contractOK = true var contractOK = true
result = tx.gasLimit result = tx.gasLimit

View File

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

View File

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