Skip to content

Commit

Permalink
chore(cketh/ckerc20): Replace rpc.sepolia.org by Ankr (#3523)
Browse files Browse the repository at this point in the history
([XC-272](https://dfinity.atlassian.net/browse/XC-272)) Replace
rpc.sepolia.org by Ankr

Remove the rpc.sepolia.org RPC Sepolia provider, and replace it with
Ankr. Ankr was originally removed due to a lack of IPv6 compatibility,
but this seems to have been fixed in the meantime.

[XC-272]:
https://dfinity.atlassian.net/browse/XC-272?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
lpahlavi authored Jan 22, 2025
1 parent 49e2de0 commit 225b046
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
9 changes: 7 additions & 2 deletions rs/ethereum/cketh/minter/src/eth_rpc_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,20 @@ impl EthRpcClient {
}

pub fn from_state(state: &State) -> Self {
use evm_rpc_client::RpcServices as EvmRpcServices;
use evm_rpc_client::{EthSepoliaService, RpcServices as EvmRpcServices};

let mut client = Self::new(state.ethereum_network());
if let Some(evm_rpc_id) = state.evm_rpc_id {
const MIN_ATTACHED_CYCLES: u128 = 500_000_000_000;

let providers = match client.chain {
EthereumNetwork::Mainnet => EvmRpcServices::EthMainnet(None),
EthereumNetwork::Sepolia => EvmRpcServices::EthSepolia(None),
EthereumNetwork::Sepolia => EvmRpcServices::EthSepolia(Some(vec![
EthSepoliaService::BlockPi,
EthSepoliaService::PublicNode,
EthSepoliaService::Alchemy,
EthSepoliaService::Ankr,
])),
};
let min_threshold = match client.chain {
EthereumNetwork::Mainnet => 3_u8,
Expand Down
6 changes: 3 additions & 3 deletions rs/ethereum/cketh/minter/src/eth_rpc_client/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) const SEPOLIA_PROVIDERS: [RpcNodeProvider; 4] = [
RpcNodeProvider::Sepolia(SepoliaProvider::BlockPi),
RpcNodeProvider::Sepolia(SepoliaProvider::PublicNode),
RpcNodeProvider::Sepolia(SepoliaProvider::Alchemy),
RpcNodeProvider::Sepolia(SepoliaProvider::RpcSepolia),
RpcNodeProvider::Sepolia(SepoliaProvider::Ankr),
];

#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
Expand Down Expand Up @@ -64,7 +64,7 @@ pub(crate) enum SepoliaProvider {
PublicNode,
// https://www.alchemy.com/chain-connect/endpoints/rpc-sepolia-sepolia
Alchemy,
RpcSepolia,
Ankr,
}

impl SepoliaProvider {
Expand All @@ -73,7 +73,7 @@ impl SepoliaProvider {
SepoliaProvider::BlockPi => "https://ethereum-sepolia.blockpi.network/v1/rpc/public",
SepoliaProvider::PublicNode => "https://ethereum-sepolia-rpc.publicnode.com",
SepoliaProvider::Alchemy => "https://eth-sepolia.g.alchemy.com/v2/demo",
SepoliaProvider::RpcSepolia => "https://rpc.sepolia.org",
SepoliaProvider::Ankr => "https://rpc.ankr.com/eth_sepolia",
}
}
}
2 changes: 1 addition & 1 deletion rs/ethereum/cketh/minter/src/eth_rpc_client/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod eth_rpc_client {
RpcNodeProvider::Sepolia(SepoliaProvider::BlockPi),
RpcNodeProvider::Sepolia(SepoliaProvider::PublicNode),
RpcNodeProvider::Sepolia(SepoliaProvider::Alchemy),
RpcNodeProvider::Sepolia(SepoliaProvider::RpcSepolia)
RpcNodeProvider::Sepolia(SepoliaProvider::Ankr)
]
);
}
Expand Down
9 changes: 5 additions & 4 deletions rs/ethereum/evm-rpc-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ use serde::de::DeserializeOwned;
use std::fmt::Debug;

pub use evm_rpc_types::{
Block, BlockTag, ConsensusStrategy, EthMainnetService, FeeHistory, FeeHistoryArgs, GetLogsArgs,
GetTransactionCountArgs, Hex, Hex20, Hex256, Hex32, HexByte, HttpOutcallError, JsonRpcError,
LogEntry, MultiRpcResult, Nat256, ProviderError, RpcApi, RpcConfig, RpcError, RpcResult,
RpcService, RpcServices, SendRawTransactionStatus, TransactionReceipt, ValidationError,
Block, BlockTag, ConsensusStrategy, EthMainnetService, EthSepoliaService, FeeHistory,
FeeHistoryArgs, GetLogsArgs, GetTransactionCountArgs, Hex, Hex20, Hex256, Hex32, HexByte,
HttpOutcallError, JsonRpcError, LogEntry, MultiRpcResult, Nat256, ProviderError, RpcApi,
RpcConfig, RpcError, RpcResult, RpcService, RpcServices, SendRawTransactionStatus,
TransactionReceipt, ValidationError,
};

#[async_trait]
Expand Down

0 comments on commit 225b046

Please sign in to comment.