mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: remove #[reth_codec] and #[derive_arbitrary] macros (#10263)
This commit is contained in:
@ -268,7 +268,8 @@ impl BlockWithSenders {
|
||||
/// Sealed Ethereum full block.
|
||||
///
|
||||
/// Withdrawals can be optionally included at the end of the RLP encoded message.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::derive_arbitrary(rlp 32))]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(rlp, 32))]
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
|
||||
@ -14,11 +14,11 @@ use serde::{Deserialize, Serialize};
|
||||
use alloc::{vec, vec::Vec};
|
||||
|
||||
/// Receipt containing result of transaction execution.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec(no_arbitrary, zstd))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests)]
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Default, RlpEncodable, RlpDecodable, Serialize, Deserialize,
|
||||
)]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(CompactZstd))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests)]
|
||||
#[rlp(trailing)]
|
||||
pub struct Receipt {
|
||||
/// Receipt type.
|
||||
@ -142,8 +142,10 @@ impl From<Receipt> for ReceiptWithBloom {
|
||||
}
|
||||
|
||||
/// [`Receipt`] with calculated bloom filter.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct ReceiptWithBloom {
|
||||
/// Bloom filter build from logs.
|
||||
pub bloom: Bloom,
|
||||
|
||||
@ -11,12 +11,11 @@ mod tests {
|
||||
use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
|
||||
use proptest::proptest;
|
||||
use proptest_arbitrary_interop::arb;
|
||||
use reth_codecs::{reth_codec, Compact};
|
||||
use reth_codecs::{add_arbitrary_tests, Compact};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// This type is kept for compatibility tests after the codec support was added to alloy-eips
|
||||
/// AccessList type natively
|
||||
#[reth_codec(rlp)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
@ -28,7 +27,10 @@ mod tests {
|
||||
RlpEncodableWrapper,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Compact,
|
||||
)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[add_arbitrary_tests(compact, rlp)]
|
||||
struct RethAccessList(Vec<RethAccessListItem>);
|
||||
|
||||
impl PartialEq<AccessList> for RethAccessList {
|
||||
@ -38,7 +40,6 @@ mod tests {
|
||||
}
|
||||
|
||||
// This
|
||||
#[reth_codec(rlp)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
@ -50,7 +51,10 @@ mod tests {
|
||||
RlpEncodable,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Compact,
|
||||
)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[add_arbitrary_tests(compact, rlp)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct RethAccessListItem {
|
||||
/// Account address that would be loaded at the start of execution
|
||||
|
||||
@ -11,8 +11,10 @@ use alloc::vec::Vec;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A transaction with a priority fee ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)).
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TxEip1559 {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
pub chain_id: ChainId,
|
||||
|
||||
@ -11,8 +11,10 @@ use alloc::vec::Vec;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Transaction with an [`AccessList`] ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)).
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TxEip2930 {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
pub chain_id: ChainId,
|
||||
|
||||
@ -22,8 +22,10 @@ use serde::{Deserialize, Serialize};
|
||||
/// [EIP-4844 Blob Transaction](https://eips.ethereum.org/EIPS/eip-4844#blob-transaction)
|
||||
///
|
||||
/// A transaction with blob hashes and max blob fee
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TxEip4844 {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
pub chain_id: ChainId,
|
||||
|
||||
@ -15,8 +15,10 @@ use reth_codecs::Compact;
|
||||
/// [EIP-7702 Set Code Transaction](https://eips.ethereum.org/EIPS/eip-7702)
|
||||
///
|
||||
/// Set EOA account code for one transaction
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TxEip7702 {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
pub chain_id: ChainId,
|
||||
|
||||
@ -10,8 +10,10 @@ use alloc::vec::Vec;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Legacy transaction.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TxLegacy {
|
||||
/// Added as EIP-155: Simple replay attack protection
|
||||
pub chain_id: Option<ChainId>,
|
||||
|
||||
@ -86,8 +86,9 @@ pub(crate) static PARALLEL_SENDER_RECOVERY_THRESHOLD: Lazy<usize> =
|
||||
/// A raw transaction.
|
||||
///
|
||||
/// Transaction types were introduced in [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718).
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::derive_arbitrary(compact))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub enum Transaction {
|
||||
/// Legacy transaction (type `0x0`).
|
||||
///
|
||||
@ -810,8 +811,9 @@ impl Encodable for Transaction {
|
||||
/// Signed transaction without its Hash. Used type for inserting into the DB.
|
||||
///
|
||||
/// This can by converted to [`TransactionSigned`] by calling [`TransactionSignedNoHash::hash`].
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::derive_arbitrary(compact))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TransactionSignedNoHash {
|
||||
/// The transaction signature values
|
||||
pub signature: Signature,
|
||||
|
||||
@ -5,12 +5,14 @@ use alloy_rlp::{
|
||||
use bytes::Buf;
|
||||
use core::mem;
|
||||
#[cfg(any(test, feature = "reth-codec"))]
|
||||
use reth_codecs::{reth_codec, Compact};
|
||||
use reth_codecs::Compact;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Deposit transactions, also known as deposits are initiated on L1, and executed on L2.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codec)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), derive(Compact))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct TxDeposit {
|
||||
/// Hash that uniquely identifies the source of the deposit.
|
||||
pub source_hash: B256,
|
||||
|
||||
@ -18,8 +18,9 @@ const SECP256K1N_HALF: U256 = U256::from_be_bytes([
|
||||
/// r, s: Values corresponding to the signature of the
|
||||
/// transaction and used to determine the sender of
|
||||
/// the transaction; formally Tr and Ts. This is expanded in Appendix F of yellow paper.
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::derive_arbitrary(compact))]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub struct Signature {
|
||||
/// The R field of the signature; the point on the curve.
|
||||
pub r: U256,
|
||||
|
||||
@ -38,10 +38,11 @@ pub const DEPOSIT_TX_TYPE_ID: u8 = 126;
|
||||
/// database format.
|
||||
///
|
||||
/// Other required changes when adding a new type can be seen on [PR#3953](https://github.com/paradigmxyz/reth/pull/3953/files).
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::derive_arbitrary(compact))]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Serialize, Deserialize, Hash,
|
||||
)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests(compact))]
|
||||
pub enum TxType {
|
||||
/// Legacy transaction pre EIP-2929
|
||||
#[default]
|
||||
|
||||
Reference in New Issue
Block a user