Skip to content

Commit 156fe47

Browse files
prestwichclaude
andcommitted
test: update signet-node-tests for HostNotifier API
Use decompose_exex_context to construct RethHostNotifier and pass it through the new builder API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 79805e7 commit 156fe47

3 files changed

Lines changed: 46 additions & 3 deletions

File tree

crates/node-tests/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ repository.workspace = true
1212
signet-node.workspace = true
1313
signet-node-config = { workspace = true, features = ["test_utils"] }
1414

15+
signet-blobber.workspace = true
1516
signet-cold = { workspace = true, features = ["in-memory"] }
1617
signet-constants.workspace = true
1718
signet-evm.workspace = true
1819
signet-genesis.workspace = true
20+
signet-host-reth.workspace = true
1921
signet-hot = { workspace = true, features = ["in-memory"] }
2022
signet-storage.workspace = true
2123
signet-storage-types.workspace = true
@@ -31,6 +33,7 @@ reth-exex-test-utils.workspace = true
3133
reth-node-api.workspace = true
3234

3335
eyre.workspace = true
36+
reqwest.workspace = true
3437
tokio.workspace = true
3538
tracing.workspace = true
3639
tracing-subscriber.workspace = true

crates/node-tests/src/context.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use reth::transaction_pool::{TransactionOrigin, TransactionPool, test_utils::Moc
1818
use reth_exex_test_utils::{Adapter, TestExExHandle};
1919
use reth_node_api::FullNodeComponents;
2020
use signet_cold::{ColdStorageReadHandle, mem::MemColdBackend};
21+
use signet_host_reth::decompose_exex_context;
2122
use signet_hot::{
2223
db::{HotDbRead, UnsafeDbWrite},
2324
mem::MemKv,
@@ -104,6 +105,9 @@ impl SignetTestContext {
104105
let (ctx, handle) = reth_exex_test_utils::test_exex_context().await.unwrap();
105106
let components = ctx.components.clone();
106107

108+
// Decompose the ExEx context into notifier + configs
109+
let decomposed = decompose_exex_context(ctx);
110+
107111
// set up Signet Node storage
108112
let constants = cfg.constants().unwrap();
109113

@@ -148,10 +152,25 @@ impl SignetTestContext {
148152

149153
let alias_oracle: Arc<Mutex<HashSet<Address>>> = Arc::new(Mutex::new(HashSet::default()));
150154

155+
// Build the blob cacher from the decomposed pool
156+
let blob_cacher = signet_blobber::BlobFetcher::builder()
157+
.with_config(cfg.block_extractor())
158+
.unwrap()
159+
.with_pool(decomposed.pool)
160+
.with_client(reqwest::Client::new())
161+
.build_cache()
162+
.unwrap()
163+
.spawn::<alloy::consensus::SimpleCoder>();
164+
151165
let (node, mut node_status) = SignetNodeBuilder::new(cfg.clone())
152-
.with_ctx(ctx)
166+
.with_notifier(decomposed.notifier)
153167
.with_storage(Arc::clone(&storage))
154168
.with_alias_oracle(Arc::clone(&alias_oracle))
169+
.with_chain_name(decomposed.chain_name)
170+
.with_blob_cacher(blob_cacher)
171+
.with_serve_config(decomposed.serve_config)
172+
.with_rpc_config(decomposed.rpc_config)
173+
.with_client(reqwest::Client::new())
155174
.build()
156175
.await
157176
.unwrap();

crates/node-tests/tests/db.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
use alloy::primitives::map::HashSet;
12
use serial_test::serial;
23
use signet_cold::mem::MemColdBackend;
4+
use signet_host_reth::decompose_exex_context;
35
use signet_hot::{
46
db::{HotDbRead, UnsafeDbWrite},
57
mem::MemKv,
68
};
79
use signet_node::SignetNodeBuilder;
810
use signet_node_config::test_utils::test_config;
911
use signet_storage::{CancellationToken, HistoryRead, HistoryWrite, HotKv, UnifiedStorage};
10-
use std::sync::Arc;
12+
use std::sync::{Arc, Mutex};
1113

1214
#[serial]
1315
#[tokio::test]
@@ -19,6 +21,8 @@ async fn test_genesis() {
1921
let chain_spec: Arc<_> = cfg.chain_spec().clone();
2022
assert_eq!(chain_spec.genesis().config.chain_id, consts.unwrap().ru_chain_id());
2123

24+
let decomposed = decompose_exex_context(ctx);
25+
2226
let cancel_token = CancellationToken::new();
2327
let hot = MemKv::new();
2428
{
@@ -30,9 +34,26 @@ async fn test_genesis() {
3034

3135
let storage = Arc::new(UnifiedStorage::spawn(hot, MemColdBackend::new(), cancel_token.clone()));
3236

37+
let blob_cacher = signet_blobber::BlobFetcher::builder()
38+
.with_config(cfg.block_extractor())
39+
.unwrap()
40+
.with_pool(decomposed.pool)
41+
.with_client(reqwest::Client::new())
42+
.build_cache()
43+
.unwrap()
44+
.spawn::<alloy::consensus::SimpleCoder>();
45+
46+
let alias_oracle: Arc<Mutex<HashSet<_>>> = Arc::new(Mutex::new(HashSet::default()));
47+
3348
let (_, _) = SignetNodeBuilder::new(cfg.clone())
34-
.with_ctx(ctx)
49+
.with_notifier(decomposed.notifier)
3550
.with_storage(Arc::clone(&storage))
51+
.with_alias_oracle(Arc::clone(&alias_oracle))
52+
.with_chain_name(decomposed.chain_name)
53+
.with_blob_cacher(blob_cacher)
54+
.with_serve_config(decomposed.serve_config)
55+
.with_rpc_config(decomposed.rpc_config)
56+
.with_client(reqwest::Client::new())
3657
.build()
3758
.await
3859
.unwrap();

0 commit comments

Comments
 (0)