Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contract call and contract creation refactor #252

Merged
merged 12 commits into from
Feb 27, 2019
Prev Previous commit
pass additional 9 GST
  • Loading branch information
jangko committed Feb 27, 2019
commit 5ce7eb78f27090215acc35fbd618d7972c2b559c
30 changes: 15 additions & 15 deletions GeneralStateTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
CREATE_ContractRETURNBigOffset.json Skip
+ CREATE_ContractSSTOREDuringInit.json OK
+ CREATE_ContractSuicideDuringInit.json OK
CREATE_ContractSuicideDuringInit_ThenStoreThenReturn.json Skip
CREATE_ContractSuicideDuringInit_WithValue.json Skip
+ CREATE_ContractSuicideDuringInit_ThenStoreThenReturn.json OK
+ CREATE_ContractSuicideDuringInit_WithValue.json OK
+ CREATE_ContractSuicideDuringInit_WithValueToItself.json OK
CREATE_EContractCreateEContractInInit_Tr.json Skip
+ CREATE_EContractCreateNEContractInInitOOG_Tr.json OK
Expand All @@ -397,7 +397,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
TransactionCollisionToEmptyButCode.json Skip
TransactionCollisionToEmptyButNonce.json Skip
```
OK: 12/30 Fail: 0/30 Skip: 18/30
OK: 14/30 Fail: 0/30 Skip: 16/30
## stDelegatecallTestHomestead
```diff
Call1024BalanceTooLow.json Skip
Expand Down Expand Up @@ -508,9 +508,9 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ contractCreationOOGdontLeaveEmptyContractViaTransaction.json OK
+ createContractViaContract.json OK
createContractViaContractOOGInitCode.json Skip
createContractViaTransactionCost53000.json Skip
+ createContractViaTransactionCost53000.json OK
```
OK: 3/5 Fail: 0/5 Skip: 2/5
OK: 4/5 Fail: 0/5 Skip: 1/5
## stInitCodeTest
```diff
+ CallContractToCreateContractAndCallItOOG.json OK
Expand All @@ -527,12 +527,12 @@ OK: 3/5 Fail: 0/5 Skip: 2/5
+ ReturnTest.json OK
+ ReturnTest2.json OK
+ StackUnderFlowContractCreation.json OK
TransactionCreateAutoSuicideContract.json Skip
+ TransactionCreateAutoSuicideContract.json OK
+ TransactionCreateRandomInitCode.json OK
+ TransactionCreateStopInInitcode.json OK
+ TransactionCreateSuicideInInitcode.json OK
```
OK: 10/18 Fail: 0/18 Skip: 8/18
OK: 11/18 Fail: 0/18 Skip: 7/18
## stLogTests
```diff
+ log0_emptyMem.json OK
Expand Down Expand Up @@ -1510,12 +1510,12 @@ OK: 315/327 Fail: 0/327 Skip: 12/327
+ randomStatetest641.json OK
+ randomStatetest642.json OK
randomStatetest643.json Skip
randomStatetest644.json Skip
randomStatetest645.json Skip
+ randomStatetest644.json OK
+ randomStatetest645.json OK
randomStatetest646.json Skip
randomStatetest647.json Skip
```
OK: 219/227 Fail: 0/227 Skip: 8/227
OK: 221/227 Fail: 0/227 Skip: 6/227
## stRecursiveCreate
```diff
recursiveCreate.json Skip
Expand Down Expand Up @@ -2093,8 +2093,8 @@ OK: 51/67 Fail: 0/67 Skip: 16/67
+ CreateTransactionReverted.json OK
+ CreateTransactionSuccess.json OK
+ EmptyTransaction.json OK
EmptyTransaction2.json Skip
EmptyTransaction3.json Skip
+ EmptyTransaction2.json OK
+ EmptyTransaction3.json OK
+ HighGasLimit.json OK
+ InternalCallHittingGasLimit.json OK
+ InternalCallHittingGasLimit2.json OK
Expand Down Expand Up @@ -2122,7 +2122,7 @@ OK: 51/67 Fail: 0/67 Skip: 16/67
+ TransactionFromCoinbaseNotEnoughFounds.json OK
+ TransactionNonceCheck.json OK
+ TransactionNonceCheck2.json OK
TransactionSendingToEmpty.json Skip
+ TransactionSendingToEmpty.json OK
+ TransactionSendingToZero.json OK
+ TransactionToAddressh160minusOne.json OK
+ TransactionToItself.json OK
Expand All @@ -2131,7 +2131,7 @@ OK: 51/67 Fail: 0/67 Skip: 16/67
+ UserTransactionZeroCost.json OK
+ UserTransactionZeroCostWithData.json OK
```
OK: 38/44 Fail: 0/44 Skip: 6/44
OK: 41/44 Fail: 0/44 Skip: 3/44
## stTransitionTest
```diff
+ createNameRegistratorPerTxsAfter.json OK
Expand Down Expand Up @@ -2520,4 +2520,4 @@ OK: 0/133 Fail: 0/133 Skip: 133/133
OK: 0/130 Fail: 0/130 Skip: 130/130

---TOTAL---
OK: 1170/2334 Fail: 0/2334 Skip: 1164/2334
OK: 1179/2334 Fail: 0/2334 Skip: 1155/2334
9 changes: 0 additions & 9 deletions tests/test_generalstate_failing.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"callcodecallcode_11.json",
"callcodecallcodecall_110.json",
"callcodecallcodecallcode_111.json",
"CREATE_ContractSuicideDuringInit_ThenStoreThenReturn.json",
"CREATE_ContractSuicideDuringInit_WithValue.json",
"CREATE_EContractCreateEContractInInit_Tr.json",
"CREATE_EContract_ThenCALLToNonExistentAcc.json",
"CREATE_EmptyContract.json",
Expand Down Expand Up @@ -59,15 +57,13 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"RawCreateGasMemory.json",
"RawCreateGasValueTransferMemory.json",
"createContractViaContractOOGInitCode.json",
"createContractViaTransactionCost53000.json",
"CallContractToCreateContractNoCash.json",
"CallContractToCreateContractOOG.json",
"CallContractToCreateContractWhichWouldCreateContractIfCalled.json",
"CallContractToCreateContractWhichWouldCreateContractInInitCode.json",
"CallTheContractToCreateEmptyContract.json",
"OutOfGasContractCreation.json",
"OutOfGasPrefundedContractCreation.json",
"TransactionCreateAutoSuicideContract.json",
"callDataCopyOffset.json",
"codeCopyOffset.json",
"CALLCODEEcrecover0_0input.json",
Expand Down Expand Up @@ -103,8 +99,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"randomStatetest85.json",
#"randomStatetest579.json",
"randomStatetest643.json",
"randomStatetest644.json",
"randomStatetest645.json",
"randomStatetest646.json",
"randomStatetest248.json",
"RevertOpcodeCalls.json",
Expand All @@ -121,12 +115,9 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"CreateHashCollision.json",
"suicideCoinbase.json",
"testRandomTest.json",
"EmptyTransaction2.json",
"EmptyTransaction3.json",
"Opcodes_TransactionInit.json",
"SuicidesMixingCoinbase.json",
"TransactionFromCoinbaseHittingBlockGasLimit1.json",
"TransactionSendingToEmpty.json",
"createNameRegistratorPerTxsNotEnoughGasAfter.json",
"createNameRegistratorPerTxsNotEnoughGasAt.json",
"createNameRegistratorPerTxsNotEnoughGasBefore.json",
Expand Down
5 changes: 0 additions & 5 deletions tests/test_generalstate_json.nim
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ proc testFixtureIndexes(prevStateRoot: Hash256, header: BlockHeader, pre: JsonNo

if tx.isContractCreation and tx.payload.len > 0:
vmState.mutateStateDB:
# TODO: move into applyCreateTransaction
# fixtures/GeneralStateTests/stTransactionTest/TransactionSendingToZero.json
# fixtures/GeneralStateTests/stTransactionTest/TransactionSendingToEmpty.json
#db.addBalance(generateAddress(sender, transaction.accountNonce), transaction.value)

let createGasUsed = applyCreateTransaction(tx, vmState, sender, some(fork))
db.addBalance(header.coinbase, createGasUsed.u256 * tx.gasPrice.u256)
return
Expand Down