From dfa87f662d382bad072284d06e0a47a53a2018ab Mon Sep 17 00:00:00 2001 From: Louise Poole Date: Wed, 25 Jun 2025 17:52:49 +0200 Subject: [PATCH] fix(balancer_v2): skip adding zero address rate_provider entrypoints (#224) --- substreams/Cargo.lock | 36 +++++++++++++------ substreams/ethereum-balancer-v2/Cargo.toml | 4 +-- .../ethereum-balancer-v2/src/modules.rs | 6 ++++ .../ethereum-balancer-v2/substreams.yaml | 2 +- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/substreams/Cargo.lock b/substreams/Cargo.lock index 46c4b84..444a962 100644 --- a/substreams/Cargo.lock +++ b/substreams/Cargo.lock @@ -235,12 +235,12 @@ dependencies = [ "substreams", "substreams-ethereum", "tiny-keccak", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] name = "ethereum-balancer-v2" -version = "0.3.1" +version = "0.3.2" dependencies = [ "anyhow", "ethabi 18.0.0", @@ -250,7 +250,7 @@ dependencies = [ "num-bigint", "substreams", "substreams-ethereum", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=51995f9)", + "tycho-substreams 0.2.2", ] [[package]] @@ -271,7 +271,7 @@ dependencies = [ "serde_qs", "substreams", "substreams-ethereum", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] @@ -308,7 +308,7 @@ dependencies = [ "substreams", "substreams-ethereum", "substreams-helper 0.0.2 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] @@ -348,7 +348,7 @@ dependencies = [ "regex", "substreams", "substreams-ethereum", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] @@ -368,7 +368,7 @@ dependencies = [ "regex", "substreams", "substreams-ethereum", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] @@ -385,7 +385,7 @@ dependencies = [ "serde-sibor", "substreams", "substreams-ethereum", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] @@ -403,7 +403,7 @@ dependencies = [ "serde_qs", "substreams", "substreams-ethereum", - "tycho-substreams 0.2.1 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021)", + "tycho-substreams 0.2.1", ] [[package]] @@ -1669,7 +1669,23 @@ dependencies = [ [[package]] name = "tycho-substreams" version = "0.2.1" -source = "git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=51995f9#51995f9731ecf549a5ae68c281906c90efe9909a" +source = "git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=52d5021#52d502198e9aa964814ef5f139df0886c3eb7bb0" +dependencies = [ + "ethabi 18.0.0", + "hex", + "itertools 0.12.1", + "num-bigint", + "prost 0.11.9", + "serde", + "serde_json", + "substreams", + "substreams-ethereum", +] + +[[package]] +name = "tycho-substreams" +version = "0.2.2" +source = "git+https://github.com/propeller-heads/tycho-protocol-sdk.git?tag=0.4.0#cfbf6812bdc9503ff51debcf5e171cd680b4d694" dependencies = [ "ethabi 18.0.0", "hex", diff --git a/substreams/ethereum-balancer-v2/Cargo.toml b/substreams/ethereum-balancer-v2/Cargo.toml index 938b5df..1a6b97d 100644 --- a/substreams/ethereum-balancer-v2/Cargo.toml +++ b/substreams/ethereum-balancer-v2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethereum-balancer-v2" -version = "0.3.1" +version = "0.3.2" edition = "2021" [lib] @@ -15,7 +15,7 @@ hex = "0.4.3" anyhow = "1.0.75" num-bigint = "0.4.4" itertools = "0.12.0" -tycho-substreams = { git = "https://github.com/propeller-heads/tycho-protocol-sdk.git", rev = "51995f9" } +tycho-substreams = { git = "https://github.com/propeller-heads/tycho-protocol-sdk.git", tag = "0.4.0" } [build-dependencies] anyhow = "1" diff --git a/substreams/ethereum-balancer-v2/src/modules.rs b/substreams/ethereum-balancer-v2/src/modules.rs index 760b4a8..13875a1 100644 --- a/substreams/ethereum-balancer-v2/src/modules.rs +++ b/substreams/ethereum-balancer-v2/src/modules.rs @@ -15,6 +15,7 @@ use tycho_substreams::{ }; pub const VAULT_ADDRESS: &[u8] = &hex!("BA12222222228d8Ba445958a75a0704d566BF2C8"); +pub const ZERO_ADDRESS: &[u8] = &[0u8; 20]; #[substreams::handlers::map] pub fn map_components(block: eth::v2::Block) -> Result { @@ -214,6 +215,11 @@ pub fn map_protocol_changes( if let Some(rate_providers) = rate_providers { for rate_provider in rate_providers { + if rate_provider == ZERO_ADDRESS { + // Skipped: is not a rate provider + continue; + } + let trace_data = TraceData::Rpc(RpcTraceData { caller: None, calldata: hex::decode("679aefce").unwrap(), // getRate() diff --git a/substreams/ethereum-balancer-v2/substreams.yaml b/substreams/ethereum-balancer-v2/substreams.yaml index 24c3432..e889b3c 100644 --- a/substreams/ethereum-balancer-v2/substreams.yaml +++ b/substreams/ethereum-balancer-v2/substreams.yaml @@ -1,7 +1,7 @@ specVersion: v0.1.0 package: name: "ethereum_balancer_v2" - version: v0.3.1 + version: v0.3.2 url: "https://github.com/propeller-heads/tycho-protocol-sdk/tree/main/substreams/ethereum-balancer-v2" protobuf: