-
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
fix(traces): Etherscan traces are only resolved for first instance of test run #7675
fix(traces): Etherscan traces are only resolved for first instance of test run #7675
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.
smol suggestion
let resolved = resolved | ||
.into_iter() | ||
.map(|addr| { | ||
let metadata = self.contracts.get(&addr).unwrap(); | ||
let label = metadata.contract_name.clone(); | ||
let abi = metadata.abi().ok().map(Cow::Owned); | ||
|
||
AddressIdentity { | ||
address: addr, | ||
label: Some(label.clone()), | ||
contract: Some(label), | ||
abi, | ||
artifact_id: None, | ||
} | ||
}) | ||
.collect::<Vec<AddressIdentity<'_>>>(); |
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 can be done in the for loop above?
so that we track AddressIdentity
in resolved?
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.
Good point, updated
Motivation
Closes #7558
Currently the resolved Etherscan traces are only applied to the first occurrence of an address due to the resolved addresses not being captured and returned, see:
foundry/crates/evm/traces/src/identifier/etherscan.rs
Lines 114 to 118 in ee47bb0
Solution
Reproducible by running minimal repro: https://github.com/zerosnacks/foundry-repro-7558
Implementation is largely pragmatic, emphasis on minimal changes - open to feedback