Skip to content

fix: repair dash-chainstate dist sources#7341

Open
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/dash-chainstate-dist-sources
Open

fix: repair dash-chainstate dist sources#7341
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/dash-chainstate-dist-sources

Conversation

@PastaPastaPasta
Copy link
Copy Markdown
Member

@PastaPastaPasta PastaPastaPasta commented Jun 6, 2026

Issue being fixed or feature implemented

The make distdir and dash-chainstate packaging/build paths referenced stale source paths after recent address index and governance refactors. This caused CI packaging/build jobs using --enable-experimental-util-chainstate to fail.

What was done?

  • Updated dash_chainstate_SOURCES to use index/addressindex.cpp and include its standalone helper/source dependencies.
  • Replaced removed governance source entries with the current governance source files used by the tree.
  • Updated bitcoin-chainstate.cpp to match the current LoadChainstate setup flow after the governance/superblock manager refactor.

How Has This Been Tested?

  • ./configure --enable-experimental-util-chainstate
  • make -C src -j4 dash-chainstate
  • git diff --check
  • rm -rf dashcore-distcheck-test && mkdir dashcore-distcheck-test && (cd src && make top_distdir=../dashcore-distcheck-test distdir=../dashcore-distcheck-test/src am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

This pull request was created by Codex.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

⚠️ Potential Merge Conflicts Detected

This PR has potential conflicts with the following open PRs:

Please coordinate with the authors of these PRs to avoid merge conflicts.

@thepastaclaw
Copy link
Copy Markdown

thepastaclaw commented Jun 6, 2026

✅ Review complete (commit 7a87bac)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 6, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c527ca31-2adb-4e20-addf-6985fc841088

📥 Commits

Reviewing files that changed from the base of the PR and between 80f75aa and 7a87bac.

📒 Files selected for processing (2)
  • src/Makefile.am
  • src/bitcoin-chainstate.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/bitcoin-chainstate.cpp

Walkthrough

This PR updates src/Makefile.am: replaces addressindex.cpp with index/addressindex.cpp, removes governance/classes.cpp, governance/exceptions.cpp, and governance/validators.cpp, and adds governance/superblock.cpp plus index/spentindex.cpp in the dash_chainstate_SOURCES block. In src/bitcoin-chainstate.cpp it removes the governance/governance.h include, constructs CSporkManager and chainlock::Chainlocks directly, and updates the node::LoadChainstate(...) call to drop CGovernanceManager and pass mn_sync in the new argument position.

Sequence Diagram(s)

sequenceDiagram
  participant BitcoinChainstate as bitcoin-chainstate.cpp
  participant CSporkManager as CSporkManager
  participant Chainlocks as chainlock::Chainlocks
  participant Node as node::LoadChainstate

  BitcoinChainstate->>CSporkManager: construct CSporkManager
  BitcoinChainstate->>Chainlocks: construct Chainlocks
  BitcoinChainstate->>Node: call LoadChainstate(..., mn_sync, ...)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • dashpay/dash#7234: Also touches dash-chainstate build sources and governance-related chainstate wiring.

Suggested reviewers

  • thepastaclaw
  • kwvg
  • UdjinM6
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: repairing the dash-chainstate distribution sources by updating stale source file paths in the build configuration.
Description check ✅ Passed The description is directly related to the changeset, explaining the issue being fixed, what was done, testing performed, and breaking changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
src/bitcoin-chainstate.cpp

src/bitcoin-chainstate.cpp:14:10: error: 'chainlock/chainlock.h' file not found with include; use "quotes" instead
14 | #include <chainlock/chainlock.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
| "chainlock/chainlock.h"
In file included from src/bitcoin-chainstate.cpp:14:
src/chainlock/chainlock.h:8:10: fatal error: 'bls/bls.h' file not found
8 | #include <bls/bls.h>
| ^~~~~~~~~~~
2 errors generated.
src/bitcoin-chainstate.cpp:74:1-322:1: ERROR translating statement 'CompoundStmt'
Aborting translation of method 'main' in file 'src/bitcoin-chainstate.cpp': "Assert_failure src/clang/cAst_utils.ml:249:53"
Uncaught Internal Error: "Assert_failure src/clang/cAst_utils.ml:249:53"
Error backtrace:
Raised at ClangFrontend__CAst_utils.get_decl_from_typ_ptr in file "src/clang/cAst_utils.ml", line 249, characters 53-65
Called from ClangFrontend__CTrans.CTrans_funct.get_destructor_decl_ref in file "src/clang/cTrans.ml", line 658, characters 12-59
Calle

... [truncated 2200 characters] ...

ine 18, characters 15-63
Called from ClangFrontend__CFrontend_errors.protect in file "src/clang/cFrontend_errors.ml", line 48, characters 6-141
Called from ClangFrontend__CFrontend_decl.CFrontend_decl_funct.add_method in file "src/clang/cFrontend_decl.ml" (inlined), line 54, characters 4-52
Called from ClangFrontend__CFrontend_decl.CFrontend_decl_funct.function_decl in file "src/clang/cFrontend_decl.ml", line 90, characters 12-151
Called from ClangFrontend__CFrontend_decl.CFrontend_decl_funct.translate_one_declaration in file "src/clang/cFrontend_decl.ml", line 453, characters 10-56
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml" (inlined), line 110, characters 17-25
Called from Base__List0.iter in file "src/list0.


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 and usage tips.

Copy link
Copy Markdown

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

Convergent finding from both reviewers: the repaired dash_chainstate_SOURCES list correctly updates moved/renamed governance and address-index paths so make distdir passes, but it still omits index/addressindex_util.cpp — the file that defines AddressBytesFromScript, which is referenced by both index/addressindex.cpp (6 call sites) and the already-listed txmempool.cpp (3 call sites). The dash-chainstate binary will therefore fail to link with an undefined reference when --enable-experimental-util-chainstate is set. Since this PR's explicit goal is to repair dash-chainstate sources, adding the helper is in scope.

🔴 1 blocking

🤖 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/Makefile.am`:
- [BLOCKING] src/Makefile.am:1168: dash_chainstate is missing index/addressindex_util.cpp — link will fail with undefined AddressBytesFromScript
  The updated source list points at the real `index/addressindex.cpp`, but does not include its companion `index/addressindex_util.cpp`, which is the sole definition of `AddressBytesFromScript` (src/index/addressindex_util.cpp:12). That symbol is used 6 times in `index/addressindex.cpp` (lines 211, 232, 254, 313, 341, 368) and 3 times in `txmempool.cpp` (lines 555, 571, 626), both of which are compiled into `dash_chainstate`. Because `dash-chainstate` is linked from this explicit source list rather than against the server library where the helper is normally pulled in, building with `--enable-experimental-util-chainstate` will fail at link time with an unresolved `AddressBytesFromScript` symbol. The PR fixes `make distdir` but leaves the actual binary unbuildable, so the repair is incomplete. Add `index/addressindex_util.cpp` next to the address index source — it is already listed in `libbitcoin_common_a_SOURCES` (Makefile.am:540), confirming it is a standalone translation unit. Note: if `spentindex.cpp` / `timestampindex.cpp` end up transitively required by chainstate code paths they would need similar treatment, but `addressindex_util.cpp` is the unambiguous immediate gap.

Comment thread src/Makefile.am
dash_chainstate_SOURCES = \
bitcoin-chainstate.cpp \
addressindex.cpp \
index/addressindex.cpp \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Blocking: dash_chainstate is missing index/addressindex_util.cpp — link will fail with undefined AddressBytesFromScript

The updated source list points at the real index/addressindex.cpp, but does not include its companion index/addressindex_util.cpp, which is the sole definition of AddressBytesFromScript (src/index/addressindex_util.cpp:12). That symbol is used 6 times in index/addressindex.cpp (lines 211, 232, 254, 313, 341, 368) and 3 times in txmempool.cpp (lines 555, 571, 626), both of which are compiled into dash_chainstate. Because dash-chainstate is linked from this explicit source list rather than against the server library where the helper is normally pulled in, building with --enable-experimental-util-chainstate will fail at link time with an unresolved AddressBytesFromScript symbol. The PR fixes make distdir but leaves the actual binary unbuildable, so the repair is incomplete. Add index/addressindex_util.cpp next to the address index source — it is already listed in libbitcoin_common_a_SOURCES (Makefile.am:540), confirming it is a standalone translation unit. Note: if spentindex.cpp / timestampindex.cpp end up transitively required by chainstate code paths they would need similar treatment, but addressindex_util.cpp is the unambiguous immediate gap.

Suggested change
index/addressindex.cpp \
bitcoin-chainstate.cpp \
index/addressindex.cpp \
index/addressindex_util.cpp \

source: ['claude', 'codex']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved in this update — dash_chainstate is missing index/addressindex_util.cpp — link will fail with undefined AddressBytesFromScript no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

@PastaPastaPasta PastaPastaPasta force-pushed the fix/dash-chainstate-dist-sources branch from 0670788 to 80f75aa Compare June 6, 2026 17:43
Copy link
Copy Markdown

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

Prior blocking finding (missing index/addressindex_util.cpp in dash_chainstate_SOURCES) is FIXED at src/Makefile.am:1169 — the util file is listed immediately after index/addressindex.cpp, providing AddressBytesFromScript. Latest delta also adds index/spentindex.cpp (line 1223) and rewires bitcoin-chainstate.cpp to the new LoadChainstate signature. Both Claude and Codex independently verified the fix; no new findings; CodeRabbit reported 0 inline findings.

@PastaPastaPasta PastaPastaPasta force-pushed the fix/dash-chainstate-dist-sources branch from 80f75aa to 7a87bac Compare June 6, 2026 18:08
Copy link
Copy Markdown

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

Cumulative review at 7a87bac confirms PR is a narrowly scoped repair of the experimental dash-chainstate target after upstream refactors of the address-index and governance code. dash_chainstate_SOURCES correctly references the relocated index/addressindex.cpp, index/addressindex_util.cpp, index/spentindex.cpp, and governance/superblock.cpp, and drops files that no longer exist (governance/classes.cpp, governance/exceptions.cpp, governance/validators.cpp) plus files unnecessary for this binary in the latest delta (governance/net_governance.cpp, governance/signing.cpp). The LoadChainstate call in bitcoin-chainstate.cpp matches the signature in src/node/chainstate.h:75-100 (govman dropped, mn_sync added, index booleans removed). Carried-forward prior findings: none. New findings in the latest delta: none.

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.

2 participants