mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 08:37:59 -05:00
chore: more reth-codec cfgs (#9547)
This commit is contained in:
@@ -40,7 +40,7 @@ c-kzg = { workspace = true, features = ["serde"], optional = true }
|
||||
# misc
|
||||
bytes.workspace = true
|
||||
derive_more.workspace = true
|
||||
modular-bitfield.workspace = true
|
||||
modular-bitfield = { workspace = true, optional = true }
|
||||
once_cell.workspace = true
|
||||
rayon.workspace = true
|
||||
serde.workspace = true
|
||||
@@ -73,6 +73,7 @@ serde_json.workspace = true
|
||||
test-fuzz.workspace = true
|
||||
toml.workspace = true
|
||||
triehash = "0.8"
|
||||
modular-bitfield.workspace = true
|
||||
|
||||
sucds = "0.8.1"
|
||||
|
||||
@@ -86,7 +87,8 @@ secp256k1.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["c-kzg", "alloy-compat", "std", "reth-codec"]
|
||||
reth-codec = ["dep:reth-codecs", "dep:zstd"]
|
||||
std = ["thiserror-no-std/std"]
|
||||
reth-codec = ["dep:reth-codecs", "dep:zstd", "dep:modular-bitfield"]
|
||||
asm-keccak = ["alloy-primitives/asm-keccak"]
|
||||
arbitrary = [
|
||||
"reth-primitives-traits/arbitrary",
|
||||
@@ -107,7 +109,6 @@ optimism = [
|
||||
"revm-primitives/optimism",
|
||||
]
|
||||
alloy-compat = ["reth-primitives-traits/alloy-compat", "dep:alloy-rpc-types"]
|
||||
std = ["thiserror-no-std/std"]
|
||||
test-utils = ["reth-primitives-traits/test-utils"]
|
||||
|
||||
[[bench]]
|
||||
|
||||
@@ -9,7 +9,6 @@ use alloy_rlp::{RlpDecodable, RlpEncodable};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
#[cfg(any(test, feature = "arbitrary"))]
|
||||
use proptest::prelude::prop_compose;
|
||||
use reth_codecs::{add_arbitrary_tests, derive_arbitrary};
|
||||
#[cfg(any(test, feature = "arbitrary"))]
|
||||
pub use reth_primitives_traits::test_utils::{generate_valid_header, valid_header_strategy};
|
||||
use reth_primitives_traits::Requests;
|
||||
@@ -31,7 +30,7 @@ prop_compose! {
|
||||
/// Ethereum full block.
|
||||
///
|
||||
/// Withdrawals can be optionally included at the end of the RLP encoded message.
|
||||
#[add_arbitrary_tests(rlp, 25)]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(rlp, 25))]
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize, Deref, RlpEncodable, RlpDecodable,
|
||||
)]
|
||||
@@ -263,7 +262,7 @@ impl BlockWithSenders {
|
||||
/// Sealed Ethereum full block.
|
||||
///
|
||||
/// Withdrawals can be optionally included at the end of the RLP encoded message.
|
||||
#[derive_arbitrary(rlp 32)]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::derive_arbitrary(rlp 32))]
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
@@ -539,7 +538,7 @@ impl SealedBlockWithSenders {
|
||||
/// A response to `GetBlockBodies`, containing bodies if any bodies were found.
|
||||
///
|
||||
/// Withdrawals can be optionally included at the end of the RLP encoded message.
|
||||
#[add_arbitrary_tests(rlp, 10)]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(rlp, 10))]
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize, RlpEncodable, RlpDecodable,
|
||||
)]
|
||||
|
||||
@@ -2,6 +2,8 @@ use super::access_list::AccessList;
|
||||
use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256};
|
||||
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
|
||||
use core::mem;
|
||||
|
||||
#[cfg(any(test, feature = "reth-codec"))]
|
||||
use reth_codecs::Compact;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
|
||||
@@ -2,6 +2,8 @@ use super::access_list::AccessList;
|
||||
use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256};
|
||||
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
|
||||
use core::mem;
|
||||
|
||||
#[cfg(any(test, feature = "reth-codec"))]
|
||||
use reth_codecs::Compact;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
|
||||
@@ -5,7 +5,10 @@ use crate::{
|
||||
};
|
||||
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
|
||||
use core::mem;
|
||||
use reth_codecs::{Compact, CompactPlaceholder};
|
||||
use reth_codecs::Compact;
|
||||
|
||||
/// To be used with `Option<CompactPlaceholder>` to place or replace one bit on the bitflag struct.
|
||||
pub(crate) type CompactPlaceholder = ();
|
||||
|
||||
#[cfg(feature = "c-kzg")]
|
||||
use crate::kzg::KzgSettings;
|
||||
|
||||
@@ -4,15 +4,20 @@ use crate::{
|
||||
};
|
||||
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
|
||||
use core::mem;
|
||||
use reth_codecs::{reth_codec, Compact};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[cfg(any(test, feature = "reth-codec"))]
|
||||
use reth_codecs::Compact;
|
||||
|
||||
/// [EIP-7702 Set Code Transaction](https://eips.ethereum.org/EIPS/eip-7702)
|
||||
///
|
||||
/// Set EOA account code for one transaction
|
||||
#[reth_codec(no_arbitrary, add_arbitrary_tests)]
|
||||
#[cfg_attr(
|
||||
any(test, feature = "reth-codec"),
|
||||
reth_codecs::reth_codec(no_arbitrary, add_arbitrary_tests)
|
||||
)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||
pub struct TxEip7702 {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256};
|
||||
use alloy_rlp::{length_of_length, Encodable, Header};
|
||||
use core::mem;
|
||||
use reth_codecs::{reth_codec, Compact};
|
||||
|
||||
#[cfg(any(test, feature = "reth-codec"))]
|
||||
use reth_codecs::Compact;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
|
||||
/// Legacy transaction.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codec)]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
||||
pub struct TxLegacy {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
|
||||
@@ -10,7 +10,6 @@ use crate::{
|
||||
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header, EMPTY_LIST_CODE};
|
||||
use bytes::Buf;
|
||||
use derive_more::{AsRef, Deref};
|
||||
use reth_codecs::add_arbitrary_tests;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
@@ -18,7 +17,7 @@ use alloc::vec::Vec;
|
||||
|
||||
/// A response to `GetPooledTransactions`. This can include either a blob transaction, or a
|
||||
/// non-4844 signed transaction.
|
||||
#[add_arbitrary_tests]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum PooledTransactionsElement {
|
||||
/// A legacy transaction
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::{transaction::util::secp256k1, Address, B256, U256};
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rlp::{Decodable, Encodable, Error as RlpError};
|
||||
use bytes::Buf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -54,6 +53,7 @@ impl reth_codecs::Compact for Signature {
|
||||
}
|
||||
|
||||
fn from_compact(mut buf: &[u8], identifier: usize) -> (Self, &[u8]) {
|
||||
use bytes::Buf;
|
||||
assert!(buf.len() >= 64);
|
||||
let r = U256::from_le_slice(&buf[0..32]);
|
||||
let s = U256::from_le_slice(&buf[32..64]);
|
||||
|
||||
Reference in New Issue
Block a user