refactor(node): W1b-3 — seam chia_peer, ChainSource trait/handle carve (#1285) - #68
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
…e (#1285, #1298) Carves the chain-source Node surface into the ChainSource trait (seam 1's public boundary), implemented by Node with the existing anchored_root_resolver accessor unchanged. Relocates the concrete production resolver (CoinsetResolver + its resolution_coinset/default_anchored_resolver helpers) from lib.rs into seams/chia_peer/coinset_resolver.rs, unchanged — no logic/algorithm change. The shared AnchoredRootResolver trait + AnchoredStoreState (W1a) stay in shared/ as the cross-seam vocabulary every seam already reads a chain-anchored root through; ChainSource composes/exposes that SAME shared resolver rather than duplicating its contract, so every consumer (content-serve's pin, chainwatch's gap-filler) keeps sharing one Arc<dyn AnchoredRootResolver>. Every caller (chainwatch.rs's spawn_chain_watch, lib.rs's own tests) now brings ChainSource into scope via `use crate::ChainSource` (or lib.rs's own `pub use`) — the only change any caller needed; no signature or behaviour changed anywhere. default_anchored_resolver/resolution_coinset stay crate-internal (pub(crate)), matching their prior visibility. Depends on W1b-2 (merged, #1285). Co-Authored-By: Claude <noreply@anthropic.com>
MichaelTaylor3d
marked this pull request as ready for review
July 20, 2026 21:36
MichaelTaylor3d
commented
Jul 20, 2026
MichaelTaylor3d
left a comment
Contributor
Author
There was a problem hiding this comment.
PASS — single correctness gate (fresh context), W1b-3 seam chia_peer / ChainSource carve.
Verified:
- Behaviour-preserving / zero logic change.
CoinsetResolver,resolution_coinset,default_anchored_resolverbodies are byte-identical in their newseams/chia_peer/home (confirmed viagit diff -w); no changed bodies/assertions. Real change = relocation +ChainSourcetrait def/impl + re-exports + version bump. - No duplication.
AnchoredRootResolver+AnchoredStoreStateremain defined ONLY inshared/chain_view.rs(from W1a); the seam imports them viacrate::shared::chain_viewandChainSourcecomposes (hands out the sameArc<dyn AnchoredRootResolver>) rather than copying. - E0364 fix preserves visibility.
default_anchored_resolver/resolution_coinsetstaypub(crate)end-to-end (pub(crate) fn→pub(crate) usein mod.rs →pub(crate) usein lib.rs) — not widened. - Blast radius bounded + back-compat. Both use-sites resolve: chainwatch.rs:281 (imports
ChainSource) and lib.rs:3392 (test).resolution_coinset/default_anchored_resolvercallers in lib.rs (1280/1632/1691/2982/3042) keep working via the crate-internal re-export; originalcrate::paths preserved. Clippy/Rustfmt/CodeQL green (compile-green). - Versions core 0.13.5 + binary 0.47.5 present and agree. Zero unresolved threads.
Non-gating note (resolved, not a blocker): CoinsetResolver visibility widened from a private struct to pub struct + re-exported to the crate's public API. It's additive (§5.1-safe), a zero-field unit struct implementing an already-public trait (no internals leaked), and matches the seam-surface pattern; but it is broader than the move strictly requires (has no external caller yet). Acceptable as a deliberate, documented seam-surface choice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
W1b-3 (4th of the 7 W1b sub-PRs, #1285): carve chainwatch.rs's `impl Node` methods +
relocate the concrete `CoinsetResolver` (currently in lib.rs) into `seams/chia_peer/`,
exposing a `ChainSource` trait + handle. The shared `AnchoredRootResolver` trait +
`AnchoredStoreState` (W1a) stay in `shared/` — `ChainSource` is the seam-1 boundary
trait, composing/using the shared vocabulary rather than duplicating it.
Behaviour-preserving only — byte-identical bodies relocated, no logic change.
Depends on W1b-2 (merged, origin/main @ b2104c2).
Closes nothing yet (tracking #1285).