Skip to content

fix(cli): Correct handling of compilation skipping in trace decoder #10254

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion crates/cast/tests/cli/main.rs
Original file line number Diff line number Diff line change
@@ -2003,7 +2003,16 @@ contract LocalProjectScript is Script {
.stdout_eq(str![[r#"
Executing previous transactions from the block.
Compiling project to generate artifacts
Nothing to compile
Copy link
Collaborator

@grandizzy grandizzy Apr 7, 2025

Choose a reason for hiding this comment

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

Hm, can you share in what conditions do you hit this? The cast call is be done from outside of the project hence Nothing to compile should be the right output (don't see any failures locally or in CI). thanks!

No files changed, compilation skipped
Traces:
[..] → new <unknown>@0x5FbDB2315678afecb367f032d93F642f64180aa3
├─ emit topic 0: 0xa7263295d3a687d750d1fd377b5df47de69d7db8decc745aaa4bbee44dc1688d
│ data: 0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266
└─ ← [Return] 62 bytes of code


Transaction successfully executed.
[GAS]

"#]]);

7 changes: 7 additions & 0 deletions crates/cli/src/utils/cmd.rs
Original file line number Diff line number Diff line change
@@ -339,7 +339,14 @@ pub async fn handle_traces(
let _ = sh_println!("Compiling project to generate artifacts");
let project = config.project()?;
let compiler = ProjectCompiler::new();

// We need to handle the case where compilation is skipped due to no changes
// This is a valid outcome and should not be treated as an error
let output = compiler.compile(&project)?;

// If output.is_unchanged() would be true, the compiler already printed
// "No files changed, compilation skipped" for us

(
Some(ContractsByArtifact::new(
output.artifact_ids().map(|(id, artifact)| (id, artifact.clone().into())),