Skip to content
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 flaky test when DEBUG logging is enabled #685

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Fix flaky test when DEBUG logging is enabled #685

merged 1 commit into from
Oct 2, 2024

Conversation

Nashtare
Copy link
Collaborator

@Nashtare Nashtare commented Oct 1, 2024

log_kernel_instructions is a no-op in INFO mode (which is almost always used), but ensures (when running in DEBUG / TRACE mode) that the PC doesn't overflow the KERNEL size.
As @0xaatif observed, this would cause the transient storage tests to fail (and only if run in DEBUG or lower AND not isolated (otherwise the actual KERNEL static wouldn't be initialized).

I've renamed the static variable in tests for clarity, and updated the check to retrieve the actual KERNEL code length from the memory instead. The overhead (if non-negligible), doesn't matter because we don't care so much about perfs with lower-level tracing anyway.

closes #664

@Nashtare Nashtare added this to the x Misc. milestone Oct 1, 2024
@Nashtare Nashtare requested a review from 0xaatif October 1, 2024 21:43
@Nashtare Nashtare self-assigned this Oct 1, 2024
@github-actions github-actions bot added the crate: evm_arithmetization Anything related to the evm_arithmetization crate. label Oct 1, 2024
Copy link
Contributor

@0xaatif 0xaatif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I still don't quite understand the bug but I appreciate the quick resolution!

assert!(pc < KERNEL.code.len(), "Kernel PC is out of range: {}", pc);
let kernel_code =
&state.get_generation_state().memory.contexts[0].segments[Segment::Code.unscale()].content;
assert!(pc < kernel_code.len(), "Kernel PC is out of range: {}", pc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nonblocking/education: I'd use assert2::assert! which would print the left and right values in the panic

@Nashtare Nashtare merged commit 6e27870 into develop Oct 2, 2024
20 checks passed
@Nashtare Nashtare deleted the kernel2 branch October 2, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: evm_arithmetization Anything related to the evm_arithmetization crate.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

cargo test --release --package evm_arithmetization fails
3 participants