mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: fmt
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
use crate::{hardforks::HlHardforks, node::{primitives::HlHeader, HlNode}, HlBlock, HlBlockBody, HlPrimitives};
|
||||
use crate::{
|
||||
HlBlock, HlBlockBody, HlPrimitives,
|
||||
hardforks::HlHardforks,
|
||||
node::{HlNode, primitives::HlHeader},
|
||||
};
|
||||
use reth::{
|
||||
api::{FullNodeTypes, NodeTypes},
|
||||
beacon_consensus::EthBeaconConsensus,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use crate::{
|
||||
node::evm::config::{HlBlockExecutorFactory, HlEvmConfig}, HlBlock, HlHeader
|
||||
HlBlock, HlHeader,
|
||||
node::evm::config::{HlBlockExecutorFactory, HlEvmConfig},
|
||||
};
|
||||
use reth_evm::{
|
||||
block::BlockExecutionError,
|
||||
|
||||
@ -270,8 +270,8 @@ impl<'a, N: HlNodeType> MigrateStaticFiles<'a, N> {
|
||||
let mut first = true;
|
||||
|
||||
for (block_range, _tx_ranges) in all_static_files {
|
||||
let migration_needed = self.using_old_header(block_range.start())?
|
||||
|| self.using_old_header(block_range.end())?;
|
||||
let migration_needed = self.using_old_header(block_range.start())? ||
|
||||
self.using_old_header(block_range.end())?;
|
||||
if !migration_needed {
|
||||
// Create a placeholder symlink
|
||||
self.create_placeholder(block_range)?;
|
||||
|
||||
@ -179,7 +179,7 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{chainspec::hl::hl_mainnet, HlHeader};
|
||||
use crate::{HlHeader, chainspec::hl::hl_mainnet};
|
||||
|
||||
use super::*;
|
||||
use alloy_primitives::{B256, U128};
|
||||
|
||||
@ -3,8 +3,13 @@ use alloy_primitives::Address;
|
||||
use reth_primitives_traits::{BlockBody as BlockBodyTrait, InMemorySize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::node::types::{ReadPrecompileCall, ReadPrecompileCalls};
|
||||
use crate::{HlHeader, node::primitives::TransactionSigned};
|
||||
use crate::{
|
||||
HlHeader,
|
||||
node::{
|
||||
primitives::TransactionSigned,
|
||||
types::{ReadPrecompileCall, ReadPrecompileCalls},
|
||||
},
|
||||
};
|
||||
|
||||
/// Block body for HL. It is equivalent to Ethereum [`BlockBody`] but additionally stores sidecars
|
||||
/// for blob transactions.
|
||||
@ -33,13 +38,11 @@ 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>())
|
||||
}
|
||||
|
||||
@ -45,7 +45,11 @@ pub struct HlHeaderExtras {
|
||||
}
|
||||
|
||||
impl HlHeader {
|
||||
pub(crate) fn from_ethereum_header(header: Header, receipts: &[EthereumReceipt], system_tx_count: u64) -> HlHeader {
|
||||
pub(crate) fn from_ethereum_header(
|
||||
header: Header,
|
||||
receipts: &[EthereumReceipt],
|
||||
system_tx_count: u64,
|
||||
) -> HlHeader {
|
||||
let logs_bloom = logs_bloom(receipts.iter().flat_map(|r| &r.logs));
|
||||
HlHeader {
|
||||
inner: header,
|
||||
@ -183,8 +187,9 @@ impl reth_codecs::Compact for HlHeader {
|
||||
// because Compact trait requires the Bytes field to be placed at the end of the struct.
|
||||
// Bytes::from_compact just reads all trailing data as the Bytes field.
|
||||
//
|
||||
// Hence we need to use other form of serialization, since extra headers are not Compact-compatible.
|
||||
// We just treat all header fields as rmp-serialized one `Bytes` field.
|
||||
// Hence we need to use other form of serialization, since extra headers are not
|
||||
// Compact-compatible. We just treat all header fields as rmp-serialized one `Bytes`
|
||||
// field.
|
||||
let result: Bytes = rmp_serde::to_vec(&self).unwrap().into();
|
||||
result.to_compact(buf)
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#![allow(clippy::owned_cow)]
|
||||
use super::{HlBlock, HlBlockBody, TransactionSigned};
|
||||
use crate::{node::types::ReadPrecompileCalls, HlHeader};
|
||||
use crate::{HlHeader, node::types::ReadPrecompileCalls};
|
||||
use alloy_consensus::{BlobTransactionSidecar, BlockBody};
|
||||
use alloy_eips::eip4895::Withdrawals;
|
||||
use alloy_primitives::Address;
|
||||
|
||||
@ -6,7 +6,10 @@ use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use super::{HlBlock, HlBlockBody};
|
||||
use crate::{node::{primitives::BlockBody, types::ReadPrecompileCalls}, HlHeader};
|
||||
use crate::{
|
||||
HlHeader,
|
||||
node::{primitives::BlockBody, types::ReadPrecompileCalls},
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HlBlockBodyBincode<'a> {
|
||||
|
||||
Reference in New Issue
Block a user