Skip to content

Commit 73b5779

Browse files
committed
Revert "review: disclose the redeem collateral floor gate, unify the activation-floor helper"
This reverts commit 596bd1f.
1 parent 596bd1f commit 73b5779

13 files changed

Lines changed: 96 additions & 112 deletions

V9.26.4_PRUNING_EXPLAINER.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ and activation cannot happen below the deployment's minimum activation height: b
1313
**23,627,520**. So every block DigiDollar validation will *ever* need lives between
1414
that height and the tip. Everything below is plain DGB history — safe to delete.
1515

16-
**How v9.26.4 does it** (one narrowly scoped consensus rule — the redeem collateral
17-
floor gate that keeps pruned and full nodes in agreement — everything else opt-in
18-
behind `-prune`):
16+
**How v9.26.4 does it** (zero consensus changes, all opt-in behind `-prune`):
1917

2018
1. **Prune lock at the floor.** Startup registers a "digidollar" prune lock at
2119
23,627,520. Automatic pruning *and* the `pruneblockchain` RPC are clamped below

V9.26.4_PRUNING_PLAN.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
~23.6 million pre-DigiDollar blocks (12 years, ~32 GB) while keeping the small
66
DigiDollar-era window — so pools **upgrade once**, enforce the Groestl algolock at
77
block 23,808,000, signal and validate DigiDollar, and never need txindex.
8-
**One narrowly scoped consensus change (the redeem collateral floor gate, added by the
9-
ship audit); every other new behavior is opt-in behind `-prune`.** The whole job
8+
**Zero consensus changes. Every new behavior is opt-in behind `-prune`.** The whole job
109
is plumbing: make sure a pruned node has every piece of data DigiDollar reads, and that
1110
each piece is wired to the right source so the node computes the same answers as a full
1211
node.
@@ -375,14 +374,6 @@ exercise our plumbing, not upstream's.
375374
| `regtest_prune_still_honors_explicit_request` | regtest `-digidollar -prune` → false (relaxed); plain regtest → false | n/a |
376375

377376
### 3b. `digidollar_pruning_tests.cpp` (NEW)
378-
379-
> **As shipped:** this file was not created. The floor computation is covered by the
380-
> `dd_prune_activation_floor` fuzz target (`src/test/fuzz/digidollar_prune_blockdb.cpp`),
381-
> which exercises the shared `DigiDollar::EarliestActivationFloor` helper directly, and
382-
> the reindex-guard cases (complete window, hole, truncated block file) are covered by
383-
> `test/functional/feature_digidollar_pruning.py` phases F9/F14 rather than unit tests;
384-
> the tip-below-floor no-op case has no direct unit test.
385-
386377
| Test | Asserts |
387378
|---|---|
388379
| `earliest_dd_activation_height_matches_consensus` | plan floor `== min(nDDActivationHeight, DEPLOYMENT_DIGIDOLLAR.min_activation_height)` for Main (23,627,520) / TestNet / RegTest — pin the exact number so a chainparams edit can't silently move the floor |
@@ -393,11 +384,6 @@ exercise our plumbing, not upstream's.
393384
| `reindex_guard_hole_signals_reindex` | tip≥floor, a DD-era block lacks `BLOCK_HAVE_DATA` → guard returns the "needs reindex" result (not a crash) |
394385

395386
### 3c. `digidollar_health_pruned_tests.cpp` (NEW — the one wiring gap)
396-
397-
> **As shipped:** this file was not created. ScanUTXOSet pruned-vs-full parity and the
398-
> pre-floor coin skip are covered by `test/functional/feature_digidollar_pruning.py`
399-
> (phases F6 restart parity and F10 full-node-to-pruned migration) rather than unit tests.
400-
401387
Build a tiny regtest chain with one DD mint, then:
402388
| Test | Asserts |
403389
|---|---|

V9.26.4_PR_EXPLAINER.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ straight through DigiDollar activation with no further upgrade.
2222
**What changes if you don't set `prune=`:** nothing. Your node behaves exactly
2323
like v9.26.3.
2424

25-
**What we changed in consensus:** one narrowly scoped rule. Redemption collateral
26-
classification is now gated on the DigiDollar activation floor (a pre-floor coin can
27-
never be vault collateral), which is what makes a pruned node accept and reject
28-
exactly the same blocks as a full node. The pre-release mainnet scan found no
29-
existing coins the rule affects. The Groestl algolock and the DigiDollar activation
30-
schedule are untouched.
25+
**What we changed in consensus:** nothing. Zero consensus changes. A pruned node
26+
accepts and rejects exactly the same blocks as a full node. The Groestl algolock
27+
and the DigiDollar activation schedule are untouched.
3128

3229
---
3330

@@ -80,9 +77,8 @@ scan that reports the same totals *and* position count; pruned nodes advertise
8077

8178
## What did NOT change
8279

83-
- **Consensus, except the redeem collateral floor gate.** Mint/transfer rules,
84-
oracle bundle rules, lock tiers — all byte-identical. The one change is in
85-
redemption collateral classification (the activation-floor gate above).
80+
- **No consensus changes.** Mint/transfer/redeem rules, collateral rules, oracle
81+
bundle rules, lock tiers — all byte-identical.
8682
- **The Groestl algolock** — untouched, and its boundary tests still pass
8783
(accept at the boundary, reject after, reindex-safe).
8884
- **DigiDollar activation (BIP9 bit 23)** — untouched; all activation tests pass.

doc/release-notes/release-notes-9.26.4.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@ only a few gigabytes of blocks instead of the entire ~12-year, ~40 GB block hist
88
**In one line:** add `prune=2000` to your `digibyte.conf`, upgrade, and your node
99
runs DigiByte + everything DigiDollar needs on a fraction of the disk.
1010

11-
**This release adds one narrowly scoped consensus rule.** Redemption collateral
12-
classification is now gated on the DigiDollar activation floor: a coin created below
13-
the floor is never treated as vault collateral, whether it appears as the redemption's
14-
input 0 (rejected as `bad-collateral-release-not-vault`) or as a fee input (see
15-
`ValidateCollateralReleaseAmount` in `src/digidollar/validation.cpp`). This rule is
16-
what keeps pruned and full nodes in agreement, and the pre-release mainnet scan found
17-
no existing coins it affects (`V9.26.4_MAINNET_VALIDATION.md`). v9.26.2's Groestl
11+
**It contains no consensus rule changes for existing nodes.** v9.26.2's Groestl
1812
algolock and the DigiDollar BIP9 deployment are carried forward unchanged, and a
1913
pruned v9.26.4 node accepts and rejects exactly the same blocks and transactions as a
20-
full node. Upgrading is optional — a node that does not set `-prune` behaves like
21-
v9.26.3 except for this one rule; node operators, pools, and exchanges should treat it
22-
as a consensus rule addition when assessing upgrade urgency.
14+
full node. Upgrading is optional — a node that does not set `-prune` behaves exactly
15+
like v9.26.3.
2316

2417

2518
How to Upgrade

src/consensus/digidollar.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@
1313

1414
namespace DigiDollar {
1515

16-
int EarliestActivationFloor(const Consensus::Params& params)
17-
{
18-
const auto& deployment = params.vDeployments[Consensus::DEPLOYMENT_DIGIDOLLAR];
19-
if (deployment.nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE ||
20-
deployment.nTimeout == Consensus::BIP9Deployment::NEVER_ACTIVE) {
21-
return 0;
22-
}
23-
if (deployment.nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE) {
24-
return deployment.min_activation_height;
25-
}
26-
return std::min(params.nDDActivationHeight, deployment.min_activation_height);
27-
}
28-
2916
int GetCollateralRatioForLockTime(int64_t lockBlocks, const ConsensusParams& params)
3017
{
3118
const auto it = params.collateralRatios.find(lockBlocks);

src/consensus/digidollar.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,6 @@ enum DigiDollarTxType : uint8_t {
4545
DD_TX_MAX = 4 // For validation
4646
};
4747

48-
/**
49-
* Earliest height at which a DigiDollar output can exist on this chain (the
50-
* "activation floor"). Single source of truth shared by consensus validation
51-
* (EarliestDigiDollarActivationHeight), the "digidollar" prune lock
52-
* (src/node/chainstate.cpp), and the startup fail-closed guards
53-
* (src/digidollar/health.cpp, src/oracle/bundle_manager.cpp) — these must
54-
* never disagree, or a pruned node could delete a block validation still
55-
* needs to read.
56-
*
57-
* Returns 0 when the deployment can never activate (NEVER_ACTIVE start or
58-
* timeout); callers treat 0 as "no floor" (no prune lock, no fail-closed
59-
* window, pre-floor gates disabled).
60-
*/
61-
int EarliestActivationFloor(const Consensus::Params& params);
62-
6348
/**
6449
* Core consensus parameters for the DigiDollar stablecoin system.
6550
* These parameters define the economic model, collateral requirements,

src/digidollar/health.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,16 @@ bool SystemHealthMonitor::ScanUTXOSet(CCoinsView* view, CCoinsView* validation_v
311311
// Below the floor there are no DD vaults, so we skip those coins without reading a
312312
// block — this is what lets the seed run identically on a pruned node (pre-floor
313313
// blocks are gone) and a full node (pre-floor blocks are present but hold no vaults).
314-
const int dd_floor = consensus ? DigiDollar::EarliestActivationFloor(*consensus) : 0;
314+
int dd_floor = 0;
315+
if (consensus) {
316+
const auto& dd_dep = consensus->vDeployments[Consensus::DEPLOYMENT_DIGIDOLLAR];
317+
if (dd_dep.nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE &&
318+
dd_dep.nTimeout != Consensus::BIP9Deployment::NEVER_ACTIVE) {
319+
dd_floor = (dd_dep.nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE)
320+
? dd_dep.min_activation_height
321+
: std::min(consensus->nDDActivationHeight, dd_dep.min_activation_height);
322+
}
323+
}
315324

316325
// Reset counters
317326
s_currentMetrics.totalDDSupply = 0;

src/digidollar/health.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,7 @@ class SystemHealthMonitor {
182182
//! (block data incomplete/damaged) — callers seeding consensus-relevant
183183
//! state must treat that as fatal (fail closed) rather than accept an
184184
//! undercounted supply/collateral baseline.
185-
//! mempool/chain/consensus deliberately have no defaults: the pre-floor
186-
//! coin skip and the fail-closed check are both gated on a non-null chain,
187-
//! so a caller that silently omitted these arguments would revert to the
188-
//! old silent-undercount behavior. Every caller must decide explicitly.
189-
static bool ScanUTXOSet(CCoinsView* view, CCoinsView* validation_view, const node::BlockManager* blockman, const CTxMemPool* mempool, const CChain* chain, const Consensus::Params* consensus);
185+
static bool ScanUTXOSet(CCoinsView* view, CCoinsView* validation_view, const node::BlockManager* blockman, const CTxMemPool* mempool = nullptr, const CChain* chain = nullptr, const Consensus::Params* consensus = nullptr);
190186

191187
/**
192188
* Reconstruct the cached system-health metrics (total DD supply + total

src/digidollar/validation.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ static bool IsCanonicalP2TROutput(const CScript& script)
6969

7070
static int EarliestDigiDollarActivationHeight(const ValidationContext& ctx)
7171
{
72-
return DigiDollar::EarliestActivationFloor(ctx.params.GetConsensus());
72+
const Consensus::Params& cp = ctx.params.GetConsensus();
73+
const auto& deployment = cp.vDeployments[Consensus::DEPLOYMENT_DIGIDOLLAR];
74+
if (deployment.nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE) {
75+
return deployment.min_activation_height;
76+
}
77+
return std::min(cp.nDDActivationHeight, deployment.min_activation_height);
7378
}
7479

7580
static bool CoinHeightMayCreateDigiDollar(const Coin& coin, const ValidationContext& ctx)

src/node/chainstate.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <arith_uint256.h>
77
#include <chain.h>
88
#include <coins.h>
9-
#include <consensus/digidollar.h>
109
#include <consensus/params.h>
1110
#include <logging.h>
1211
#include <node/blockstorage.h>
@@ -166,7 +165,15 @@ static ChainstateLoadResult CompleteChainstateInitialization(
166165
// DigiDollar with incomplete data. Registered here (cs_main held, tip loaded) before
167166
// the first prune/flush can run.
168167
{
169-
const int dd_floor = DigiDollar::EarliestActivationFloor(chainman.GetConsensus());
168+
const Consensus::Params& consensus = chainman.GetConsensus();
169+
const auto& dd_dep = consensus.vDeployments[Consensus::DEPLOYMENT_DIGIDOLLAR];
170+
int dd_floor = 0;
171+
if (dd_dep.nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE &&
172+
dd_dep.nTimeout != Consensus::BIP9Deployment::NEVER_ACTIVE) {
173+
dd_floor = (dd_dep.nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE)
174+
? dd_dep.min_activation_height
175+
: std::min(consensus.nDDActivationHeight, dd_dep.min_activation_height);
176+
}
170177

171178
if (options.prune && dd_floor > 0) {
172179
PruneLockInfo dd_lock;

0 commit comments

Comments
 (0)