mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(exex): derive serde ser/deser for ExExNotification (#8963)
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -7174,6 +7174,7 @@ dependencies = [
|
|||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-trie",
|
"reth-trie",
|
||||||
"revm",
|
"revm",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -7193,6 +7194,7 @@ dependencies = [
|
|||||||
"reth-provider",
|
"reth-provider",
|
||||||
"reth-tasks",
|
"reth-tasks",
|
||||||
"reth-tracing",
|
"reth-tracing",
|
||||||
|
"serde",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
]
|
]
|
||||||
@ -8440,6 +8442,7 @@ dependencies = [
|
|||||||
"reth-storage-errors",
|
"reth-storage-errors",
|
||||||
"reth-trie-common",
|
"reth-trie-common",
|
||||||
"revm",
|
"revm",
|
||||||
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"similar-asserts",
|
"similar-asserts",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|||||||
@ -36,7 +36,7 @@ proptest-derive.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "serde"]
|
default = ["std", "serde"]
|
||||||
std = ["thiserror-no-std/std"]
|
|
||||||
serde = ["dep:serde"]
|
|
||||||
arbitrary = ["dep:arbitrary", "dep:proptest", "dep:proptest-derive"]
|
arbitrary = ["dep:arbitrary", "dep:proptest", "dep:proptest-derive"]
|
||||||
optimism = []
|
optimism = []
|
||||||
|
serde = ["dep:serde"]
|
||||||
|
std = ["thiserror-no-std/std"]
|
||||||
|
|||||||
@ -18,10 +18,13 @@ reth-trie.workspace = true
|
|||||||
|
|
||||||
revm.workspace = true
|
revm.workspace = true
|
||||||
|
|
||||||
|
serde = { workspace = true, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
reth-primitives = { workspace = true, features = ["test-utils"] }
|
reth-primitives = { workspace = true, features = ["test-utils"] }
|
||||||
alloy-primitives.workspace = true
|
alloy-primitives.workspace = true
|
||||||
alloy-eips.workspace = true
|
alloy-eips.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = ["dep:reth-chainspec"]
|
optimism = ["dep:reth-chainspec"]
|
||||||
|
serde = ["dep:serde", "reth-trie/serde", "revm/serde"]
|
||||||
|
|||||||
@ -21,6 +21,7 @@ use std::{borrow::Cow, collections::BTreeMap, fmt, ops::RangeInclusive};
|
|||||||
///
|
///
|
||||||
/// A chain of blocks should not be empty.
|
/// A chain of blocks should not be empty.
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct Chain {
|
pub struct Chain {
|
||||||
/// All blocks in this chain.
|
/// All blocks in this chain.
|
||||||
blocks: BTreeMap<BlockNumber, SealedBlockWithSenders>,
|
blocks: BTreeMap<BlockNumber, SealedBlockWithSenders>,
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use std::collections::HashMap;
|
|||||||
/// The `ExecutionOutcome` structure aggregates the state changes over an arbitrary number of
|
/// The `ExecutionOutcome` structure aggregates the state changes over an arbitrary number of
|
||||||
/// blocks, capturing the resulting state, receipts, and requests following the execution.
|
/// blocks, capturing the resulting state, receipts, and requests following the execution.
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct ExecutionOutcome {
|
pub struct ExecutionOutcome {
|
||||||
/// Bundle state with reverts.
|
/// Bundle state with reverts.
|
||||||
pub bundle: BundleState,
|
pub bundle: BundleState,
|
||||||
|
|||||||
@ -32,3 +32,8 @@ tokio-util.workspace = true
|
|||||||
## misc
|
## misc
|
||||||
eyre.workspace = true
|
eyre.workspace = true
|
||||||
metrics.workspace = true
|
metrics.workspace = true
|
||||||
|
serde = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
serde = ["dep:serde", "reth-provider/serde"]
|
||||||
|
|||||||
@ -4,6 +4,7 @@ use reth_provider::{CanonStateNotification, Chain};
|
|||||||
|
|
||||||
/// Notifications sent to an `ExEx`.
|
/// Notifications sent to an `ExEx`.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum ExExNotification {
|
pub enum ExExNotification {
|
||||||
/// Chain got committed without a reorg, and only the new chain is returned.
|
/// Chain got committed without a reorg, and only the new chain is returned.
|
||||||
ChainCommitted {
|
ChainCommitted {
|
||||||
|
|||||||
@ -52,5 +52,5 @@ reth-tracing.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serde"]
|
default = ["serde"]
|
||||||
test-utils = ["dep:rand"]
|
|
||||||
serde = ["dep:serde"]
|
serde = ["dep:serde"]
|
||||||
|
test-utils = ["dep:rand"]
|
||||||
|
|||||||
@ -45,10 +45,11 @@ async-stream.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serde"]
|
default = ["serde"]
|
||||||
serde = ["dep:serde"]
|
|
||||||
arbitrary = [
|
arbitrary = [
|
||||||
"reth-primitives/arbitrary",
|
"reth-primitives/arbitrary",
|
||||||
"dep:arbitrary",
|
"dep:arbitrary",
|
||||||
"dep:proptest",
|
"dep:proptest",
|
||||||
"dep:proptest-derive",
|
"dep:proptest-derive",
|
||||||
]
|
]
|
||||||
|
serde = ["dep:serde"]
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,6 @@ async-stream.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serde"]
|
default = ["serde"]
|
||||||
serde = ["dep:serde"]
|
|
||||||
arbitrary = [
|
arbitrary = [
|
||||||
"reth-primitives/arbitrary",
|
"reth-primitives/arbitrary",
|
||||||
"dep:arbitrary",
|
"dep:arbitrary",
|
||||||
@ -71,6 +70,7 @@ arbitrary = [
|
|||||||
"dep:proptest-derive",
|
"dep:proptest-derive",
|
||||||
]
|
]
|
||||||
optimism = ["reth-primitives/optimism"]
|
optimism = ["reth-primitives/optimism"]
|
||||||
|
serde = ["dep:serde"]
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "fuzz_roundtrip"
|
name = "fuzz_roundtrip"
|
||||||
|
|||||||
@ -95,9 +95,9 @@ criterion = { workspace = true, features = ["async_tokio", "html_reports"] }
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serde"]
|
default = ["serde"]
|
||||||
|
geth-tests = []
|
||||||
serde = ["dep:serde", "dep:humantime-serde", "secp256k1/serde", "enr/serde", "dep:serde_json"]
|
serde = ["dep:serde", "dep:humantime-serde", "secp256k1/serde", "enr/serde", "dep:serde_json"]
|
||||||
test-utils = ["reth-provider/test-utils", "dep:tempfile", "reth-transaction-pool/test-utils"]
|
test-utils = ["reth-provider/test-utils", "dep:tempfile", "reth-transaction-pool/test-utils"]
|
||||||
geth-tests = []
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "bench"
|
name = "bench"
|
||||||
|
|||||||
@ -34,7 +34,7 @@ mod error;
|
|||||||
pub use error::{GotExpected, GotExpectedBoxed};
|
pub use error::{GotExpected, GotExpectedBoxed};
|
||||||
|
|
||||||
mod log;
|
mod log;
|
||||||
pub use log::{logs_bloom, Log};
|
pub use log::{logs_bloom, Log, LogData};
|
||||||
|
|
||||||
mod storage;
|
mod storage;
|
||||||
pub use storage::StorageEntry;
|
pub use storage::StorageEntry;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use alloy_primitives::Bloom;
|
use alloy_primitives::Bloom;
|
||||||
pub use alloy_primitives::Log;
|
pub use alloy_primitives::{Log, LogData};
|
||||||
|
|
||||||
/// Calculate receipt logs bloom.
|
/// Calculate receipt logs bloom.
|
||||||
pub fn logs_bloom<'a>(logs: impl IntoIterator<Item = &'a Log>) -> Bloom {
|
pub fn logs_bloom<'a>(logs: impl IntoIterator<Item = &'a Log>) -> Bloom {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ use proptest::strategy::Strategy;
|
|||||||
#[cfg(feature = "zstd-codec")]
|
#[cfg(feature = "zstd-codec")]
|
||||||
use reth_codecs::CompactZstd;
|
use reth_codecs::CompactZstd;
|
||||||
use reth_codecs::{add_arbitrary_tests, main_codec, Compact};
|
use reth_codecs::{add_arbitrary_tests, main_codec, Compact};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use alloc::{vec, vec::Vec};
|
use alloc::{vec, vec::Vec};
|
||||||
@ -66,7 +67,19 @@ impl Receipt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A collection of receipts organized as a two-dimensional vector.
|
/// A collection of receipts organized as a two-dimensional vector.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Default, From, Deref, DerefMut, IntoIterator)]
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Default,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
From,
|
||||||
|
Deref,
|
||||||
|
DerefMut,
|
||||||
|
IntoIterator,
|
||||||
|
)]
|
||||||
pub struct Receipts {
|
pub struct Receipts {
|
||||||
/// A two-dimensional vector of optional `Receipt` instances.
|
/// A two-dimensional vector of optional `Receipt` instances.
|
||||||
pub receipt_vec: Vec<Vec<Option<Receipt>>>,
|
pub receipt_vec: Vec<Vec<Option<Receipt>>>,
|
||||||
|
|||||||
@ -73,5 +73,6 @@ assert_matches.workspace = true
|
|||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test-utils = ["alloy-rlp", "reth-db/test-utils", "reth-nippy-jar/test-utils"]
|
|
||||||
optimism = ["reth-primitives/optimism", "reth-execution-types/optimism"]
|
optimism = ["reth-primitives/optimism", "reth-execution-types/optimism"]
|
||||||
|
serde = ["reth-execution-types/serde"]
|
||||||
|
test-utils = ["alloy-rlp", "reth-db/test-utils", "reth-nippy-jar/test-utils"]
|
||||||
|
|||||||
@ -67,9 +67,9 @@ serde_json.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serde"]
|
default = ["serde"]
|
||||||
|
arbitrary = ["proptest", "reth-primitives/arbitrary"]
|
||||||
serde = ["dep:serde"]
|
serde = ["dep:serde"]
|
||||||
test-utils = ["rand", "paste", "serde"]
|
test-utils = ["rand", "paste", "serde"]
|
||||||
arbitrary = ["proptest", "reth-primitives/arbitrary"]
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "truncate"
|
name = "truncate"
|
||||||
|
|||||||
@ -40,6 +40,9 @@ metrics = { workspace = true, optional = true }
|
|||||||
# `test-utils` feature
|
# `test-utils` feature
|
||||||
triehash = { version = "0.8", optional = true }
|
triehash = { version = "0.8", optional = true }
|
||||||
|
|
||||||
|
# `serde` feature
|
||||||
|
serde = { workspace = true, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
# reth
|
# reth
|
||||||
reth-chainspec.workspace = true
|
reth-chainspec.workspace = true
|
||||||
@ -67,6 +70,7 @@ criterion.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
metrics = ["reth-metrics", "dep:metrics"]
|
metrics = ["reth-metrics", "dep:metrics"]
|
||||||
|
serde = ["dep:serde"]
|
||||||
test-utils = ["triehash", "reth-trie-common/test-utils"]
|
test-utils = ["triehash", "reth-trie-common/test-utils"]
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use std::collections::{hash_map::IntoIter, HashMap, HashSet};
|
|||||||
|
|
||||||
/// The key of a trie node.
|
/// The key of a trie node.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum TrieKey {
|
pub enum TrieKey {
|
||||||
/// A node in the account trie.
|
/// A node in the account trie.
|
||||||
AccountNode(StoredNibbles),
|
AccountNode(StoredNibbles),
|
||||||
@ -24,6 +25,7 @@ pub enum TrieKey {
|
|||||||
|
|
||||||
/// The operation to perform on the trie.
|
/// The operation to perform on the trie.
|
||||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum TrieOp {
|
pub enum TrieOp {
|
||||||
/// Delete the node entry.
|
/// Delete the node entry.
|
||||||
Delete,
|
Delete,
|
||||||
@ -40,6 +42,7 @@ impl TrieOp {
|
|||||||
|
|
||||||
/// The aggregation of trie updates.
|
/// The aggregation of trie updates.
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Deref)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Deref)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct TrieUpdates {
|
pub struct TrieUpdates {
|
||||||
trie_operations: HashMap<TrieKey, TrieOp>,
|
trie_operations: HashMap<TrieKey, TrieOp>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user