Skip to content

Commit

Permalink
fix forge verify-contract etherscan cloudflare bug
Browse files Browse the repository at this point in the history
Etherscan verification for non-mainnet chains requires a question
mark at the end of the verifier url in order to prevent a forward slash
from being added to the url which trips a cloudflare rule on requests
from ec2 boxes.

Verification on both Goerli and Sepolia both fails without this
character present.

Hardhat-verify does not add the extra forward slash to the verifier url
and has no issues verifying contracts on etherscan.

Fixes foundry-rs#4865, foundry-rs#5251, foundry-rs#5741
  • Loading branch information
tsite committed Oct 22, 2023
1 parent 619f3c5 commit de2c1fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/forge/bin/cmd/verify/etherscan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ impl EtherscanVerificationProvider {
config: &Config,
) -> Result<Client> {
let etherscan_config = config.get_etherscan_config_with_chain(Some(chain))?;
let etherscan_api_url = etherscan_config.as_ref().map(|c| (c.api_url.clone()+"?"));

let api_url =
verifier_url.or_else(|| etherscan_config.as_ref().map(|c| c.api_url.as_str()));
let api_url = verifier_url.or_else(|| etherscan_api_url.as_deref());
let base_url = etherscan_config
.as_ref()
.and_then(|c| c.browser_url.as_deref())
Expand Down

0 comments on commit de2c1fc

Please sign in to comment.