Skip to main content

alloy_eip7928/
lib.rs

1//! Block-level access lists for Reth.
2//! [EIP-7928]: <https://eips.ethereum.org/EIPS/eip-7928>
3#![cfg_attr(not(feature = "std"), no_std)]
4
5#[allow(unused_imports)]
6#[macro_use]
7extern crate alloc;
8
9/// Module containing constants used throughout the block access list.
10pub mod constants;
11pub use constants::*;
12
13/// Module for handling storage changes within a block.
14pub mod storage_change;
15pub use storage_change::*;
16
17/// Module for managing storage slots and their changes.
18pub mod slot_changes;
19pub use slot_changes::*;
20
21/// Module for handling balance changes within a block.
22pub mod balance_change;
23pub use balance_change::*;
24
25/// Module for handling nonce changes within a block.
26pub mod nonce_change;
27pub use nonce_change::*;
28
29/// Module for handling code changes within a block.
30pub mod code_change;
31pub use code_change::*;
32
33/// Module for managing account changes within a block.
34pub mod account_changes;
35pub use account_changes::*;
36
37/// Module for managing block access lists.
38pub mod block_access_list;
39pub use block_access_list::*;
40
41/// Serde for quantity types.
42#[cfg(feature = "serde")]
43mod quantity {
44    use alloy_primitives::U64;
45    use serde::{Deserialize, Deserializer, Serialize, Serializer};
46
47    /// Serializes a primitive number as a "quantity" hex string.
48    pub(crate) fn serialize<S>(value: &u64, serializer: S) -> Result<S::Ok, S::Error>
49    where
50        S: Serializer,
51    {
52        U64::from(*value).serialize(serializer)
53    }
54
55    /// Deserializes a primitive number from a "quantity" hex string.
56    pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result<u64, D::Error>
57    where
58        D: Deserializer<'de>,
59    {
60        U64::deserialize(deserializer).map(|value| value.to())
61    }
62}