fixes long standing bug create2nocash

This commit is contained in:
andri lim 2020-01-14 17:17:53 +07:00 committed by zah
parent 2535219830
commit 52fffa6e25
5 changed files with 13 additions and 17 deletions

View File

@ -405,7 +405,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ create2collisionSelfdestructedOOG.json OK + create2collisionSelfdestructedOOG.json OK
+ create2collisionSelfdestructedRevert.json OK + create2collisionSelfdestructedRevert.json OK
+ create2collisionStorage.json OK + create2collisionStorage.json OK
create2noCash.json Skip + create2noCash.json OK
+ returndatacopy_0_0_following_successful_create.json OK + returndatacopy_0_0_following_successful_create.json OK
+ returndatacopy_afterFailing_create.json OK + returndatacopy_afterFailing_create.json OK
+ returndatacopy_following_create.json OK + returndatacopy_following_create.json OK
@ -413,7 +413,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ returndatacopy_following_successful_create.json OK + returndatacopy_following_successful_create.json OK
+ returndatasize_following_successful_create.json OK + returndatasize_following_successful_create.json OK
``` ```
OK: 42/44 Fail: 0/44 Skip: 2/44 OK: 43/44 Fail: 0/44 Skip: 1/44
## stCreateTest ## stCreateTest
```diff ```diff
+ CREATE_AcreateB_BSuicide_BStore.json OK + CREATE_AcreateB_BSuicide_BStore.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: 2344/2447 Fail: 0/2447 Skip: 103/2447

View File

@ -814,7 +814,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ create2collisionSelfdestructedOOG.json OK + create2collisionSelfdestructedOOG.json OK
+ create2collisionSelfdestructedRevert.json OK + create2collisionSelfdestructedRevert.json OK
+ create2collisionStorage.json OK + create2collisionStorage.json OK
create2noCash.json Skip + create2noCash.json OK
+ returndatacopy_0_0_following_successful_create.json OK + returndatacopy_0_0_following_successful_create.json OK
+ returndatacopy_afterFailing_create.json OK + returndatacopy_afterFailing_create.json OK
+ returndatacopy_following_create.json OK + returndatacopy_following_create.json OK
@ -822,7 +822,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ returndatacopy_following_successful_create.json OK + returndatacopy_following_successful_create.json OK
+ returndatasize_following_successful_create.json OK + returndatasize_following_successful_create.json OK
``` ```
OK: 41/44 Fail: 0/44 Skip: 3/44 OK: 42/44 Fail: 0/44 Skip: 2/44
## stCreateTest ## stCreateTest
```diff ```diff
+ CREATE_AcreateB_BSuicide_BStore.json OK + CREATE_AcreateB_BSuicide_BStore.json OK
@ -3028,4 +3028,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: 2620/2730 Fail: 0/2730 Skip: 110/2730 OK: 2621/2730 Fail: 0/2730 Skip: 109/2730

View File

@ -411,7 +411,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ create2collisionSelfdestructedOOG.json OK + create2collisionSelfdestructedOOG.json OK
+ create2collisionSelfdestructedRevert.json OK + create2collisionSelfdestructedRevert.json OK
+ create2collisionStorage.json OK + create2collisionStorage.json OK
create2noCash.json Skip + create2noCash.json OK
+ returndatacopy_0_0_following_successful_create.json OK + returndatacopy_0_0_following_successful_create.json OK
+ returndatacopy_afterFailing_create.json OK + returndatacopy_afterFailing_create.json OK
+ returndatacopy_following_create.json OK + returndatacopy_following_create.json OK
@ -419,7 +419,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ returndatacopy_following_successful_create.json OK + returndatacopy_following_successful_create.json OK
+ returndatasize_following_successful_create.json OK + returndatasize_following_successful_create.json OK
``` ```
OK: 41/44 Fail: 0/44 Skip: 3/44 OK: 42/44 Fail: 0/44 Skip: 2/44
## stCreateTest ## stCreateTest
```diff ```diff
+ CREATE_AcreateB_BSuicide_BStore.json OK + CREATE_AcreateB_BSuicide_BStore.json OK
@ -2625,4 +2625,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: 2303/2411 Fail: 0/2411 Skip: 108/2411 OK: 2304/2411 Fail: 0/2411 Skip: 107/2411

View File

@ -597,6 +597,8 @@ proc setupCreate(c: Computation, memPos, len: int, value: Uint256, opCode: stati
template genCreate(callName: untyped, opCode: Op): untyped = template genCreate(callName: untyped, opCode: Op): untyped =
op callName, inline = false, val, startPosition, size: op callName, inline = false, val, startPosition, size:
## 0xf0, Create a new account with associated code. ## 0xf0, Create a new account with associated code.
checkInStaticContext(c)
let (memPos, len) = (startPosition.safeInt, size.safeInt) let (memPos, len) = (startPosition.safeInt, size.safeInt)
if not c.canTransfer(memPos, len, val, opCode): if not c.canTransfer(memPos, len, val, opCode):
push: 0 push: 0
@ -613,7 +615,6 @@ template genCreate(callName: untyped, opCode: Op): untyped =
else: else:
push: child.msg.contractAddress push: child.msg.contractAddress
checkInStaticContext(c)
child.applyMessage(Create) child.applyMessage(Create)
genCreate(create, Create) genCreate(create, Create)

View File

@ -94,11 +94,7 @@ func allowedFailingGeneralStateTest(folder, name: string): bool =
# conflicts between native int and big int. # conflicts between native int and big int.
# gasFee calculation in modexp precompiled # gasFee calculation in modexp precompiled
# contracts # contracts
"modexp.json", "modexp.json"
# perhaps a design flaw with create/create2 opcode.
# a conflict between balance checker and
# static call context checker
"create2noCash.json",
] ]
result = name in allowedFailingGeneralStateTests result = name in allowedFailingGeneralStateTests
@ -152,7 +148,6 @@ func skipNewBCTests*(folder: string, name: string): bool =
# see allowedFailingGeneralStateTest # see allowedFailingGeneralStateTest
"modexp.json", "modexp.json",
"create2noCash.json",
# BC huge memory consumption # BC huge memory consumption
"randomStatetest94.json", "randomStatetest94.json",