From 3a0b09cd778327465b5dea58ad0a2d12cecab935 Mon Sep 17 00:00:00 2001 From: "Ian K. Guimaraes" Date: Mon, 11 Nov 2024 16:40:34 -0300 Subject: [PATCH 1/3] feat: add mekong --- crates/core/Cargo.toml | 2 +- crates/core/src/common/chain.rs | 7 +++++++ crates/core/src/interpreter/backend/resolve_block.rs | 4 +++- crates/core/src/interpreter/frontend/productions.pest | 3 ++- eqlup/default-config.json | 6 ++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index ee4c39a..1340888 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" alloy = { version = "0.2", features = ["std", "contract", "provider-http", "network", "rpc-types"] } pest = "2.7.10" pest_derive = "2.6" -tokio = { version = "1", features = ["macros"] } +tokio = { version = "1", features = ["macros", "rt"] } serde = { version = "1" } serde_json = { version = "1" } serde_with = "1.14" diff --git a/crates/core/src/common/chain.rs b/crates/core/src/common/chain.rs index d2db8c6..3bab2f9 100644 --- a/crates/core/src/common/chain.rs +++ b/crates/core/src/common/chain.rs @@ -62,6 +62,9 @@ pub enum Chain { Fantom, Kava, Gnosis, + + // Short-lived Pectra testnet + Mekong, } #[derive(thiserror::Error, Debug)] @@ -137,6 +140,7 @@ impl Chain { Chain::Fantom => "https://fantom.drpc.org", Chain::Kava => "https://evm.kava.io", Chain::Gnosis => "https://gnosis.drpc.org", + Chain::Mekong => "https://rpc.mekong.ethpandaops.io", } } } @@ -174,6 +178,7 @@ impl TryFrom<&str> for Chain { "fantom" => Ok(Chain::Fantom), "kava" => Ok(Chain::Kava), "gnosis" => Ok(Chain::Gnosis), + "mekong" => Ok(Chain::Mekong), _ => Err(ChainError::InvalidChain(chain.to_string())), } } @@ -204,6 +209,7 @@ impl From<&Chain> for u64 { Chain::Fantom => 250, Chain::Kava => 2222, Chain::Gnosis => 100, + Chain::Mekong => 7078815900, } } } @@ -265,6 +271,7 @@ impl fmt::Display for Chain { Chain::Fantom => "fantom", Chain::Kava => "kava", Chain::Gnosis => "gnosis", + Chain::Mekong => "mekong", }; write!(f, "{}", chain_str) } diff --git a/crates/core/src/interpreter/backend/resolve_block.rs b/crates/core/src/interpreter/backend/resolve_block.rs index 811975c..6be876f 100644 --- a/crates/core/src/interpreter/backend/resolve_block.rs +++ b/crates/core/src/interpreter/backend/resolve_block.rs @@ -122,7 +122,9 @@ pub async fn batch_get_blocks( for block_number in block_numbers { let provider = Arc::clone(&provider); let block_future = async move { - get_block(BlockNumberOrTag::Number(block_number), provider, hydrate).await + let block = get_block(BlockNumberOrTag::Number(block_number), provider, hydrate).await; + println!("block: {:#?}", block); + block }; block_futures.push(block_future); } diff --git a/crates/core/src/interpreter/frontend/productions.pest b/crates/core/src/interpreter/frontend/productions.pest index ca33f4a..aea2dff 100644 --- a/crates/core/src/interpreter/frontend/productions.pest +++ b/crates/core/src/interpreter/frontend/productions.pest @@ -272,7 +272,8 @@ chain = { "ronin" | "fantom" | "kava" | - "gnosis" + "gnosis" | + "mekong" } rpc_url = { ("http://" | "https://") ~ (ASCII_ALPHANUMERIC | "." | "-" | ":" | "/")+ } address = { "0x" ~ (ASCII_HEX_DIGIT){40} } diff --git a/eqlup/default-config.json b/eqlup/default-config.json index d9b418e..83e3e66 100644 --- a/eqlup/default-config.json +++ b/eqlup/default-config.json @@ -140,6 +140,12 @@ "rpcs": [ "https://gnosis.drpc.org" ] + }, + "mekong": { + "default": "https://rpc.mekong.ethpandaops.io", + "rpcs": [ + "https://rpc.mekong.ethpandaops.io" + ] } } } From 38aa566fa47485a581d9dea69261a0ef3c1cdf46 Mon Sep 17 00:00:00 2001 From: "Ian K. Guimaraes" Date: Mon, 11 Nov 2024 18:22:10 -0300 Subject: [PATCH 2/3] chore: bump core version --- crates/core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 1340888..5ec8a81 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "eql_core" -version = "0.1.17" +version = "0.1.18" rust-version.workspace = true edition.workspace = true authors.workspace = true From 844d05f6d239735e0501159454b0a2ba1c904a77 Mon Sep 17 00:00:00 2001 From: "Ian K. Guimaraes" Date: Mon, 11 Nov 2024 19:31:17 -0300 Subject: [PATCH 3/3] fix: remove log --- Cargo.lock | 2 +- crates/core/src/interpreter/backend/resolve_block.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index adbf9d1..3163cac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1634,7 +1634,7 @@ dependencies = [ [[package]] name = "eql_core" -version = "0.1.17" +version = "0.1.18" dependencies = [ "alloy", "anyhow", diff --git a/crates/core/src/interpreter/backend/resolve_block.rs b/crates/core/src/interpreter/backend/resolve_block.rs index 6be876f..811975c 100644 --- a/crates/core/src/interpreter/backend/resolve_block.rs +++ b/crates/core/src/interpreter/backend/resolve_block.rs @@ -122,9 +122,7 @@ pub async fn batch_get_blocks( for block_number in block_numbers { let provider = Arc::clone(&provider); let block_future = async move { - let block = get_block(BlockNumberOrTag::Number(block_number), provider, hydrate).await; - println!("block: {:#?}", block); - block + get_block(BlockNumberOrTag::Number(block_number), provider, hydrate).await }; block_futures.push(block_future); }