Skip to content

csnode: bootstrap tables of 9 to 25 confidants, official weights up to 8 - #70

Merged
EnzinoBB merged 1 commit into
masterfrom
fix/bootstrap-weight
Oct 22, 2026
Merged

EnzinoBB merged 1 commit into
masterfrom
fix/bootstrap-weight

Conversation

@EnzinoBB

@EnzinoBB EnzinoBB commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Node::calculateBootStrapWeight can only weigh bootstrap tables of up to 8 confidants. A network of 9 or more initial confidants therefore never bootstraps. In testnet run 39758454691 (9 nodes) every node stayed at sequence 0 for 45 minutes. This is an upstream issue; mainnet (7 default confidants) is not affected as configured today.

Change

cs::bootstrapWeight (csnode/include/csnode/bootstrapweight.hpp) replaces the calculation.

  • Up to 8 keys: exactly the official values on x86-64, so community and official nodes choose the same table. This was checked against a replica of the official loop on every table of up to 8 keys taken from up to 12 initial confidants, in order and shuffled: 179,656 cases, no difference.
  • 9 to 25 keys (MaxTrustedNodes): well-formed tables of initial confidants are weighed, and a larger table weighs more than a smaller one.
  • 32-bit weight, no undefined behaviour in the loop.
  • Signed tables weigh more than any unsigned one.
  • Logging: Bootstrap on logs the table's size and weight, and a table that is not taken is logged.

Tests

  • Golden values of the official function.
  • Every table of up to 8 keys compared with the official loop.
  • Partial tables of 7.
  • Tables of 9 to 25.
  • Edge cases.

Validation

🤖 Generated with Claude Code

Node::calculateBootStrapWeight could only weigh tables of up to 8 confidants, so a network of 9
or more initial confidants never bootstrapped (testnet, 9 nodes: sequence 0 for 45 min).

cs::bootstrapWeight (csnode/bootstrapweight.hpp) replaces it: up to 8 keys it gives exactly the
official values on x86-64, so community and official nodes choose the same table; from 9 to 25
keys (MaxTrustedNodes) it weighs well-formed tables of initial confidants, a larger one above a
smaller one. 32-bit weight, no undefined behaviour in the loop, signed tables above unsigned ones.
"Bootstrap on" logs the table's size and weight, and a table that is not taken is logged.

Unit tests compare it with the official loop on every table of up to 8 keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnzinoBB
EnzinoBB force-pushed the fix/bootstrap-weight branch from 6524e16 to ce2a751 Compare October 22, 2026 12:54
@EnzinoBB EnzinoBB changed the title csnode: accept bootstrap tables of 9 to 25 confidants, with the official weights up to 8 csnode: bootstrap tables of 9 to 25 confidants, official weights up to 8 Oct 22, 2026
@EnzinoBB
EnzinoBB merged commit 53a8bee into master Oct 22, 2026
2 checks passed
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