From cebf6739e261354a8168474c8c11a408077fea8e Mon Sep 17 00:00:00 2001 From: Dakota Brink <779390+codabrink@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:50:07 -0400 Subject: [PATCH] Update how we're matching chains with scw verification (#1131) * update chain matching * spelling --- xmtp_id/src/scw_verifier/chain_urls_default.json | 14 +++++++------- xmtp_id/src/scw_verifier/mod.rs | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/xmtp_id/src/scw_verifier/chain_urls_default.json b/xmtp_id/src/scw_verifier/chain_urls_default.json index 47f07c32b..c3a1edebe 100644 --- a/xmtp_id/src/scw_verifier/chain_urls_default.json +++ b/xmtp_id/src/scw_verifier/chain_urls_default.json @@ -1,9 +1,9 @@ { - "1": "https://eth.llamarpc.com", - "10": "https://rpc.ankr.com/optimism", - "137": "https://polygon.llamarpc.com", - "324": "https://mainnet.era.zksync.io", - "8453": "https://base.llamarpc.com", - "42161": "https://arbitrum.llamarpc.com", - "59144": "https://linea-rpc.publicnode.com" + "eip155:1": "https://eth.llamarpc.com", + "eip155:10": "https://rpc.ankr.com/optimism", + "eip155:137": "https://polygon.llamarpc.com", + "eip155:324": "https://mainnet.era.zksync.io", + "eip155:8453": "https://base.llamarpc.com", + "eip155:42161": "https://arbitrum.llamarpc.com", + "eip155:59144": "https://linea-rpc.publicnode.com" } diff --git a/xmtp_id/src/scw_verifier/mod.rs b/xmtp_id/src/scw_verifier/mod.rs index 002491151..eb7116abc 100644 --- a/xmtp_id/src/scw_verifier/mod.rs +++ b/xmtp_id/src/scw_verifier/mod.rs @@ -117,7 +117,12 @@ impl MultiSmartContractSignatureVerifier { /// Upgrade the default urls to paid/private/alternative urls if the env vars are present. pub fn upgrade(mut self) -> Self { self.verifiers.iter_mut().for_each(|(id, verif)| { - if let Ok(url) = env::var(format!("CHAIN_RPC_{id}")) { + // TODO: coda - update the chain id env var ids to preceeded with "EIP155_" + let eip_id = id + .split(":") + .nth(1) + .expect("All chain ids are preceeded with 'eip155:' for now."); + if let Ok(url) = env::var(format!("CHAIN_RPC_{eip_id}")) { *verif = Box::new(RpcSmartContractWalletVerifier::new(url)); } else { info!("No upgraded chain url for chain {id}, using default.");