-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: Etherscan V2 support #10440
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: Etherscan V2 support #10440
Conversation
…pi version from config
c5592d5
to
735424c
Compare
6337fa1
to
a182e56
Compare
crates/cli/src/opts/rpc.rs
Outdated
env = "ETHERSCAN_API_VERSION" | ||
)] | ||
#[serde(rename = "etherscan_api_version", skip_serializing_if = "Option::is_none")] | ||
pub api_version: Option<String>, |
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.
Since the package is included here if it makes sense to use the struct you would get seralization/deseralization errors.
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, yeah, could also get rid of the newly introduced InvalidApiVersion, requires foundry-rs/block-explorers#85
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.
Simplified in 24782b1
@@ -1324,6 +1324,7 @@ async fn test_fork_execution_reverted() { | |||
|
|||
// <https://github.com/foundry-rs/foundry/issues/8227> | |||
#[tokio::test(flavor = "multi_thread")] | |||
#[ignore] |
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.
unrelated, flaky immutable test
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.
lgtm!
let chain = config.chain.unwrap_or_default(); | ||
let api_version = config.get_etherscan_api_version(Some(chain)); | ||
let api_key = config.get_etherscan_api_key(Some(chain)).unwrap_or_default(); |
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.
it's funny how when you try to unify things you now suddenly need to handle another case -.-
if is_etherscan { | ||
etherscan_config.as_ref().map(|c| c.api_version).unwrap_or_default() | ||
} else { | ||
EtherscanApiVersion::V1 |
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.
I see, this is for non v2 compat verifiers?
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.
yes, they'll default to v1, we can gradually move that to default v2 as they upgrade
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.
lgtm!
Exciting! |
Thank you for your contribution! |
Motivation
Etherscan
provider, default to V2; custom verifier providers use V1foundry.toml
config asor
etherscan_api_version = "v2"
in top level foundry.toml--etherscan-api-version
to forge and cast commands (added for v1 compatibility), defaults to v2Solution
PR Checklist