Lotus V2 upgrade mechanisms: soft-fork activation and the scalar vote
On this page
- Decision summary
- 1. What exists and what is missing
- 2. Prior art
- 3. The shape: a genesis minimum and a policy release
- 4. The genesis minimum (consensus)
- 5. The policy release (Avalanche)
- 6. Soft-fork activation
- 7. The scalar vote in use
- 8. The payout split (review U10, R2)
- 9. Mapping the audit items to the mechanisms
- 10. Reorgs, IBD and C22a
- 11. Draft normative text for consensus.md (proposal only)
- 12. Draft normative text for peering.md (proposal only)
- 13. Implementation estimate (review R10)
- 14. Risks and what this note does not establish
- Reproduce
- References
Status: research, third revision, after the second review (2026-11-19). This note changes no normative file and no code. Nothing was built. The draft normative text in sections 11 and 12 is a proposal only.
The owner's goal: "I want to not have to touch this again. Bitcoin died because of needing fixes that couldn't get done politically." Every future change must go through a mechanism agreed before launch. The owner also rejects caps and magic numbers.
Inputs:
- the constants audit ("the audit");
- the work-indexed fee floor and its review with addendum;
- the review of this note ("the review": findings U1–U15, and R1–R10 in its addendum);
consensus.md,decisions.md, P01, P02, P05, P06,peering.md, the treasury guide,daemon/audit/launch-plan.md;- lotusd at
fd10cf77a7:src/avalanche/{proof,treasury,peermanager,processor,voterecord}.*,src/lotus_v2/avalanche_proof.*,src/protocol.h.
Scripts: tools/lotus-v2-reference/research/upgrade/ (uncommitted; see Reproduce).
What changed in this revision. The second review's verdict was "sound with fixes". The coordinator set:
| Decision | Effect on the design | |
|---|---|---|
| R1 | Block polls | A hold block is answered normally. Only a block whose signal moves something is held back. A stale or unpolled item counts as "no". Finality can no longer stop (section 5.4, simulated). |
| R2 | Miner's half | Dropped. The whole 50/25/25 split is staker policy (section 8). |
| R3 | Snapshot | A registry of once-finalized proofs; a proof counts only if it expires within the 66-epoch window, so never-expiring and lost-key stake ages out (section 5.2). |
| R4 | A_0 |
A_0 = 0 and A ≥ 0: the vote only raises prices, the frozen-minimum principle. scalar_bounds.py now prices at 1,000 atoms/kB through the cu term. |
| R5, R6 | Guarantee and floor | The consensus guarantee is written down as what it is (section 4.5). The floor stays a share q of supply, because no chain-visible quantity can replace it; q is owner item D1. Lock-ins need the full q, not 3q/4. |
| R7 | Supply | Exactly defined, in u128, with expired unswept coins counted. |
| R8 | Certificate size | Bounded by C06's framing bound and charged in cu to the coinbase. |
| R9 | Lock items | One deployment ID per coin per boundary in consensus; policy polls at most one lock item from its own tally. |
| R10 | Scope | The note is now built around the genesis minimum. The certificate is signed by the stake coins' own keys, not built from Avalanche proofs. Everything else is a later policy release. |
Decision summary
Decided (owner, 2026-11-18; coordinator under the owner's delegation, 2026-11-18 and 2026-11-19):
- Stakers vote through Avalanche, with a vote protocol of their own.
- One voted scalar, the price shift
A, applied only to fee rule (c)'s indexed terms: the transactions' linear cu termL_txand the byte fee. A_0 = 0andA ≥ 0: the vote can raise prices above (c)'s index and lower them back, never below it.- Deployments are identified by the hash of their specification.
- Every move needs a stake certificate that consensus verifies from genesis.
- The genesis release contains only what a later soft fork cannot add. The rest is a policy release.
What goes into the genesis format (section 4). These four parts are all a later soft fork could not add:
UpgradeState, a 72-byte element of theStateRootpreimage. It holds a running deployment root, a pending root, a count, andAactive and pending. At genesis both roots are0^32andA = 0.- The signal word, which is the coinbase input's
sequence.ffffffffmeans hold. At a boundary (every 2,016 blocks) it can stepAby ±1 and lock in one deployment ID. Every change takes effect one epoch after it is decided. - The
UpgradeCertificate, a new coinbase field. - It is signed by the keys of the stake coins themselves:
pubkey ‖ ballot ‖ signature ‖ outpoints. - Consensus checks against the parent state that the coins are unspent, old enough and locked to the key. It also checks that their value clears a floor: more than
q/2of supply for a price step, at leastqof supply for a lock-in. - The certificate is empty when the signal holds.
- A miner without stake can therefore move nothing, and no single miner can activate anything.
Aon the cu term:L_tx·2^AandByteFee·2^A, with0 ≤ A ≤ 63.
The estimate is 14 commits, about 2,500–3,450 lines including tests, and 9–12 lane-days, or about 6–7 days elapsed with two lanes (section 13). That fits before the 2026-12-10 go/no-go.
The policy release (section 5). It can follow the launch:
- the ballot in the Avalanche proof;
- the snapshot registry and the tally;
- three yes/no Avalanche items per boundary;
- relay of certificate groups;
UpgradePolicyparking;- templates, mempool, RPC and wallet;
- the deployment-keyed script cache.
Until it ships, nothing moves: nodes have no items, so every moving block counts as "no" and is parked (rule R1). That is the intended launch state.
What is actually guaranteed (section 4.5):
- With Avalanche enforcing, a price step follows more than half of the live snapshot stake, and a lock-in needs at least 3/4 of it.
- Without Avalanche enforcing, for any reason (too few nodes, a partition, IBD, a bug, an unseen miner), consensus alone admits:
- a ±1 step backed by more than
q/2of all coins; - a lock-in backed by at least
qof all coins. - Always:
- at most one step, a factor of 2, per 2.8-day epoch;
Anever falls below (c)'s index;- liveness terms (
K,L_own, dust,Q) are never scaled; - every move is public one epoch before it takes effect.
Capture, at 2 cents per XPI:
- A persistent stake majority can raise a payment from 0.012 XPI to about 48 XPI (about $0.95) in 12 steps, roughly 36 days.
- Holders who stake against it count within two boundaries, so at most 2 steps (4×) are decided before the reversal starts.
- The vote can never make anything cheaper than (c) prices it.
Still needs the owner:
| # | Decision | Recommended | Why it is the owner's |
|---|---|---|---|
| D1 | q. Its exact meaning: the share of all coins (Supply, section 4.3) whose keys must sign at one boundary for consensus to accept a move made while Avalanche is not enforcing the tally. A step needs more than q/2, a lock-in at least q. |
q = 1/8. A step then needs more than 1/16 of all coins, and a lock-in 1/8. |
No on-chain fact fixes it: the stake that exists is off chain. A floor relative to the snapshot's W is impossible, because consensus cannot see W (section 4.5). Too high, and nothing can move. Too low, and a large holder plus one block moves alone when Avalanche is down. |
| D3 | Write O11 into the spec as a norm: no deployment shortens an existing coin's lifespan, or strands coins without a rescue path specified first | Yes, labelled as a norm. It binds by agreement, not by mechanism. | It is the confiscation line, a statement of values. |
| D4 | Schedule and fallback | Build the genesis minimum now (section 13) and decide at the 2026-12-10 go/no-go. If that is at risk, the fallback drops the A fields and the price bits, and handles raises as deployments at 3/4 (saves 400–600 lines). The fallback must be chosen before genesis, because adding A later needs a StateRoot change. |
It is a launch-date call, and the fallback reverses part of the owner's scalar-vote decision. |
D2 from the previous revision, coin-owner consent, is settled by construction: the certificate is signed by the coin keys.
1. What exists and what is missing
- Header. It is 134 bytes with no version bits and no reserved bytes (P04). Unknown versions reject (C02).
- Coinbase. Its single input carries:
prev_txid= the parent BlockID;prev_index= the height;sequence = ffffffff;CoinbaseData: 0 or 1 opaque element of at most 8,192 bytes (P01).
No rule gives the coinbase sequence a meaning.
- Extension points. There are 30
OP_SUCCESS_Nbytes and 256EXT2codes (P03), andC_enforce ≥ C_accountallows price raises (P05). No activation mechanism exists (audit U1). - The scalar vote.
- C14a sketches a frozen minimum, with a working value raised by Avalanche parking.
- C14c: "still to be designed". The owner asked for it on 2026-11-09.
- The resource calibration, the audit (U5, U6) and the fee-floor lane depend on it.
- Treasury proof vote (D11).
- Each proof carries
treasuryPayouts. Each node tallies, by plurality, the slate backed by eligible proofs: connected, finalized, and registered at least 1 hour earlier. TreasuryPolicyparks blocks that pay none of the winners.- The epoch vote reuses the proof transport and the item-polling machinery, and replaces the rest. A plurality is not a numeric aggregate, eligibility depends on who is connected, one contender per outcome halts under a three-way split (review U1), and the result never becomes consensus state.
- Avalanche (
voterecord.{h,cpp}). - Each item is a binary record. A round counts when more than 6 of the last 8 answers agree, and finalization needs 128 rounds.
- A record is stale, and dropped without finalizing, once
successfulVotes > 4,096andsuccessfulVotes > 64 × confidence(voterecord.h:103-107). Inconclusive answers count as votes. - Stake must be 2,016 blocks old. The quorum is latched.
2. Prior art
Activation:
| Mechanism | Who decides | Used for | What happened | Lesson for V2 |
|---|---|---|---|---|
| Flag day in code (BIP16, BIP30) | Developers and node operators | Early soft forks | Worked while the community was small. BIP16 versus BIP17 was already a fight. | Needs agreement on who ships code. |
| IsSuperMajority (BIP34, then BIP66 and BIP65) | Miners, 750/950 of 1,000 blocks | 2012–2015 | At BIP66 (July 2015), miners that skipped validation built six invalid blocks. | Signalling is not enforcement. |
| BIP9 | Miners, 95% of a 2,016-block period, with a timeout | CSV (2016), SegWit (2016–17) | SegWit stalled at about 30% for months. | A high threshold hands a small minority a veto. |
| BIP148, BIP91 | Users threatening a split; miners at 80% | Forcing SegWit, 2017 | SegWit activated at block 481,824. BCH split off on 1 August 2017. SegWit2x was cancelled. | A failed mechanism turns into brinkmanship. |
| BIP8 (LOT) | Miners, or mandatory at the timeout | Proposed for Taproot | The 2021 fight was over the fallback itself. | Fix the fallback before the first deployment. Here it is "withdraw". |
| Speedy Trial (Bitcoin Core 0.21.1: BIP9 at 90% with a minimum activation height) | Miners | Taproot, 2021 | Locked in June 2021, active at block 709,632 | Works when nobody objects. |
| BCH and eCash median-time upgrades | Whoever writes the release | Twice a year | Splits in November 2018 (BSV) and November 2020 (ABC against BCHN) | No measurable rule says whether the network agreed. |
| eCash Avalanche policies | Stakers, by parking | Finalization, staking rewards (2024) | Binding for online nodes only | Syncing nodes need a recorded result. |
| Decred | Ticket holders: 75% of votes cast over 8,064 blocks, with a quorum | Every rule change since 2017 | No splits | The closest precedent. Ticket votes are signed by the coins' keys and recorded on chain, as the certificate here is. |
| Tezos | Bakers by stake, 80%, adaptive quorum | Every upgrade | Regular upgrades without forks | A stake supermajority for code changes works. |
| XRPL amendments | Validators, more than 80% for two weeks | Features | Works with a curated validator list | A hold period gives notice. |
Scalar votes:
- Ethereum's gas limit (Yellow Paper §4.3.4). Each producer may move it by at most
parent/1024toward its own target. It went from 36M to 45M in 2025, then to 60M in late 2025. The mechanism itself has never been fought over. - XRPL fee voting. Reserves were lowered in 2021 and 2024, with split votes and objections that lower reserves invite DoS. That is the reason
Ahere cannot go below the index. - Decred's treasury (DCP-0006).
- Self-adjusting, with no vote. BCH's ABLA (CHIP-2023-04), and Monero's long-term median, which exists to stop short-term ratcheting.
Lessons:
- Mechanisms fail when a small minority holds a veto, when the fallback is decided late, or when "the release" is the decider.
- They work when the decider, the threshold, the window and the fallback are fixed in advance, and the decider bears the cost.
- Steps must be small.
3. The shape: a genesis minimum and a policy release
A soft fork cannot add:
- a
StateRootelement; - a field to the coinbase grammar;
- a meaning for a signal value that old nodes reject.
Each of those changes what old nodes compute or accept. Everything else can be added later by a release that only narrows what it accepts.
| Part | Where | Why there |
|---|---|---|
UpgradeState in StateRoot, with the A fields |
Genesis | Old nodes must compute the same root |
| The signal word and the transition (pending values, ±1 bounds, root hashing) | Genesis | Old nodes must accept a moving block |
| The certificate field, verified at genesis | Genesis | Without verification any miner moves and locks, and junk roots break predecessor targeting |
A applied to L_tx and the byte fee |
Genesis (could be deferred) | Small. With A ≥ 0, applying it later would be a tightening, but nothing is gained by waiting. |
| Ballot in the proof, snapshot registry, tally | Policy release | Avalanche policy only |
Items, the R1 polling rule, UpgradePolicy |
Policy release | Avalanche policy only |
| Certificate-group relay, templates, mempool, RPC, wallet | Policy release | Policy and tooling |
| Deployment-keyed script cache, deployment tables | With the first deployment | No deployment exists at genesis |
Launch behaviour. The genesis release has no items. By rule R1 (section 5.4), a moving boundary block then counts as "no" on every node that runs Avalanche: it is parked, and a hold block replaces it. So nothing moves until the policy release ships, and the certificate keeps it so when Avalanche is not enforcing.
4. The genesis minimum (consensus)
4.1 UpgradeState
A fixed 72-byte element of the StateRoot preimage, little-endian:
| Offset | Field | Type | Meaning |
|---|---|---|---|
| 0 | deployment_root |
h32 | Running hash of the activated deployment IDs; 0^32 at genesis |
| 32 | pending_root |
h32 | Equals deployment_root, or H(deployment_root ‖ lock_id) while a lock-in awaits activation |
| 64 | deployment_count |
u32 | Number of activated deployments |
| 68 | price_shift |
u16 | A, active; 0 at genesis |
| 70 | pending_price_shift |
u16 | A from the next boundary; 0 at genesis |
StateRoot = H_state(00 || ChainID || height:u64 || UtxoRoot:h32 || Bytes(MonetaryState(h)) || UpgradeState)
MonetaryStateis unchanged at 56/88 bytes. Rule (c) adds no field.- The preimage after the domain tag grows from 130/162 bytes to 202/234: one more BLAKE3 block.
UpgradeStateis a separate element, so governance stays out of the monetary record.deployment_countis redundant with the root, but it lets a snapshot import check the length of its list of activated IDs.
4.2 Signal word and transition
Boundaries. With P = 2,016, a height b ≥ P with b mod P = 0 is a boundary.
Signal word. The coinbase input's sequence:
| Bits | Field | Values |
|---|---|---|
| 0–1 | price step | 11 hold, 01 +1, 10 −1, 00 invalid |
| 2 | lock | 1 none, 0 lock in the certificate's lock_id |
| 3–31 | — | must be 1 |
All-ones means hold. It is required at every non-boundary height.
Transition at a boundary b, from the parent state:
- Apply the pending values. If
pending_root ≠ deployment_root, setdeployment_root = pending_rootand incrementdeployment_count. Setprice_shift = pending_price_shift. Letvbe the result. - Check the signal and the certificate (section 4.3).
- Set
pending_price_shift = v + step. Reject the block if the result leaves0 … 63. - If the signal locks, set
pending_root = H_tag("lotus.v2.deployment_root", deployment_root ‖ lock_id). A lock is invalid whilepending_root ≠ deployment_rootafter step 1. That cannot happen, because step 1 always clears it, so at most one lock-in is pending at a time.
At other heights UpgradeState is copied. A block is validated with its own active values, which come from its parent, so a coinbase never affects the validity of its own block.
Why 63. A shifts amounts. At A = 63, any nonzero indexed requirement is at least 2^63, twice MAX_MONEY = 2^62 and beyond what any one coin can hold, so the price is already prohibitive. 63 is the largest shift of a u64 amount, so it is the width of the amount type, not a policy choice.
4.3 The certificate
Grammar. A new final field of the coinbase input's authorization:
authorization(02 coinbase) = CoinbaseData || UpgradeCertificate
UpgradeCertificate = lock_id:h32 || Vec(CertGroup) lock_id = 0^32 unless the lock bit is 0
CertGroup = pubkey:x32 || ballot:33 || sig:64 || Vec(outpoint)
ballot = price_target:u8 || deployment_id:h32
outpoint = prev_txid:h32 || prev_index:u32
sig = BIP340 by pubkey over
H_tag("lotus.v2.ballot_attest", ChainID || BlockID(b − P) || ballot)
- The group vector is empty exactly when the signal is
ffffffff. price_targetis the value ofAthe key's owner wants, or0xfffor no opinion.deployment_id = 0^32supports nothing.- One signature covers every coin of that key. The key owner consents for the coins locked to it, and the miner may include any subset of them.
Consensus checks, against the parent state only, so UtxoRoot stays independent of the coinbase:
- The signature verifies. It names
BlockID(b − P), so a ballot attested at one boundary is valid only atb, on either side of a fork atb. Attestations from earlier epochs name a different block and fail. - Each outpoint is a coin of the state at
b − 1. Its native value is counted. The coin must also: - be locked to the keyhash leaf of
pubkey, the same lockAdmitProofrequires of stakes; - have creation height
≤ b − 2P, that is, at leastPblocks old at the snapshot blockb − P; - have
expiration_height = 0or> b. - No
pubkeyand no outpoint repeats. Each coin therefore supports at most one ballot, and so at most one deployment ID, per boundary (review R9). - Every group supports at least one move in the signal. For
+1,price_target ≠ 0xffandprice_target > v. For−1,price_target < v. For a lock,deployment_id = lock_id. - The supporting value clears the floor. Each move is checked separately over the groups that support it:
+1:2·Up_cert > q·Supply;−1:2·Down_cert > q·Supply;- lock:
Lock_cert ≥ q·Supply. That is higher than the previous revision's3q/4: lock-ins are rare and are the dangerous case (review R5).
The comparisons use checked u256 arithmetic, with q = 1/8 written as 8·Lock_cert ≥ Supply, and so on.
Supply (review R7). Supply(b − 1) is the sum of the native value of every coin in the state at b − 1 (C03), computed in u128. It counts:
- immature coinbase outputs;
- stake coins and coins under any lock;
- coins whose
expiration_heighthas passed but which are not yet swept. They are still coins of the state.
It excludes burn outputs (never in the state) and token amounts (C04). Counting expired coins keeps Supply a pure function of the committed coin set, with no filter that depends on height. They can be at most one sweep behind, and counting them only raises the floor.
Supply fits u128 with a wide margin: each value is at most 2^62, and the state holds far fewer than 2^66 coins. lotusd's current SnapshotSupply is a u64 sum of the tree's total_value plus pending coinbase. It must become this u128 quantity. A node maintains it incrementally, adding created coins and subtracting spent ones, and a snapshot import recomputes it.
Size and cost (review R8).
- Each
Vectakes C06's framing bound: at most 256 groups, and at most 256 outpoints per group. A parser therefore allocates at most256·(129 + 3 + 256·36) ≈ 2.39 MB. - A group is 129 bytes plus 36 per coin. A move backed by 100 large keys is about 17 KB.
- The certificate is part of the coinbase. Its wire bytes cost 2 cu each, and each signature and each coin read costs its C24 weight, all in the coinbase's
L, so the coinbase's parabolicC_txapplies. - The coinbase must still pay
U_requiredfrom its entitlement (C16). A certificate whose cost the entitlement cannot cover cannot be mined, so a move that needs too many small coins fails safe until stakers consolidate.
Why coin keys and not Avalanche proofs (review R10):
- The Avalanche proof format stays out of consensus, and the second proof codec disappears from the genesis work.
- Coin owners sign by construction, so pool operators cannot move consensus with pooled coins.
- Lost-key and dormant stake can never appear in a certificate, because each one needs a fresh signature for this snapshot.
- The size is about the same as proofs plus a master attestation.
4.4 A on the cu term (review R4)
L_tx(A) = L_tx << A (c)'s floor(X·√I_sub), shifted left
ByteFee(A) = ByteFee << A (c)'s ceiling byte fee at the lagged index, shifted left
- Both use checked u256 arithmetic. A requirement above
MAX_MONEYcannot be met. A_0 = 0andA ≥ 0. (c)'s index moves prices both ways by itself. Its one blind spot is a hardware-efficiency jump: a 200× ASIC step makes the index read about 14× too cheap.Acorrects that, and can only add to what (c) charges. LoweringAreturns toward (c), never below it. This is C14a's original principle, a frozen minimum that the vote only tightens.- Launch overpricing is left to (c). At genesis work
√I = 19.9, and (c) removes it as hash arrives (2× at 100× the launch fleet). The vote could not have helped anyway: at launch the staked share is unlikely to clear the floor (review R6). - Never scaled:
K,L_own, coinbase dust, ordinary dust, the token burn, rent, the bounty,Q,E_min, cu weights and issuance.
Effect, from scalar_bounds.py. The table shows the quiet-chain fee of a 1-in/2-out bare-key payment (251 bytes, 1,454 cu) at 1,000 atoms/kB; the standard keyhash payment (287 bytes, 1,537 cu) pays about 5.7% more, 12,309 atoms at I = 1, and every row scales the same way. The cu share, 11,633·√I + 12 atoms, sets that fee, and the byte fee (251·√I) never binds:
A |
Genesis work (√I = 19.9) |
I = 1 (2 cents) |
200× ASIC step (√I = 0.071) |
|---|---|---|---|
| 0 | 232,038 | 11,645 | 834 |
| 1 | 464,064 | 23,278 | 1,656 |
| 2 | 928,116 | 46,544 | 3,300 |
| 4 | 3,712,428 | 186,140 | 13,164 |
| 8 | 59,398,668 | 2,978,060 | 210,444 |
After a 200× step, 4 raises restore the I = 1 price (13,164 atoms against 11,645).
4.5 What consensus actually guarantees (review R5, R6)
Consensus checks a certificate's value against Supply, not against the stake that exists (W). It cannot do otherwise. W is the set of live Avalanche proofs, which is off chain by design. Making it chain-visible would need every staker's ballot on chain every epoch, which means censorable registrations, state growth and the proof format in consensus.
Two alternatives were checked:
- A committed
W. The boundary blockb − Pwould commit a registry root andW. Consensus could not check either, so a miner who cannot be parked could commit a tinyWand certify against it. - A ratchet on the largest stake ever shown. It stalls once that stake leaves, and a decaying ratchet needs a decay constant.
So:
| Situation | A ±1 step needs | A lock-in needs |
|---|---|---|
| Avalanche enforcing (the policy release, quorum present) | More than half of the live snapshot stake W, and the consensus floor |
At least 3/4 of W, and the consensus floor |
| Avalanche not enforcing, for any reason | More than q/2 of all coins signing, plus one boundary block |
At least q of all coins signing, plus one boundary block |
| Always | One step per epoch; A ∈ 0 … 63; active one epoch after the decision |
One pending at a time; enforced one epoch after the decision |
With q = 1/8, that means 6.25% of all coins for a step and 12.5% for a lock-in.
Why the no-Avalanche case is tolerable:
- A price step only raises fees, by 2× per epoch. It is undone at the same rate once Avalanche enforces again.
- A lock-in is the serious case. It can activate rules that well under 2/3 of the online stake enforces, which is the split condition of section 6.1. Hence the full
qfor lock-ins. - Deployment releases can add their own conditions. A release that defines
Xmay reject its own lock-in outside its window or under anotherpredecessor, as its own tightening.
The previous revision claimed that a holder of the floor then held "more than half of all the stake there is". That is withdrawn: it holds only when the outage is W < q·Supply, not after a partition, a bug or too few nodes.
5. The policy release (Avalanche)
None of this is consensus. It can ship after launch, and different releases may differ in it.
5.1 Ballot
A new field of the V2 Avalanche proof, serialized after the treasury payouts and committed in the ProofId:
EpochBallot = price_target:u8 || deployment_id:h32 (the certificate's ballot)
Each stake's signature in the proof also covers H(EpochBallot). The tally then counts only what the coin owners signed, the same keys that sign the certificate. Staking software never fills deployment_id by default.
5.2 The snapshot registry (review R3)
lotusd forgets dangling proofs: cleanupDanglingProofs calls rejectProof(INVALIDATE), which drops hasFinalized, and dangling proofs are not offered in avaproofs. Nodes that started later would systematically miss offline stake. The registry fixes that:
- Membership. A node keeps a separate registry of every proof it has seen finalized. A proof leaves the registry only when a stake coin is spent, when it expires, or when a conflicting proof replaces it. Dangling does not remove it. The registry is persisted.
- Relay. When a node announces a boundary snapshot block, it can serve the registry's proof IDs. A peer fetches any proof it lacks, checks it, and adds it if it was finalized. That makes the snapshot converge for nodes that joined late.
- Liveness (R3). At boundary
b, a proof counts only ifexpirationTime ≠ 0andMTP(b − P) < expirationTime ≤ MTP(b − P) + 66·P·τ. - Every counted ballot therefore has to be renewed within the withdrawal window (section 6.1), so lost-key and abandoned stake ages out within one window.
expirationTime = 0never counts.- No constant is added: 66 epochs is the existing window.
- Snapshot
S_(b−P). Whenb − Pconnects, the node records the registry's counted proofs and their ballots. - Weight. At
b, a proof's weight is its stake whose coins are in the state atb − 1and were created at height≤ b − 2P. This is the same coin rule the certificate uses.Wis the sum of the weights.
5.3 Tally
With v the active A after the boundary update:
Up = Σ weight : price_target ≠ 0xff and price_target > v
Down = Σ weight : price_target < v
up = 2·Up > W and 2·Up > q·Supply
down = 2·Down > W and 2·Down > q·Supply
lock(X) = 4·Lock_X ≥ 3·W and Lock_X ≥ q·Supply
and X.predecessor = pending_root and start_X ≤ b < start_X + 66·P (last two: for deployments the node knows)
- The consensus floor is folded into the tally, so a separate "gate" is not needed. A tally whose
Wis below the floor never says yes. - A missing ballot counts as the current value, so silent stakers hold.
- A counter-ballot set at any time enters the next snapshot and counts at the boundary after it. That holds for holders and attackers alike.
5.4 Items and block polls (review R1)
Items. Every node polls up to three yes/no Avalanche items for each boundary b, keyed by the parent b − 1:
UpgradeItemId = BLAKE3_keyed("lotus.v2.ava.upgrade_item", H(b−1) || kind || payload)
kind 01 "price up?", 02 "price down?" (no payload), 03 "lock in X?" (payload id_X)
MSG_AVA_UPGRADE_ITEM = MSG_TYPE_AVALANCHE_INBOUND | 0x7 = 0x20000007 (unused in protocol.h)
- What is polled.
- "Up" and "down", from the moment
b − 1connects. - "Lock X" only for an
Xthat its own tally gives at least 3/4 ofW. At most one suchXcan exist. - When a boundary block arrives, the items its signal implies, including its
lock_id.
A Sybil naming many IDs therefore adds nothing to poll (R9).
- Initial vote. The node's tally. A node with no snapshot answers inconclusively.
- How an item ends. It ends finalized yes, finalized no, or stale, by lotusd's rule. A stale item, and an item the node does not poll at all, counts as "no". An item that ends "no" is the status quo, so every ending maps to a valid outcome.
- Outcome. "Up" yes and "down" not yes gives +1. "Down" yes and "up" not yes gives −1. Anything else holds. "Lock X" yes gives that lock-in.
Block polls, the R1 rule:
- A hold boundary block (
ffffffff) is answered normally from the start. It is always a valid outcome, and a miner gains nothing by racing it. - A moving boundary block, and any descendant of it, is answered inconclusively until the node's items for that boundary have ended. After that:
- if the items' outcome matches the block's signal, the block is answered yes;
- otherwise it is parked, and miners re-mine the boundary with hold at the cost of one block.
Simulation. stale_items_sim.py uses the reviewer's Record model with lotusd's staleness rule and 60 nodes.
Part 1, the reviewer's table: items stall once most answers are inconclusive.
| Inconclusive share | Yes share among the conclusive answers | Finalized / stale (of 200) |
|---|---|---|
| 0.4 | 1.0 / 0.9 | 200 / 0 and 200 / 0 |
| 0.5 | 1.0 / 0.9 | 200 / 0 and 70 / 130 |
| 0.6 | 1.0 / 0.9 | 0 / 200 and 0 / 200 |
Part 2, block finality at a boundary under the R1 rule. A step is one poll per node; the table gives the worst of 4 runs.
| Case | Steps until every node finalized a block at the boundary | Outcome |
|---|---|---|
| Launch, floor fails, hold block | 134 | hold |
| Launch, floor fails, moving block | 269 | replaced by hold |
| Genesis release (no items), moving block | 269 | replaced by hold |
| Items 60% inconclusive (all stale), moving block | 4,231 | replaced by hold |
| Items 50% inconclusive, 90% yes, moving block | 8,154 | replaced by hold |
| Items healthy, all yes, moving block | 267 | moved |
| Items healthy, hold block | 134 | hold |
What the simulation shows:
- Finality never stops. In every case, every node finalizes a block at the boundary.
- The worst case is bounded by the staleness rule. A record ends within
64 × 128 = 8,192votes, about 60 times an ordinary block's finalization. - The common cases cost nothing. A hold, or a launch where the floor fails, finalizes like an ordinary block. In normal operation the items have finalized long before the boundary block arrives, because they are polled from the moment
b − 1connects.
binary_items_sim.py (the previous revision, unchanged) shows that the three items converge where one-contender-per-outcome rejects everything: 24/24 runs over three-way splits, and +1 in 19/20 and 20/20 runs at 60% agreement. Avalanche guarantees agreement, not that the majority wins a close split. Correctness comes from the registry making honest tallies nearly identical, and even a wrongly agreed move needs a real certificate.
The models use uniform stake, random pollees and no delay. They are not network simulations.
5.5 Certificate groups, relay and templates
- Relay. When
b − Pconnects, a staker's node signs oneCertGroupfor its ballot, if the ballot wants anything. It relays the group asavaballotattest(BlockID(b − P), CertGroup). - Relay checks. A node relays a group only if the signature verifies, and the coins exist, are old enough and carry at least the stake-dust minimum. It relays at most one group per key per epoch.
- Templates. Miners write the finalized outcome and assemble the certificate from the groups they hold, largest first. Without finalized items, they hold.
5.6 UpgradePolicy
- Before the items end, a node parks a moving block only if it locks a deployment the node knows is withdrawn, or whose
predecessororstartdisqualifies it. Consensus already rejects bad certificates and out-of-range steps. - After the items end, it parks a boundary block whose signal contradicts the outcome. A block that holds a move the items accepted is parked only if the node itself holds groups sufficient for the certificate. Miners therefore cannot censor a move, and the chain never waits on stakers who are offline.
- Mempool. Admission uses the larger of the active and pending fee, and the node evicts at the boundary.
- RPC and wallet.
getupgradestateandgetepochtally; the wallet pays fees against the pending value.
6. Soft-fork activation
6.1 Deployments, threshold and withdrawal
- ID. A deployment
Xis a specification document: its normative text, its reference vectors, itsstartheight, and thepredecessorroot it builds on. Its ID isid_X = H_tag("lotus.v2.deployment", spec bytes). - A ballot names
id_X, never a number, so consent cannot carry over to different code. - Only a deployment whose
predecessorequals the chain's root can lock in. Two deployments with the same predecessor can run in parallel, and at most one reaches 3/4. The other then rebases under a new ID. - Running root.
deployment_rootchains every activated ID. - A node that cannot reproduce the root is running behind a deployment it does not know. It warns that it must upgrade and keeps enforcing everything it knows. That is safe, because soft forks only narrow validity, and it is BIP9's "unknown rules" warning.
- Snapshots carry the list of activated IDs, checked against the root and
deployment_count. - Threshold, 3/4 of
W(policy, with the consensus floorq). The reviewer'svoterecord_sim.pymodels a node polling stake in which a shareurejects a block that breaks a locked-in rule:
Upgraded share u |
P(rejection finalized) | Median votes |
|---|---|---|
| 0.55 | 0.005 | more than 60,000 |
| 0.60 | 0.965 | about 12,000 |
| 0.67 | 1.000 | about 800 |
| 0.75 | 1.000 | about 360 |
| 0.875 | 1.000 | about 180 |
- Enforcement is reliable from about 2/3.
- 3/4 is the first quarter step above 2/3, and it leaves margin for supporting stake that is offline or not yet upgraded one epoch later.
- 7/8 would hand 12.5% of stake a veto for no safety gain.
- Withdrawal. A deployment that has not locked in by
start + 66·Pis withdrawn, never forced. Its release refuses its lock-in afterwards, and its place is free for a successor with a new ID. - 66 epochs is
⌈UTXO_MIN_LIFESPAN_BLOCKS / P⌉ = ⌈131,400 / 2,016⌉, about 6 months. - It reuses an existing constant. It is also the registry's liveness window (section 5.2), so every counted staker has renewed a ballot within one window.
- The fallback is fixed in advance as "withdraw", which is BIP8's lesson.
6.2 Timeline
release defines X (start, predecessor)
→ stakers set deployment_id = id_X in their proofs; the proofs re-register and finalize
→ the next boundary b − P snapshots those ballots; stakers relay CertGroups for b − P
→ at boundary b, the tally gives ≥ 3/4 of W and the floor q: "lock X" finalizes yes;
the miner writes the lock bit and a certificate; pending_root = H(root ‖ id_X)
→ at b + P: deployment_root = pending_root and the rules are enforced
(no lock-in by start + 66·P → withdrawn)
6.3 Why not the alternatives
- Miner bits. There is no header field, miners do not enforce finality, and SegWit showed that miner signalling becomes a veto.
- Flag days. Nothing measurable says whether the network agreed. With Avalanche, a flag day adopted by less than about 2/3 of stake stalls finalization rather than splitting cleanly.
6.4 What stays hard-fork-only
- Loosening any rule. That includes lowering an existing operation's cu price (the route is a new, cheaper opcode), and taking
Abelow 0. - The closed sets (audit F6–F9): transaction version, input kinds, output flags, lock kinds, signing modes and CHECKDATASIG selectors.
- Formats: the header, hashes and domain tags, the state tree,
MonetaryState,UpgradeState, the address format, block framing andCOIN. - Monetary rules: issuance (P06),
MAX_MONEY, the 50% fee burn, the ASERT anchor and half-life, τ, and fee rule (c) itself. - The consensus terms of the mechanism:
P;- the factor-2 step;
- the range
0 … 63; q;- the signal word;
- the certificate format and its coin rule (
≤ b − 2P); - the set of voted scalars.
The tally thresholds (1/2, 3/4) and the 66-epoch window are policy. Stakers could change them by running different releases, as they can change any parking rule.
- Confiscation: D3's norm.
7. The scalar vote in use
7.1 Capture (review U9, R4)
From scalar_bounds.py: a persistent majority starting at A = 0, I = 1, 2 cents per XPI. Each step is decided one epoch after its snapshot and takes effect one epoch after the decision.
| Steps | First active (days) | Payment fee |
|---|---|---|
| 1 | 5.6 | 0.023 XPI ($0.0005) |
| 4 | 14 | 0.19 XPI ($0.004) |
| 7 | 22 | 1.5 XPI ($0.03) |
| 10 | 31 | 11.9 XPI ($0.24) |
| 12 | 36 | 47.6 XPI ($0.95) |
| 13 | 39 | 95.3 XPI ($1.91) |
The power a majority gets:
- A real majority of snapshot stake can price out ordinary payments in about five weeks, and nothing in the mechanism stops a majority that persists. That is what majority rule means.
- The vote gives a coalition of 50–67% a power that parking alone did not, because parking needs about 2/3 to halt the chain.
What bounds it:
- Speed against reaction. At most 2 steps (4×) are decided before holders' counter-ballots count. Pricing out takes 12 steps.
- Halving the step would slow capture and recovery alike.
- A longer epoch would delay the ASIC correction, which takes 4 steps, about 11 days.
- Cost. The captor must keep coins worth more than half of
Wstaked and signing every epoch, and every honest holder who stakes raises that price. - Direction.
A ≥ 0, so the vote can never price below (c). The DoS lever of the previous revision, 16× below the approved price, is gone. - Reach. Coinbase-only blocks, dust,
K,L_ownandQare out of reach, so the chain stays live at everyA.
Other vectors:
| Vector | Assessment |
|---|---|
| Sybil splitting | No effect: weight is by amount, and lock items come from the node's own tally |
| Reusing stake | Each coin counts once per certificate; each key signs one ballot per boundary |
| Pooled staking | The certificate needs the coin keys, and the policy ballot is signed by them too |
| Lost-key or dormant stake | Never in a certificate; ages out of the tally within 66 epochs (section 5.2) |
| A miner's signal against the outcome | Parked once the items end (section 5.6) |
| No Avalanche quorum | Moves need the floor q (section 4.5) |
7.2 Worked example: the ASIC case
A BLAKE3 ASIC arrives in year 3 of the tail era. √I falls about 14×, and the quiet-chain payment fee drops from 11,645 to 834 atoms. A is 0.
- Staking software suggests
price_target = 4. Stakers holding 60% ofW, and more than 1/16 of all coins, re-register their proofs during epoche. - The snapshot at the next boundary
b1holds those ballots, and the stakers relay their groups forb1. - At
b2 = b1 + P: - every node's tally gives "up";
- the items finalize as (up yes, down no) before the boundary block arrives;
- the miner writes signal
fffffffdand a certificate whose up-value clearsq/2ofSupply; pending_price_shift = 1.- At
b3,A = 1and fees double. Wallets saw it coming fromb2. - One step per epoch follows until
A = 4is active atb6, about 11 days afterb2. A payment then costs 13,164 atoms. - If the 60% falls to 45% along the way,
Upno longer exceeds half ofWand the steps stop. If (c)'s index later rises again, stakers voteAback down, one step per epoch.
8. The payout split (review U10, R2)
The whole 50/25/25 is staker policy. It is enforced only by StakingRewardsPolicy and TreasuryPolicy, which are the stakers' own parking.
- Stakers with enough stake to park, about 2/3, can change any part of it, including the miner's share, by running different policy.
- Consensus cannot protect the miner's share, because it cannot tell whose script any coinbase output pays.
The previous revision's rule 2·value(vout[0]) ≥ Σ value(vout) is dropped. Staker policy could simply require vout[0] to pay the treasury or the stakers, so the rule capped nothing. Its only effect was to forbid layouts such as pools paying several miners directly, or a burn commitment placed first.
Nothing in the vote touches the split.
9. Mapping the audit items to the mechanisms
| Audit item | Mechanism | Class after |
|---|---|---|
X5 E_min |
Not voted; (c) leaves it frozen; capacity is a later deployment | 1 |
X6 S_linear, S_quad |
Not voted; L_tx is shifted by A on top of (c)'s √I |
1, with A on L_tx |
X7 MIN_FEE_PER_KB |
(c)'s √I (lagged), then << A |
2 + 3 |
X8 DUST_LIMIT |
Not voted and not indexed: 54,600 for coinbase and ordinary outputs alike | 1 |
| X9 token burn "2" | Not a vote matter: derive it (audit) | 1 |
X10 CLEANING_CREW_REWARD |
Not voted: derive it from the erase cost (audit) | 1 or 2 |
X14 UTXO_RENT |
Not voted | 1 |
| X22 payout ratios | All staker policy, labelled as such (section 8) | policy |
| X23 stake dust, quorum | The quorum becomes q (D1), the certificate floor, folded into the tally. Stake dust stays policy. |
3 / policy |
| X19 maturity raise | Deployment | 3 |
| X12 minimum lifespan | Frozen; D3 norm; also the source of the 66-epoch window | 1 |
| U1 activation | Deployment IDs, certificate, 3/4 policy, withdrawal | Specified |
| U2 PQ signatures | Deployment. Audit U2b (multi-item operands) and U2c (a rescue path) are still needed. | 3 |
| U3 opcodes and profiles; U4 price raises | Deployment | 3 |
U5 scalar vote; U6 η |
A |
3 |
| X29 relay floors | Derive them from consensus, including active and pending A |
— |
10. Reorgs, IBD and C22a
- Reorgs.
UpgradeStateis undone with the block.- Active values at
hwere fixed at least one boundary earlier, so no reorg shallower than an epoch changes validity. - A boundary block whose parent was never the tip has no local items yet. The node polls the block's implied items and answers the block inconclusively until they end (R1).
- IBD and snapshot sync.
UpgradeStateand the certificates are checkable from the chain alone: the coins, their keys andSupplyare all state. A snapshot carries the list of activated IDs. - C22a.
- A script's validity can now also depend on
deployment_root, through the opcodes a deployment assigns. That change is monotone and known one epoch ahead, and relay already refuses unassigned success bytes. - The fee depends on
A, which is also known one epoch ahead. The mempool admits against the larger of the active and pending fee. - With the first deployment, the script execution cache must key on the active deployment set (C20).
11. Draft normative text for consensus.md (proposal only)
C02, after "An assignment may only narrow transaction/block validity":
An assignment takes effect only through a deployment activated under C29.
C14b, append:
The required fee is the byte fee of rule (c) shifted left by the block's active price shift
A(C29).
C25, append:
The ordinary transactions' linear term of rule (c) is shifted left by
A.K, the block's own linear term andQare never shifted.
New rule in section 7:
C29 — Upgrade state, the epoch signal and the stake certificate.
State.
StateRootcommitsUpgradeState = deployment_root:h32 ‖ pending_root:h32 ‖ deployment_count:u32 ‖ price_shift:u16 ‖ pending_price_shift:u16(72 bytes, little-endian) afterBytes(MonetaryState)(P02). At genesis every field is zero.Boundaries. Let
P = 2,016. A heightb ≥ Pwithb mod P = 0is a boundary.Non-boundary heights. The coinbase input
sequenceMUST beffffffff. TheUpgradeCertificateMUST be0^32followed by an empty vector.UpgradeStateis copied.Boundaries: pending values. First apply the pending values. If
pending_root ≠ deployment_root, setdeployment_root = pending_rootand add 1 todeployment_count. Setprice_shift = pending_price_shift, and call itv.Boundaries: signal. Then read
sequence:
- bits 0–1 are the price step:
11hold,01+1,10−1, and00rejects;- bit 2 is the lock:
1none,0lock;- bits 3–31 MUST be 1.
The certificate's group vector MUST be empty if and only if
sequence = ffffffff.lock_idMUST be0^32unless the lock bit is 0.Certificate groups. Each
CertGroup = pubkey:x32 ‖ ballot ‖ sig:64 ‖ Vec(outpoint), withballot = price_target:u8 ‖ deployment_id:h32, MUST satisfy:
sigis a valid BIP340 signature bypubkeyoverH_tag("lotus.v2.ballot_attest", ChainID ‖ BlockID(b − P) ‖ ballot);- every outpoint is a coin of the parent state locked to the keyhash leaf of
pubkey, created at height≤ b − 2P, withexpiration_height = 0or> b;- no
pubkeyand no outpoint appears twice in the certificate;- the group supports at least one move in the signal. It supports
+1ifprice_target ≠ 0xffandprice_target > v;−1ifprice_target < v; and the lock ifdeployment_id = lock_id.Vectors are bounded as in C06. The certificate's bytes, signature checks and coin reads are charged to the coinbase's cost.
Floor. Let
Supplybe the u128 sum of the native values of all coins in the parent state, including immature and expired, unswept coins. LetV(m)be the sum of the native values of the coins of the groups that support movem. Then:
- a
+1step needs2·V(+1) > q·Supply;- a
−1step needs2·V(−1) > q·Supply;- a lock needs
V(lock) ≥ q·Supply;with
q = 1/8(D1), computed exactly.Update. Set
pending_price_shift = v + step, and reject the block if that leaves0 … 63. If the lock bit is 0, setpending_root = H_tag("lotus.v2.deployment_root", deployment_root ‖ lock_id).Validation. A block is validated with its own active values, which depend only on its parent. A deployment's rules apply when its ID is chained into
deployment_root. A deployment's specification MAY make its own lock-in invalid outside[start, start + 66·P)or under a differentpredecessor.Guarantee. Consensus guarantees only the floor. A tally of the live stake is Avalanche policy (peering N06b).
Norm (D3). No deployment shortens an existing coin's
expiration_height, or makes an existing spendable coin unspendable, unless a rescue path for it was specified before activation.
P01, coinbase paragraph:
Replace "
sequence=ffffffff" with "sequence=ffffffff, or C29's signal word at a boundary". AppendUpgradeCertificateto the coinbase authorization grammar. Explorers and PSBT tools must not decode it as a relative lock.
P02: add UpgradeState to the StateRoot preimage (202 bytes at genesis, 234 after) and define Supply. Snapshots carry the list of activated deployment IDs, checked against deployment_root and deployment_count.
C22a: add "or the activation of a deployment, which is known one epoch ahead" to the events that can change script validity.
C28 freeze list: P, the step, the range 0 … 63, q, and the signal and certificate formats.
12. Draft normative text for peering.md (proposal only)
§4 inventory table, add:
|
MSG_AVA_UPGRADE_ITEM = 0x20000007|UpgradeItemId = BLAKE3_keyed("lotus.v2.ava.upgrade_item", H(b−1) ‖ kind ‖ payload), kinds 1 (price up), 2 (price down), 3 (lock inid_X) | From the node's tally, and from the signal of any received boundary block |
(Aside: the table lists MSG_AVA_PROOF = 0x20000001 and MSG_AVA_STAKE_CONTENDER = 0x20000004, but protocol.h has 0x1f000001 and 0x1f000002. Fix the table separately.)
New subsection in §7, "Epoch vote (N06b)", policy:
Ballot. A V2 Avalanche proof carries
EpochBallot = price_target:u8 ‖ deployment_id:h32after the treasury payouts. The ProofId and each stake's signature commit to it.Registry. A node keeps every proof it has seen finalized until a stake coin is spent, the proof expires, or a conflicting proof replaces it. Dangling does not remove a proof. The registry is persisted, and its proof IDs are served on request for a boundary snapshot block.
Snapshot. At boundary
b, a proof counts ifMTP(b−P) < expirationTime ≤ MTP(b−P) + 66·P·τ. Its weight is its stake whose coins are in the state atb − 1and were created at height≤ b − 2P.Tally. Follow section 5.3 of the upgrade-mechanisms note. Every yes includes the C29 floor.
Items. On
b − 1, a node polls "price up" and "price down", and "lock in X" only for anXits tally supports with 3/4 ofW. On receiving a boundary block, it adds the items that block's signal implies. A stale or unpolled item counts as "no". Finalized items map to an outcome: up and not down is +1, down and not up is −1, and anything else holds.Block polls. A boundary block with signal
ffffffffis answered normally. A boundary block that moves anything, and its descendants, are answered inconclusively until the node's items for that boundary have ended. After that they are answered by the outcome.Certificate groups. A staker's node relays
avaballotattest(BlockID(b−P), CertGroup)whenb − Pconnects, if its ballot wants anything. A node relays at most one group per key per epoch, and only groups whose signature and coins check.Parking (
UpgradePolicy).
- Before the items end: park only a lock-in of a deployment the node knows is withdrawn or disqualified.
- After they end: park a boundary block whose signal contradicts the outcome.
- A block that holds an accepted move is parked only if the node holds groups sufficient for its certificate.
Templates. Write the outcome, with the certificate assembled from the groups held, largest first. Without ended items, hold.
Mempool. Admit against the larger of the active and pending fee, and evict at the boundary.
13. Implementation estimate (review R10)
The figures are lines including unit tests, and assume fee rule (c) itself is done by its own lane. Each commit builds and passes its own tests, following the project's commit-granularity rule. Paths are relative to lotusd's src/ unless noted.
13.1 Genesis minimum: commit list
| # | Commit | Places | Lines |
|---|---|---|---|
| 1 | reference: UpgradeState encoding and the StateRoot preimage; regenerate the vectors |
tools/lotus-v2-reference: new upgrade.py, monetary.py, block.py, dev_genesis.py |
150–200 |
| 2 | lotusd: UpgradeState type, encode and decode |
new lotus_v2/upgrade.{h,cpp} and unit tests |
100–150 |
| 3 | lotusd: StateRoot commits UpgradeState |
lotus_v2/sparse_state.{h,cpp}; the 23 non-test callers of StateRoot( (kernel/chainparams.cpp anchor, lotus_v2/{block,block_transition,dev_genesis,development_chain,disk_block,disk_body,disk_state,fast_sync,reorg_recovery}.cpp, fast_sync.h, net/v2_protocol_handler.cpp, node/miner.cpp, primitives/block.{h,cpp}, rpc/mining.cpp, validation.cpp, wallet/v2_{node_provider,payment}.cpp); dev-genesis roots and pinned vectors |
450–550 |
| 4 | lotusd: UpgradeState through undo, disk state and fast sync |
validation.cpp (BLOCKUNDO), disk_state.cpp, fast_sync.*, the fast-sync wire messages (protocol.h:390-396), reorg_recovery.cpp tests |
200–300 |
| 5 | reference: the signal word and the UpgradeCertificate grammar |
encoding.py, block_wire.py, vectors |
100–150 |
| 6 | lotusd: the coinbase grammar carries the certificate; sequence is free only at boundaries; templates write ffffffff and an empty certificate |
lotus_v2/transaction.{h,cpp} (parse, serialize, TxID/TxHash, :133-152), block_assembler.cpp, block_template.cpp, pool_coordinator.cpp |
280–380 |
| 7 | lotusd: PSBT and the explorer do not decode the signal as a lock; the functional framework's V2 codec | psbt.cpp, chronik_explorer.cpp, test/functional/test_framework/messages.py |
120–170 |
| 8 | reference: Supply, the certificate check and the transition |
upgrade.py, vectors |
150–200 |
| 9 | lotusd: Supply as a specified u128 state quantity |
primitives/block.cpp (circulating_supply), sparse_state.* (SnapshotSupply), disk_state.cpp, tests |
80–100 |
| 10 | lotusd: certificate verification (signature, coin lookup against the parent, keyhash leaf, age, expiry, repeats, floor, cu charge) | lotus_v2/upgrade.cpp, block_cost.cpp, block_transition.cpp |
250–330 |
| 11 | lotusd: the boundary transition (pending values, step and range, root hashing, the unknown-root warning) | lotus_v2/upgrade.cpp, block_transition.cpp, validation.cpp |
120–170 |
| 12 | lotusd: A on L_tx and the byte fee |
lotus_v2/monetary.{h,cpp}, block_transition.cpp, network_profile.h (P, q), wallet/native.cpp, fee_hysteresis.*, mempool admission (active and pending) |
250–350 |
| 13 | functional: feature_upgrade_certificate.py |
forged and replayed signatures, an earlier epoch's group, repeated key and outpoint, a young or expired coin, below and at the floor, a miner with no stake, the range at 0 and 63 | 150–250 |
| 14 | functional: feature_upgrade_state.py |
a regtest move and lock-in with short epochs, a snapshot import at nonzero A, a reorg across a boundary, IBD |
100–150 |
Totals.
- About 2,500–3,450 lines. The reviewer's 2,300–3,200 did not include the two functional test files.
- Time: 9–12 lane-days.
- Lane 1: commits 1–4, then 12.
- Lane 2: commits 5–11.
- Then 13–14 together.
That is about 6–7 days elapsed with two lanes, plus independent review of the spec and the code.
- Against the dates. Today is 2026-11-19, and the go/no-go is 2026-12-10, 21 days away. It fits with slack for review.
- The riskiest parts, in order:
- the
StateRootchange across fast sync, undo, disk and the anchor (commits 3 and 4); - certificate verification in consensus (commit 10);
Supplybecoming a consensus quantity (commit 9).
Fallback (D4). Drop the A fields, the price bits and commit 12, and handle raises as deployments at 3/4. That saves about 400–600 lines, at the cost of the scalar protocol. It must be chosen before genesis.
13.2 Policy release
| Work | Places | Lines |
|---|---|---|
| Ballot in the proof and in each stake signature | avalanche/proof.{h,cpp} (computeProofId around :81-95), proofbuilder.*, lotus_v2/avalanche_proof.*, rpc/avalanche.cpp, test_framework/{messages.py,avatools.py}, hex-pinned proofs |
500–800 |
| Snapshot registry, liveness window and relay of registry proof IDs | avalanche/peermanager.*, persistence |
350–500 |
| Certificate-group relay and template assembly | net_processing.cpp, storage, block_assembler.cpp |
350–500 |
| Items and the R1 block-poll rule | avalanche/processor.*, protocol.h (0x20000007), an item cache modelled on the treasury contender cache |
600–800 |
UpgradePolicy |
new policy/block/upgradepolicy.* |
200–300 |
| RPC and wallet | getupgradestate, getepochtally, fees against the pending value |
200–300 |
| Functional tests | feature_epoch_vote.py, feature_deployment_activation.py (3/4 and not below, withdrawal, predecessor), multi-node finality under stale items |
400–600 |
That is about 2,600–3,800 lines, or 10–14 lane-days, after launch. The deployment-keyed script cache (150–250 lines) ships with the first deployment.
14. Risks and what this note does not establish
- The simulations are qualitative. They use uniform stake, no delay and no real network. A multi-node test on short regtest epochs is still needed. That test belongs to the policy release.
- Under a close split, Avalanche agreement is not the majority answer. Correctness rests on the registry making honest tallies nearly identical.
- The floor needs
q(D1). If participation is low, the floor rises above what stakers can sign, and nothing can move. That fails safe, but it is a stall. - Without Avalanche enforcing, the floor is the only protection (section 4.5). A lock-in then needs
qof all coins, which can be well below 3/4 of the live stake. - Coin-key certificates need online coin keys at each moving boundary. Cold stakers can still vote in the tally, but the certificate must clear the floor with the keys that sign.
- Coins under other locks, such as multisig or scripts, cannot sign a certificate. That matches staking today, which also requires keyhash coins.
- Post-quantum readiness also needs audit U2b and U2c. The certificate's BIP340 signature is itself a format that a PQ deployment would have to replace by a hard fork, or by a second group type defined at genesis. This note does not define one.
- The
predecessorrule makes deployments a chain. Parallel candidates are allowed, but only one lands per root.
Reproduce
All in tools/lotus-v2-reference/research/upgrade/ (uncommitted):
python3 -I voterecord_sim.py 2 # reviewer: threshold table (section 6.1); two-contender convergence
python3 -I multi_contender_sim.py # reviewer: the old design's three-way splits reject everything
python3 -I binary_items_sim.py 11 # binary items under the same splits, plus near agreement (also seed 5)
python3 -I stale_items_sim.py # reviewer part 1: stale items; part 2 (this revision): block finality under rule R1
python3 -I scalar_bounds.py # A_0 = 0: the payment fee by A at 1,000 atoms/kB, the capture timeline
All five model avalanche::VoteRecord, or do plain arithmetic, and need only the Python standard library.
References
- Bitcoin: BIP9, BIP8, BIP91, BIP148, BIP342, the Bitcoin Core 0.21.1 release notes (Speedy Trial), and the July 2015 BIP66 fork (alert).
- Decred: consensus rule voting, DCP-0006.
- Tezos: the voting process.
- XRPL: amendments, fee voting.
- Ethereum: the Yellow Paper §4.3.4.
- BCH: CHIP-2023-04.
- Lotus:
- the constants audit;
- the fee floor and its review with addendum, for option (c) and the 1,000 atoms/kB figures;
- the review of this note and its addendum;
consensus.mdC02, C03, C04, C06, C14b, C16, C16a, C20, C22a, C25 and C28; P01; P02; P06 (D11);peering.md§4 and §7;- lotusd at
fd10cf77a7:src/avalanche/{proof.cpp:253,treasury.cpp,peermanager.cpp:548-600,1237,processor.cpp,voterecord.h:103-107},src/lotus_v2/avalanche_proof.h,src/protocol.h:693-716.