Skip to content

[hackathon] feat: add HostNotifier trait and decouple node from ExExContext#105

Draft
prestwich wants to merge 6 commits intorefactor/preparatory-genericsfrom
feat/host-notifier-trait
Draft

[hackathon] feat: add HostNotifier trait and decouple node from ExExContext#105
prestwich wants to merge 6 commits intorefactor/preparatory-genericsfrom
feat/host-notifier-trait

Conversation

@prestwich
Copy link
Member

@prestwich prestwich commented Mar 13, 2026

Summary

  • Add new signet-node-types crate with HostNotifier trait, HostNotification, and HostNotificationKind types — no reth dependencies
  • Refactor signet-node to be generic over HostNotifier instead of depending on ExExContext<Host> directly
  • Remove reth ExEx dependency from signet-node-config (RPC config moved to host-reth in follow-up PR)
  • SignetNodeBuilder now accepts any HostNotifier implementation

PR 2 of 5 in the host context adapter refactor.
Precursor: #104

Test plan

  • cargo clippy -p signet-node-types --all-features --all-targets
  • cargo clippy -p signet-node --all-features --all-targets
  • cargo clippy -p signet-node-config --all-features --all-targets
  • cargo clippy -p signet-node-config --no-default-features --all-targets
  • cargo +nightly fmt

🤖 Generated with Claude Code

@prestwich prestwich requested a review from a team as a code owner March 13, 2026 19:52
@prestwich prestwich marked this pull request as draft March 13, 2026 19:56
@prestwich prestwich changed the title feat: add HostNotifier trait and decouple node from ExExContext [hackathon] feat: add HostNotifier trait and decouple node from ExExContext Mar 13, 2026
@prestwich prestwich force-pushed the feat/host-notifier-trait branch from fdae9f3 to 1654673 Compare March 13, 2026 20:11
prestwich and others added 4 commits March 13, 2026 16:24
Introduces the signet-node-types crate containing HostNotification,
HostNotificationKind, and the HostNotifier trait — the core abstraction
layer for host chain events with no reth dependencies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
signet-node is now reth-free. All host chain interaction flows through
the HostNotifier trait from signet-node-types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add doc note that `None` means use backend default for
`set_backfill_thresholds`, and add comment in node-config noting that
RPC config merging moved to the host adapter crate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich prestwich force-pushed the feat/host-notifier-trait branch from 1654673 to 09aad33 Compare March 13, 2026 20:25
…ight clamping

Remove the introduced chain_name field from SignetNode and its builder.
Add committed_chain/reverted_chain shortcuts on HostNotification to
avoid reaching through .kind at call sites. Unify load_safe_block_heights
and load_finalized_block_heights into a single clamp_host_heights method.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich
Copy link
Member Author

[Claude Code]

Note: CI failures here are expected — test fixes land in #108 (fix/node-tests-host-notifier). PRs #104, #105, #106, #107, and #108 are intended to be merged as a unit; they are broken out into separate PRs for review isolation.

@prestwich
Copy link
Member Author

[Claude Code]

Code review

Found 3 issues:

  1. node-tests uses the removed .with_ctx() API, which will cause a compile failure. The PR removes .with_ctx(ExExContext) from SignetNodeBuilder and replaces it with .with_notifier(), but crates/node-tests/src/context.rs and crates/node-tests/tests/db.rs still call .with_ctx(ctx).

let (node, mut node_status) = SignetNodeBuilder::new(cfg.clone())
.with_ctx(ctx)
.with_storage(Arc::clone(&storage))

let (_, _) = SignetNodeBuilder::new(cfg.clone())
.with_ctx(ctx)
.with_storage(Arc::clone(&storage))

  1. crates/node/src/alias.rs is orphaned. The PR removes mod alias from lib.rs and removes the reth dependency from Cargo.toml, but leaves alias.rs on disk. The file imports from reth which is no longer a dependency, so it would fail to compile if ever re-included.

use alloy::{consensus::constants::KECCAK_EMPTY, primitives::Address};
use core::{
fmt,
future::{self, Future},
};
use eyre::OptionExt;
use reth::providers::{StateProviderBox, StateProviderFactory};
use signet_block_processor::{AliasOracle, AliasOracleFactory};
/// An [`AliasOracle`] backed by a reth [`StateProviderBox`].

  1. if/else instead of functional combinator in start_inner (CLAUDE.md says "ALWAYS prefer functional combinators over imperative control flow")

// Set the head position and backfill thresholds on the notifier
let host_height = if last_rollup_block == 0 {
self.constants.host_deploy_height()
} else {
self.constants.pair_ru(last_rollup_block).host
};
self.notifier.set_head(host_height);

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

- Add implementation guide and rustdoc examples to HostNotifier trait
- Add rustdoc examples to HostNotification and HostNotificationKind
- Add rustdoc example to SignetNodeBuilder
- Use functional combinators in metrics (inspect over if/is_some)
- Narrow visibility: on_notification, on_host_revert, start_rpc → pub(crate)
- Enforce blob_cacher, serve_config, rpc_config at compile time via
  type-state builder params (removing runtime ok_or_eyre checks)
- Document intentional snapshot semantics on HostNotification
- Document unwrap_or(0) safety in on_host_revert

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant