refactor(examples): Replace redundant type definitions with a CustomTransaction alias in the custom_node example (#16367)

This commit is contained in:
Roman Hodulák
2025-05-20 16:57:54 +02:00
committed by GitHub
parent 9919b7a350
commit 72ab1d6ee8
4 changed files with 11 additions and 10 deletions

View File

@@ -1,9 +1,7 @@
use crate::primitives::{CustomHeader, CustomTransactionEnvelope, ExtendedOpTxEnvelope};
use crate::primitives::{CustomHeader, CustomTransaction};
/// The Block type of this node
pub type Block =
alloy_consensus::Block<ExtendedOpTxEnvelope<CustomTransactionEnvelope>, CustomHeader>;
pub type Block = alloy_consensus::Block<CustomTransaction, CustomHeader>;
/// The body type of this node
pub type BlockBody =
alloy_consensus::BlockBody<ExtendedOpTxEnvelope<CustomTransactionEnvelope>, CustomHeader>;
pub type BlockBody = alloy_consensus::BlockBody<CustomTransaction, CustomHeader>;

View File

@@ -22,6 +22,6 @@ impl NodePrimitives for CustomNodePrimitives {
type Block = Block;
type BlockHeader = CustomHeader;
type BlockBody = BlockBody;
type SignedTx = ExtendedOpTxEnvelope<CustomTransactionEnvelope>;
type SignedTx = CustomTransaction;
type Receipt = OpReceipt;
}

View File

@@ -20,6 +20,9 @@ use reth_op::primitives::{Extended, SignedTransaction};
use revm_primitives::{Address, Bytes};
use serde::{Deserialize, Serialize};
/// An [`OpTxEnvelope`] that is [`Extended`] by one more variant of [`CustomTransactionEnvelope`].
pub type CustomTransaction = ExtendedOpTxEnvelope<CustomTransactionEnvelope>;
/// A [`SignedTransaction`] implementation that combines the [`OpTxEnvelope`] and another
/// transaction type.
pub type ExtendedOpTxEnvelope<T> = Extended<OpTxEnvelope, T>;