feat(exex): derive serde ser/deser for ExExNotification (#8963)

This commit is contained in:
Alexey Shekhirin
2024-06-20 11:33:53 +01:00
committed by GitHub
parent 8b6ca877d6
commit 554e8b1913
18 changed files with 48 additions and 12 deletions

View File

@ -40,6 +40,9 @@ metrics = { workspace = true, optional = true }
# `test-utils` feature
triehash = { version = "0.8", optional = true }
# `serde` feature
serde = { workspace = true, optional = true }
[dev-dependencies]
# reth
reth-chainspec.workspace = true
@ -67,6 +70,7 @@ criterion.workspace = true
[features]
metrics = ["reth-metrics", "dep:metrics"]
serde = ["dep:serde"]
test-utils = ["triehash", "reth-trie-common/test-utils"]
[[bench]]

View File

@ -13,6 +13,7 @@ use std::collections::{hash_map::IntoIter, HashMap, HashSet};
/// The key of a trie node.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum TrieKey {
/// A node in the account trie.
AccountNode(StoredNibbles),
@ -24,6 +25,7 @@ pub enum TrieKey {
/// The operation to perform on the trie.
#[derive(PartialEq, Eq, Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum TrieOp {
/// Delete the node entry.
Delete,
@ -40,6 +42,7 @@ impl TrieOp {
/// The aggregation of trie updates.
#[derive(Debug, Default, Clone, PartialEq, Eq, Deref)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TrieUpdates {
trie_operations: HashMap<TrieKey, TrieOp>,
}