Repository navigation
Conversation
The OdraVM panic hook replaced the process-wide hook on every contract call and printed only reverts and assertion failures, so after the first OdraVM call any other panic in the test binary printed nothing, and a user-installed hook was dropped. Install the hook once, keep the previous one and pass every panic that is not an Odra revert to it. Reverts are flagged by the VM right before it panics, so a nested revert is recognized and unrelated panics are not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
Contributor
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The OdraVM panic hook was hiding the output of other panics in the test binary.
unwrap(),expect(),panic!()andtodo!(), in every test thread of the binary, CasperVM and plain unit tests included. You gotFAILEDand an empty output.What changed:
std::sync::Once), keeps the previous hook, and passes every panic that is not an Odra revert to it, assertions included. The standard message, location andRUST_BACKTRACEoutput work again.OdraVm::revertflags the revert (thread-local) right before it panics. Only flagged panics get the compact Odra output. So reverts in nested calls are recognised, and a user's ownpanic!("Revert: …")is not.unwrapin an entry point) now prints the standard panic message. It is still returned asVmError::Panic.Before / after
Each scenario makes one OdraVM contract call first. The output is from
odra-vm/tests/panic_hook.rs.unwrap()onNoneBefore:
After:
assert_eq!(1, 2)Before (custom format, no column, no backtrace support):
After (standard output):
User hook set before the first call (
panic!("boom"))Before:
After:
Contract revert (nested call): unchanged
Tests
odra-vm/tests/panic_hook.rsre-runs the test binary as a child process for each scenario and checks its stderr:unwrap, assertion, user hook, revert and nested revert. Before the fix, theunwrap, assertion and user-hook tests fail. The two revert tests guard the existing output.Test plan
cargo test(workspace)cargo odra testinexamplesandexamples/ourcoincargo clippy --all-targets -- -D warnings --allow unexpected_cfgs(root andexamples)cargo fmt -- --checkNote: #678 also edits
OdraVm::revert, so whichever PR merges second may need a one-line conflict resolved.🤖 Generated with Claude Code