Skip to content

test: batch DIP0008 activation with slow_mode=False - #7501

Open
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:perf/dip4-test-activation
Open

test: batch DIP0008 activation with slow_mode=False#7501
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:perf/dip4-test-activation

Conversation

@thepastaclaw

@thepastaclaw thepastaclaw commented Jul 30, 2026

Copy link
Copy Markdown

Issue being fixed or feature implemented

feature_dip4_coinbasemerkleroots.py activates DIP0008 with the default slow_mode=True path, which mines activation blocks in batches of 10. That is slower than necessary on the first activation path: activate_by_name already disables SPORK_17 for the whole activation window and syncs after every batch.

What was done?

Pass the existing slow_mode parameter through to activate_by_name and use slow_mode=False (batch size 50) on the first DIP0008 activation path.

The post-invalidateblock activation intentionally keeps slow_mode=True. Smaller batches keep the replacement chain synchronized on slow CI builds after invalidateblock.

Coverage is preserved:

  • Activation height is unchanged (DIP0008_HEIGHT).
  • Softfork inactive/active assertions around the final blocks are unchanged.
  • SPORK_17 remains disabled during activation mining and is restored afterward.
  • Every generate batch still calls sync_blocks().

How Has This Been Tested?

  • python3 -m py_compile test/functional/feature_dip4_coinbasemerkleroots.py
  • git diff --check upstream/develop...HEAD
  • Exact-head code review completed with this PR
  • Six balanced A/B functional runs using the same local dashd build (develop tip 2e52d33fa3b), alternating baseline and candidate with unique datadirs and port seeds; all runs passed
Variant Runs (seconds) Median
upstream/develop 131.302, 121.942, 123.394 123.394s
This PR 89.584, 80.741, 96.117 89.584s

Median improvement: 33.810 seconds (27.4%).

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

@thepastaclaw

thepastaclaw commented Jul 30, 2026

Copy link
Copy Markdown
Author

✅ Final review complete — no blockers (commit 52b2e58)

Wire the existing slow_mode parameter through to activate_by_name
and use batch-50 on both DIP0008 activation paths. activate_by_name
already syncs after every batch and disables SPORK_17, so batch-50
matches the former batch-10 behavior without the post-reorg catch-up
risk that once justified slow_mode=True.
@thepastaclaw
thepastaclaw force-pushed the perf/dip4-test-activation branch from 3bb0a3a to 52b2e58 Compare July 30, 2026 14:45
@thepastaclaw

Copy link
Copy Markdown
Author

Changed-test CI timing comparison

Test: feature_dip4_coinbasemerkleroots.py

Develop baseline: d41edd90 (successful develop CI push run 30402917810; exact base 2e52d33f run 30483914944 failed)
PR run: 52b2e58e (run 30553292326)

CI configuration develop baseline PR delta change
linux64 95s 81s -14s -14.7%
linux64_ubsan 97s 82s -15s -15.5%
linux64_tsan 138s 126s -12s -8.7%
linux64_sqlite 87s 84s -3s -3.4%
linux64_multiprocess 127s 106s -21s -16.5%
Total across applicable configurations 544s 479s -65s -11.9%

The changed test was faster in all five applicable CI configurations, saving 1m 05s across them in this pair of runs. linux64_nowallet is excluded because the test is skipped when wallet support is not compiled.

These are the functional test runner's per-test durations from the CI logs, not whole-job or whole-suite runtimes.

The changed test passed in every applicable configuration. The PR's overall SQLite job failure occurred elsewhere and does not affect these test timings.

@PastaPastaPasta
PastaPastaPasta marked this pull request as ready for review July 30, 2026 16:07
@PastaPastaPasta
PastaPastaPasta requested review from UdjinM6 and knst July 30, 2026 16:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52b2e58e82

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

n.invalidateblock(oldhash)
self.sync_all()
# Smaller batches keep the replacement chain synchronized on slow CI builds after invalidateblock.
first_quorum = self.test_dip8_quorum_merkle_root_activation(False, True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use fast batch mode on the second activation

When the post-invalidateblock activation runs, this True argument flows through to activate_by_name, where slow_mode=True selects batches of 10 rather than 50. Consequently, this path retains the previous batching behavior despite the change description stating that both DIP0008 activation paths use slow_mode=False; only the first call is accelerated. Pass False or omit the second argument to apply the intended optimization to both paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Intentional for the post-invalidateblock path — smaller batches keep the replacement chain synchronized on slow CI. PR description updated accordingly.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The DIP8 coinbase merkle roots functional test now passes its existing slow_mode value to activate_by_name('dip0008', ...). It also adds a comment explaining that smaller batches help keep the replacement chain synchronized on slow CI builds.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly matches the main change: using slow_mode=False to batch DIP0008 activation.
Description check ✅ Passed The description is directly related to the test change and accurately explains the behavior and validation.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/functional/feature_dip4_coinbasemerkleroots.py`:
- Around line 122-123: Update the first_quorum call to
test_dip8_quorum_merkle_root_activation so its second argument is False,
matching the fast activation mode used by the other DIP8 path and preserving the
intended batch size.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b611186-3d72-444b-bd5c-72aa60921251

📥 Commits

Reviewing files that changed from the base of the PR and between 2e52d33 and 52b2e58.

📒 Files selected for processing (1)
  • test/functional/feature_dip4_coinbasemerkleroots.py

Comment thread test/functional/feature_dip4_coinbasemerkleroots.py

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Final validation — Codex + Sonnet

This one-commit PR wires the previously-dead slow_mode parameter through to activate_by_name, letting the first (pre-reorg) DIP0008 activation use 50-block batches instead of the old default of 10. The second (post-invalidateblock) activation explicitly keeps slow_mode=True with a new comment justifying it, which is a sound and safe choice, but it directly contradicts the commit message's claim of using batch-50 "on both DIP0008 activation paths." That's a real, verifiable inconsistency between the stated rationale and the actual diff, though it has no functional or test-safety impact.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed), gpt-5.6-sol — dash-core-commit-history (completed)
  • Verifier: claude-sonnet-5 — final-verifier
  • Sonnet reviewers: claude-sonnet-5 — general (completed), claude-sonnet-5 — dash-core-commit-history (completed)

🟡 1 suggestion(s)

🤖 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 `test/functional/feature_dip4_coinbasemerkleroots.py`:
- [SUGGESTION] test/functional/feature_dip4_coinbasemerkleroots.py:122-123: Commit message claims batch-50 on both activation paths, but the second path still passes slow_mode=True
  The commit message says this change makes both DIP0008 activation call sites use batch-50, but the code tells a different story: `test_dip8_quorum_merkle_root_activation(False, True)` explicitly passes `slow_mode=True`, which `activate_by_name` maps to `batch_size = 10` (see test_framework.py:1571). Only the first call at line 118 (which relies on the new `slow_mode=False` default) actually gets batch-50; the second, post-`invalidateblock` call intentionally keeps the old slow batching, as the added comment on line 122 explains. Keeping slow mode here is a reasonable and probably correct choice for CI stability after a reorg, but the commit message overstates the change ("use batch-50 on both DIP0008 activation paths") in a way that could mislead anyone reading history later. Update the commit message/PR description to say batch-50 now applies to the first (pre-reorg) activation only, while the post-reorg path intentionally remains slow.

Comment on lines +122 to 123
# Smaller batches keep the replacement chain synchronized on slow CI builds after invalidateblock.
first_quorum = self.test_dip8_quorum_merkle_root_activation(False, True)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🟡 Suggestion: Commit message claims batch-50 on both activation paths, but the second path still passes slow_mode=True

The commit message says this change makes both DIP0008 activation call sites use batch-50, but the code tells a different story: test_dip8_quorum_merkle_root_activation(False, True) explicitly passes slow_mode=True, which activate_by_name maps to batch_size = 10 (see test_framework.py:1571). Only the first call at line 118 (which relies on the new slow_mode=False default) actually gets batch-50; the second, post-invalidateblock call intentionally keeps the old slow batching, as the added comment on line 122 explains. Keeping slow mode here is a reasonable and probably correct choice for CI stability after a reorg, but the commit message overstates the change ("use batch-50 on both DIP0008 activation paths") in a way that could mislead anyone reading history later. Update the commit message/PR description to say batch-50 now applies to the first (pre-reorg) activation only, while the post-reorg path intentionally remains slow.

source: ['codex']

@thepastaclaw

Copy link
Copy Markdown
Author

CI note: linux64_sqlite-test failed on an unrelated pre-existing flake in feature_protx_version.py (test_protx_v24_versioning / wait_until timeout), not on the DIP0008 test change in this PR.

#7501 only touches test/functional/feature_dip4_coinbasemerkleroots.py. Leaving the branch as-is.

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