-
Notifications
You must be signed in to change notification settings - Fork 320
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
EIP-4200 Tests #1103
EIP-4200 Tests #1103
Conversation
whats new? |
ba4553d
to
6de19bf
Compare
48a25a6
to
0831735
Compare
Rebased and moved fillers to |
# Initcode: [Data: contract_code, Code: PUSH1(contract_size) PUSH1(data_offset) PUSH1(0) CODECOPY PUSH1(contract_size) PUSH1(0) RETURN] | ||
- ':label eof1_initcode_deploy_eof1_rjump_jumpdest_pos :raw 0xef000101000c020014006014601660003960146000f3ef000101000d005c000300f3005b600160015500' | ||
# - Negative: | ||
# Deployed code: RJUMP(8) STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP JUMPDEST RJUMP(-11) STOP - ef0001010010005c0008005b6001600155005b5cFFF500 |
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.
To avoid unreachable code this could be
RJUMP(7) JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP JUMPDEST RJUMP(-11)
data: | ||
# Valid EOF deployed code with RJUMP having JUMPDEST as target | ||
# - Positive: | ||
# Deployed code: RJUMP(3) STOP RETURN STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP - ef000101000d005c000300f3005b600160015500 |
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.
To avoid unreachable code this could be something like
RJUMP(3) SSTORE STOP JUMPDEST PUSH1(1) PUSH1(1) RJUMP(-10)
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.
Maybe I would just delete all the tests with JUMPDEST, it is now NOP instruction, not better than any other instruction...
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.
Also I want to remove combinations that test whether it's validated in deployed code.
I think it's enough to try only initcode, doesn't seem worth it to check all tiny details of validation in both.
|
||
# Valid EOF deployed code with RJUMPI having JUMPDEST as target | ||
# - Positive: | ||
# Deployed code: PUSH1(1) RJUMPI(3) STOP RETURN STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP - ef000101000f0060015d000300f3005b600160015500 |
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.
To avoid unreachable code
# Deployed code: PUSH1(1) RJUMPI(3) STOP RETURN STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP - ef000101000f0060015d000300f3005b600160015500 | |
# Deployed code: PUSH1(1) RJUMPI(3) NOP NOP STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP - ef000101000f0060015d00035B5B005b600160015500 |
# Initcode: [Data: contract_code, Code: PUSH1(contract_size) PUSH1(data_offset) PUSH1(0) CODECOPY PUSH1(contract_size) PUSH1(0) RETURN] | ||
- ':label eof1_initcode_deploy_eof1_rjumpi_jumpdest_pos :raw 0xef000101000c020016006016601660003960166000f3ef000101000f0060015d000300f3005b600160015500' | ||
# - Negative: | ||
# Deployed code: RJUMP(8) STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP JUMPDEST PUSH1(1) RJUMPI(-13) STOP - ef0001010012005c0008005b6001600155005b60015dFFF300 |
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.
# Deployed code: RJUMP(8) STOP JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP JUMPDEST PUSH1(1) RJUMPI(-13) STOP - ef0001010012005c0008005b6001600155005b60015dFFF300 | |
# Deployed code: RJUMP(7) JUMPDEST PUSH1(1) PUSH1(1) SSTORE STOP JUMPDEST PUSH1(1) RJUMPI(-13) STOP - ef0001010011005c00075b6001600155005b60015dFFF300 |
a67b32c
to
811bfa4
Compare
For some tests with EOF code in pre-state I used
Also addition in main config file:
|
eb7db8b
to
2d77f2c
Compare
|
||
# Valid EOF initcode with RJUMPV table size 255 | ||
# Initcode (data): ef000101000402000100010300000000000000fe (code to be deployed) | ||
# Initcode: PUSH1(0) RJUMPV(3, 0, -10) NOP NOP STOP PUSH1(20) PUSH1(44) PUSH1(0) CODECOPY PUSH1(20) PUSH1(0) RETURN |
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 looks to me like a copy paste error
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.
yes, thanks
f88667e
to
771bbb0
Compare
771bbb0
to
cd392fd
Compare
74e0a66
to
1ac5aa2
Compare
src/EIPTestsFiller/StateTests/stEOF/stEIP4200/CREATE_EOF1Invalid_FromEOFFiller.yml
Outdated
Show resolved
Hide resolved
src/EIPTestsFiller/StateTests/stEOF/stEIP4200/CREATE_EOF1InvalidFiller.yml
Outdated
Show resolved
Hide resolved
src/EIPTestsFiller/StateTests/stEOF/stEIP4200/CREATE2_EOF1InvalidFiller.yml
Outdated
Show resolved
Hide resolved
src/EIPTestsFiller/StateTests/stEOF/stEIP4200/CreateTransactionInvalidEOF1Filler.yml
Outdated
Show resolved
Hide resolved
d02c59d
to
7980f7e
Compare
I updated the tests to use new validation format, all validation tests are now in this file. This is a better format for EOF code validation since it allows to specify the expected error. |
:label EOF1I4200_0001 :raw 0xef0001010004020001000103000000000000005c | ||
expectException: | ||
"Shanghai" : "EOF_InvalidCode" | ||
">=Cancun" : "EOF_TruncatedImmediate" |
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.
Why is there difference between forks?
All RJUMP-related changes supposedly target the single fork.
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.
Ah it's activated in Cancun, and the error for Shanghai means deploying code starting with 0xEF byte is rejected
7980f7e
to
a4b8913
Compare
Based on Tests vectors: #1093
Tests
Valid
Invalid
Execution
Test RJUMP/RJUMPI/RJUMPV execution.