Skip to content
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

fix: replace the unavailable goerli testnet part with sepolia and holesky #334

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/src/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ impl CheckpointFallback {
networks::Network::MAINNET,
networks::Network::GOERLI,
networks::Network::SEPOLIA,
networks::Network::HOLESKY,
],
}
}
Expand Down
22 changes: 20 additions & 2 deletions config/tests/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ async fn test_checkpoint_fallback() {

assert_eq!(cf.services.get(&networks::Network::MAINNET), None);
assert_eq!(cf.services.get(&networks::Network::GOERLI), None);
assert_eq!(cf.services.get(&networks::Network::SEPOLIA), None);
assert_eq!(cf.services.get(&networks::Network::HOLESKY), None);

assert_eq!(
cf.networks,
[
networks::Network::MAINNET,
networks::Network::GOERLI,
networks::Network::SEPOLIA
networks::Network::SEPOLIA,
networks::Network::HOLESKY,
]
.to_vec()
);
Expand All @@ -28,6 +31,8 @@ async fn test_construct_checkpoints() {

assert!(cf.services[&networks::Network::MAINNET].len() > 1);
assert!(cf.services[&networks::Network::GOERLI].len() > 1);
assert!(cf.services[&networks::Network::SEPOLIA].len() > 1);
assert!(cf.services[&networks::Network::HOLESKY].len() > 1);
}

#[tokio::test]
Expand All @@ -37,7 +42,12 @@ async fn test_fetch_latest_checkpoints() {
.await
.unwrap();
let checkpoint = cf
.fetch_latest_checkpoint(&networks::Network::GOERLI)
.fetch_latest_checkpoint(&networks::Network::SEPOLIA)
.await
.unwrap();
assert!(checkpoint != H256::zero());
let checkpoint = cf
.fetch_latest_checkpoint(&networks::Network::HOLESKY)
.await
.unwrap();
assert!(checkpoint != H256::zero());
Expand All @@ -58,6 +68,10 @@ async fn test_get_all_fallback_endpoints() {
assert!(!urls.is_empty());
let urls = cf.get_all_fallback_endpoints(&networks::Network::GOERLI);
assert!(!urls.is_empty());
let urls = cf.get_all_fallback_endpoints(&networks::Network::SEPOLIA);
assert!(!urls.is_empty());
let urls = cf.get_all_fallback_endpoints(&networks::Network::HOLESKY);
assert!(!urls.is_empty());
}

#[tokio::test]
Expand All @@ -70,4 +84,8 @@ async fn test_get_healthy_fallback_endpoints() {
assert!(!urls.is_empty());
let urls = cf.get_healthy_fallback_endpoints(&networks::Network::GOERLI);
assert!(!urls.is_empty());
let urls = cf.get_healthy_fallback_endpoints(&networks::Network::SEPOLIA);
assert!(!urls.is_empty());
let urls = cf.get_healthy_fallback_endpoints(&networks::Network::HOLESKY);
assert!(!urls.is_empty());
}
15 changes: 11 additions & 4 deletions examples/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ async fn main() -> Result<()> {
.await
.unwrap();

// Fetch the latest goerli checkpoint
let goerli_checkpoint = cf
.fetch_latest_checkpoint(&networks::Network::GOERLI)
// Fetch the latest sepolia checkpoint
let sepolia_checkpoint = cf
.fetch_latest_checkpoint(&networks::Network::SEPOLIA)
.await
.unwrap();
println!("Fetched latest goerli checkpoint: {goerli_checkpoint}");
println!("Fetched latest goerli checkpoint: {sepolia_checkpoint}");

// Fetch the latest holesky checkpoint
let holesky_checkpoint = cf
.fetch_latest_checkpoint(&networks::Network::SEPOLIA)
.await
.unwrap();
println!("Fetched latest goerli checkpoint: {holesky_checkpoint}");

// Fetch the latest mainnet checkpoint
let mainnet_checkpoint = cf
Expand Down
Loading