Skip to content

fix: support Core V24 coinbase payloads - #318

Merged
ktechmidas merged 1 commit into
dashpay:masterfrom
infraclaw-dash:fix/v24-coinbase-payload
Oct 23, 2026
Merged

ktechmidas merged 1 commit into
dashpay:masterfrom
infraclaw-dash:fix/v24-coinbase-payload

Conversation

@infraclaw-dash

@infraclaw-dash infraclaw-dash commented Oct 23, 2026 •

Copy link
Copy Markdown

Summary

Add Core V24 coinbase payload version 4 support to fix Insight crashing after activation with Failed to parse payload: raw payload is bigger than expected.

Core appends merkleRootAssetUnlocks (a little-endian uint256) after the version-3 fields. Parse, validate, serialize, JSON-convert and copy that field for version 4+, with an optional TypeScript property. Existing version 1–3 encoding and strict trailing-byte validation are retained.

Evidence and regression coverage

  • Reproduced against actual public testnet activation block 1,578,000 (and postactivation block 1,578,004).
  • Fixtures include preactivation block 1,577,999; full blocks and coinbase transactions round-trip byte-for-byte, and coinbase txids match Core RPC.
  • Nonzero-root vector checks byte order; missing/truncated/oversized/nonhex roots and trailing bytes are rejected.
  • Version 1–3 compatibility and JSON/copy round trips covered.
  • Layout verified against Core v24.0.0-rc.4 CCbTx.

Validation

  • Focused payload tests: 22 passing.
  • Complete Node suite: 3,516 passing, 17 existing pending.
  • TypeScript (npm run test:types): passed.
  • Webpack (npm run build): passed with bundle-size/tooling warnings.
  • Parser ESLint and git diff --check: passed.
  • Browser test suite not run locally.

Insight integration

Insight 4.0.10 ships dashcore-lib 0.22.0; its installed coinbasepayload.js is identical to the pre-fix file on current master (0.25.0). This patch can therefore be applied alone in a pinned Insight hotfix image, preserving all other dependency versions, until the normal library/Insight release chain is published. No Core product changes are included.

Summary by CodeRabbit

  • New Features
    • Added support for the asset-unlocks Merkle root in Coinbase payload version 4 and later. The root is available in payload data and JSON representations, with validation for its format and length. Coinbase payload versions 1–3 continue to work without this field. Also added coverage for reading, writing, and serializing version 4 payloads using Core V24 block data.

@coderabbitai

coderabbitai Bot commented Oct 23, 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: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7716621-f211-4cce-a1bb-b6862933f03b
📥 Commits

Reviewing files that changed from the base of the PR and between a1da488 and c2195d3.

📒 Files selected for processing: 4
  • lib/transaction/payload/coinbasepayload.js
  • test/fixtures/core24-coinbase.json
  • test/transaction/payload/coinbasepayload.js
  • typings/transaction/payload/CoinbasePayload.d.ts

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

📝 Walkthrough

Coinbase payload version 4 and later now process merkleRootAssetUnlocks in binary and JSON forms. The payload declarations expose the field, and tests cover its encoding, validation, version compatibility, and Core V24 fixtures.

Changes: Coinbase Payload

Layer / File(s) Summary
Asset-unlocks root payload handling
lib/transaction/payload/coinbasepayload.js, typings/transaction/payload/CoinbasePayload.d.ts
The payload implementation and declarations add merkleRootAssetUnlocks. Version 4 and later read and write it in reversed byte order, include it in JSON conversion, and validate its length and hexadecimal form.
Version compatibility and fixture checks
test/fixtures/core24-coinbase.json, test/transaction/payload/coinbasepayload.js
Tests cover version 4 round trips and invalid inputs, verify that versions 1–3 omit the field, and check fixture-based transaction and block serialization.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to c2195

No actionable merge-blocking issue is established for the coinbase payload update; it is mergeable after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding support for Core V24 Coinbase payloads.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 …
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: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

typings/transaction/payload/CoinbasePayload.d.ts

Parsing error: Unexpected token type

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

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 23, 2026 •

Copy link
Copy Markdown

🔍 Review in progress — actively reviewing now (commit c2195d3) · triage: normal
██░░░░░░░░░░░░░░░░░░ 10% · about 25 min left · running for 2 min
✅ triage → ⏳ Phase 1 (0/1 lanes) → ▫️ verify 1 → ▫️ gate → ▫️ Phase 2 → ▫️ verify 2 → ▫️ publish
Estimated from recent reviews of this tier · updated 17:32 UTC · live progress

@infraclaw-dash

infraclaw-dash commented Oct 23, 2026 •

Copy link
Copy Markdown
Author

Testnet verification

Deployed the exact parser from c2195d3c0ed8de9745dd76e2b5b19b8bd96d3368 to the managed testnet Insight service at 17:01 UTC on October 23.

  • Built from pinned official Insight 4.0.10; changed only the top-level coinbase parser used by dashcore-node and insight-api. All dependency versions remain unchanged, including dashcore-lib 0.22.0. Its original parser was byte-identical to the pre-fix master parser.
  • The image itself passed preactivation/activation/postactivation block round trips, Core coinbase txid checks, nonzero-root byte order and malformed-payload checks.
  • Public block-list, activation-block, coinbase-transaction, block-transactions and address endpoints all return successful JSON again. Sync is complete at height 1,578,019.
  • Zero container restarts or parser errors after deployment; the independent console cleared the Insight host to healthy. Core, proxies, database and faucet containers were not restarted or replaced.

This is a testnet hotfix from this PR's exact commit, not an upstream merge or published library release. Upstream review and approval of the fork Actions run remain pending. The connected infraclaw-dash account cannot merge or enable auto-merge; a maintainer must complete those steps.

Completion update — 17:33 UTC: The owner explicitly authorized use of the stored administrative PAT. Approved the fork workflow, obtained passing CI (including browser tests), and merged this PR as 64a9efa1fe46811826dc38819bba662293de2019. The merged parser is byte-for-byte identical to the testnet hotfix. Final public checks pass at height 1,578,033; the same container has zero restarts/parser errors. No further restart or release publication was needed.

@ktechmidas
ktechmidas merged commit 64a9efa into dashpay:master Oct 23, 2026
3 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.

3 participants