Skip to content

fix(traces): decode expectRevert payload before revert formatting#13981

Open
ArshLabs wants to merge 1 commit intofoundry-rs:masterfrom
ArshLabs:fix/expectrevert-trace-decode
Open

fix(traces): decode expectRevert payload before revert formatting#13981
ArshLabs wants to merge 1 commit intofoundry-rs:masterfrom
ArshLabs:fix/expectrevert-trace-decode

Conversation

@ArshLabs
Copy link
Copy Markdown

@ArshLabs ArshLabs commented Mar 28, 2026

Motivation

expectRevert trace formatting currently feeds full cheatcode calldata into RevertDecoder, instead of decoding the cheatcode input first and passing only the expected-revert payload. This can produce misleading trace output.

Solution

Decode expectRevert inputs first in CallTraceDecoder::decode_cheatcode_inputs, then pass the decoded expected-revert bytes (bytes or bytes4) into RevertDecoder.

Added local decoder test coverage in the same module for:

  • expectRevert(bytes4)
  • expectRevert(bytes)
  • expectRevert() fallback behavior

Validation performed:

  • cargo +nightly fmt -- --check
  • cargo test -p foundry-evm-traces
  • cargo check --all
  • cargo +nightly clippy -p foundry-evm-traces --all-targets -- -D warnings
  • attempted cargo test --all --all-features (currently fails in this environment at tracy-client-sys, unrelated to touched code)

AI disclosure: I used AI assistance for basic code navigation, then did drafting & manually verified the implementation and test behavior.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant