reth_codecs/alloy/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Implements Compact for alloy types.

/// Will make it a pub mod if test-utils is enabled
macro_rules! cond_mod {
    ($($mod_name:ident),*) => {
        $(
            #[cfg(feature = "test-utils")]
            pub mod $mod_name;
            #[cfg(not(feature = "test-utils"))]
            pub(crate) mod $mod_name;
        )*
    };
}

cond_mod!(
    access_list,
    authorization_list,
    genesis_account,
    header,
    log,
    signature,
    transaction,
    trie,
    txkind,
    withdrawal
);

#[cfg(test)]
mod tests {
    use crate::{
        alloy::{
            genesis_account::{GenesisAccount, GenesisAccountRef, StorageEntries, StorageEntry},
            header::{Header, HeaderExt},
            transaction::{
                eip1559::TxEip1559, eip2930::TxEip2930, eip4844::TxEip4844, eip7702::TxEip7702,
                legacy::TxLegacy,
            },
            withdrawal::Withdrawal,
        },
        test_utils::UnusedBits,
        validate_bitflag_backwards_compat,
    };

    #[test]
    fn validate_bitflag_backwards_compat() {
        // In case of failure, refer to the documentation of the
        // [`validate_bitflag_backwards_compat`] macro for detailed instructions on handling
        // it.
        validate_bitflag_backwards_compat!(Header, UnusedBits::Zero);
        validate_bitflag_backwards_compat!(HeaderExt, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(TxEip2930, UnusedBits::Zero);
        validate_bitflag_backwards_compat!(StorageEntries, UnusedBits::Zero);
        validate_bitflag_backwards_compat!(StorageEntry, UnusedBits::Zero);

        validate_bitflag_backwards_compat!(GenesisAccountRef<'_>, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(GenesisAccount, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(TxEip1559, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(TxEip4844, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(TxEip7702, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(TxLegacy, UnusedBits::NotZero);
        validate_bitflag_backwards_compat!(Withdrawal, UnusedBits::NotZero);
    }
}