mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: remove serde support from reth-codec (#9570)
This commit is contained in:
@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
/// An Ethereum account.
|
/// An Ethereum account.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
pub struct Account {
|
pub struct Account {
|
||||||
/// Account nonce.
|
/// Account nonce.
|
||||||
pub nonce: u64,
|
pub nonce: u64,
|
||||||
|
|||||||
@ -18,11 +18,12 @@ use bytes::BufMut;
|
|||||||
use core::mem;
|
use core::mem;
|
||||||
use reth_codecs::{add_arbitrary_tests, reth_codec, Compact};
|
use reth_codecs::{add_arbitrary_tests, reth_codec, Compact};
|
||||||
use revm_primitives::{calc_blob_gasprice, calc_excess_blob_gas};
|
use revm_primitives::{calc_blob_gasprice, calc_excess_blob_gas};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Block header
|
/// Block header
|
||||||
#[reth_codec(no_arbitrary)]
|
#[reth_codec(no_arbitrary)]
|
||||||
#[add_arbitrary_tests(rlp, 25)]
|
#[add_arbitrary_tests(rlp, 25)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub struct Header {
|
pub struct Header {
|
||||||
/// The Keccak 256-bit hash of the parent
|
/// The Keccak 256-bit hash of the parent
|
||||||
/// block’s header, in its entirety; formally Hp.
|
/// block’s header, in its entirety; formally Hp.
|
||||||
|
|||||||
@ -8,12 +8,13 @@ use bytes::BufMut;
|
|||||||
use core::mem;
|
use core::mem;
|
||||||
use derive_more::{AsRef, Deref};
|
use derive_more::{AsRef, Deref};
|
||||||
use reth_codecs::{add_arbitrary_tests, reth_codec, Compact};
|
use reth_codecs::{add_arbitrary_tests, reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// A [`Header`] that is sealed at a precalculated hash, use [`SealedHeader::unseal()`] if you want
|
/// A [`Header`] that is sealed at a precalculated hash, use [`SealedHeader::unseal()`] if you want
|
||||||
/// to modify header.
|
/// to modify header.
|
||||||
#[reth_codec(no_arbitrary)]
|
#[reth_codec(no_arbitrary)]
|
||||||
#[add_arbitrary_tests(rlp, compact)]
|
#[add_arbitrary_tests(rlp, compact)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref, Serialize, Deserialize)]
|
||||||
pub struct SealedHeader {
|
pub struct SealedHeader {
|
||||||
/// Locked Header hash.
|
/// Locked Header hash.
|
||||||
hash: BlockHash,
|
hash: BlockHash,
|
||||||
|
|||||||
@ -20,11 +20,14 @@ mod tests {
|
|||||||
use proptest::proptest;
|
use proptest::proptest;
|
||||||
use proptest_arbitrary_interop::arb;
|
use proptest_arbitrary_interop::arb;
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// This type is kept for compatibility tests after the codec support was added to
|
/// This type is kept for compatibility tests after the codec support was added to
|
||||||
/// alloy-primitives Log type natively
|
/// alloy-primitives Log type natively
|
||||||
#[reth_codec(rlp)]
|
#[reth_codec(rlp)]
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, RlpDecodable, RlpEncodable, Default)]
|
#[derive(
|
||||||
|
Clone, Debug, PartialEq, Eq, RlpDecodable, RlpEncodable, Default, Serialize, Deserialize,
|
||||||
|
)]
|
||||||
struct Log {
|
struct Log {
|
||||||
/// Contract that emitted this log.
|
/// Contract that emitted this log.
|
||||||
address: Address,
|
address: Address,
|
||||||
|
|||||||
@ -6,13 +6,27 @@ use alloy_rlp::{Decodable, Encodable};
|
|||||||
use derive_more::{Deref, DerefMut, From, IntoIterator};
|
use derive_more::{Deref, DerefMut, From, IntoIterator};
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
use revm_primitives::Bytes;
|
use revm_primitives::Bytes;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
/// A list of EIP-7685 requests.
|
/// A list of EIP-7685 requests.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Hash, Deref, DerefMut, From, IntoIterator)]
|
#[derive(
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Default,
|
||||||
|
Hash,
|
||||||
|
Deref,
|
||||||
|
DerefMut,
|
||||||
|
From,
|
||||||
|
IntoIterator,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
pub struct Requests(pub Vec<Request>);
|
pub struct Requests(pub Vec<Request>);
|
||||||
|
|
||||||
impl Encodable for Requests {
|
impl Encodable for Requests {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ use alloc::vec::Vec;
|
|||||||
/// Re-export from `alloy_eips`.
|
/// Re-export from `alloy_eips`.
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use alloy_eips::eip4895::Withdrawal;
|
pub use alloy_eips::eip4895::Withdrawal;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Represents a collection of Withdrawals.
|
/// Represents a collection of Withdrawals.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
@ -27,6 +28,8 @@ pub use alloy_eips::eip4895::Withdrawal;
|
|||||||
IntoIterator,
|
IntoIterator,
|
||||||
RlpEncodableWrapper,
|
RlpEncodableWrapper,
|
||||||
RlpDecodableWrapper,
|
RlpDecodableWrapper,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
)]
|
)]
|
||||||
#[as_ref(forward)]
|
#[as_ref(forward)]
|
||||||
pub struct Withdrawals(Vec<Withdrawal>);
|
pub struct Withdrawals(Vec<Withdrawal>);
|
||||||
@ -93,7 +96,18 @@ mod tests {
|
|||||||
/// This type is kept for compatibility tests after the codec support was added to alloy-eips
|
/// This type is kept for compatibility tests after the codec support was added to alloy-eips
|
||||||
/// Withdrawal type natively
|
/// Withdrawal type natively
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Hash, RlpEncodable, RlpDecodable)]
|
#[derive(
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Default,
|
||||||
|
Hash,
|
||||||
|
RlpEncodable,
|
||||||
|
RlpDecodable,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
struct RethWithdrawal {
|
struct RethWithdrawal {
|
||||||
/// Monotonically increasing identifier issued by consensus layer.
|
/// Monotonically increasing identifier issued by consensus layer.
|
||||||
index: u64,
|
index: u64,
|
||||||
|
|||||||
@ -16,7 +16,9 @@ use alloc::{vec, vec::Vec};
|
|||||||
/// Receipt containing result of transaction execution.
|
/// 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::reth_codec(no_arbitrary, zstd))]
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::add_arbitrary_tests)]
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Default, RlpEncodable, RlpDecodable)]
|
#[derive(
|
||||||
|
Clone, Debug, PartialEq, Eq, Default, RlpEncodable, RlpDecodable, Serialize, Deserialize,
|
||||||
|
)]
|
||||||
#[rlp(trailing)]
|
#[rlp(trailing)]
|
||||||
pub struct Receipt {
|
pub struct Receipt {
|
||||||
/// Receipt type.
|
/// Receipt type.
|
||||||
@ -141,7 +143,7 @@ impl From<Receipt> for ReceiptWithBloom {
|
|||||||
|
|
||||||
/// [`Receipt`] with calculated bloom filter.
|
/// [`Receipt`] with calculated bloom filter.
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
pub struct ReceiptWithBloom {
|
pub struct ReceiptWithBloom {
|
||||||
/// Bloom filter build from logs.
|
/// Bloom filter build from logs.
|
||||||
pub bloom: Bloom,
|
pub bloom: Bloom,
|
||||||
|
|||||||
@ -12,12 +12,22 @@ mod tests {
|
|||||||
use proptest::proptest;
|
use proptest::proptest;
|
||||||
use proptest_arbitrary_interop::arb;
|
use proptest_arbitrary_interop::arb;
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// This type is kept for compatibility tests after the codec support was added to alloy-eips
|
/// This type is kept for compatibility tests after the codec support was added to alloy-eips
|
||||||
/// AccessList type natively
|
/// AccessList type natively
|
||||||
#[reth_codec(rlp)]
|
#[reth_codec(rlp)]
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Debug, PartialEq, Eq, Hash, Default, RlpDecodableWrapper, RlpEncodableWrapper,
|
Clone,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Default,
|
||||||
|
RlpDecodableWrapper,
|
||||||
|
RlpEncodableWrapper,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
)]
|
)]
|
||||||
struct RethAccessList(Vec<RethAccessListItem>);
|
struct RethAccessList(Vec<RethAccessListItem>);
|
||||||
|
|
||||||
@ -29,7 +39,18 @@ mod tests {
|
|||||||
|
|
||||||
// This
|
// This
|
||||||
#[reth_codec(rlp)]
|
#[reth_codec(rlp)]
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Default, RlpDecodable, RlpEncodable)]
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Default,
|
||||||
|
RlpDecodable,
|
||||||
|
RlpEncodable,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct RethAccessListItem {
|
struct RethAccessListItem {
|
||||||
/// Account address that would be loaded at the start of execution
|
/// Account address that would be loaded at the start of execution
|
||||||
|
|||||||
@ -8,10 +8,11 @@ use reth_codecs::Compact;
|
|||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// A transaction with a priority fee ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)).
|
/// 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)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||||
pub struct TxEip1559 {
|
pub struct TxEip1559 {
|
||||||
/// Added as EIP-155: Simple replay attack protection
|
/// Added as EIP-155: Simple replay attack protection
|
||||||
pub chain_id: ChainId,
|
pub chain_id: ChainId,
|
||||||
|
|||||||
@ -8,10 +8,11 @@ use reth_codecs::Compact;
|
|||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Transaction with an [`AccessList`] ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)).
|
/// Transaction with an [`AccessList`] ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)).
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||||
pub struct TxEip2930 {
|
pub struct TxEip2930 {
|
||||||
/// Added as EIP-155: Simple replay attack protection
|
/// Added as EIP-155: Simple replay attack protection
|
||||||
pub chain_id: ChainId,
|
pub chain_id: ChainId,
|
||||||
|
|||||||
@ -15,12 +15,13 @@ use crate::kzg::KzgSettings;
|
|||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// [EIP-4844 Blob Transaction](https://eips.ethereum.org/EIPS/eip-4844#blob-transaction)
|
/// [EIP-4844 Blob Transaction](https://eips.ethereum.org/EIPS/eip-4844#blob-transaction)
|
||||||
///
|
///
|
||||||
/// A transaction with blob hashes and max blob fee
|
/// A transaction with blob hashes and max blob fee
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||||
pub struct TxEip4844 {
|
pub struct TxEip4844 {
|
||||||
/// Added as EIP-155: Simple replay attack protection
|
/// Added as EIP-155: Simple replay attack protection
|
||||||
pub chain_id: ChainId,
|
pub chain_id: ChainId,
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use core::mem;
|
|||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(any(test, feature = "reth-codec"))]
|
#[cfg(any(test, feature = "reth-codec"))]
|
||||||
use reth_codecs::Compact;
|
use reth_codecs::Compact;
|
||||||
@ -15,7 +16,7 @@ use reth_codecs::Compact;
|
|||||||
///
|
///
|
||||||
/// Set EOA account code for one transaction
|
/// Set EOA account code for one transaction
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||||
pub struct TxEip7702 {
|
pub struct TxEip7702 {
|
||||||
/// Added as EIP-155: Simple replay attack protection
|
/// Added as EIP-155: Simple replay attack protection
|
||||||
pub chain_id: ChainId,
|
pub chain_id: ChainId,
|
||||||
|
|||||||
@ -7,10 +7,11 @@ use reth_codecs::Compact;
|
|||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Legacy transaction.
|
/// Legacy transaction.
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codecs::reth_codec)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||||
pub struct TxLegacy {
|
pub struct TxLegacy {
|
||||||
/// Added as EIP-155: Simple replay attack protection
|
/// Added as EIP-155: Simple replay attack protection
|
||||||
pub chain_id: Option<ChainId>,
|
pub chain_id: Option<ChainId>,
|
||||||
|
|||||||
@ -4,11 +4,12 @@ use alloy_rlp::{
|
|||||||
};
|
};
|
||||||
use bytes::Buf;
|
use bytes::Buf;
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
/// Deposit transactions, also known as deposits are initiated on L1, and executed on L2.
|
/// Deposit transactions, also known as deposits are initiated on L1, and executed on L2.
|
||||||
#[cfg_attr(any(test, feature = "reth-codec"), reth_codec)]
|
#[cfg_attr(any(test, feature = "reth-codec"), reth_codec)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||||
pub struct TxDeposit {
|
pub struct TxDeposit {
|
||||||
/// Hash that uniquely identifies the source of the deposit.
|
/// Hash that uniquely identifies the source of the deposit.
|
||||||
pub source_hash: B256,
|
pub source_hash: B256,
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
use crate::PruneMode;
|
use crate::PruneMode;
|
||||||
use alloy_primitives::{BlockNumber, TxNumber};
|
use alloy_primitives::{BlockNumber, TxNumber};
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Saves the pruning progress of a stage.
|
/// Saves the pruning progress of a stage.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Default))]
|
#[cfg_attr(test, derive(Default))]
|
||||||
pub struct PruneCheckpoint {
|
pub struct PruneCheckpoint {
|
||||||
/// Highest pruned block number. If it's [None], the pruning for block `0` is not finished yet.
|
/// Highest pruned block number. If it's [None], the pruning for block `0` is not finished yet.
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
use crate::{segment::PrunePurpose, PruneSegment, PruneSegmentError};
|
use crate::{segment::PrunePurpose, PruneSegment, PruneSegmentError};
|
||||||
use alloy_primitives::BlockNumber;
|
use alloy_primitives::BlockNumber;
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Prune mode.
|
/// Prune mode.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum PruneMode {
|
pub enum PruneMode {
|
||||||
/// Prune all blocks.
|
/// Prune all blocks.
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
use crate::MINIMUM_PRUNING_DISTANCE;
|
use crate::MINIMUM_PRUNING_DISTANCE;
|
||||||
use derive_more::Display;
|
use derive_more::Display;
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
/// Segment of the data that can be pruned.
|
/// Segment of the data that can be pruned.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Display, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
#[derive(
|
||||||
|
Debug, Display, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
|
||||||
|
)]
|
||||||
pub enum PruneSegment {
|
pub enum PruneSegment {
|
||||||
/// Prune segment responsible for the `TransactionSenders` table.
|
/// Prune segment responsible for the `TransactionSenders` table.
|
||||||
SenderRecovery,
|
SenderRecovery,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ use alloy_primitives::{Address, BlockNumber, B256};
|
|||||||
use bytes::Buf;
|
use bytes::Buf;
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
use reth_trie_common::{hash_builder::HashBuilderState, StoredSubNode};
|
use reth_trie_common::{hash_builder::HashBuilderState, StoredSubNode};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use std::ops::RangeInclusive;
|
use std::ops::RangeInclusive;
|
||||||
|
|
||||||
use super::StageId;
|
use super::StageId;
|
||||||
@ -75,7 +76,7 @@ impl Compact for MerkleCheckpoint {
|
|||||||
|
|
||||||
/// Saves the progress of AccountHashing stage.
|
/// Saves the progress of AccountHashing stage.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct AccountHashingCheckpoint {
|
pub struct AccountHashingCheckpoint {
|
||||||
/// The next account to start hashing from.
|
/// The next account to start hashing from.
|
||||||
pub address: Option<Address>,
|
pub address: Option<Address>,
|
||||||
@ -87,7 +88,7 @@ pub struct AccountHashingCheckpoint {
|
|||||||
|
|
||||||
/// Saves the progress of StorageHashing stage.
|
/// Saves the progress of StorageHashing stage.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct StorageHashingCheckpoint {
|
pub struct StorageHashingCheckpoint {
|
||||||
/// The next account to start hashing from.
|
/// The next account to start hashing from.
|
||||||
pub address: Option<Address>,
|
pub address: Option<Address>,
|
||||||
@ -101,7 +102,7 @@ pub struct StorageHashingCheckpoint {
|
|||||||
|
|
||||||
/// Saves the progress of Execution stage.
|
/// Saves the progress of Execution stage.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct ExecutionCheckpoint {
|
pub struct ExecutionCheckpoint {
|
||||||
/// Block range which this checkpoint is valid for.
|
/// Block range which this checkpoint is valid for.
|
||||||
pub block_range: CheckpointBlockRange,
|
pub block_range: CheckpointBlockRange,
|
||||||
@ -111,7 +112,7 @@ pub struct ExecutionCheckpoint {
|
|||||||
|
|
||||||
/// Saves the progress of Headers stage.
|
/// Saves the progress of Headers stage.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct HeadersCheckpoint {
|
pub struct HeadersCheckpoint {
|
||||||
/// Block range which this checkpoint is valid for.
|
/// Block range which this checkpoint is valid for.
|
||||||
pub block_range: CheckpointBlockRange,
|
pub block_range: CheckpointBlockRange,
|
||||||
@ -121,7 +122,7 @@ pub struct HeadersCheckpoint {
|
|||||||
|
|
||||||
/// Saves the progress of Index History stages.
|
/// Saves the progress of Index History stages.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct IndexHistoryCheckpoint {
|
pub struct IndexHistoryCheckpoint {
|
||||||
/// Block range which this checkpoint is valid for.
|
/// Block range which this checkpoint is valid for.
|
||||||
pub block_range: CheckpointBlockRange,
|
pub block_range: CheckpointBlockRange,
|
||||||
@ -131,7 +132,7 @@ pub struct IndexHistoryCheckpoint {
|
|||||||
|
|
||||||
/// Saves the progress of abstract stage iterating over or downloading entities.
|
/// Saves the progress of abstract stage iterating over or downloading entities.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Default, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub struct EntitiesCheckpoint {
|
pub struct EntitiesCheckpoint {
|
||||||
/// Number of entities already processed.
|
/// Number of entities already processed.
|
||||||
pub processed: u64,
|
pub processed: u64,
|
||||||
@ -159,7 +160,7 @@ impl EntitiesCheckpoint {
|
|||||||
/// Saves the block range. Usually, it's used to check the validity of some stage checkpoint across
|
/// Saves the block range. Usually, it's used to check the validity of some stage checkpoint across
|
||||||
/// multiple executions.
|
/// multiple executions.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct CheckpointBlockRange {
|
pub struct CheckpointBlockRange {
|
||||||
/// The first block of the range, inclusive.
|
/// The first block of the range, inclusive.
|
||||||
pub from: BlockNumber,
|
pub from: BlockNumber,
|
||||||
@ -181,7 +182,7 @@ impl From<&RangeInclusive<BlockNumber>> for CheckpointBlockRange {
|
|||||||
|
|
||||||
/// Saves the progress of a stage.
|
/// Saves the progress of a stage.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Default, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub struct StageCheckpoint {
|
pub struct StageCheckpoint {
|
||||||
/// The maximum block processed by the stage.
|
/// The maximum block processed by the stage.
|
||||||
pub block_number: BlockNumber,
|
pub block_number: BlockNumber,
|
||||||
@ -247,7 +248,7 @@ impl StageCheckpoint {
|
|||||||
// is not a Copy type.
|
// is not a Copy type.
|
||||||
/// Stage-specific checkpoint metrics.
|
/// Stage-specific checkpoint metrics.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub enum StageUnitCheckpoint {
|
pub enum StageUnitCheckpoint {
|
||||||
/// Saves the progress of AccountHashing stage.
|
/// Saves the progress of AccountHashing stage.
|
||||||
Account(AccountHashingCheckpoint),
|
Account(AccountHashingCheckpoint),
|
||||||
|
|||||||
@ -45,13 +45,13 @@ pub fn reth_codec(args: TokenStream, input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let compact = if with_zstd {
|
let compact = if with_zstd {
|
||||||
quote! {
|
quote! {
|
||||||
#[derive(CompactZstd, serde::Serialize, serde::Deserialize)]
|
#[derive(CompactZstd)]
|
||||||
#ast
|
#ast
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
#[derive(Compact, serde::Serialize, serde::Deserialize)]
|
#[derive(Compact)]
|
||||||
#ast
|
#ast
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
|
|||||||
@ -3,12 +3,13 @@ use alloy_eips::eip7702::{Authorization as AlloyAuthorization, SignedAuthorizati
|
|||||||
use alloy_primitives::{Address, ChainId, U256};
|
use alloy_primitives::{Address, ChainId, U256};
|
||||||
use bytes::Buf;
|
use bytes::Buf;
|
||||||
use reth_codecs_derive::reth_codec;
|
use reth_codecs_derive::reth_codec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Authorization acts as bridge which simplifies Compact implementation for AlloyAuthorization.
|
/// Authorization acts as bridge which simplifies Compact implementation for AlloyAuthorization.
|
||||||
///
|
///
|
||||||
/// Notice: Make sure this struct is 1:1 with `alloy_eips::eip7702::Authorization`
|
/// Notice: Make sure this struct is 1:1 with `alloy_eips::eip7702::Authorization`
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
struct Authorization {
|
struct Authorization {
|
||||||
chain_id: ChainId,
|
chain_id: ChainId,
|
||||||
address: Address,
|
address: Address,
|
||||||
|
|||||||
@ -2,12 +2,13 @@ use crate::Compact;
|
|||||||
use alloy_genesis::GenesisAccount as AlloyGenesisAccount;
|
use alloy_genesis::GenesisAccount as AlloyGenesisAccount;
|
||||||
use alloy_primitives::{Bytes, B256, U256};
|
use alloy_primitives::{Bytes, B256, U256};
|
||||||
use reth_codecs_derive::reth_codec;
|
use reth_codecs_derive::reth_codec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// GenesisAccount acts as bridge which simplifies Compact implementation for AlloyGenesisAccount.
|
/// GenesisAccount acts as bridge which simplifies Compact implementation for AlloyGenesisAccount.
|
||||||
///
|
///
|
||||||
/// Notice: Make sure this struct is 1:1 with `alloy_genesis::GenesisAccount`
|
/// Notice: Make sure this struct is 1:1 with `alloy_genesis::GenesisAccount`
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
struct GenesisAccount {
|
struct GenesisAccount {
|
||||||
/// The nonce of the account at genesis.
|
/// The nonce of the account at genesis.
|
||||||
nonce: Option<u64>,
|
nonce: Option<u64>,
|
||||||
@ -22,13 +23,13 @@ struct GenesisAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
struct StorageEntries {
|
struct StorageEntries {
|
||||||
entries: Vec<StorageEntry>,
|
entries: Vec<StorageEntry>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
struct StorageEntry {
|
struct StorageEntry {
|
||||||
key: B256,
|
key: B256,
|
||||||
value: B256,
|
value: B256,
|
||||||
|
|||||||
@ -2,12 +2,13 @@ use crate::Compact;
|
|||||||
use alloy_eips::eip4895::Withdrawal as AlloyWithdrawal;
|
use alloy_eips::eip4895::Withdrawal as AlloyWithdrawal;
|
||||||
use alloy_primitives::Address;
|
use alloy_primitives::Address;
|
||||||
use reth_codecs_derive::reth_codec;
|
use reth_codecs_derive::reth_codec;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Withdrawal acts as bridge which simplifies Compact implementation for AlloyWithdrawal.
|
/// Withdrawal acts as bridge which simplifies Compact implementation for AlloyWithdrawal.
|
||||||
///
|
///
|
||||||
/// Notice: Make sure this struct is 1:1 with `alloy_eips::eip4895::Withdrawal`
|
/// Notice: Make sure this struct is 1:1 with `alloy_eips::eip4895::Withdrawal`
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
struct Withdrawal {
|
struct Withdrawal {
|
||||||
/// Monotonically increasing identifier issued by consensus layer.
|
/// Monotonically increasing identifier issued by consensus layer.
|
||||||
index: u64,
|
index: u64,
|
||||||
|
|||||||
@ -414,6 +414,7 @@ const fn decode_varuint_panic() -> ! {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use alloy_primitives::B256;
|
use alloy_primitives::B256;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compact_bytes() {
|
fn compact_bytes() {
|
||||||
@ -556,7 +557,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||||
struct TestStruct {
|
struct TestStruct {
|
||||||
f_u64: u64,
|
f_u64: u64,
|
||||||
f_u256: U256,
|
f_u256: U256,
|
||||||
@ -608,7 +609,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default, Serialize, Deserialize)]
|
||||||
enum TestEnum {
|
enum TestEnum {
|
||||||
#[default]
|
#[default]
|
||||||
Var0,
|
Var0,
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use reth_codecs::{reth_codec, Compact};
|
use reth_codecs::{reth_codec, Compact};
|
||||||
use reth_primitives::{Header, TxNumber, Withdrawals, B256};
|
use reth_primitives::{Header, TxNumber, Withdrawals, B256};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
/// Total number of transactions.
|
/// Total number of transactions.
|
||||||
@ -11,7 +12,7 @@ pub type NumTransactions = u64;
|
|||||||
///
|
///
|
||||||
/// It has the pointer to the transaction Number of the first
|
/// It has the pointer to the transaction Number of the first
|
||||||
/// transaction in the block and the total number of transactions.
|
/// transaction in the block and the total number of transactions.
|
||||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize)]
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
pub struct StoredBlockBodyIndices {
|
pub struct StoredBlockBodyIndices {
|
||||||
/// The number of the first transaction in this block
|
/// The number of the first transaction in this block
|
||||||
@ -69,7 +70,7 @@ impl StoredBlockBodyIndices {
|
|||||||
///
|
///
|
||||||
/// It is stored as the headers of the block's uncles.
|
/// It is stored as the headers of the block's uncles.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize)]
|
||||||
pub struct StoredBlockOmmers {
|
pub struct StoredBlockOmmers {
|
||||||
/// The block headers of this block's uncles.
|
/// The block headers of this block's uncles.
|
||||||
pub ommers: Vec<Header>,
|
pub ommers: Vec<Header>,
|
||||||
@ -77,7 +78,7 @@ pub struct StoredBlockOmmers {
|
|||||||
|
|
||||||
/// The storage representation of block withdrawals.
|
/// The storage representation of block withdrawals.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize)]
|
||||||
pub struct StoredBlockWithdrawals {
|
pub struct StoredBlockWithdrawals {
|
||||||
/// The block withdrawals.
|
/// The block withdrawals.
|
||||||
pub withdrawals: Withdrawals,
|
pub withdrawals: Withdrawals,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ use reth_primitives::{Address, B256, *};
|
|||||||
use reth_prune_types::{PruneCheckpoint, PruneSegment};
|
use reth_prune_types::{PruneCheckpoint, PruneSegment};
|
||||||
use reth_stages_types::StageCheckpoint;
|
use reth_stages_types::StageCheckpoint;
|
||||||
use reth_trie_common::{StoredNibbles, StoredNibblesSubKey, *};
|
use reth_trie_common::{StoredNibbles, StoredNibblesSubKey, *};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
pub mod blocks;
|
pub mod blocks;
|
||||||
@ -264,7 +265,7 @@ macro_rules! add_wrapper_struct {
|
|||||||
$(
|
$(
|
||||||
/// Wrapper struct so it can use StructFlags from Compact, when used as pure table values.
|
/// Wrapper struct so it can use StructFlags from Compact, when used as pure table values.
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||||
pub struct $wrapper(pub $name);
|
pub struct $wrapper(pub $name);
|
||||||
|
|
||||||
impl From<$name> for $wrapper {
|
impl From<$name> for $wrapper {
|
||||||
|
|||||||
@ -106,7 +106,7 @@ And the corresponding trait implementations are present in the primitives crate.
|
|||||||
[File: crates/primitives/src/transaction/mod.rs](https://github.com/paradigmxyz/reth/blob/1563506aea09049a85e5cc72c2894f3f7a371581/crates/primitives/src/transaction/mod.rs)
|
[File: crates/primitives/src/transaction/mod.rs](https://github.com/paradigmxyz/reth/blob/1563506aea09049a85e5cc72c2894f3f7a371581/crates/primitives/src/transaction/mod.rs)
|
||||||
```rust, ignore
|
```rust, ignore
|
||||||
#[reth_codec]
|
#[reth_codec]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref, Default, Serialize, Deserialize)]
|
||||||
pub struct TransactionSigned {
|
pub struct TransactionSigned {
|
||||||
pub hash: TxHash,
|
pub hash: TxHash,
|
||||||
pub signature: Signature,
|
pub signature: Signature,
|
||||||
|
|||||||
Reference in New Issue
Block a user