-
Notifications
You must be signed in to change notification settings - Fork 124
fix(levm)!: fix jumpdests for large initcodes #5254
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 1 commit
226f91a
9d129ce
084c8e2
da77868
8c7b633
4d3ef13
4a7156a
6f974b4
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 |
|---|---|---|
|
|
@@ -884,7 +884,7 @@ impl StoreEngine for Store { | |
| } | ||
|
|
||
| for (code_hash, code) in update_batch.code_updates { | ||
| let mut buf = Vec::with_capacity(6 + code.bytecode.len() + 2 * code.jump_targets.len()); | ||
| let mut buf = Vec::with_capacity(6 + code.bytecode.len() + 4 * code.jump_targets.len()); | ||
|
||
| code.bytecode.encode(&mut buf); | ||
| code.jump_targets | ||
| .into_iter() | ||
|
|
@@ -1258,7 +1258,7 @@ impl StoreEngine for Store { | |
|
|
||
| async fn add_account_code(&self, code: Code) -> Result<(), StoreError> { | ||
| let hash_key = code.hash.0.to_vec(); | ||
| let mut buf = Vec::with_capacity(6 + code.bytecode.len() + 2 * code.jump_targets.len()); | ||
| let mut buf = Vec::with_capacity(6 + code.bytecode.len() + 4 * code.jump_targets.len()); | ||
| code.bytecode.encode(&mut buf); | ||
| code.jump_targets | ||
| .into_iter() | ||
|
|
@@ -1306,8 +1306,8 @@ impl StoreEngine for Store { | |
| hash: code_hash, | ||
| bytecode: Bytes::copy_from_slice(bytecode), | ||
| jump_targets: targets | ||
| .chunks_exact(2) | ||
| .map(|c| u16::from_le_bytes([c[0], c[1]])) | ||
| .chunks_exact(4) | ||
| .map(|c| u32::from_le_bytes([c[0], c[1], c[2], c[3]])) | ||
|
||
| .collect(), | ||
| }; | ||
| Ok(Some(code)) | ||
|
|
@@ -1868,7 +1868,7 @@ impl StoreEngine for Store { | |
|
|
||
| for (code_hash, code) in account_codes { | ||
| let key = code_hash.as_bytes().to_vec(); | ||
| let mut buf = Vec::with_capacity(6 + code.bytecode.len() + 2 * code.jump_targets.len()); | ||
| let mut buf = Vec::with_capacity(6 + code.bytecode.len() + 4 * code.jump_targets.len()); | ||
| code.bytecode.encode(&mut buf); | ||
| code.jump_targets | ||
| .into_iter() | ||
|
|
||
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.
Can we add a comment here or anywhere you consider convenient about the reason why we use 32 bits? So nobody changes it to u16 back again
If you want you can link EIP-3860 but it's not necessary
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.
No, it would be a good idea to link to the EIP. Also to the failing EEST test.
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.
When in doubt, overcommenting is better than undercommenting. Don't let school tell you otherwise.
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.
Added comment in da77868