-
Notifications
You must be signed in to change notification settings - Fork 966
Add essential EIP-7756 tracing fields #2023
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
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 | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -92,6 +92,18 @@ impl Jumps for ExtBytecode { | |||||||||||||||||||||||||||||||||
| .offset_from(self.base.bytecode().as_ptr()) as usize | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| #[inline] | ||||||||||||||||||||||||||||||||||
| fn trace_pc(&self) -> usize { | ||||||||||||||||||||||||||||||||||
| match &self.base { | ||||||||||||||||||||||||||||||||||
| Bytecode::Eof(_) => unsafe { | ||||||||||||||||||||||||||||||||||
| // SAFETY: `instruction_pointer` should be at an offset from the start of the bytecode. | ||||||||||||||||||||||||||||||||||
| // In practice this is always true unless a caller modifies the `instruction_pointer` field manually. | ||||||||||||||||||||||||||||||||||
| self.instruction_pointer | ||||||||||||||||||||||||||||||||||
| .offset_from(self.base.eof().unwrap().raw.as_ptr()) as usize | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| fn pc(&self) -> usize { | |
| // SAFETY: `instruction_pointer` should be at an offset from the start of the bytecode. | |
| // In practice this is always true unless a caller modifies the `instruction_pointer` field manually. | |
| unsafe { | |
| self.instruction_pointer | |
| .offset_from(self.base.bytecode().as_ptr()) as usize | |
| } | |
| } | |
| } |
and bytecode() gives self.base.eof().raw here:
revm/crates/bytecode/src/bytecode.rs
Lines 137 to 143 in be92e1d
| pub fn bytecode(&self) -> &Bytes { | |
| match self { | |
| Self::LegacyAnalyzed(analyzed) => analyzed.bytecode(), | |
| Self::Eof(eof) => &eof.body.code, | |
| Self::Eip7702(code) => code.raw(), | |
| } | |
| } |
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.
Okay my mistake, will see to change the fn pc to become trace_pc it is not used in any other place for 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 was causing the depth field to read incorrectly when this case triggered. Not sure if here was any way to leverage it. Also, EOF only.
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.
Good find! Yeah it is good fix and it is EOF only