mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(sdk): make reth-chain-state types generic over receipt (#12667)
This commit is contained in:
@ -15,6 +15,7 @@ workspace = true
|
||||
# reth
|
||||
reth-chain-state.workspace = true
|
||||
reth-execution-types.workspace = true
|
||||
reth-primitives-traits.workspace = true
|
||||
|
||||
# reth
|
||||
alloy-primitives.workspace = true
|
||||
@ -38,11 +39,13 @@ serde = [
|
||||
"reth-execution-types/serde",
|
||||
"alloy-eips/serde",
|
||||
"alloy-primitives/serde",
|
||||
"rand/serde"
|
||||
"rand/serde",
|
||||
"reth-primitives-traits/serde",
|
||||
]
|
||||
serde-bincode-compat = [
|
||||
"reth-execution-types/serde-bincode-compat",
|
||||
"serde_with",
|
||||
"reth-primitives/serde-bincode-compat",
|
||||
"alloy-eips/serde-bincode-compat"
|
||||
"alloy-eips/serde-bincode-compat",
|
||||
"reth-primitives-traits/serde-bincode-compat",
|
||||
]
|
||||
|
||||
@ -2,27 +2,28 @@ use std::sync::Arc;
|
||||
|
||||
use reth_chain_state::CanonStateNotification;
|
||||
use reth_execution_types::Chain;
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
|
||||
/// Notifications sent to an `ExEx`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum ExExNotification {
|
||||
pub enum ExExNotification<P: NodePrimitives = reth_chain_state::EthPrimitives> {
|
||||
/// Chain got committed without a reorg, and only the new chain is returned.
|
||||
ChainCommitted {
|
||||
/// The new chain after commit.
|
||||
new: Arc<Chain>,
|
||||
new: Arc<Chain<P>>,
|
||||
},
|
||||
/// Chain got reorged, and both the old and the new chains are returned.
|
||||
ChainReorged {
|
||||
/// The old chain before reorg.
|
||||
old: Arc<Chain>,
|
||||
old: Arc<Chain<P>>,
|
||||
/// The new chain after reorg.
|
||||
new: Arc<Chain>,
|
||||
new: Arc<Chain<P>>,
|
||||
},
|
||||
/// Chain got reverted, and only the old chain is returned.
|
||||
ChainReverted {
|
||||
/// The old chain before reversion.
|
||||
old: Arc<Chain>,
|
||||
old: Arc<Chain<P>>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -60,8 +61,8 @@ impl ExExNotification {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CanonStateNotification> for ExExNotification {
|
||||
fn from(notification: CanonStateNotification) -> Self {
|
||||
impl<P: NodePrimitives> From<CanonStateNotification<P>> for ExExNotification<P> {
|
||||
fn from(notification: CanonStateNotification<P>) -> Self {
|
||||
match notification {
|
||||
CanonStateNotification::Commit { new } => Self::ChainCommitted { new },
|
||||
CanonStateNotification::Reorg { old, new } => Self::ChainReorged { old, new },
|
||||
|
||||
Reference in New Issue
Block a user