Skip to content

csnode: take a bootstrap round table only for a round next to the node's own, and only once its round has stalled - #79

Open
EnzinoBB wants to merge 1 commit into
CREDITSCOM:masterfrom
CreditsCommunity:official/bootstrap-gate
Open

EnzinoBB wants to merge 1 commit into
CREDITSCOM:masterfrom
CreditsCommunity:official/bootstrap-gate

Conversation

@EnzinoBB

@EnzinoBB EnzinoBB commented Nov 1, 2026

Copy link
Copy Markdown

Why this PR

Node::getBootstrapTable takes a bootstrap round table for any round number, at any time, as long as it weighs more than the last one taken. An unsigned table is not authenticated, so a node can be pushed into a bootstrap round while its own round is progressing normally, or for a round far from its own. The same function also requests the removal of blocks derived from the table's round; that request never takes effect (the permission flag it sets is already set by every loaded or recorded block). Reported privately to the Credits team (problem 2 of our report). This PR is a mitigation that every node can deploy on its own; the complete fix (every bootstrap table signed with the blockchain key) changes what nodes accept and needs a coordinated release.

What changes

  • cs::isBootstrapRoundInWindow (new csnode/include/csnode/bootstrapgate.hpp): a table is taken only for a round from the node's last block to max(last block, current round) + 2, the rounds an honest starter (its last block + 1) sends to a node at most one block away or still syncing.
  • cs::isBootstrapStallAccepted: an unsigned table is taken only once the node's own round has lasted half of round_elapse_time, the condition under which an honest node starts a bootstrap. A node younger than round_elapse_time, or already in a bootstrap round, takes it as today.
  • RoundStat keeps the time of the last round change (msSinceRoundChange) apart from the elapse tick, and the node start time (msSinceStart).
  • A table of initial confidants signed with the blockchain key through the diag API is recognised by its signature and skips the stall check.
  • A table whose signature cannot be read is dropped (processing went on before).
  • The block-removal request derived from the table's round is removed.

Effect on the network

Nothing changes on the wire. An honest bootstrap still works: the starter only sends a table after its own round stalled, and the receivers of an honest table are within the window. A node with this change ignores tables that a node without it would take outside that window or before its round stalls. Tested on private networks of mixed official and community binaries, including bootstrap restarts.

Tests

tests/csnode/bootstrapgate_tests.cpp (new): the window (honest rounds, other rounds, no overflow near the top) and the stall rule. Built and run on 4a95aaa (GCC 13).

Same change in the community fork: CreditsCommunity#71, running on mainnet community nodes.

…d stall state

- a table is taken only for a round next to the node's own: from its last block to its round + 2,
  the rounds an honest starter (last block + 1) sends to a node at most one block away or that
  learned the round (cs::isBootstrapRoundInWindow, csnode/bootstrapgate.hpp)
- an unsigned table only once the node's own round has lasted half of round_elapse_time, the
  condition under which an honest node starts a bootstrap; a node younger than round_elapse_time
  or already in a bootstrap round takes it as before (cs::isBootstrapStallAccepted). RoundStat
  keeps the time of the last round change apart from the elapse tick
- a table of initial confidants signed through the diag API is recognised by its signature and
  skips the stall check
- a table whose signature cannot be read is dropped (it went on before)
- the block-removal request derived from the table's round is gone: the permission flag it set
  is already set by every loaded or recorded block, so it never took effect

Same change in the community fork: #71.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

1 participant