-
Notifications
You must be signed in to change notification settings - Fork 318
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
Add EIP-3607 tests for Sender not EOA #963
Conversation
Just reading the description, I think this PR might be a bit over-ambitious? Also, to clarify; this change should be retroactive, so could be extended for pre-berlin aswell, but that's not important either. |
Thanks for the feedback, what I had in mind was that perhaps other clients implemented this differently and adding some extra checks just to be safe would be ok, but if everyone is inclined to reduce the number of test cases, that is also ok by me. |
My opinion is that having a few extra tests won't hurt anything, and might save us from an unspecified error in the future. |
Reminder to self: selfdestruct a contract and send a tx from it after |
Added this test case in the latest commit. The test case I ended up writing:
Let me know if this is ok. |
👍 Looks good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think can merge many tests into one and use data as array.
# Transaction originating from account with code | ||
transaction: | ||
data: | ||
- ':raw 0x00' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can define multiple data raws here.
all the transactions would get rejected. I don't think there is a much need to cover every possible init data code.
but because each state test is translated into bc test for each fork here. please limit the amount of tests.
if the pre state is the same you can define it in one file with different data raws.
- '400000' | ||
gasPrice: '10' | ||
nonce: '0' | ||
to: '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 2 cases here is really when transaction has destination.
and the second when it runs creation. (empty to) this are 2 different files
@@ -0,0 +1,80 @@ | |||
# Init into a non-empty account, call from init code | |||
|
|||
initNonEmptyAccount_call: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an interesting case. collision and wrong sender at the same time.
yes a good test case but in blockchain test within one block |
Yes this was created as a blockchain test in src/BlockchainTestsFiller/ValidBlocks/bcStateTests/contractSuicideThenSendFiller.yml Also reduced the number of files as suggested in latest commit, and changed the fork to ">=London" to generate less tests. |
value: !!int -1 | ||
|
||
network: | ||
- '>=London' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok here could be >=Frontier
095e7baea6a6c7c4c2dfeb977efac326af552d87: | ||
balance: '0' | ||
nonce: '0' | ||
code: ':raw 0xdeadbeef' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put something meaningfull like 0x6000600155
value: !!int -1 | ||
|
||
network: | ||
- '>=London' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here >=Frontiner
@@ -0,0 +1,102 @@ | |||
# Account attempts to send tx to create a contract on a non-empty address | |||
|
|||
initNonEmptyAccount: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put here that collision involved
- '>=London' | ||
|
||
result: | ||
6295ee1b4f6dd65047762f924ecd367c17eabf8f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check a94f5374fce5edbc8e2a8697c15331677e6ebf0b nonce
0xfebc70C40FadB14d796F1d499b3f247e12FBbd94: | ||
balance: '10000000000' | ||
nonce: '0' | ||
code: :raw 0x737ae27a42774a1f034ac7edb93d23cb5a662017d5FF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source code???
|
||
# We send back the assets received from the self-destruct opcode | ||
- data: '' | ||
gasLimit: 21000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put more gaslimit as it tend to change to higher number in the future forks
@@ -0,0 +1,92 @@ | |||
# Contract self-destructs and then a private key with colliding address attempts to retrieve value from the account. | |||
|
|||
contractSuicideThenSend: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transaction from selfdestruct
0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0: | ||
balance: '9995800000' | ||
|
||
0xfebc70C40FadB14d796F1d499b3f247e12FBbd94: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check nonce
This PR closes #952 .
The following test cases are included:
All tests are negative test cases and correctly fail.
This PR excludes tests where create and create2 deploy to an existing address since this is already tested by: GeneralStateTests/stCreate2, GeneralStateTests/stCreateTest