Conversation
This will need to be wired to the new chain selection stage that doesn't yet exist. Signed-off-by: Roland Kuhn <rk@rkuhn.info>
Signed-off-by: Roland Kuhn <rk@rkuhn.info>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
WalkthroughThis PR consolidates the Changes
Sequence DiagramsequenceDiagram
participant Peer as Peer (Upstream)
participant TP as TrackPeers Stage
participant CO as ConsensusOps
participant DL as Ledger/Store
participant Mgr as Manager (Downstream)
Peer->>TP: ChainSyncInitiatorMsg (FromUpstream)
TP->>TP: Match message variant
alt Initialize
TP->>TP: Add peer to upstream map
TP->>Mgr: Signal peer ready
else IntersectFound
TP->>TP: Update peer current tip
else RollForward
TP->>CO: validate_header(peer, raw_header)
CO->>DL: Decode & validate BlockHeader
DL-->>CO: BlockHeader result
CO-->>TP: Validated header
TP->>CO: roll_forward(peer, header, tip)
CO->>DL: Store header, update chain state
DL-->>CO: Result<Tip>
CO-->>TP: Updated tip
TP->>TP: Update peer highest
TP->>Mgr: Send downstream Tip event
else RollBackward
TP->>CO: roll_backward(peer, current, tip)
CO->>DL: Rollback chain state
DL-->>CO: Result<()>
CO-->>TP: Rollback result
TP->>TP: Update peer current
end
TP-->>Peer: State update (continue/stop)
Estimated code review effort🎯 5 (Critical) | ⏱️ ~135 minutes Reasoning: This PR is substantial and heterogeneous. The scope spans 40+ files across consensus, protocols, kernel, and application layers. Key complexity drivers: (1) large-scale crate consolidation with 1294 lines removed + 1613 lines of new type definitions; (2) cross-cutting import refactors affecting module visibility and type paths throughout the codebase; (3) new stage implementation with 1287 lines of logic and extensive test coverage; (4) public API surface changes (Clone trait implementations, accessor methods, type signature changes in several key structs); (5) error handling enhancements requiring review across multiple call sites; (6) interconnected refactors in consensus effects, store relocation, and chain-sync message types that demand careful reasoning about each integration point. Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Roland Kuhn <rk@rkuhn.info>
53089de to
be54a0a
Compare
This stage will replace pull+receive_header+validate_header stages as well as incorporate the upstream peer tracking currently performed in the HeadersTree that is employed by select_chain. This is a sketch of the envisioned consensus stages, whereof this PR is the first step.

This is also the first step of #658.
Summary by CodeRabbit
New Features
Improvements
Refactor