Repository navigation
feat(zkevm): add schema-id prefix to stateless guest program input bytes #2826
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
Changes from all commits
ffcef22
224df69
0951b85
e1eb780
4d63eb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ | |
| verify_stateless_new_payload, | ||
| ) | ||
| from .stateless_ssz import ( | ||
| STATELESS_INPUT_SCHEMA_ID, | ||
| STATELESS_INPUT_SCHEMA_ID_SIZE, | ||
| SszStatelessInput, | ||
| ssz_to_stateless_input, | ||
| validation_result_to_ssz, | ||
|
|
@@ -25,8 +27,20 @@ def serialize_stateless_output( | |
|
|
||
|
|
||
| def deserialize_stateless_input(data: Bytes) -> StatelessInput: | ||
| """Deserialize a StatelessInput from SSZ bytes.""" | ||
| ssz_obj = SszStatelessInput.decode_bytes(data) | ||
| """Deserialize a StatelessInput from schema-prefixed SSZ bytes.""" | ||
| if len(data) < STATELESS_INPUT_SCHEMA_ID_SIZE: | ||
| raise ValueError("Stateless input is missing schema id") | ||
| schema_id = int.from_bytes( | ||
| data[:STATELESS_INPUT_SCHEMA_ID_SIZE], | ||
| "big", | ||
| ) | ||
| if schema_id != STATELESS_INPUT_SCHEMA_ID: | ||
| raise ValueError( | ||
| f"Unsupported stateless input schema id: 0x{schema_id:04x}" | ||
| ) | ||
|
Comment on lines
+37
to
+40
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the spec, we don't have a single guest program entry point that supports multiple-forks. This is mainly related on how In real EL guest programs which support multiple forks, they will probably have a |
||
| ssz_obj = SszStatelessInput.decode_bytes( | ||
| data[STATELESS_INPUT_SCHEMA_ID_SIZE:] | ||
| ) | ||
| return ssz_to_stateless_input(ssz_obj) | ||
|
|
||
|
|
||
|
|
||
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.
Crux of the PR.