Skip to content

fix: Respect --override-* flags on cast call with --trace flag #10721

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

Merged
merged 7 commits into from
Jun 26, 2025

Conversation

Yen
Copy link
Contributor

@Yen Yen commented Jun 5, 2025

Fixes #10720

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

thank you! I think it makes sense, we'd need some tests for it too.
what do others think re adding such?

@Yen
Copy link
Contributor Author

Yen commented Jun 6, 2025

I have looked at the existing tests for --override and they use the stderr_eq check to ensure the output is expected. If I add additional tests in the case of --trace this output is more complex and I assume it will change more often. Is it ok for the tests to fail when the format of the trace changes in the future, would the expectation be that the tests are updated to reflect this?

@Yen
Copy link
Contributor Author

Yen commented Jun 6, 2025

Ah, actually I did not see the SNAPSHOTS=overwrite functionality which I assume is meant to assist in this case. I will add equivalent tests to the existing --override tests with the --trace flag enabled.

@Yen Yen requested a review from grandizzy June 6, 2025 14:19
@Yen Yen force-pushed the fix/cast-call-trace-overrides branch 2 times, most recently from 007b3e5 to 66a282b Compare June 13, 2025 13:03
@Yen
Copy link
Contributor Author

Yen commented Jun 13, 2025

I have added tests and rebased onto the latest master. Thanks

@grandizzy
Copy link
Collaborator

@Yen cast call accepts now block.time and block.number overrides (as of #10727) mind to add those to work with --trace as well? thank you

@Yen Yen force-pushed the fix/cast-call-trace-overrides branch from 66a282b to 5cde566 Compare June 19, 2025 14:58
@Yen
Copy link
Contributor Author

Yen commented Jun 19, 2025

I have rebased and added the block overrides to work with --trace. The changes were minor. 👍

@Yen
Copy link
Contributor Author

Yen commented Jun 19, 2025

Tests in CI are failing after the rebase but not sure what the reason is as these tests don't use --trace. Can a maintainer confirm these are caused by the changes here as I can't understand what change causes them.

@grandizzy
Copy link
Collaborator

yeah, not related, looks like a contract we use in a test was upgraded and returns different now

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
grandizzy
grandizzy previously approved these changes Jun 20, 2025
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

thank you, makes sense. waiting for one more review before merging, @zerosnacks mind to have a look?

mattsse added 2 commits June 27, 2025 01:04

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
.build(env, db);

// Apply the state overrides.
if let Some(state_overrides) = state_overrides {
Copy link
Member

Choose a reason for hiding this comment

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

making a note here that after the next alloy-evm bump we have utils for this

@mattsse mattsse added the C-cast Command: cast label Jun 26, 2025
@mattsse mattsse merged commit b202bd4 into foundry-rs:master Jun 26, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

bug(cast call): --override-* flags not respected with --trace
3 participants