Skip to content

Emit handler-level assertion failures in invariant logs#5

Open
aviggiano wants to merge 2 commits intomasterfrom
feat/assertion-failure-emission
Open

Emit handler-level assertion failures in invariant logs#5
aviggiano wants to merge 2 commits intomasterfrom
feat/assertion-failure-emission

Conversation

@aviggiano
Copy link
Copy Markdown
Owner

Summary

  • add a dedicated invariant error key for handler assertion failures (assertion_failure::<handler>)
  • keep invariant failure behavior, but also surface assertion context in test output
  • emit assertion failure in <handler> ... in other_failures during invariant runs
  • improve persisted replay labeling: when a replay sequence only fails due fail-on-assert/fail-on-revert flags, label it as assertion failure in <handler> instead of the invariant name

Why

This gives behavior closer to Medusa semantics: assertion failures are emitted as handler-level failures (for example counter_increment) even without synthetic/noop invariants.

Validation

  • cargo +1.91.0 check -p foundry-evm -p forge
  • local canary run (../foundry/target/debug/forge test --mc CryticToFoundry) now shows:
    • [FAIL: assertion failure in counter_increment ...]
    • plus real invariant failures

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad0dfbfd63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +909 to +910
false,
false,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep revert checks when detecting assertion-only replay failures

This probe calls check_sequence with both fail_on_revert and fail_on_assert forced to false, but check_sequence only treats reverted handler calls as failures when one of those flags is enabled. As a result, when users run with both flags enabled and a persisted sequence fails due to a normal revert (for example a require), the probe reports assert_only_failure=true and the replay gets mislabeled as assertion failure in <handler>. That makes replay diagnostics incorrect for non-assert failures.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant