Skip to content

refactor(node): W1b-3 — seam chia_peer, ChainSource trait/handle carve (#1285) - #68

Merged
MichaelTaylor3d merged 2 commits into
mainfrom
feat/w1b3-seam-chia-peer
Jul 20, 2026
Merged

refactor(node): W1b-3 — seam chia_peer, ChainSource trait/handle carve (#1285)#68
MichaelTaylor3d merged 2 commits into
mainfrom
feat/w1b3-seam-chia-peer

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

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).

MichaelTaylor3d and others added 2 commits July 20, 2026 14:12
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
MichaelTaylor3d marked this pull request as ready for review July 20, 2026 21:36

@MichaelTaylor3d MichaelTaylor3d left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PASS — single correctness gate (fresh context), W1b-3 seam chia_peer / ChainSource carve.

Verified:

  • Behaviour-preserving / zero logic change. CoinsetResolver, resolution_coinset, default_anchored_resolver bodies are byte-identical in their new seams/chia_peer/ home (confirmed via git diff -w); no changed bodies/assertions. Real change = relocation + ChainSource trait def/impl + re-exports + version bump.
  • No duplication. AnchoredRootResolver + AnchoredStoreState remain defined ONLY in shared/chain_view.rs (from W1a); the seam imports them via crate::shared::chain_view and ChainSource composes (hands out the same Arc<dyn AnchoredRootResolver>) rather than copying.
  • E0364 fix preserves visibility. default_anchored_resolver/resolution_coinset stay pub(crate) end-to-end (pub(crate) fnpub(crate) use in mod.rs → pub(crate) use in 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_resolver callers in lib.rs (1280/1632/1691/2982/3042) keep working via the crate-internal re-export; original crate:: 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.

@MichaelTaylor3d
MichaelTaylor3d merged commit 335ac46 into main Jul 20, 2026
12 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the feat/w1b3-seam-chia-peer branch July 20, 2026 21:42
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