From 3b822f9ac5473e0fd6a3872b3311498b56bffc06 Mon Sep 17 00:00:00 2001 From: Kyriakos Oikonomakos Date: Tue, 12 Aug 2025 13:56:30 +0300 Subject: [PATCH] Update deposit data with the correct values --- src/validators.rs | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/src/validators.rs b/src/validators.rs index 58e54a7..6845560 100644 --- a/src/validators.rs +++ b/src/validators.rs @@ -9,6 +9,7 @@ use bip39::{Mnemonic, Seed as Bip39Seed}; use eth2_keystore::Keystore; use eth2_wallet::json_wallet::Kdf; use serde::{Deserialize, Serialize}; +use tree_hash::TreeHash; use types::{ ChainSpec, DepositData, Hash256, Keypair, PublicKey, PublicKeyBytes, Signature, SignatureBytes, SignedRoot, @@ -272,40 +273,8 @@ impl Validators { .strip_prefix("0x") .unwrap() .to_string(), - // NOTE: We use network-specific values here because of tree_hash_root compatibility issues - // between different Lighthouse versions. This approach ensures consistent values across - // both versions for deposit verification. The proper long-term solution would be to - // standardize on a single tree hashing implementation. - deposit_message_root: match network_name.as_str() { - "mainnet" => { - if deposit.withdrawal_credentials.as_slice()[0] == 0 { - "9720268f705275b44bf4a7cd35246277f408dd245aafc676a3c335f1d714e724" - .to_string() - } else { - "dc224ac1c94d70906d643644f20398bdea5dabea123116a9d6135b8f5f4906bd" - .to_string() - } - } - "hoodi" => "97a32e1a21bd89ccbe6c4e323e6ecdce540a9c80d607778e559425b1138941dd" - .to_string(), - _ => "c417b18c319742e01914a6210223c9d89ff20bac700eb65c8cd6d0795eb5b95f" - .to_string(), - }, - deposit_data_root: match network_name.as_str() { - "mainnet" => { - if deposit.withdrawal_credentials.as_slice()[0] == 0 { - "270169ee3da4da7566daa4a29727b893bb1c6ce2f26b6c861afe6d480b3f9a7d" - .to_string() - } else { - "f5c6b52d2ba608f0df4123e5ed051b5765a636e09d1372668e1ec074430f2279" - .to_string() - } - } - "hoodi" => "2a25f626e6b017355a866fca99d2d4b2b2dc84fd5eaf8b21b3b5f3e27b68d98d" - .to_string(), - _ => "c417b18c319742e01914a6210223c9d89ff20bac700eb65c8cd6d0795eb5b95f" - .to_string(), - }, + deposit_message_root: hex::encode(deposit.as_deposit_message().tree_hash_root()), + deposit_data_root: hex::encode(deposit.tree_hash_root()), fork_version: hex::encode(chain_spec.genesis_fork_version), network_name: network_name.clone(), deposit_cli_version: deposit_cli_version.clone(),