mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 02:49:55 +00:00
refactor: Move BlockBody from transaction to body
This commit is contained in:
@ -3,8 +3,8 @@ use alloy_primitives::Address;
|
||||
use reth_primitives_traits::{BlockBody as BlockBodyTrait, InMemorySize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::node::primitives::{BlockBody, TransactionSigned};
|
||||
pub use crate::node::types::{ReadPrecompileCall, ReadPrecompileCalls};
|
||||
use crate::node::types::{ReadPrecompileCall, ReadPrecompileCalls};
|
||||
use crate::{HlHeader, node::primitives::TransactionSigned};
|
||||
|
||||
/// Block body for HL. It is equivalent to Ethereum [`BlockBody`] but additionally stores sidecars
|
||||
/// for blob transactions.
|
||||
@ -29,13 +29,17 @@ pub struct HlBlockBody {
|
||||
pub highest_precompile_address: Option<Address>,
|
||||
}
|
||||
|
||||
pub type BlockBody = alloy_consensus::BlockBody<TransactionSigned, HlHeader>;
|
||||
|
||||
impl InMemorySize for HlBlockBody {
|
||||
fn size(&self) -> usize {
|
||||
self.inner.size() +
|
||||
self.sidecars
|
||||
self.inner.size()
|
||||
+ self
|
||||
.sidecars
|
||||
.as_ref()
|
||||
.map_or(0, |s| s.capacity() * core::mem::size_of::<BlobTransactionSidecar>()) +
|
||||
self.read_precompile_calls
|
||||
.map_or(0, |s| s.capacity() * core::mem::size_of::<BlobTransactionSidecar>())
|
||||
+ self
|
||||
.read_precompile_calls
|
||||
.as_ref()
|
||||
.map_or(0, |s| s.0.capacity() * core::mem::size_of::<ReadPrecompileCall>())
|
||||
}
|
||||
|
||||
@ -2,12 +2,12 @@ use reth_ethereum_primitives::Receipt;
|
||||
use reth_primitives::NodePrimitives;
|
||||
|
||||
pub mod transaction;
|
||||
pub use transaction::{BlockBody, TransactionSigned};
|
||||
pub use transaction::TransactionSigned;
|
||||
|
||||
pub mod block;
|
||||
pub use block::HlBlock;
|
||||
pub mod body;
|
||||
pub use body::HlBlockBody;
|
||||
pub use body::{BlockBody, HlBlockBody};
|
||||
pub mod header;
|
||||
pub use header::HlHeader;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
//! except that it supports pseudo signer for system transactions.
|
||||
use std::convert::Infallible;
|
||||
|
||||
use crate::{evm::transaction::HlTxEnv, HlHeader};
|
||||
use crate::evm::transaction::HlTxEnv;
|
||||
use alloy_consensus::{
|
||||
SignableTransaction, Signed, Transaction as TransactionTrait, TransactionEnvelope, TxEip1559,
|
||||
TxEip2930, TxEip4844, TxEip7702, TxLegacy, TxType, TypedTransaction, crypto::RecoveryError,
|
||||
@ -181,8 +181,6 @@ impl SerdeBincodeCompat for TransactionSigned {
|
||||
}
|
||||
}
|
||||
|
||||
pub type BlockBody = alloy_consensus::BlockBody<TransactionSigned, HlHeader>;
|
||||
|
||||
impl TryFrom<TransactionSigned> for PooledTransactionVariant {
|
||||
type Error = <InnerType as TryInto<PooledTransactionVariant>>::Error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user