-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(forge, cast): add cast --with_local_artifacts
/forge selectors cache
to trace with local artifacts
#7359
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supportive, though we can solve this a bit differently
lmk if anything's unclear
2a08d1c
to
4f0ee53
Compare
I updated my code. please check again @mattsse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry this one slipped through,
some nits.
generally supportive, wdyt @DaniPopes @klkvr
how to proceed here @klkvr ? |
crates/cli/src/utils/cmd.rs
Outdated
| NamedChain::ArbitrumTestnet | ||
| NamedChain::ArbitrumGoerli | ||
| NamedChain::ArbitrumSepolia | ||
| NamedChain::Moonbeam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove all the formatting changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for my mistakes, I will fix it
crates/cli/src/utils/cmd.rs
Outdated
let cache_contents = std::fs::read_to_string(path.clone()).unwrap(); | ||
match serde_json::from_str::<CachedSignatures>(&cache_contents) { | ||
Ok(existed_signatures) => cached_signatures = existed_signatures, | ||
Err(e) => { | ||
println!("parse cached local signatures file error: {}", e); | ||
} | ||
} | ||
dbg!(&cached_signatures); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is now duplicated with SignatureIdentifier::new
, can we move this logic to CachedSignatures::load(path)
So this can be broken into 2 separate usecases
|
825579e
to
c575b2d
Compare
…racts functions and events
merge project signatures with exists cached local signatures instead of just override them
For case 1, I believe having helper options in For case 2, I have considered the solution you mentioned. However, the changes involved are quite extensive and a bit difficult for me, which is why I chose the current method. It allows me to get it working quickly. |
thanks @byteshijinn ! I made following changes and updated the PR:
tested locally as:
@klkvr mind to review? thank you! |
cast --with_local_artifacts
/forge selectors cache
to trace with local artifacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, a couple nits
- compile without quiet, fix test - merge local sources with etherscan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last nit
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
… cache` to trace with local artifacts (foundry-rs#7359) * add RunArgs generate_local_signatures to enable trace with local contracts functions and events * make generate_local_signatures as a helper function * rename generate_local_signatures to cache_local_signatures merge project signatures with exists cached local signatures instead of just override them * extract duplicate method for CachedSignatures * fix cache load path * fix for lint * fix fot lint * remove unnecessary `let` binding * fix for format check * fix for clippy check * fix for clippy check * Move cache in forge selectors, use local artifacts for cast run and send traces * Add test * Review changes: - compile without quiet, fix test - merge local sources with etherscan * Update crates/evm/traces/src/debug/sources.rs Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com> --------- Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com> Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com> Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
Motivation
Closes #8949
Closes #8581
Supply a fast way to add all project contracts functions and events to signatures makes them decode correctly.
Solution
This PR introduces such a possibility using a cli argument --generate-local-signatures for cast run.