Skip to content

fix(node): recover sync state after outbound request failure - #147

Open
zjubiology wants to merge 1 commit into
MbongoChain:devfrom
zjubiology:dev
Open

zjubiology wants to merge 1 commit into
MbongoChain:devfrom
zjubiology:dev

Conversation

@zjubiology

Copy link
Copy Markdown

Description

Fix a sync liveness failure where an outbound GetBlocks error could leave the orchestrator permanently stuck with in_flight = true.

The P2P layer now tracks outbound block-range request IDs and emits the internal-only SyncEvent::RequestFailed event when one of those requests fails. GetHeight failures are deliberately excluded so they cannot clear an unrelated block request.

The sync orchestrator clears in_flight on that event, allowing a later height response or block-gap announcement to restart synchronization.

request_next_batch() now returns true only when the SyncCommand was successfully accepted by the command channel.

Regression tests cover:

  • forwarding a GetBlocks outbound failure;
  • not forwarding a GetHeight failure as a block-request failure;
  • retrying after the orchestrator receives RequestFailed;
  • leaving in_flight false when the command receiver has been dropped.

No locked surfaces affected. This changes only in-process request tracking and node orchestration. SyncRequest, SyncResponse, SyncNotification, SCALE encodings, protocol strings, MAX_RANGE, consensus, storage semantics, and RPC contracts are unchanged.

Linked Issue

Closes #146

Scope Confirmation

  • Targets dev branch
  • Linked to an open issue
  • Does not modify consensus logic unless explicitly scoped
  • Does not introduce new cryptographic primitives unless explicitly scoped

Determinism Checklist

  • Deterministic replay verified
  • No state transition divergence
  • Replay harness passes

Security Checklist

  • I understand all code submitted
  • Reviewed overflow / underflow risks
  • Reviewed error handling paths
  • Added unit tests if applicable

Testing

cargo +1.94.0 fmt --all -- --check
PASS

cargo +1.94.0 clippy --all-targets --all-features -- -D warnings
PASS

cargo test --workspace
PASS

cargo run -p mbongo-node --bin replay_harness
DETERMINISTIC REPLAY: PASS

cargo run -p mbongo-node --bin devnet_harness
DEVNET CONVERGENCE: PASS

git diff --check
PASS

Signed-off-by: zjubiology <zjubiology@outlook.com>

This branch has not been deployed

No deployments
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.

[BUG] node: sync can stall after an outbound GetBlocks failure

1 participant