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