Skip to content

Commit 91a4b2d

Browse files
authored
fix(verification): BSC chain id is incorrect, verification fails with missing or unsupported chainid parameter (#11716)
* bump to alloy-chains 0.2.10 * mumbai -> amoy, deprecated * clippy fix
1 parent e64d9ed commit 91a4b2d

File tree

9 files changed

+86
-81
lines changed

9 files changed

+86
-81
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/src/opts/chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl TypedValueParser for ChainValueParser {
3333
Ok(Chain::from_id(id))
3434
} else {
3535
// NamedChain::VARIANTS is a subset of all possible variants, since there are aliases:
36-
// mumbai instead of polygon-mumbai etc
36+
// amoy instead of polygon-amoy etc
3737
//
3838
// Parse first as NamedChain, if it fails parse with NamedChain::VARIANTS for displaying
3939
// the error to the user

crates/cli/src/utils/cmd.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ pub fn has_different_gas_calc(chain_id: u64) -> bool {
178178
| NamedChain::KaruraTestnet
179179
| NamedChain::Mantle
180180
| NamedChain::MantleSepolia
181-
| NamedChain::MantleTestnet
182181
| NamedChain::Moonbase
183182
| NamedChain::Moonbeam
184183
| NamedChain::MoonbeamDev

crates/config/src/cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ mod tests {
281281
block_explorer: 4230000,
282282
},
283283
ChainCache {
284-
name: "mumbai".to_string(),
284+
name: "amoy".to_string(),
285285
blocks: vec![("1".to_string(), 1), ("2".to_string(), 2)],
286286
block_explorer: 0,
287287
},
@@ -301,7 +301,7 @@ mod tests {
301301
- Block Explorer (4.2 MB)\n\n\t\
302302
- Block 1 (1.0 kB)\n\t\
303303
- Block 2 (2.0 MB)\n\
304-
- mumbai (3.0 B)\n\t\
304+
- amoy (3.0 B)\n\t\
305305
- Block Explorer (0.0 B)\n\n\t\
306306
- Block 1 (1.0 B)\n\t\
307307
- Block 2 (2.0 B)\n";

crates/config/src/lib.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,19 +3288,19 @@ mod tests {
32883288
r#"
32893289
[profile.default]
32903290
[rpc_endpoints]
3291-
polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/${_RESOLVE_RPC_ALIAS}"
3291+
polygonAmoy = "https://polygon-amoy.g.alchemy.com/v2/${_RESOLVE_RPC_ALIAS}"
32923292
"#,
32933293
)?;
32943294
let mut config = Config::load().unwrap();
3295-
config.eth_rpc_url = Some("polygonMumbai".to_string());
3295+
config.eth_rpc_url = Some("polygonAmoy".to_string());
32963296
assert!(config.get_rpc_url().unwrap().is_err());
32973297

32983298
jail.set_env("_RESOLVE_RPC_ALIAS", "123455");
32993299

33003300
let mut config = Config::load().unwrap();
3301-
config.eth_rpc_url = Some("polygonMumbai".to_string());
3301+
config.eth_rpc_url = Some("polygonAmoy".to_string());
33023302
assert_eq!(
3303-
"https://polygon-mumbai.g.alchemy.com/v2/123455",
3303+
"https://polygon-amoy.g.alchemy.com/v2/123455",
33043304
config.get_rpc_url().unwrap().unwrap()
33053305
);
33063306

@@ -3550,7 +3550,7 @@ mod tests {
35503550
35513551
[etherscan]
35523552
optimism = { key = "https://etherscan-optimism.com/" }
3553-
mumbai = { key = "https://etherscan-mumbai.com/" }
3553+
amoy = { key = "https://etherscan-amoy.com/" }
35543554
"#,
35553555
)?;
35563556

@@ -3559,10 +3559,10 @@ mod tests {
35593559
let optimism = config.get_etherscan_api_key(Some(NamedChain::Optimism.into()));
35603560
assert_eq!(optimism, Some("https://etherscan-optimism.com/".to_string()));
35613561

3562-
config.etherscan_api_key = Some("mumbai".to_string());
3562+
config.etherscan_api_key = Some("amoy".to_string());
35633563

3564-
let mumbai = config.get_etherscan_api_key(Some(NamedChain::PolygonMumbai.into()));
3565-
assert_eq!(mumbai, Some("https://etherscan-mumbai.com/".to_string()));
3564+
let amoy = config.get_etherscan_api_key(Some(NamedChain::PolygonAmoy.into()));
3565+
assert_eq!(amoy, Some("https://etherscan-amoy.com/".to_string()));
35663566

35673567
Ok(())
35683568
});
@@ -3577,17 +3577,17 @@ mod tests {
35773577
[profile.default]
35783578
35793579
[etherscan]
3580-
mumbai = { key = "https://etherscan-mumbai.com/", chain = 80001 }
3580+
amoy = { key = "https://etherscan-amoy.com/", chain = 80002 }
35813581
"#,
35823582
)?;
35833583

35843584
let config = Config::load().unwrap();
35853585

3586-
let mumbai = config
3587-
.get_etherscan_config_with_chain(Some(NamedChain::PolygonMumbai.into()))
3586+
let amoy = config
3587+
.get_etherscan_config_with_chain(Some(NamedChain::PolygonAmoy.into()))
35883588
.unwrap()
35893589
.unwrap();
3590-
assert_eq!(mumbai.key, "https://etherscan-mumbai.com/".to_string());
3590+
assert_eq!(amoy.key, "https://etherscan-amoy.com/".to_string());
35913591

35923592
Ok(())
35933593
});
@@ -3602,18 +3602,18 @@ mod tests {
36023602
[profile.default]
36033603
36043604
[etherscan]
3605-
mumbai = { key = "https://etherscan-mumbai.com/", chain = 80001 , url = "https://verifier-url.com/"}
3605+
amoy = { key = "https://etherscan-amoy.com/", chain = 80002 , url = "https://verifier-url.com/"}
36063606
"#,
36073607
)?;
36083608

36093609
let config = Config::load().unwrap();
36103610

3611-
let mumbai = config
3612-
.get_etherscan_config_with_chain(Some(NamedChain::PolygonMumbai.into()))
3611+
let amoy = config
3612+
.get_etherscan_config_with_chain(Some(NamedChain::PolygonAmoy.into()))
36133613
.unwrap()
36143614
.unwrap();
3615-
assert_eq!(mumbai.key, "https://etherscan-mumbai.com/".to_string());
3616-
assert_eq!(mumbai.api_url, "https://verifier-url.com/".to_string());
3615+
assert_eq!(amoy.key, "https://etherscan-amoy.com/".to_string());
3616+
assert_eq!(amoy.api_url, "https://verifier-url.com/".to_string());
36173617

36183618
Ok(())
36193619
});
@@ -3626,23 +3626,23 @@ mod tests {
36263626
"foundry.toml",
36273627
r#"
36283628
[profile.default]
3629-
eth_rpc_url = "mumbai"
3629+
eth_rpc_url = "amoy"
36303630
36313631
[etherscan]
3632-
mumbai = { key = "https://etherscan-mumbai.com/" }
3632+
amoy = { key = "https://etherscan-amoy.com/" }
36333633
36343634
[rpc_endpoints]
3635-
mumbai = "https://polygon-mumbai.g.alchemy.com/v2/mumbai"
3635+
amoy = "https://polygon-amoy.g.alchemy.com/v2/amoy"
36363636
"#,
36373637
)?;
36383638

36393639
let config = Config::load().unwrap();
36403640

3641-
let mumbai = config.get_etherscan_config_with_chain(None).unwrap().unwrap();
3642-
assert_eq!(mumbai.key, "https://etherscan-mumbai.com/".to_string());
3641+
let amoy = config.get_etherscan_config_with_chain(None).unwrap().unwrap();
3642+
assert_eq!(amoy.key, "https://etherscan-amoy.com/".to_string());
36433643

3644-
let mumbai_rpc = config.get_rpc_url().unwrap().unwrap();
3645-
assert_eq!(mumbai_rpc, "https://polygon-mumbai.g.alchemy.com/v2/mumbai");
3644+
let amoy_rpc = config.get_rpc_url().unwrap().unwrap();
3645+
assert_eq!(amoy_rpc, "https://polygon-amoy.g.alchemy.com/v2/amoy");
36463646
Ok(())
36473647
});
36483648
}

crates/forge/tests/cli/create.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ forgetest!(can_create_oracle_on_goerli, |prj, cmd| {
120120
create_on_chain(EnvExternalities::goerli(), prj, cmd, setup_oracle);
121121
});
122122

123-
// tests `forge` create on mumbai if correct env vars are set
124-
forgetest!(can_create_oracle_on_mumbai, |prj, cmd| {
125-
create_on_chain(EnvExternalities::mumbai(), prj, cmd, setup_oracle);
123+
// tests `forge` create on amoy if correct env vars are set
124+
forgetest!(can_create_oracle_on_amoy, |prj, cmd| {
125+
create_on_chain(EnvExternalities::amoy(), prj, cmd, setup_oracle);
126126
});
127127

128128
// tests that we can deploy the template contract

crates/forge/tests/cli/utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ impl EnvExternalities {
8989
})
9090
}
9191

92-
pub fn mumbai() -> Option<Self> {
92+
pub fn amoy() -> Option<Self> {
9393
Some(Self {
94-
chain: NamedChain::PolygonMumbai,
95-
rpc: network_rpc_key("mumbai")?,
96-
pk: network_private_key("mumbai")?,
97-
etherscan: etherscan_key(NamedChain::PolygonMumbai)?,
94+
chain: NamedChain::PolygonAmoy,
95+
rpc: network_rpc_key("amoy")?,
96+
pk: network_private_key("amoy")?,
97+
etherscan: etherscan_key(NamedChain::PolygonAmoy)?,
9898
verifier: "etherscan".to_string(),
9999
})
100100
}

0 commit comments

Comments
 (0)