Skip to content

Insert the note commitment tree in chunks of 10,000 blocks, keep per-block as an information row - #3

Merged
danielgorgonha merged 4 commits into
mainfrom
feat/chunked-tree-insertion
Nov 11, 2026
Merged

danielgorgonha merged 4 commits into
mainfrom
feat/chunked-tree-insertion

Conversation

@danielgorgonha

@danielgorgonha danielgorgonha commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

What this changes and why:

  • The tree stage inserts the note commitment tree in chunks of 10,000 blocks: one ShardTree::batch_insert per chunk, a checkpoint per block kept (an empty block's checkpoint is added at the last leaf before it), and every leaf hashed. A 50,000-block first scan is five chunks; the daily range of 3,456 blocks is one.
  • Inserting once per block cost about 3.4 Sinsemilla hashes per leaf, where 1 is the floor. Native timing on 50,000 synthetic blocks at 12.41 actions per block: per-block 194.5 s, chunked 70.6 s, with the same root.
  • Per-block insertion stays as an information row (page option, link parameter tree=per-block). Every result records tree_insert and tree_insert_asked. The summary gives a per-block row no verdict, accepts only chunk-10000 as chunked, and refuses a result whose mode is missing or differs from the one asked.
  • The checkpoints of empty blocks are bounded to the 100 kept, in both modes.
  • Docs and CHANGELOG describe the insertion; a checkpoint for every block is this harness's choice.

Tests run (see CONTRIBUTING.md):

  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --release --locked (tree_insert 9: chunked and per-block give the same root at every checkpoint, the same final root and the same witnesses, with empty blocks, chunk boundaries, ranges of 9,999, 10,000 and 10,001 blocks, and starts at 65,533 to 65,536).
  • node --test tests/node.test.mjs tests/charts.test.mjs: 196 pass.
  • Each new test was checked to fail without its fix.

For a result under community-results/: commit built, device, browser:

Not applicable.

AI disclosure: no AI assistance / AI-assisted (tool and what it did):

AI-assisted: Claude Code wrote the change, the tests and the docs; separate AI review passes audited the code and challenged the tests.

🤖 Generated with Claude Code

danielgorgonha and others added 4 commits November 11, 2026 13:08
…n information row

One batch_insert per chunk with a checkpoint per block; a block with no
leaves gets its checkpoint at the last leaf before it. The mode is chosen
by a page option or tree=per-block, recorded in every result, and a
per-block row is printed with its bar and never a verdict.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…s chunked, say what the wallet does

Empty-block checkpoints keep a sorted list of the ids kept, skip a block
older than the newest 100 and prune after being added, in both modes. The
summary refuses any chunked size but chunk-10000 and a missing or unknown
tree_insert_asked. The CHANGELOG, docs and code comment say every block
having a checkpoint is this harness's choice. The unused append_block is
gone, and the tests cover ranges at the chunk size and starts next to a
shard boundary.

Co-Authored-By: Claude <noreply@anthropic.com>
The checkpoint count already catches growth; the time bound only guards
against a quadratic path.

Co-Authored-By: Claude <noreply@anthropic.com>
@danielgorgonha danielgorgonha self-assigned this Nov 11, 2026
@danielgorgonha
danielgorgonha merged commit e1a019c into main Nov 11, 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