Skip to content

Commit

Permalink
feat: Migrate to TrieAccount of alloy-trie (#1750)
Browse files Browse the repository at this point in the history
* feat: Migrate to `TrieAcount` from alloy-trie

* touchups

---------

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
moricho and mattsse authored Dec 4, 2024
1 parent 7095b64 commit 221a1b9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 90 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ alloy-primitives = { version = "0.8.11", default-features = false }
alloy-sol-types = { version = "0.8.11", default-features = false }

alloy-rlp = { version = "0.3.9", default-features = false }
alloy-trie = { version = "0.7.4", default-features = false }
alloy-trie = { version = "0.7.5", default-features = false }

alloy-chains = { version = "0.1.18", default-features = false }

Expand Down
3 changes: 2 additions & 1 deletion crates/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ workspace = true
alloy-eips = { workspace = true, features = ["kzg-sidecar"] }
alloy-primitives = { workspace = true, features = ["rlp"] }
alloy-rlp.workspace = true
alloy-trie.workspace = true
alloy-trie = { workspace = true, features = ["ethereum"] }
alloy-serde = { workspace = true, optional = true }

# k256
Expand Down Expand Up @@ -71,5 +71,6 @@ serde = [
"alloy-primitives/serde",
"dep:alloy-serde",
"alloy-eips/serde",
"alloy-trie/serde",
]
serde-bincode-compat = ["alloy-eips/serde-bincode-compat", "serde_with"]
78 changes: 0 additions & 78 deletions crates/consensus/src/account.rs

This file was deleted.

10 changes: 2 additions & 8 deletions crates/consensus/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Ethereum protocol-related constants
use alloy_primitives::{b256, B256};

pub use alloy_trie::{EMPTY_ROOT_HASH, KECCAK_EMPTY};

/// The first four bytes of the call data for a function call specifies the function to be called.
pub const SELECTOR_LEN: usize = 4;

Expand Down Expand Up @@ -47,18 +49,10 @@ pub const GOERLI_OP_GENESIS: B256 =
pub const GOERLI_BASE_GENESIS: B256 =
b256!("a3ab140f15ea7f7443a4702da64c10314eb04d488e72974e02e2d728096b4f76");

/// Keccak256 over empty array.
pub const KECCAK_EMPTY: B256 =
b256!("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");

/// Ommer root of empty list.
pub const EMPTY_OMMER_ROOT_HASH: B256 =
b256!("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347");

/// Root hash of an empty trie.
pub const EMPTY_ROOT_HASH: B256 =
b256!("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421");

/// Transactions root of empty receipts set.
pub const EMPTY_RECEIPTS: B256 = EMPTY_ROOT_HASH;

Expand Down
6 changes: 4 additions & 2 deletions crates/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

extern crate alloc;

mod account;
pub use account::Account;
pub use alloy_trie::TrieAccount;

#[deprecated(since = "0.7.3", note = "use TrieAccount instead")]
pub use alloy_trie::TrieAccount as Account;

mod block;
pub use block::{Block, BlockBody, BlockHeader, Header};
Expand Down

0 comments on commit 221a1b9

Please sign in to comment.