add timeout-without-lockin and variant detection examples (#108, #109) - #116
Merged
Conversation
Phase 6.E.3 + 6.E.4: closes Phase 6.1 milestone with the final two worked examples. examples_test.go — TestExampleTimeoutWithoutLockin The narrated mirror of TestExampleActivateTestdummy for the FAILED path. Configures testdummy with a far-future timeout (year 2096), uses the new WarpTime to drag MTP past it, mines to the second retarget boundary where Core's BIP9 evaluates STARTED → FAILED. Two non-obvious recipe details surfaced during development: - Bitcoin Core's BIP9 evaluates the signaling threshold BEFORE the timeout check, so on regtest where every block signals by default, the deployment LOCKED_IN before timeout could fire. Adding -blockversion=0x20000000 to ExtraArgs suppresses signaling so the failure path is reachable. - Block timestamps are uint32 — values above 4_294_967_295 (year 2106) overflow when bitcoind constructs the block, surfacing as a cryptic "time-too-old" error from generatetoaddress. Bumped time.go to validate against this limit (new maxBlockTime constant) so callers see an actionable error up front. Skips on Inquisition, where testdummy is a "heretical" deployment that isn't BIP9-overridable via -vbparams. examples_inquisition_test.go — TestVariantDetection Smoke test that Variant() resolves to Core or Inquisition (not the zero-value VariantUnknown — that means subversion parsing regressed). Logs the detected variant and the binary path so CI output records which build the suite ran against. time.go — uint32 cap validation - new maxBlockTime constant (4_294_967_295) - MineWithTimestamp rejects unix > maxBlockTime up front - WarpTime rejects target > maxBlockTime up front Documented in both methods' godoc. Closes #108, #109. Closes Phase 6.1 milestone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes Phase 6.1. Two final worked examples plus a small validation hardening of
time.gothat surfaced during development.TestExampleTimeoutWithoutLockin(closes #108)Narrated mirror of
TestExampleActivateTestdummyfor the BIP9 FAILED path. UsesWarpTimeto drag MTP past a configured timeout, then mines to the second retarget boundary where Bitcoin Core evaluatesSTARTED → FAILED.Two non-obvious recipe details surfaced and are documented inline:
LOCKED_INbefore timeout could fire. The test passes-blockversion=0x20000000(BIP9 baseline with no deployment bits set) viaExtraArgsto suppress signaling so the FAILED path is reachable.nTimeasuint32, max4_294_967_295(year 2106). Setting mocktime above this cap causesgeneratetoaddressto fail with a cryptictime-too-olderror (the value overflows). The test usestimeout = 4_000_000_000(year 2096) — comfortably under the cap.Skips on Inquisition, where testdummy is a
hereticaldeployment that isn't-vbparams-overridable.TestVariantDetection(closes #109)Smoke test that
Variant()resolves toVariantCoreorVariantInquisition(not the zero-valueVariantUnknown— that would indicate agetnetworkinfo.subversionparser regression). Logs the detected variant and binary path so CI output records which build the suite ran against.time.go— uint32 cap validationSurfaced by the timeout test work. Added
maxBlockTimeconstant (4_294_967_295) and validation:MineWithTimestampContextrejectsunix > maxBlockTimeup front with a clear message.WarpTimeContextrejectstarget > maxBlockTimeup front.Both methods' godoc updated. Existing
SetMockTimekeeps the loosermaxMockTime = 9_223_372_036cap (matches Core's RPC validation) since you can callsetmocktimefor non-mining purposes.Test plan
make ai-checkgreen (againstbitcoind-inquisitionon PATH).TestVariantDetectionpasses on Inquisition (logsrunning against variant: inquisition).TestExampleTimeoutWithoutLockint.Skips cleanly on Inquisition.BinaryPath-override probe):TestExampleTimeoutWithoutLockinruns to completion withfinal status: failed. Probe was deleted before commit.Notes
-blockversionworkaround is regtest-only (MineBlocksOnDemand()gates the override). On mainnet/testnet it's a no-op.🤖 Generated with Claude Code