From ff6017e443efff0a8ead5af3a64b038d78b73c96 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 2 Sep 2025 13:20:08 -0400 Subject: [PATCH 1/5] fix: fee history filterer behavior and arc management --- crates/rpc/src/ctx/fee_hist.rs | 127 ++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 16 deletions(-) diff --git a/crates/rpc/src/ctx/fee_hist.rs b/crates/rpc/src/ctx/fee_hist.rs index 2ef1ff3..381ebcd 100644 --- a/crates/rpc/src/ctx/fee_hist.rs +++ b/crates/rpc/src/ctx/fee_hist.rs @@ -8,49 +8,144 @@ use std::sync::Arc; /// Removes Signet system transactions from the block. fn strip_block(block: RecoveredBlock) -> RecoveredBlock { - let (sealed, senders) = block.split_sealed(); + let (sealed, mut senders) = block.split_sealed(); let (header, mut body) = sealed.split_sealed_header_body(); // This is the index of the first transaction that has a system magic // signature. let sys_index = body .transactions - .partition_point(|tx| MagicSig::try_from_signature(tx.signature()).is_some()); + .partition_point(|tx| MagicSig::try_from_signature(tx.signature()).is_none()); body.transactions.truncate(sys_index); + senders.truncate(sys_index); let sealed = SealedBlock::from_sealed_parts(header, body); + RecoveredBlock::new_sealed(sealed, senders) } /// Removes Signet system transactions from the chain. This function uses /// `Arc::make_mut` to clone the contents of the Arc and modify the new /// instance. -fn strip_chain(chain: &mut Arc) { - let chain = Arc::make_mut(chain); +fn strip_chain(chain: &Chain) -> Arc { + // Takes the contents out, replacing with default + let (blocks, outcome, trie) = chain.clone().into_inner(); - let (blocks, outcome, trie) = std::mem::take(chain).into_inner(); - let blocks = blocks.into_blocks().map(strip_block); + // Strip each block + let blocks: Vec> = blocks.into_blocks().map(strip_block).collect(); - *chain = Chain::new(blocks, outcome, trie); + // Replace the original chain with the stripped version + Arc::new(Chain::new(blocks, outcome, trie)) } /// Strips Signet system transactions from the `CanonStateNotification`. pub(crate) fn strip_signet_system_txns(notif: CanonStateNotification) -> CanonStateNotification { - // Cloning here ensures that the `make_mut` invocations in - // `strip_chain` do not ever modify the original `notif` object. - let _c = notif.clone(); - match notif { - CanonStateNotification::Commit { mut new } => { - strip_chain(&mut new); - CanonStateNotification::Commit { new } + CanonStateNotification::Commit { new } => { + CanonStateNotification::Commit { new: strip_chain(&new) } } CanonStateNotification::Reorg { mut old, mut new } => { - strip_chain(&mut old); - strip_chain(&mut new); + old = strip_chain(&old); + new = strip_chain(&new); CanonStateNotification::Reorg { old, new } } } } + +#[cfg(test)] +mod test { + use alloy::{ + consensus::{TxEip1559, TxEnvelope}, + primitives::{Address, B256}, + signers::Signature, + }; + use reth::primitives::{BlockBody, SealedHeader}; + + use super::*; + + fn test_magic_sig_tx() -> TxEnvelope { + let sig = MagicSig::enter(B256::repeat_byte(0x22), 3); + + let sig = sig.into(); + + dbg!(MagicSig::try_from_signature(&sig).is_some()); + + TxEnvelope::new_unchecked(TxEip1559::default().into(), sig, B256::repeat_byte(0x33)) + } + + fn test_non_magic_sig_tx() -> TxEnvelope { + let sig = Signature::test_signature(); + TxEnvelope::new_unchecked(TxEip1559::default().into(), sig.into(), B256::repeat_byte(0x44)) + } + + fn test_block_body() -> BlockBody { + BlockBody { + transactions: vec![ + test_non_magic_sig_tx().into(), + test_non_magic_sig_tx().into(), + test_magic_sig_tx().into(), + test_magic_sig_tx().into(), + ], + ..Default::default() + } + } + + fn test_sealed_header(block_num: u64) -> SealedHeader { + let mut header: reth::primitives::Header = Default::default(); + header.number = block_num; + SealedHeader::new_unhashed(header) + } + + fn test_sealed_block(block_num: u64) -> SealedBlock { + SealedBlock::from_sealed_parts(test_sealed_header(block_num), test_block_body()) + } + + fn test_block(block_num: u64) -> RecoveredBlock { + RecoveredBlock::new_sealed( + test_sealed_block(block_num), + vec![Address::repeat_byte(0x11); 4], + ) + } + + fn test_chain(count: u64) -> Arc { + let blocks = (0..count).map(test_block); + Arc::new(Chain::new(blocks, Default::default(), None)) + } + + #[test] + fn test_strip_block() { + let block = test_block(0); + assert_eq!(block.body().transactions.len(), 4); + assert_eq!(block.senders().len(), 4); + + let stripped = strip_block(block); + assert_eq!(stripped.body().transactions.len(), 2); + assert_eq!(stripped.senders().len(), 2); + + for tx in stripped.body().transactions.iter() { + assert!(MagicSig::try_from_signature(tx.signature()).is_none()); + } + } + + #[test] + fn test_strip_chain() { + let original = test_chain(2); + assert_eq!(original.blocks().len(), 2); + + let chain = strip_chain(&original); + + assert_ne!(&*chain, &*original); + + assert_eq!(chain.blocks().len(), 2); + + for (_num, block) in chain.blocks().iter() { + assert_eq!(block.body().transactions.len(), 2); + assert_eq!(block.senders().len(), 2); + for tx in block.body().transactions.iter() { + assert!(MagicSig::try_from_signature(tx.signature()).is_none()); + } + } + } +} From 2abdbbae4587ba1264c19bddd5c8bf6d99587e78 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 2 Sep 2025 13:25:24 -0400 Subject: [PATCH 2/5] lint: clippy --- crates/rpc/src/ctx/fee_hist.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/rpc/src/ctx/fee_hist.rs b/crates/rpc/src/ctx/fee_hist.rs index 381ebcd..237fa26 100644 --- a/crates/rpc/src/ctx/fee_hist.rs +++ b/crates/rpc/src/ctx/fee_hist.rs @@ -61,7 +61,7 @@ mod test { primitives::{Address, B256}, signers::Signature, }; - use reth::primitives::{BlockBody, SealedHeader}; + use reth::primitives::{BlockBody, Header, SealedHeader}; use super::*; @@ -77,7 +77,7 @@ mod test { fn test_non_magic_sig_tx() -> TxEnvelope { let sig = Signature::test_signature(); - TxEnvelope::new_unchecked(TxEip1559::default().into(), sig.into(), B256::repeat_byte(0x44)) + TxEnvelope::new_unchecked(TxEip1559::default().into(), sig, B256::repeat_byte(0x44)) } fn test_block_body() -> BlockBody { @@ -92,9 +92,8 @@ mod test { } } - fn test_sealed_header(block_num: u64) -> SealedHeader { - let mut header: reth::primitives::Header = Default::default(); - header.number = block_num; + fn test_sealed_header(number: u64) -> SealedHeader { + let header = Header { number, ..Default::default() }; SealedHeader::new_unhashed(header) } From 467ac499f3eeec3eb8d47c35ec9d6e6a6944fa6a Mon Sep 17 00:00:00 2001 From: James Date: Tue, 2 Sep 2025 15:58:30 -0400 Subject: [PATCH 3/5] feat: a task that updates the final/safe/canonical when ingesting --- crates/db/src/journal/ingestor.rs | 74 ++++++++++++++++++++++++++++ crates/db/src/journal/mod.rs | 76 ++--------------------------- crates/db/src/journal/provider.rs | 81 +++++++++++++++++++++++++++++++ crates/db/src/journal/trait.rs | 8 +-- 4 files changed, 164 insertions(+), 75 deletions(-) create mode 100644 crates/db/src/journal/ingestor.rs create mode 100644 crates/db/src/journal/provider.rs diff --git a/crates/db/src/journal/ingestor.rs b/crates/db/src/journal/ingestor.rs new file mode 100644 index 0000000..5b1263c --- /dev/null +++ b/crates/db/src/journal/ingestor.rs @@ -0,0 +1,74 @@ +use crate::{SignetDbRw, journal::JournalDb}; +use futures_util::{Stream, StreamExt}; +use reth::providers::ProviderResult; +use signet_node_types::NodeTypesDbTrait; +use signet_types::primitives::SealedHeader; +use std::sync::Arc; +use tokio::task::JoinHandle; +use trevm::journal::BlockUpdate; + +/// A task that ingests journals into a reth database. +#[derive(Debug)] +pub struct JournalIngestor { + db: Arc>, +} + +impl From> for JournalIngestor { + fn from(value: SignetDbRw) -> Self { + Self::new(value.into()) + } +} + +impl From>> for JournalIngestor { + fn from(value: Arc>) -> Self { + Self::new(value) + } +} + +impl JournalIngestor { + /// Create a new `JournalIngestor` with the given database provider. + pub const fn new(db: Arc>) -> Self { + Self { db } + } + + async fn task_future(self, mut stream: S) -> ProviderResult<()> + where + S: Stream)> + Send + Unpin + 'static, + { + while let Some(item) = stream.next().await { + // FUTURE: Sanity check that the header height matches the update + // height. Sanity check that both heights are 1 greater than the + // last height in the database. + + let db = self.db.clone(); + let (header, block_update) = item; + + // DB interaction is sync, so we spawn a blocking task for it. We + // immediately await that task. This prevents blocking the worker + // thread + tokio::task::spawn_blocking(move || db.ingest(header, block_update)) + .await + .expect("ingestion should not panic")?; + } + // Stream has ended, return Ok + Ok(()) + } + + /// Spawn a task to ingest journals from the provided stream. + pub fn spawn(self, stream: S) -> JoinHandle> + where + S: Stream)> + Send + Unpin + 'static, + { + tokio::spawn(self.task_future(stream)) + } +} + +/// Ingest journals from a stream into a reth database. +pub async fn ingest_journals(db: Arc>, stream: S) -> ProviderResult<()> +where + Db: NodeTypesDbTrait, + S: Stream)> + Send + Unpin + 'static, +{ + let ingestor = JournalIngestor::new(db); + ingestor.task_future(stream).await +} diff --git a/crates/db/src/journal/mod.rs b/crates/db/src/journal/mod.rs index c032cec..2e898db 100644 --- a/crates/db/src/journal/mod.rs +++ b/crates/db/src/journal/mod.rs @@ -3,76 +3,8 @@ mod r#trait; pub use r#trait::JournalDb; -use crate::SignetDbRw; -use futures_util::{Stream, StreamExt}; -use reth::providers::ProviderResult; -use signet_node_types::NodeTypesDbTrait; -use std::sync::Arc; -use tokio::task::JoinHandle; -use trevm::journal::BlockUpdate; +mod provider; +pub use provider::JournalProviderTask; -/// A task that ingests journals into a reth database. -#[derive(Debug)] -pub struct JournalIngestor { - db: Arc>, -} - -impl From> for JournalIngestor { - fn from(value: SignetDbRw) -> Self { - Self::new(value.into()) - } -} - -impl From>> for JournalIngestor { - fn from(value: Arc>) -> Self { - Self::new(value) - } -} - -impl JournalIngestor { - /// Create a new `JournalIngestor` with the given database provider. - pub const fn new(db: Arc>) -> Self { - Self { db } - } - - async fn task_future(self, mut stream: S) -> ProviderResult<()> - where - S: Stream)> + Send + Unpin + 'static, - { - while let Some(item) = stream.next().await { - // FUTURE: Sanity check that the header height matches the update - // height. Sanity check that both heights are 1 greater than the - // last height in the database. - - let db = self.db.clone(); - let (header, block_update) = item; - - // DB interaction is sync, so we spawn a blocking task for it. We - // immediately await that task. This prevents blocking the worker - // thread - tokio::task::spawn_blocking(move || db.ingest(&header, block_update)) - .await - .expect("ingestion should not panic")?; - } - // Stream has ended, return Ok - Ok(()) - } - - /// Spawn a task to ingest journals from the provided stream. - pub fn spawn(self, stream: S) -> JoinHandle> - where - S: Stream)> + Send + Unpin + 'static, - { - tokio::spawn(self.task_future(stream)) - } -} - -/// Ingest journals from a stream into a reth database. -pub async fn ingest_journals(db: Arc>, stream: S) -> ProviderResult<()> -where - Db: NodeTypesDbTrait, - S: Stream)> + Send + Unpin + 'static, -{ - let ingestor = JournalIngestor::new(db); - ingestor.task_future(stream).await -} +mod ingestor; +pub use ingestor::{JournalIngestor, ingest_journals}; diff --git a/crates/db/src/journal/provider.rs b/crates/db/src/journal/provider.rs new file mode 100644 index 0000000..36c5e54 --- /dev/null +++ b/crates/db/src/journal/provider.rs @@ -0,0 +1,81 @@ +use crate::{DataCompat, journal::JournalDb}; +use futures_util::{Stream, StreamExt}; +use reth::{ + providers::{ + CanonChainTracker, DatabaseProviderFactory, DatabaseProviderRW, ProviderResult, + providers::BlockchainProvider, + }, + rpc::types::engine::ForkchoiceState, +}; +use signet_node_types::{NodeTypesDbTrait, SignetNodeTypes}; +use signet_types::primitives::SealedHeader; +use tokio::task::JoinHandle; +use trevm::journal::BlockUpdate; + +/// A task that processes journal updates for a specific database, and calls +/// the appropriate methods on a [`BlockchainProvider`] to update the in-memory +/// chain view. +#[derive(Debug, Clone)] +pub struct JournalProviderTask { + provider: BlockchainProvider>, +} + +impl JournalProviderTask { + /// Instantiate a new task. + pub const fn new(provider: BlockchainProvider>) -> Self { + Self { provider } + } + + /// Get a reference to the provider. + pub const fn provider(&self) -> &BlockchainProvider> { + &self.provider + } + + /// Deconstruct the task into its provider. + pub fn into_inner(self) -> BlockchainProvider> { + self.provider + } + + /// Create a future for the task, suitable for [`tokio::spawn`] or another + /// task-spawning system. + pub async fn task_future(self, mut journals: S) -> ProviderResult<()> + where + S: Stream)> + Send + Unpin + 'static, + { + loop { + let Some((header, block_update)) = journals.next().await else { break }; + + let block_hash = header.hash(); + + let rw = self.provider.database_provider_rw().map(DatabaseProviderRW); + + let r_header = header.clone_convert(); + + // DB interaction is sync, so we spawn a blocking task for it. We + // immediately await that task. This prevents blocking the worker + // thread + tokio::task::spawn_blocking(move || rw?.ingest(header, block_update)) + .await + .expect("ingestion should not panic")?; + + self.provider.set_canonical_head(r_header.clone()); + self.provider.set_safe(r_header.clone()); + self.provider.set_finalized(r_header); + self.provider.on_forkchoice_update_received(&ForkchoiceState { + head_block_hash: block_hash, + safe_block_hash: block_hash, + finalized_block_hash: block_hash, + }); + } + + Ok(()) + } + + /// Spawn the journal provider task. + pub fn spawn(self, journals: S) -> JoinHandle> + where + S: Stream)> + Send + Unpin + 'static, + { + tokio::spawn(self.task_future(journals)) + } +} diff --git a/crates/db/src/journal/trait.rs b/crates/db/src/journal/trait.rs index daaeee9..40de896 100644 --- a/crates/db/src/journal/trait.rs +++ b/crates/db/src/journal/trait.rs @@ -18,7 +18,7 @@ pub trait JournalDb: RuWriter { /// /// This is intended to be used for tx simulation, and other purposes that /// need fast state access WITHTOUT needing to retrieve historical data. - fn ingest(&self, header: &Header, update: BlockUpdate<'_>) -> ProviderResult<()> { + fn ingest(&self, header: SealedHeader, update: BlockUpdate<'_>) -> ProviderResult<()> { let journal_hash = update.journal_hash(); // TODO: remove the clone in future versions. This can be achieved by @@ -29,7 +29,7 @@ pub trait JournalDb: RuWriter { let execution_outcome = ExecutionOutcome::new(bundle_state, vec![], header.number()); let block: SealedBlock = - SealedBlock { header: SealedHeader::new(header.to_owned()), body: Default::default() }; + SealedBlock { header, body: Default::default() }; let block_result = BlockResult { sealed_block: RecoveredBlock::new(block, vec![]), execution_outcome }; @@ -40,7 +40,9 @@ pub trait JournalDb: RuWriter { std::iter::empty(), &block_result, journal_hash, - ) + )?; + + Ok(()) } } From e6445a8c3813813e2ec2af0f2460d66a9ff22c6f Mon Sep 17 00:00:00 2001 From: James Date: Wed, 3 Sep 2025 14:41:12 -0400 Subject: [PATCH 4/5] refactor: make it depend on signet-journal --- Cargo.toml | 1 + crates/db/Cargo.toml | 3 +-- crates/db/src/convert.rs | 2 +- crates/db/src/journal/ingestor.rs | 16 +++++++--------- crates/db/src/journal/provider.rs | 21 ++++++++++----------- crates/db/src/journal/trait.rs | 13 ++++++++----- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d2ca8ec..e73ac7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ signet-bundle = "0.10.0" signet-constants = "0.10.0" signet-evm = "0.10.0" signet-extract = "0.10.0" +signet-journal = "0.10.0" signet-tx-cache = "0.10.0" signet-types = "0.10.0" signet-zenith = "0.10.0" diff --git a/crates/db/Cargo.toml b/crates/db/Cargo.toml index 2877093..cf52191 100644 --- a/crates/db/Cargo.toml +++ b/crates/db/Cargo.toml @@ -12,11 +12,10 @@ repository.workspace = true signet-node-types.workspace = true signet-evm.workspace = true +signet-journal.workspace = true signet-types.workspace = true signet-zenith.workspace = true -trevm.workspace = true - alloy.workspace = true reth.workspace = true diff --git a/crates/db/src/convert.rs b/crates/db/src/convert.rs index 95faea1..7737b84 100644 --- a/crates/db/src/convert.rs +++ b/crates/db/src/convert.rs @@ -10,7 +10,7 @@ use alloy::consensus::TxReceipt; /// Trait for types that can be converted into other types as they're already compatible. -/// Uswed for converting between alloy/reth/signet types. +/// Used for converting between alloy/reth/signet types. pub trait DataCompat>: Sized { /// Convert `self` into the target type. fn convert(self) -> Other; diff --git a/crates/db/src/journal/ingestor.rs b/crates/db/src/journal/ingestor.rs index 5b1263c..481e5a3 100644 --- a/crates/db/src/journal/ingestor.rs +++ b/crates/db/src/journal/ingestor.rs @@ -1,11 +1,10 @@ use crate::{SignetDbRw, journal::JournalDb}; -use futures_util::{Stream, StreamExt}; +use futures_util::StreamExt; use reth::providers::ProviderResult; +use signet_journal::{Journal, JournalStream}; use signet_node_types::NodeTypesDbTrait; -use signet_types::primitives::SealedHeader; use std::sync::Arc; use tokio::task::JoinHandle; -use trevm::journal::BlockUpdate; /// A task that ingests journals into a reth database. #[derive(Debug)] @@ -33,20 +32,19 @@ impl JournalIngestor { async fn task_future(self, mut stream: S) -> ProviderResult<()> where - S: Stream)> + Send + Unpin + 'static, + S: JournalStream<'static> + Send + Unpin + 'static, { - while let Some(item) = stream.next().await { + while let Some(Journal::V1(journal)) = stream.next().await { // FUTURE: Sanity check that the header height matches the update // height. Sanity check that both heights are 1 greater than the // last height in the database. let db = self.db.clone(); - let (header, block_update) = item; // DB interaction is sync, so we spawn a blocking task for it. We // immediately await that task. This prevents blocking the worker // thread - tokio::task::spawn_blocking(move || db.ingest(header, block_update)) + tokio::task::spawn_blocking(move || db.ingest(journal)) .await .expect("ingestion should not panic")?; } @@ -57,7 +55,7 @@ impl JournalIngestor { /// Spawn a task to ingest journals from the provided stream. pub fn spawn(self, stream: S) -> JoinHandle> where - S: Stream)> + Send + Unpin + 'static, + S: JournalStream<'static> + Send + Unpin + 'static, { tokio::spawn(self.task_future(stream)) } @@ -67,7 +65,7 @@ impl JournalIngestor { pub async fn ingest_journals(db: Arc>, stream: S) -> ProviderResult<()> where Db: NodeTypesDbTrait, - S: Stream)> + Send + Unpin + 'static, + S: JournalStream<'static> + Send + Unpin + 'static, { let ingestor = JournalIngestor::new(db); ingestor.task_future(stream).await diff --git a/crates/db/src/journal/provider.rs b/crates/db/src/journal/provider.rs index 36c5e54..31cad05 100644 --- a/crates/db/src/journal/provider.rs +++ b/crates/db/src/journal/provider.rs @@ -1,16 +1,16 @@ -use crate::{DataCompat, journal::JournalDb}; -use futures_util::{Stream, StreamExt}; +use crate::journal::JournalDb; +use futures_util::StreamExt; use reth::{ + primitives::SealedHeader, providers::{ CanonChainTracker, DatabaseProviderFactory, DatabaseProviderRW, ProviderResult, providers::BlockchainProvider, }, rpc::types::engine::ForkchoiceState, }; +use signet_journal::{Journal, JournalStream}; use signet_node_types::{NodeTypesDbTrait, SignetNodeTypes}; -use signet_types::primitives::SealedHeader; use tokio::task::JoinHandle; -use trevm::journal::BlockUpdate; /// A task that processes journal updates for a specific database, and calls /// the appropriate methods on a [`BlockchainProvider`] to update the in-memory @@ -40,21 +40,20 @@ impl JournalProviderTask { /// task-spawning system. pub async fn task_future(self, mut journals: S) -> ProviderResult<()> where - S: Stream)> + Send + Unpin + 'static, + S: JournalStream<'static> + Send + Unpin + 'static, { loop { - let Some((header, block_update)) = journals.next().await else { break }; - - let block_hash = header.hash(); + let Some(Journal::V1(journal)) = journals.next().await else { break }; let rw = self.provider.database_provider_rw().map(DatabaseProviderRW); - let r_header = header.clone_convert(); + let r_header = SealedHeader::new_unhashed(journal.header().clone()); + let block_hash = r_header.hash(); // DB interaction is sync, so we spawn a blocking task for it. We // immediately await that task. This prevents blocking the worker // thread - tokio::task::spawn_blocking(move || rw?.ingest(header, block_update)) + tokio::task::spawn_blocking(move || rw?.ingest(journal)) .await .expect("ingestion should not panic")?; @@ -74,7 +73,7 @@ impl JournalProviderTask { /// Spawn the journal provider task. pub fn spawn(self, journals: S) -> JoinHandle> where - S: Stream)> + Send + Unpin + 'static, + S: JournalStream<'static> + Send + Unpin + 'static, { tokio::spawn(self.task_future(journals)) } diff --git a/crates/db/src/journal/trait.rs b/crates/db/src/journal/trait.rs index 40de896..cac2020 100644 --- a/crates/db/src/journal/trait.rs +++ b/crates/db/src/journal/trait.rs @@ -2,8 +2,8 @@ use crate::RuWriter; use alloy::consensus::{BlockHeader, Header}; use reth::{providers::ProviderResult, revm::db::BundleState}; use signet_evm::{BlockResult, ExecutionOutcome}; +use signet_journal::HostJournal; use signet_types::primitives::{RecoveredBlock, SealedBlock, SealedHeader, TransactionSigned}; -use trevm::journal::BlockUpdate; /// A database that can be updated with journals. pub trait JournalDb: RuWriter { @@ -18,18 +18,21 @@ pub trait JournalDb: RuWriter { /// /// This is intended to be used for tx simulation, and other purposes that /// need fast state access WITHTOUT needing to retrieve historical data. - fn ingest(&self, header: SealedHeader, update: BlockUpdate<'_>) -> ProviderResult<()> { - let journal_hash = update.journal_hash(); + fn ingest(&self, journal: HostJournal<'static>) -> ProviderResult<()> { + let journal_hash = journal.journal_hash(); + + let (meta, bsi) = journal.into_parts(); + let (_, _, header) = meta.into_parts(); // TODO: remove the clone in future versions. This can be achieved by // _NOT_ making a `BlockResult` and instead manually updating relevan // tables. However, this means diverging more fro the underlying reth // logic that we are currently re-using. - let bundle_state: BundleState = update.journal().clone().into(); + let bundle_state: BundleState = bsi.into(); let execution_outcome = ExecutionOutcome::new(bundle_state, vec![], header.number()); let block: SealedBlock = - SealedBlock { header, body: Default::default() }; + SealedBlock { header: SealedHeader::new(header), body: Default::default() }; let block_result = BlockResult { sealed_block: RecoveredBlock::new(block, vec![]), execution_outcome }; From c319849b9e102714e3aa170f7b1beb726bd8b8ae Mon Sep 17 00:00:00 2001 From: James Date: Wed, 3 Sep 2025 16:46:29 -0400 Subject: [PATCH 5/5] fix: update sdk to 0.10.1 --- Cargo.toml | 18 +++++++++--------- crates/db/src/journal/trait.rs | 9 ++++++--- crates/db/src/provider.rs | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e73ac7f..45128f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.package] -version = "0.10.0" +version = "0.10.1" edition = "2024" rust-version = "1.88" authors = ["init4"] @@ -41,14 +41,14 @@ signet-rpc = { version = "0.10.0", path = "crates/rpc" } init4-bin-base = { version = "0.11.0", features = ["alloy"] } -signet-bundle = "0.10.0" -signet-constants = "0.10.0" -signet-evm = "0.10.0" -signet-extract = "0.10.0" -signet-journal = "0.10.0" -signet-tx-cache = "0.10.0" -signet-types = "0.10.0" -signet-zenith = "0.10.0" +signet-bundle = "0.10.1" +signet-constants = "0.10.1" +signet-evm = "0.10.1" +signet-extract = "0.10.1" +signet-journal = "0.10.1" +signet-tx-cache = "0.10.1" +signet-types = "0.10.1" +signet-zenith = "0.10.1" # ajj ajj = { version = "0.3.4" } diff --git a/crates/db/src/journal/trait.rs b/crates/db/src/journal/trait.rs index cac2020..014714f 100644 --- a/crates/db/src/journal/trait.rs +++ b/crates/db/src/journal/trait.rs @@ -22,7 +22,7 @@ pub trait JournalDb: RuWriter { let journal_hash = journal.journal_hash(); let (meta, bsi) = journal.into_parts(); - let (_, _, header) = meta.into_parts(); + let (host_height, _, header) = meta.into_parts(); // TODO: remove the clone in future versions. This can be achieved by // _NOT_ making a `BlockResult` and instead manually updating relevan @@ -33,8 +33,11 @@ pub trait JournalDb: RuWriter { let block: SealedBlock = SealedBlock { header: SealedHeader::new(header), body: Default::default() }; - let block_result = - BlockResult { sealed_block: RecoveredBlock::new(block, vec![]), execution_outcome }; + let block_result = BlockResult { + sealed_block: RecoveredBlock::new(block, vec![]), + execution_outcome, + host_height, + }; self.append_host_block( None, diff --git a/crates/db/src/provider.rs b/crates/db/src/provider.rs index 7e07109..25b245a 100644 --- a/crates/db/src/provider.rs +++ b/crates/db/src/provider.rs @@ -417,7 +417,7 @@ where // // last reviewed at tag v1.5.1 - let BlockResult { sealed_block: block, execution_outcome } = block_result; + let BlockResult { sealed_block: block, execution_outcome, .. } = block_result; let ru_height = block.number(); self.insert_signet_block(header, block, journal_hash, StorageLocation::Database)?;