Skip to content

backport: bitcoin#35670 - net: append compact-block extra txn until full - #7958

Merged
PastaPastaPasta merged 1 commit into
developfrom
backport-35670-compact-extra-txn
Oct 31, 2026
Merged

PastaPastaPasta merged 1 commit into
developfrom
backport-35670-compact-extra-txn

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

  • vExtraTxnForCompact holds orphan and rejected transactions for compact block reconstruction. On the first insertion it was resized to its full configured capacity. Until the ring filled, PartiallyDownloadedBlock::InitData scanned default {uint256(), nullptr} entries in the unused slots.

What was done?

Backport of bitcoin#35670 (upstream commit 1a3cbf1): the extra-transaction ring buffer now appends until full.

  • src/net_processing.cpp: AddToCompactExtraTransactions now reserves the configured capacity and appends entries until the cache is full. After that it overwrites in ring order, as before. The configured maximum and the replacement order are unchanged.
  • Dash adaptation: the cache is keyed by the transaction instance hash (GetInstanceHash()) rather than upstream's witness hash.

The diff is 1:1 with upstream apart from that hash adaptation. No upstream hunks were omitted.

How Has This Been Tested?

  • Built test_dash and dashd on Linux x86_64 with --enable-werror --enable-suppress-external-warnings --without-gui, plus CXXFLAGS=-Wno-error=suggest-override. The extra flag is needed because the Boost signals2 headers from depends trigger that warning under this host's newer GCC. The warning is in an untouched file and unrelated to this change.
  • ./src/test/test_dash --run_test=blockencodings_tests,net_peer_connection_tests,denialofservice_tests passes.
  • p2p_compactblocks.py passes.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 61031f5e-e847-4ff5-99ba-143a5655d6d7
Commits

Reviewing files that changed from the base of the PR and between 771e8e8 and f5930b8.

Files selected for processing: 1
  • src/net_processing.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

AddToCompactExtraTransactions returns when the configured limit is zero. It appends transactions until the vector reaches the limit, reserving capacity on the first insertion. After that, it overwrites entries using the existing ring-buffer index.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • dashpay/dash#7941: Changes the max_extra_txs configuration contract used by the compact-block cache.
Merge Risk: Minimal · up to f5930

The cache change preserves compact-block reconstruction behavior and introduces no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the upstream backport (bitcoin#35670) and the main change: compact-block extra transactions are appended until the cache is full. This matches the raw summary, which describes AddToCom…
Description check Passed The description states the problem: vExtraTxnForCompact was resized to full capacity on first insertion, leaving default entries that InitData scanned. It explains the fix (append until full, then rin…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the upstream backport (bitcoin#35670) and the main change: compact-block extra transactions are appended until the cache is full. This matches the raw summary, which describes AddToCompactExtraTransactions reserving capacity and appending until the limit, and the description, which states the same fix. The title is specific and identifies the primary change. It does not mention the Dash-specific hash adaptation, which is an acceptable omission.

Full details: Description check

Explanation

The description states the problem: vExtraTxnForCompact was resized to full capacity on first insertion, leaving default entries that InitData scanned. It explains the fix (append until full, then ring-order overwrite), the Dash adaptation to GetInstanceHash(), the build and test commands run, and the absence of breaking changes. This relates directly to the changeset in src/net_processing.cpp.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T08:34:58.224350Z
We couldn’t complete this review. Comment @codex review to try again.
4339411 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@thepastaclaw

thepastaclaw commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

⏹️ Not reviewed — PR is closed (merged) (commit f5930b8)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

The backport correctly preserves Dash's instance-hash handling while changing the compact-block extra-transaction cache to append until full. The null-entry guard closes the demonstrated dereference path, and the available CI snapshot has no relevant failures; build jobs were still pending. One non-blocking test-coverage issue remains: the regression test keys entries with transaction IDs rather than the instance hashes used in production.

💬 1 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a contained behavioral change to compact-block transaction caching and reconstruction, with added test coverage, but it does not alter consensus, funds movement, cryptography, or other critical surfaces.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/test/blockencodings_tests.cpp`:
- [NITPICK] src/test/blockencodings_tests.cpp:121-124: Test keys extra entries with GetHash instead of production GetInstanceHash
  The production path stores compact-block extra transactions under GetInstanceHash() in src/net_processing.cpp:1953, and compact-block short IDs are also computed from instance hashes in src/blockencodings.cpp:34. This test uses GetHash(), which happens to match for the ordinary transactions created by BuildBlockTestCase, but does not verify the Dash-specific invariant for version 2+ asset unlocks where the two hashes differ. Keying the test entries with GetInstanceHash() would make the regression test mirror the production path.

Comment thread src/test/blockencodings_tests.cpp Resolved
@thepastaclaw thepastaclaw added the pastaclaw:commented thepastaclaw's latest review was comment-only label Oct 29, 2026
Comment thread src/test/blockencodings_tests.cpp Resolved
@thepastaclaw thepastaclaw removed the pastaclaw:commented thepastaclaw's latest review was comment-only label Oct 31, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

Verified the complete diff at 771e8e8 against upstream bitcoin#35670 and the surrounding Dash code: the change preserves instance-hash keying and ring-buffer behavior, with no correctness defects found, and the prior test-key finding is fixed. One non-blocking commit-history suggestion remains. Static validation only: current CI shows successful lint and multiple platform builds, with tests and additional builds pending; the milestone requirement fails and conflict-prediction jobs were cancelled, neither indicating a code failure.

🟡 1 suggestion(s)

1 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Fold the corrective follow-up into the initial backport
<commit:771e8e8a00d>:1

Commit 771e8e8 removes the InitData guard and regression test introduced by 4339411 and completes the same backport's early-return alignment. These commits represent one logical change; retaining both leaves an unnecessary introduction/removal cycle, while the initial commit message describes guard and test behavior absent from the final tree. Fold the correction into the initial backport and update the resulting message to describe only the final change, retaining the upstream reference and Dash instance-hash adaptation.

source: gpt-6.1-sol (phase2-reviewer: dash-core-commit-history)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: low by gpt-6.1-sol (effort low) — The diff is a small, contained change to compact-block transaction cache initialization and insertion, with straightforward append-until-full behavior and unchanged replacement order.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 93% left, weekly 77% left; passed over gemini-3.8-flash-high (antigravity quota lookup failed)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `<commit:771e8e8a00d>`:
- [SUGGESTION] <commit:771e8e8a00d>:1: Fold the corrective follow-up into the initial backport
  Commit 771e8e8a00d removes the InitData guard and regression test introduced by 4339411b01c and completes the same backport's early-return alignment. These commits represent one logical change; retaining both leaves an unnecessary introduction/removal cycle, while the initial commit message describes guard and test behavior absent from the final tree. Fold the correction into the initial backport and update the resulting message to describe only the final change, retaining the upstream reference and Dash instance-hash adaptation.

@thepastaclaw thepastaclaw added the pastaclaw:commented thepastaclaw's latest review was comment-only label Oct 31, 2026
@knst knst added this to the 24.1 milestone Oct 31, 2026
@knst

knst commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

squash 2 commits please and update commit description accordingly

Comment thread src/blockencodings.cpp Resolved
vExtraTxnForCompact was resized to its configured capacity on the first
insertion. Until the ring filled, compact block reconstruction scanned
default {uint256(), nullptr} entries created for the unused slots.

Reserve the configured capacity and append entries until the cache is
full, then keep the same ring-buffer overwrite behavior. This preserves
the configured maximum and replacement order while keeping
reconstruction from scanning unused capacity.

Port of bitcoin/bitcoin@1a3cbf1bd2. Dash keys the cache by the
transaction instance hash (GetInstanceHash()) instead of upstream's
witness hash.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PastaPastaPasta
PastaPastaPasta force-pushed the backport-35670-compact-extra-txn branch from 771e8e8 to f5930b8 Compare October 31, 2026 19:52
@thepastaclaw thepastaclaw removed the pastaclaw:commented thepastaclaw's latest review was comment-only label Oct 31, 2026

@knst knst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK f5930b8

@PastaPastaPasta
PastaPastaPasta merged commit e0656bc into develop Oct 31, 2026
75 of 76 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the backport-35670-compact-extra-txn branch November 15, 2026 17:27
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.

3 participants