From abf2ef9b215906492dddfad05810bb036f8d3d88 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Sat, 7 Dec 2024 18:30:32 +0100 Subject: [PATCH] some minor cleanup before review --- Cargo.toml | 2 +- packages/ethereum-light-client/Cargo.toml | 2 +- packages/ethereum-light-client/src/client_state.rs | 4 ++-- packages/ethereum-light-client/src/trie.rs | 7 ------- packages/ethereum-light-client/src/types/fork.rs | 2 +- packages/ethereum-light-client/src/types/light_client.rs | 4 +--- packages/ethereum-test-utils/Cargo.toml | 2 -- packages/ethereum-trie-db/Cargo.toml | 4 ---- 8 files changed, 6 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dead7b3e..c979462a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,7 +115,7 @@ rlp = { version = "0.6", default-features = false } rlp-derive = { version = "0.2", default-features = false } primitive-types = { version = "0.13", default-features = false } -# From union (might be removed if they are replaced by something more standard) +# TODO: From union (might be removed if they are replaced by something more standard). #147 typenum = { version = "1.17.0", default-features = false } # dev-dependencies diff --git a/packages/ethereum-light-client/Cargo.toml b/packages/ethereum-light-client/Cargo.toml index bbe4c28e..b20ed697 100644 --- a/packages/ethereum-light-client/Cargo.toml +++ b/packages/ethereum-light-client/Cargo.toml @@ -25,7 +25,7 @@ thiserror = { workspace = true } sha2 = { workspace = true } serde_with = { workspace = true } -# From union (might be removed if they are replaced by something more standard) +# TODO: From union (might be removed if they are replaced by something more standard). #147 typenum = { workspace = true, features = ["const-generics", "no_std"] } [dev-dependencies] diff --git a/packages/ethereum-light-client/src/client_state.rs b/packages/ethereum-light-client/src/client_state.rs index 284640c5..98d8e9f3 100644 --- a/packages/ethereum-light-client/src/client_state.rs +++ b/packages/ethereum-light-client/src/client_state.rs @@ -11,14 +11,14 @@ pub struct ClientState { pub chain_id: u64, #[serde(with = "ethereum_utils::base64::fixed_size")] pub genesis_validators_root: B256, - pub min_sync_committee_participants: u64, // TODO: Needs be added to e2e tests + pub min_sync_committee_participants: u64, // TODO: Needs be added to e2e tests #143 pub genesis_time: u64, pub fork_parameters: ForkParameters, pub seconds_per_slot: u64, pub slots_per_epoch: u64, pub epochs_per_sync_committee_period: u64, pub latest_slot: u64, - // TODO: Should this be frozen_slot? + // TODO: Should this be frozen_slot? Consider this in #143 pub frozen_height: Height, #[serde(with = "ethereum_utils::base64::uint256")] pub ibc_commitment_slot: U256, diff --git a/packages/ethereum-light-client/src/trie.rs b/packages/ethereum-light-client/src/trie.rs index c39c2876..a0d135bb 100644 --- a/packages/ethereum-light-client/src/trie.rs +++ b/packages/ethereum-light-client/src/trie.rs @@ -45,7 +45,6 @@ pub fn validate_merkle_branch( #[cfg(test)] mod test { - use alloy_primitives::{hex::FromHex, Address, Bloom, Bytes, B256, U256}; use crate::{ @@ -127,12 +126,6 @@ mod test { let index = get_subtree_index(EXECUTION_PAYLOAD_INDEX); let root = header.beacon.body_root; - println!("Leaf: {:?}", leaf); - println!("Branch: {:?}", header.execution_branch); - println!("Depth: {:?}", depth); - println!("Index: {:?}", index); - println!("Root: {:?}", root); - validate_merkle_branch(leaf, header.execution_branch.0.into(), depth, index, root).unwrap(); } } diff --git a/packages/ethereum-light-client/src/types/fork.rs b/packages/ethereum-light-client/src/types/fork.rs index 29a8e0e7..f4904743 100644 --- a/packages/ethereum-light-client/src/types/fork.rs +++ b/packages/ethereum-light-client/src/types/fork.rs @@ -5,6 +5,6 @@ use super::wrappers::WrappedVersion; #[derive(Serialize, Deserialize, PartialEq, Clone, Debug, Default)] pub struct Fork { pub version: WrappedVersion, - #[serde(default)] // TODO: REMOVE AND FIX IN E2E + #[serde(default)] // TODO: Remove this when doing e2e integration #143 pub epoch: u64, } diff --git a/packages/ethereum-light-client/src/types/light_client.rs b/packages/ethereum-light-client/src/types/light_client.rs index a3bb3bd9..1fe21d68 100644 --- a/packages/ethereum-light-client/src/types/light_client.rs +++ b/packages/ethereum-light-client/src/types/light_client.rs @@ -39,9 +39,7 @@ pub struct LightClientUpdate { /// Header attested to by the sync committee pub attested_header: LightClientHeader, /// Next sync committee corresponding to `attested_header.state_root` - // NOTE: These fields aren't actually optional, they are just because of the current structure of the ethereum Header. - // TODO: Remove the Option and improve ethereum::header::Header to be an enum, instead of using optional fields and bools. - #[serde(default)] + #[serde(default)] // TODO: Check if this can be removed in #143 pub next_sync_committee: Option, pub next_sync_committee_branch: Option>, /// Finalized header corresponding to `attested_header.state_root` diff --git a/packages/ethereum-test-utils/Cargo.toml b/packages/ethereum-test-utils/Cargo.toml index ffaaa157..c87c9ed6 100644 --- a/packages/ethereum-test-utils/Cargo.toml +++ b/packages/ethereum-test-utils/Cargo.toml @@ -13,5 +13,3 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } milagro_bls = { workspace = true } thiserror = { workspace = true } - - diff --git a/packages/ethereum-trie-db/Cargo.toml b/packages/ethereum-trie-db/Cargo.toml index de778381..fbfae598 100644 --- a/packages/ethereum-trie-db/Cargo.toml +++ b/packages/ethereum-trie-db/Cargo.toml @@ -15,10 +15,6 @@ rlp = { workspace = true, features = ["std"] } rlp-derive = { workspace = true } primitive-types = { workspace = true, features = ["rlp"] } sha3 = { workspace = true } - alloy-primitives = { workspace = true } # Needed for alloy-based interfaces/functions thiserror = { workspace = true } serde = { workspace = true } - - -