feat: scale block-denominated settings with BLOCKTIMEMS

🔎 Visual review: building it for b9a49716; the link appears here.

With !5265, the BLOCKTIMEMS mimir changes the real block interval. This MR keeps every block-denominated setting at its wall-clock meaning at any block time. Values are converted once, when they are read. No governance value is rewritten, there is no store migration, and unsetting BLOCKTIMEMS undoes everything.

Depends on !5265 and includes its commits until it merges. Review the commits after aad7151c6b (the !5265 head when this was opened).

!5265 has dropped its mainnet guard, which leaves only the 2/3 validator vote between BLOCKTIMEMS and mainnet. This MR therefore also fixes the two places where a change of block time would skip work: the regular churn and LackSigning. While the mimir is unset, nothing changes.

How it works

  • Reference unit: the network's default ThorchainBlockTime (6000 ms mainnet, 1000 ms mocknet). r = ThorchainBlockTime / BLOCKTIMEMS. r = 1 exactly while the mimir is unset or 0, and every conversion is then the identity. Integer math only.
  • Unit tags (constants/units.go): every ConstantName has one. A unit test fails for any untagged name.
    • Duration: ceil(v·r); values ≤ 0 (off/unset) pass through.
    • PerBlockRate: v/r, rounded half up.
    • Count, Height, WallClock: unchanged.
    • Non-constant mimir keys are tagged too (SignatureRefreshBlocks = Duration; halt keys = Height).
  • The block time is latched per block. At the start of BeginBlock, UpdateBlockTime takes the BLOCKTIMEMS target (clamped to the hard limits) as the effective block time. It stores it with the change height and the previous value (blocktime/ keys), writing only when the value changes, so nothing is stored while the mimir is unset. A mimir set in block H therefore applies from H+1, and every read within a block sees one block time. The commit wait in !5265 also switches after H.
  • Keeper.GetConfigInt64 applies the tag to both mimir and constant values. New keeper methods:
    • GetBlockTimeMs(ctx): the effective (latched) block time.
    • GetBlockTimeChange(ctx): the height and previous value of the last change.
    • GetConfigInt64Ref(ctx, key): the value in reference blocks, before scaling.
    • UpdateBlockTime(ctx): the latch, called from module BeginBlock.
    • ScaleConfigInt64(ctx, key, v): for reads that bypass GetConfigInt64.
    • RefBlocks(ctx, n): for hardcoded counts.
  • Gas: BLOCKTIMEMS is read on a throwaway gas meter, so the conversion never changes a tx's gas_used (unit test TestGetConfigInt64ScalingChargesNoGas).
  • Bypassing reads: every direct GetInt64Value/GetMimir read of a Duration or Rate key in x/ now goes through GetConfigInt64 or ScaleConfigInt64. The original fallback semantics are kept, e.g. <= 0 versus < 0. Reads converted:
    • SigningTransactionPeriod (×9)
    • BlocksPerYear (emission, THORName)
    • DoubleSignMaxAge
    • JailTimeKeygen / JailTimeKeysign
    • FailKeygenSlashPoints
    • the ChurnRetryInterval fallback
    • BondLockupPeriod (leave/unbond)
    • TxOutDelayMax / MaxTxOutOffset (queue metrics, queriers)
  • Analyzer: tools/analyze -unscaled_config, wired into scripts/lint.sh. It flags a GetInt64Value(constants.X) or GetMimir(ctx, constants.X.String() | "X") of a Duration or Rate key when the enclosing function never passes constants.X to ScaleConfigInt64. The opt-out is // analyze-ignore(unscaled-config), used where a value is deliberately read in reference blocks: the THORName reference fee and free year, and the wall-clock windows and ages below (RefWindowStart, RefBlocksSince, SortBySecurity).
  • /thorchain/constants shows constants at the current block time. /thorchain/mimir still shows the stored (reference) values.
  • /thorchain/network has a new block_time_ms field: the block time in force for this block (the latched BLOCKTIMEMS), or the network default while it is unset. /thorchain/constants still shows the default BlockTimeMs, so integrators and bifrost should read this field instead.
  • THORName fee: expiry is priced in reference blocks, (free year + paid / fee-per-reference-block), and converted once. The per-block fee therefore doesn't lose ~1/3 to integer rounding at 2s. GetTHORNamePerBlockFee (for /thorchain/network) shows the rate at the current block time.

Unit table: decisions for review

The defaults follow the design doc's inventory, checked against each key's usage.

Unit Keys
Duration BlocksPerYear, PoolCycle, PendingLiquidityAgeLimit, MaxAnchorBlocks, DynamicMaxAnchorSlipBlocks, DynamicMaxAnchorCalcInterval, FundMigrationInterval, ChurnInterval, ChurnRetryInterval, MissingBlockChurnOut, MaxTrackMissingBlock, SigningTransactionPeriod, DoubleSignMaxAge, FailKeygenSlashPoints, LiquidityLockUpBlocks, ObservationDelayFlexibility, JailTimeKeygen, JailTimeKeysign, NodePauseChainBlocks, TxOutDelayMax, MaxTxOutOffset, StreamingSwapMaxLength(Native), StreamingLimitSwapMaxAge, ChurnOutForLowVersionBlocks, SynthYieldCycle, CloutReset, KeygenRetryInterval, SaversStreamingSwapsInterval, RescheduleCoalesceBlocks, RUNEPoolDepositMaturityBlocks, SaversEjectInterval, OverSolvencyCheckInterval, BondLockupPeriod, MemolessTxnTTL, L1DynamicFeeEpochBlocks, MissingObservationHalfLife, MissingObservationGuardMaxBlocks; mimir SignatureRefreshBlocks
PerBlockRate TxOutDelayRate, MinTxOutVolumeThreshold, TNSFeePerBlock, TNSFeePerBlockUSD, POLMaxPoolMovement, POLReserveMaxDeployment (both cycles run every block)
Height ArtificialRagnarokBlockHeight, PauseBond/Unbond, StreamingSwapPause, RUNEPoolHalt*, TCYHalt, HaltRebond, HaltOperatorRotate, HaltMemoless, HaltOracle; mimirs Halt, NodePauseChainGlobal, ScheduledMigration, HaltMonovaultKeygen
WallClock OracleUpdateInterval (already ms), BlockTimeMs
Count everything else: amounts, bps, flags, node counts (MaxMissingBlockChurnOut, DesiredValidatorSet, …), MinSwapsPerBlock/MaxSwapsPerBlock and AdvSwapQueueRapidSwapMax (more throughput is the point), RagnarokProcessNumOfLPPerIteration, ChurnMigrateRounds, L1DynamicFeeWindowEpochs (epochs, whose length scales), StagedPoolCost / MinimumPoolLiquidityFee (per PoolCycle, which scales)

Policy items for review:

  1. Slash points stay Counts. ObserveSlashPoints and LackOfObservationPenalty are charged per observation (L1 activity), not per block. MissBlockSignSlashPoints does accrue per block, but integer points can't be divided, so it accrues faster at shorter block times.
    • Open question: whether MinSlashPointsForBadValidator should scale to compensate. It is left as a Count.
    • FailKeygenSlashPoints is a Duration ("720 blocks of slash ≈ 1h of rewards").
  2. POLMaxPoolMovement as a Rate rounds small values down. At 2s, a value of 1 becomes 0.
  3. MemolessTxnTTL is a Duration. Lowering the block time raises it in blocks, and per docs/mimir.md raising it revives already-expired references until one TTL has passed.
  4. Memo and quote block counts stay raw THORChain blocks: streaming interval, custom TTL, THORName expiry height. Their bounds (StreamingSwapMaxLength, StreamingLimitSwapMaxAge) are in reference time.

Hardcoded block counts

Converted:

  • keeper_refund.go refund-cleanup retention 432000 → RefBlocks, and the stored expiry is converted at a change
  • keeper_xmr_spent_refs.go spent-ref retention 432000 → wall-clock cutoff (HeightAgo)
  • manager_slasher_current.go SOL sibling scan 14400 → wall-clock floor (HeightAgo)
  • handler_sol_nonce_attest.go re-attest minimum age 600 → RefBlocksSince
  • xmr_genesis_delay*.go XMR monovault genesis delay 128 → RefBlocks at use
  • ebifrost cachedBlocks 10: the app wires GetBlockTimeMs into ebifrost (proposer-local)
  • common/chain.go TRON solvency-voter quota window 10 → windows of wall-clock time since genesis, so the window index never goes back. Counting blocks, it went back after the block time went down, and every signer that had used its quota got "quota is ahead of current window" until the index caught up.
  • querier.go /queue/scheduled scan 17280 and genesis.go export scan 17200 → TxOutDelayMax + MaxTxOutOffset at the current block time (maxTxOutWindow)
  • common.THORChain.ApproximateBlockMilliseconds() in queriers (quote *_seconds, order expiry, tx-stages ETAs) → thorchainBlockMs: the 6s approximation scaled by BLOCKTIMEMS/default. It is unchanged while the mimir is unset (on mocknet too).
  • handler_tss.go durationToBlocks(6 min) for the XMR keygen window → uses the effective block time
  • node config vault_pubkeys_cutoff_blocks → wall-clock cutoff (HeightAgo). Bifrost uses /vaults/pubkeys to choose which vault addresses to watch, so a block-count cutoff dropped vaults early after a slowdown.

Left as they are:

  • x/scheduler MaxAfter = 100_000: a bound on a user-input block count (After, raw blocks like memo intervals), enforced in stateless ValidateBasic. With MaxMsgsPerHeight it also caps pending storage.
  • common.Chain.ApproximateBlockMilliseconds() itself: no ctx. Callers with a ctx convert as above; bifrost and tools/events callers are out of scope.
  • Telemetry only: IsPeriodLastBlock(ctx, blocksPerDay) for daily metrics, which follows the scaled BlocksPerYear.

Windows keyed to a block count

  • Swap-slip rollups (keeper_swap_slip.go) reset when the window shrinks and extend cleanly when it grows: blocks below the old window were already subtracted and deleted, so none is subtracted twice. The height % target snapshot changes phase once, which is acceptable for a rolling metric. A reset leaves the old window's per-block keys behind (as lowering MaxAnchorBlocks already does on develop). Deleting them in the reset block could mean ~170k deletes in one EndBlock after a 500 ms → 6 s revert, so they are left. The anchor-slip snapshots are now pruned by wall-clock age (DynamicMaxAnchorSlipBlocks), so a slowdown no longer drops snapshots still in the window.
  • Dynamic-fee epochs already re-base LastActiveEpoch when L1DynamicFeeEpochBlocks changes (rebaseOnEpochBlocksChange).
  • Swap-queue, pool-cycle and churn alignments (height % N) change phase once at a change.

Work a change would skip: fixed here

  • Churn schedule. The churn now follows wall-clock time since the last churn: the regular churn fires in the block whose age (RefBlocksSince(lastChurnHeight)) reaches ChurnInterval reference blocks, and retries fire each time it passes another ChurnRetryInterval. Without a change these are lastChurnHeight + ChurnInterval and every ChurnRetryInterval blocks after it. Counting blocks, a change mid-cycle fired the churn early after a slowdown (a deadline already "passed" in blocks) and late after a speedup. churnDeadlinePassedByBlockTimeChange is removed. TestChurnSurvivesBlockTimeChange: last churn at 30, interval 30 reference blocks, 20 of them at 1000 ms. At 2000 ms the churn fires at 55 (5 more blocks), with or without retries; at 500 ms at 70 (20 more blocks).
  • LackSigning is covered below: with the block time history it reschedules each outbound once it is a full period old in wall-clock time, so no height is skipped or checked early.

Outbound windows in wall-clock time

A fixed block count is the wrong window for an outbound across a change. When the block time goes up (including an emergency revert), outbounds scheduled at the faster rate sit more blocks back and more blocks ahead than the new period and offset reach. Without this section:

  • LackSigning would reschedule them as soon as they fell outside the shorter window, while they were still in flight (broadcast, not yet observed). That is a double spend.
  • Outbound matching would miss them, so their observations would not close the item. The result is a double spend plus a false slash.
  • GetPendingOutbounds, migrateFunds, the over-solvency check and CalcTxOutHeight would stop their scans short. Owed funds would count as free, and the over-solvency treasury sweep is live on mainnet.
  • Bifrost would keep its old constants for up to a churn interval, so it could sign after THORChain rescheduled.

The fix:

  • History. UpdateBlockTime appends each change to a block time history (blocktime/history, a BlockTimeHistory proto). constants.BlockTimeHistory measures wall-clock time over it:
    • HeightAgo(now, ms): the newest height that is at least ms old at now.
    • Reach(now, refBlocks): the furthest height a window could have scheduled to from any block so far.
  • Keeper helpers. RefWindowStart and RefWindowEnd wrap these. Without a change they reduce exactly to now − period and now + offset. History reads use an infinite gas meter, and every caller reads the same mimirs as before, so gas_used is unchanged.
  • LackSigning. Once a history exists, each block checks the heights that became a full period old (per class: standard, XMR, EVM aggregator, EVM token) since the previous block. That is several per block after the block time went up, none in some blocks after it went down, and each height exactly once. This replaces the change-block catch-up.
  • Same windows everywhere. These now use the same windows: GetPendingOutbounds, migrateFunds, the over-solvency backward and forward scans, CalcTxOutHeight, ExportGenesis, maxTxOutWindow, outbound matching (handler_common_outbound.go, findOriginalMemoForOutbound), and the /queue, /queue/outbound and /queue/scheduled queries.
  • API. /thorchain/constants returns block_time_ms and block_time_history (the latter omitted while empty) in the same response as the scaled constants.
  • Bifrost:
    • ConstantsProvider refreshes as soon as block_time_ms changes. It pairs the constants with the block time and history read before and after them, retrying if the block time moved in between.
    • The signer's stale check (signingWindowExpired) measures an outbound's age in wall-clock time over the same history, as THORChain does. Without a change it is the old block comparison.
    • reschedule_buffer_blocks is read as reference blocks of time: scaled in the EVM and ETH unstuck paths, and in milliseconds in the signer.

Stored deadlines and lockups

  • Deadlines stored as a future height are converted once, in the block where the block time changes (convertStoredHeights, called from UpdateBlockTime). Each keeps the wall-clock time it had left: a deadline at D after a change at H becomes H−1 + ceil((D−H+1)·prev/new). Deadlines at or before H are left alone. Converted:
    • jail release heights
    • the outbound delay queue: future TxOut heights are moved and merged, and their voters' OutboundHeight follows. Past the offset the queue stays contiguous: a converted height there directly follows the previous queued height (or the offset), because scans stop at the first empty height past the offset. Those outbounds go out a little sooner, never later.
    • THORName expiries
    • the limit-swap TTL index
    • the NodePauseChainGlobal pause height
    • the observation tally queue (keyed by due height)
    • the missing-observation guard's refill height (ObservationGuardFullAt)
    • refund-cleanup marker expiries (marker and its expiry index)
  • Lockups are now measured in wall-clock time since the stored height (RefBlocksSince, RefHeightAfter): BondLockupPeriod (unbond), LiquidityLockUpBlocks (withdraw), RUNEPoolDepositMaturityBlocks, and the bond lockup on LEAVE for a node that already churned out (handler_leave.go, which had its own copy of the unbond check). Their error heights and block counts come from the same history. A limit swap's age check (IsDone) reads its TTL in blocks of the block time it was placed at, so it agrees with its converted TTL entry.
  • Cost: without a change, every one of these is the old arithmetic. The conversion runs once per change and iterates every jail, every THORName, the TTL index, and the delay queue window. On mainnet that is tens of thousands of writes in the change block.

Ages and attempt counts in wall-clock time

Code that measured an age as now − height against a block count now uses RefBlocksSince against the value in reference blocks. Code that scanned a window back from now uses RefWindowStart/HeightAgo. Without a change each is the old arithmetic, and each reads the same mimirs, so gas_used is unchanged.

  • Funds-risk:
    • Outbound attempt counts (outboundAttempts): MaxRetiredVaultRecoveryAttempts (100, live on mainnet), MaxOutboundAttempts (treasury recovery) and the durable-nonce stuck alert. Counting blocks at the current period, 9999 blocks at 1500 ms followed by a change to 6000 ms counted as 199 attempts instead of 49, so a retired-vault outbound was dropped from the queue after ~12.5 h instead of ~50 h.
    • Solvency report exclusion (excludePendingOutboundFromVault): an outbound scheduled under the faster block time and still in flight dropped out of the deduction after a slowdown. The vault then looked short and the chain could be halted for solvency.
    • Bond lockup on leave (above).
  • Signer and slasher:
    • Stale outbound observation (staleNonFinalOutboundObservation, 3 periods) and the reassignment waiting window (needsNewVault)
    • DoubleSignMaxAge
    • Round-7 retry attempts in bifrost (round7Attempts), matching THORNode's count
    • Ragnarok outbounds: handler_ragnarok.go follows the heights LackSigning reschedules to (one period of wall-clock time apart) instead of a fixed block stride
    • FailKeygenSlashPoints restored to a late keygen signer is now scaled to the block time at consensus, when it was charged, so a change in between no longer leaves a difference
  • Churn and vaults:
    • Churn schedule (above), migration rounds (nth and the round tick in migrateFunds), stale pending migrates (migrateFunds and GetPendingOutbounds, kept identical), and the churn's pending-outbound count (getPendingTxOut)
    • Keygen result validity (handler_tss.go validate and hasPendingKeygen): a result for a keygen scheduled under the faster block time was rejected after a slowdown, stalling the churn until the next retry. hasPendingKeygen scans from the oldest height the validity check can still accept (RefBlocksSince rounds down).
    • Low-version churn-out grace (ChurnOutForLowVersionBlocks)
    • Vault security ordering (SortBySecurity, GetMostSecure, GetLeastSecure now take the period in reference blocks)
  • Observation scoring: the ObservationDelayFlexibility window for late observers (inbound, outbound, network fee, solvency, TSS, errata), the tally due height, and the missing-observation guard grace (MissingObservationGuardMaxBlocks), which ran out up to 4× early after a slowdown.
  • Other ages: MemolessTxnTTL (reference memo expiry, register, preflight, genesis), CloutReset, PendingLiquidityAgeLimit.
  • Queries and telemetry: /queue scheduled value, the queue metrics and stuck-outbound telemetry, and /vaults/pubkeys.

Genesis export

The export scans the outbound queue up to max(now + TxOutDelayMax + MaxTxOutOffset, RefWindowEnd(17200)), so it never covers less than the fixed span it used before. Lowering those settings does not move outbounds that are already queued.

GenesisState carries the latched block time and its history (block_time_ms = 51, block_time_history = 52, both omitted while unset, so no export fixture changes). InitGenesis restores them first, before the ages above are used.

Without this, an export/import at a non-default block time reset the latched value to the default. The first BeginBlock then re-latched BLOCKTIMEMS as a new change and converted every stored deadline as if it had been set at the default block time. ValidateGenesis checks that the two are set together, that heights ascend, and that the last segment matches the latched value.

Rate limit

UpdateBlockTime latches the target in steps:

  • A step back toward the default ThorchainBlockTime, without going past it, applies at once, so a bad change can always be undone in one block.
  • Any other step waits until ChurnInterval of wall-clock time has passed since the previous change, and moves at most half or double the current block time. On mainnet, 6000 ms → 1500 ms takes two steps one churn apart (3000, then 1500).

TestBlockTimeRateLimit walks the steps in both directions. Tests that need a larger jump seed the history with SetBlockTimeHistory, the genesis restore path.

Deliberately left in blocks

  • Governance heights (Halt*, upgrade heights, ScheduledMigration): absolute heights set by people, not derived from a duration. Operators must re-plan them after a change. NodePauseChainGlobal is converted because the protocol computes it from NodePauseChainBlocks.
  • Leave score, churn-out score and node rewards ((now − StatusSince)/slash points, earnedBlocks/totalActiveBlocks): ratios of per-block quantities. Slash points like MissBlockSignSlashPoints accrue per block, so measuring the age in blocks keeps the ratio consistent across a change. Measuring it in time would bias against nodes during fast periods. MissingBlocks versus MissingBlockChurnOut is the same kind of comparison.
  • Modulo cadences (PoolCycle, epochs, the pending-liquidity cleanup rotation, the height % FundMigrationInterval pool check, IsPeriodLastBlock): change phase once.
  • User-specified block counts (x/scheduler After, streaming interval, custom TTL).
  • The XMR monovault bootstrap delay: a one-off keygen scheduled a few minutes ahead. A change in between moves it by at most that.
  • Bifrost blockscanner flex (blockscanner.go): it looks up c["6s"], gets 0, and always uses 1 block (a bug already on develop). It does not depend on the block time, so fixing it belongs in its own MR.

Bifrost timing

  • One block time for the whole process. New leaf package bifrost/blocktime holds THORChain's block time as Bifrost last read it. The bridge sets it whenever it reads block_time_ms (GetBlockTime, which the signer's ConstantsProvider calls every block). Before the first read, and while BLOCKTIMEMS is unset, blocktime.Get() is the default ThorchainBlockTime, so every timer below is unchanged.
  • Follows the block time (work done about once per THORChain block):
    • the bridge's one-block HTTP response cache and the pool cache
    • the chain-halt mimir check intervals (block scanner, SOL scanner)
    • the pubkey manager's per-block fetch and the EVM unstuck loop
    • the halted-chain solvency runners: callers pass 0, and the runner waits one block at the current block time on each pass
    • the per-block caches for asgard addresses (UTXO, XMR), XMR consolidation config, and the TSS version checks
    • tickers in the XMR errata maintenance and retry, keygen retry and XMR keygen workers, and XMR consolidation: blocktime.NewTicker re-reads the block time before each tick
  • Left on the default 6 s, because they are timeouts, error backoffs or retry budgets (an interval times a maximum number of attempts), and shrinking them would cut the time allowed: the HTTP request timeout, queue-send timeouts, persistence and attestation waits, the mempool and catching-up backoffs, and the XMR recovery and spent-ref retry intervals.
  • Raw mimir reads. The duration mimirs Bifrost reads raw are in reference blocks, and most were already converted with the reference 6 s, so they are wall-clock correct: KeygenRetryInterval (× 6 s), SignatureRefreshBlocks (× 20 SOL slots), OracleUpdateInterval (ms). The rest are flags, counts or heights. The exception was the keygen acceptance window and retry grid. They now measure wall-clock time since the keygen over the block time history (keygenRefElapsed), matching THORNode's RefBlocksSince check. A prepared retry stores its boundary in reference blocks and fires once fresh history reaches it, so nodes that prepared before and after a change fire together.
  • Signer safety:
    • EVM and ETH unstuck measure a signed outbound's age and its period phase in wall-clock time over the history (signing.UnstuckWindow), as the signer does. Unstuck therefore never clears the signer cache while the signer could still re-sign before THORChain reschedules.
    • The constants provider fails closed when the block time can't be read, instead of serving cached constants whose history could miss a change.

Tests

  • Unit tests:
    • constants: unit coverage, scaling math, overflow
    • keeper/v1: scaling, clamping, identity, gas neutrality, THORName fees; mainnet tag: 6s reference and the 1500 ms floor
    • churn and LackSigning across a block-time change
    • the latch: no write while unset, effective from the next block
    • the analyzer's testdata
  • Full mocknet unit run plus -race on the touched packages.
  • Regtest suites/blocktime/duration-scaling.yaml:
    • sets BLOCKTIMEMS to 500 (half of mocknet's 1000)
    • asserts the scaled /thorchain/constants values (durations ×2, rates ÷2, counts unchanged)
    • checks a keysign-failure jail releases after 20 blocks instead of 10
    • checks a change takes effect from the next block, and that unsetting restores everything
    • asserts /thorchain/network block_time_ms is 1000, then 500, and 1000 again once unset
  • History and windows:
    • constants: brute-force checks of HeightAgo and Reach against a block-by-block sum over several histories, including that each height is checked exactly once
    • keeper/v1: history recording, RefWindowStart/RefWindowEnd, gas neutrality, and GetPendingOutbounds across a 500 → default revert
    • slasher: no early reschedule after the block time goes up, and the exact due block in both directions
    • bifrost: signingWindowExpired in both directions, the refresh on a block time change, and parsing block_time_ms/block_time_history
  • Stored heights:
    • keeper/v1: one change converts jails, THORNames, the delay queue (two heights merging into one, with their voters), the TTL index and the pause height, and leaves past deadlines alone; also RefBlocksSince/RefHeightAfter with and without a change
    • adv swap queue: a limit swap placed under 500 ms expires after the same wall-clock time, at the height its converted TTL entry fires
    • constants: ElapsedMs and HeightAfter checked against a block-by-block sum
  • Regtest suites/blocktime/stored-heights.yaml: BLOCKTIMEMS 500 → 0 with a jailed node and a pending THORName. The jail release moves 25 → 17 and the expiry 60 → 35. The name is live through 35 and expired at 36.
  • Ages, attempts and the rate limit:
    • slasher: outboundAttempts over a 1500 → 6000 ms change against a real keeper (49 attempts where counting blocks gives 199; 99 and 100 at the exact boundary), a retired-vault outbound rescheduled at 51 periods and abandoned at 100 through LackSigning, and stale-observation boundaries. Both attempt tests fail against the old block count.
    • solvency: excludePendingOutboundFromVault keeps an outbound 70 blocks back (195 reference blocks) after 1500 → 6000 ms, at the exact window edge
    • withinObservationFlex, referenceMemoExpired and restoreClout across 1500 → 6000 ms
    • keeper: one change moves the observation tally queue and refund-cleanup expiries; TestBlockTimeRateLimit
    • churn: TestChurnSurvivesBlockTimeChange now expects the wall-clock schedule
    • genesis: the block time round-trips, a re-latch after import is not a new change, and invalid histories are rejected
  • Review fixes: the queue stays contiguous past the offset after the block time halves (GetPendingOutbounds finds all 8, against 5 under a plain mapping); hasPendingKeygen at 500 ms at the rounding edge; the export keeps an outbound at now+800 after TxOutDelayMax is lowered; a keygen retry prepared before a change fires with one prepared after; UnstuckWindow across a doubling; the constants provider failing closed. The queue and keygen tests fail against the previous code.
  • Bifrost: blocktime get/set and the ticker following a change (40 → 400 → 20 ms); the bridge response cache going stale at three quarters of the old block once block_time_ms halves; the keygen window and retry grid across a change (target 2851 where counting blocks gives 2900); SignatureRefreshBlocks unchanged by the block time; go test -tags=mocknet ./bifrost/... passes.
  • Regtest suites/blocktime/solvency.yaml: BLOCKTIMEMS 500 → 0 with an in-flight outbound (0.0826 BTC from the dog vault at 4). At 18 the outbound is 14 blocks old but 8.5 s, and a solvency report of the vault's balance less the outbound is solvent: BTC is not halted, the vault is unchanged, and the outbound is rescheduled at 20. With the block-count check put back, the same suite halts BTC (negative control run locally).
  • Regtest suites/blocktime/revert.yaml: BLOCKTIMEMS 500 → 0 with an in-flight outbound and a queued (scheduled) one.
    • The in-flight outbound is past the new period in blocks but not in time. It is not rescheduled in the change block, and is rescheduled at exactly the block where it becomes 10 s old.
    • The queued outbound, scheduled 40 half-length blocks ahead, is moved at the revert to keep its time (48 → 32) and goes out at 32.
  • Identity check: a full make test-regression CI=1 EXPORT=1 DEBUG=1 (196 suites, 0 failed) leaves every export and block fixture outside blocktime/ unchanged. The blocktime suites' exports gain the new block_time_ms and block_time_history genesis fields, and the new suite's fixtures are added.

🤖 Generated with Claude Code

Edited by Huginn Ai

Merge request reports

Loading
Loading