-
Notifications
You must be signed in to change notification settings - Fork 255
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
Implement EOF #972
base: forks/prague
Are you sure you want to change the base?
Implement EOF #972
Conversation
c5318cc
to
ab31dd7
Compare
ab31dd7
to
f672f5d
Compare
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.
Partial review.
src/ethereum/prague/vm/__init__.py
Outdated
@@ -95,6 +111,7 @@ class Evm: | |||
error: Optional[Exception] | |||
accessed_addresses: Set[Address] | |||
accessed_storage_keys: Set[Tuple[Address, Bytes32]] | |||
eof: EOF |
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 not a descriptive field name. How about:
eof: EOF | |
container_format: Eof |
src/ethereum/prague/vm/eof.py
Outdated
header_end_index: Uint | ||
|
||
|
||
def get_opcode(opcode: int, eof: EOF) -> Ops: |
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.
We should name this more descriptively. Some (bad) ideas:
integer_to_op
parse_op
validate_op
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.
Updated as map_int_to_op
pc: Uint | ||
stack: List[U256] | ||
memory: bytearray | ||
code: Bytes |
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.
Should we create NewType for code vs. container vs. whatever other types of sections there are?
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 am interpreting this as the code being implemented. If it is legacy, then it's just the code. If EOF, it is the code in the section being currently implemented.
src/ethereum/prague/vm/eof.py
Outdated
) | ||
|
||
|
||
def validate_header(container: bytes) -> EOFMetadata: |
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 this separate from meta_from_valid_eof1_container
?
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.
Combined into one function with a flag to validate
src/ethereum/prague/vm/eof.py
Outdated
raise InvalidEOF("Invalid input/output for first section") | ||
|
||
|
||
def get_valid_instructions(code: bytes) -> Set[int]: |
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.
Should have a better name for this. From just the signature, it looks like it returns a uniqued list of all the opcodes used in code
, but I think it returns offsets instead?
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.
Has now been integrated into the validate_code_section
function.
f672f5d
to
47180a1
Compare
47180a1
to
5869072
Compare
This commit updates to the latest test releases and fixes some minor bugs exposed by the increased coverage. In particular, the bugs related to faulty return flag in the type section are fixed. Any code section that has RETF instruction or has a JUMPF to a returning section is considered a returning section. Otherwise, the code section is considered non-returning. The output in the type section should reflect this behaviour. If not, the container is invalid
0dbb07f
to
9c12043
Compare
What was wrong?
The current specs do not support
EOF
Related to Issue #971
How was it fixed?
Implement the 11 EOF EIPs
Cute Animal Picture