-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix Cycle count in logs for interpreter #77
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nashtare
added
bug
Something isn't working
crate: evm_arithmetization
Anything related to the evm_arithmetization crate.
labels
Mar 2, 2024
Nashtare
commented
Mar 2, 2024
Comment on lines
-451
to
-482
/// Increments the `gas_used` register by a value `n`. | ||
fn incr_gas(&mut self, n: u64) { | ||
self.registers.gas_used += n; | ||
} | ||
|
||
/// Increments the `program_counter` register by a value `n`. | ||
fn incr_pc(&mut self, n: usize) { | ||
self.registers.program_counter += n; | ||
} | ||
|
||
/// Returns a `State`'s registers. | ||
fn get_registers(&self) -> RegistersState { | ||
self.registers | ||
} | ||
|
||
/// Returns a `State`'s mutable registers. | ||
fn get_mut_registers(&mut self) -> &mut RegistersState { | ||
&mut self.registers | ||
} | ||
|
||
/// Returns the value stored at address `address` in a `State`. | ||
fn get_from_memory(&mut self, address: MemoryAddress) -> U256 { | ||
self.memory.get_with_init(address) | ||
} | ||
|
||
/// Returns a mutable `GenerationState` from a `State`. | ||
fn get_generation_state(&self) -> &GenerationState<F> { | ||
self | ||
} | ||
|
||
fn get_mut_generation_state(&mut self) -> &mut GenerationState<F> { | ||
self | ||
} | ||
|
||
/// Returns the value of a `State`'s clock. | ||
fn get_clock(&self) -> usize { | ||
self.traces.clock() | ||
} | ||
|
||
/// Rolls back a `State`. |
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.
All these methods are from the State
trait, so re-documenting here is useless.
LindaGuiga
approved these changes
Mar 4, 2024
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.
LGTM, thank you!
muursh
approved these changes
Mar 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
crate: evm_arithmetization
Anything related to the evm_arithmetization crate.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tiny other fix from #56.
Running CPU simulation outputs the correct total CPU cycles count at the end, but using
Debug
orTrace
levels would display alwaysCycle 0
with currentmain
when going through the execution.The issue was that we were still using
GenerationState
forlog_kernel_instruction
instead of the newState
trait.It also hides the final unpadded length print behind a
#[cfg(not(test))]
flag, as to not get the CI logs too verbose (it's getting spammed currently).