Review: Lotus V2 upgrade mechanisms (soft-fork activation and the epoch vote)
On this page
Status: independent adversarial review (2026-11-18) of lotus-v2-upgrade-mechanisms.md, called "the note" below. Research only: no normative file, no code and no commit changed. Code was read at lotusd fd10cf77a7 (the note cites 38cfb7d273; same subject line, rebased) with git show. Two small simulations of avalanche::VoteRecord are in the session scratchpad (see Reproduce).
Verdict
Sound with fixes. Do not adopt it as written. The fixes are serious, and two of them change the genesis format.
What holds up:
- The layering. Stakers choose, the coinbase records the choice, and consensus checks only the bounds. The values take effect one epoch after the decision.
- Syncing and snapshot nodes rebuild
UpgradeStatefrom the chain alone and need no Avalanche history. - Because the active values at height
hwere fixed ath − P, no reorg shallower than one epoch can change any transaction's validity. - Both properties are real improvements over C14a's policy-only sketch.
- The scalar rule. "More than half of
Won one side, absent ballots counted atv" is the sign of the weighted median. It needs no sort, the two sums are disjoint so both cannot pass, and it is outlier-proof. - The signal word. All-ones means "hold", so a template builder that knows nothing of the vote stays valid. No other rule gives the coinbase
sequencea meaning (checked below).
What does not hold up:
- The agreement layer can halt the chain at a boundary (U1). Lotusd's Avalanche polls each contender as an independent yes/no item. It is not a multi-value Snowball. When local tallies split three ways, every contender finalizes as rejected (simulated). "Park unless the signal matches my own preference" then parks every boundary block on most nodes, and Avalanche block polling invalidates them.
- Deployment levels are numbers that carry no content (U2). A ballot of
level_target ≥ nnever says which rules it supports. It persists, and the note reuses numbers. So consent carries over to different code, and two releases that both define "deployment 5" split the chain at activation. - Without a quorum, a single miner can activate any deployment whose
start_nhas passed (U3). The 7/8 staker threshold exists only in policy, so a stake-free activation path exists. - "All eligible stake" is not all stake (U4).
Wsums only the proofs bound to connected peers whose local registration time is old enough. Offline stake drops out ofW; it is not counted for the status quo. Quorum is latched, so after a mass staker loss the survivors keep tallying and parking. The note's claims about bribery cost and "no quorum constant" rest on the opposite. - The 7/8 lock-in is not Avalanche's threshold (U5). With 67% of upgraded stake rejecting a breaking block, rejection finalizes in about 780 votes. The 7-of-8 window does not translate into a 7/8 stake requirement. As chosen, 7/8 hands 12.5% of online stake a permanent veto with no timeout, and because levels are sequential that veto also blocks every later deployment. That is the SegWit pattern at a lower threshold.
Gdoes almost nothing, because the unvoted backstopC²>>32it leaves in place prices capacity (U8).A's bounds andA_0rest on a staleMIN_FEE_PER_KB(U7).
The smaller design is one voted scalar (A), binary agreement items, a deterministic tally input, and deployment IDs in place of bare numbers (section 4).
Findings at a glance
| # | Severity | Finding |
|---|---|---|
| U1 | High (chain-halt class) | With independent per-item contender polling, a three-way split of local preferences finalizes no outcome. Combined with "park unless the signal equals my own preference", every boundary block is parked by most nodes and then invalidated by block polling, and nothing re-polls. A fresh node also never polls the signal in a block it receives, because contenders come only from its own tally. |
| U2 | High | level_target is a bare number. Persistent ballots plus number reuse carry consent over to different rules. Competing releases that define the same level split the chain at activation. "Who numbers deployments" becomes the political choke point. |
| U3 | High | Without a quorum (cold start, or any node whose Avalanche has not started), consensus accepts a lock-in written by any miner. After start_n that activates deployment n with no staker support. Before start_n it splits upgraded nodes from the rest. Pre-quorum scalar moves also drift one way, since honest miners write "hold" rather than reversing them. |
| U4 | High | W covers only connected peers whose local registration_time is more than an hour old (peermanager.cpp:1237-1262). Offline or knocked-off stake leaves W instead of counting as the status quo, so DoS against status-quo stakers before a boundary shifts the vote. The quorum is latched (processor.cpp:998-1058) and set by local -avaminquorum* arguments. The note's §4.8 and its bribery row describe neither. |
| U5 | Medium | The 7/8 threshold is presented as derived from Avalanche's 7-of-8 window, but it is not. Rejection finalizes reliably from about 2/3 of stake. 7/8 is a free choice that grants a 12.5% veto, and with sequential levels the veto is head-of-line blocking. |
| U6 | Medium | lock = 1 if 8·Σ ≥ 7·W locks in when W = 0, for example on a node whose proofs all re-registered within the last hour. It must also require W > 0. |
| U7 | Medium | A_0 = 9 is justified as "1000 >> 9 = 1 atom per kB" and by covering the review's 400× launch overpricing. The approved byte fee is 100,000 atoms per kB, and under the revised √I rule launch overpricing is 20×. The upper bound 62 confuses A with A − A_0. The headroom A_0 is a magic number. |
| U8 | Medium | G cannot do its job. The unvoted C²>>32 backstop it deliberately leaves alone already makes a 2× design block cost about 2 subsidies at bootstrap and hundreds in the tail. Raising G cuts only the terms the backstop dominates. Either G is inert, or moving S_quad would make it an unguarded lever. |
| U9 | Medium | Capture is limited in rate, not in level. A simple majority, which is less than the roughly 2/3 that parking-halts need, can price out every ordinary payment in about 10 to 15 epochs. Because the result is consensus state, undoing it takes as long, even after the community acts. "Adds little to what capture already buys" is not accurate. |
| U10 | Medium | O9 freezes 50/25/25 "as permanent policy". The split is enforced only by the stakers' own parking (TreasuryPolicy, StakingRewardsPolicy), so stakers can change it whenever they like, and freezing it binds nobody. Either make it consensus or say plainly that it is staker policy. |
| U11 | Medium | Format collisions and stale sizes. MSG_AVA_UPGRADE_CONTENDER = 0x20000006 is already MSG_AVA_MEMPOOL_BATCH (protocol.h:716, peering.md §4). The revised fee floor adds ema_miner_fees:u64 to the same record, giving 76/108 bytes, not 68/100. The field order and alignment are unspecified. |
| U12 | Medium | The estimate is low. The 56-byte record is pinned in about 25 places: the fast-sync wire messages, BLOCKUNDO, the compiled-in snapshot anchor, the disk format, the reference and the tests. There are about 100 non-test call sites for the scaled quantities, plus a second proof adapter (src/lotus_v2/avalanche_proof.*), script-cache flags for level-dependent rules, and the functional test framework's proof codec. A realistic figure is 4,000 to 5,500 lines and 15 to 20 days. |
| U13 | Low–Medium | The ballot belongs to the proof's master key. Stake signatures commit only to (expirationTime, master) (proof.cpp:30-37), so pooled-staking operators vote their pool's coins without the coin owners' consent. That is a custody concentration beyond exchanges. |
| U14 | Low | Accuracy:<br>• TreasuryPolicy does not just "accept while not ready". It parks against its local tally winner before finalization, which is the same as the epoch vote's rule.<br>• BIP34 is listed as a flag day. It was the first IsSuperMajority deployment.<br>• The gas-limit history stops at 45M (it reached 60M in late 2025).<br>• Monero's long-term median is its defence against ratcheting, not a source of it.<br>• The size is given as about 3,000 lines in the summary and 2,550 in §10.<br>• The ASIC example still uses the full-I 200× rather than √I's 14×. |
| U15 | Low | Spec text owed:<br>• C22a's "a script's result depends only on the transaction, its coins and ChainID" now also depends on level_active. That is monotone, but it must be stated.<br>• The contender id needs a domain tag, as the treasury id has (BLAKE3_keyed("lotus.v2.ava.treasury_contender", …)).<br>• The coupling of the epoch to the stake-confirmation default (-avastakeutxoconfirmations, a local argument) is nominal. |
1. Safety and liveness of activation
1.1 Contender agreement (U1)
The note says that "Avalanche converges even from a near-tie, which is what Snowball is for". Lotusd does not run multi-value Snowball. VoteRecord::registerVote (voterecord.cpp:14-58) is a binary record per item. TreasuryContenderCache (treasury.cpp:474-591) gives each node a yes vote only for its own tally's winner, and nothing links contenders of the same prevblockhash as a conflict set. The treasury tolerates this because its policy accepts any slate in a winner set (TreasuryPolicy, treasury.cpp:653-721). The note's UpgradePolicy instead demands the finalized outcome, and in its absence the node's own preference.
The simulation (multi_contender_sim.py) uses 60 nodes, each initially accepting only its preferred outcome and answering polls from its current state:
| Local preferences | Result (4 runs each) |
|---|---|
| 50% / 50% | Always converges on one outcome (the two items are complements) |
| 40% / 35% / 25% | Every contender finalized rejected on every node, in all 4 runs |
| 50% / 30% / 20% | Rejected everywhere in 3 runs; outcome 0 in 1 run |
| 34% / 33% / 33% | Rejected everywhere |
Three or more distinct preferences arise when two dimensions are close at once: a price share near 50% and a level share near 7/8. They also arise when nodes' W differ (U4), which is exactly when the vote is contested. The chain then fails like this:
- Nodes whose preference differs from the block's signal park it.
- They vote "parked" (
net_processing.cpp:6794, error code 2, a no vote). - Block polling finalizes it as
Invalid, so it is parked andBlockInvalidatedis signalled everywhere (net_processing.cpp:9306-9328). - The next boundary block meets the same fate.
- Nothing re-tallies, because
hasTallylatches perprevblockhash.
Separately, contenders are "derived locally … no announcement". A node whose tally yields only "hold", for example one with W ≈ 0 after a restart, never polls the signal carried by the block it has just received. It can never finalize that outcome, so it never unparks.
Fix, all of it policy except the last item:
- Decompose into binary items, which do converge:
price-up?,price-down?,capacity-up?,capacity-down?andlock?, each keyed by(prevblockhash, item);- if both directions of a scalar finalize as accepted, the outcome is "hold".
- Always add the received block's signal to the pollable set.
- Remove the "park unless my own preference" branch. Before finalization, park only a signal that is outside every possible outcome, that is, one that fails the bounds or locks in a level the release does not define. Let block polling decide the rest. Stakers' block votes already reflect their parking, and
Acceptedunparks (net_processing.cpp:9331-9334). - Make the tally's input deterministic (U4's fix), so that honest nodes rarely disagree in the first place.
- Simulate it before genesis. The note already lists this gap (§11, "No simulation").
1.2 Lock-in, one epoch later, and no timeout (U2, U3, U5)
- One epoch of notice is adequate for soft forks. Old nodes follow the upgraded chain. Shallow reorgs cannot cross an activation, because
level_activeathwas fixed ath − P. - No timeout combined with sequential levels is head-of-line blocking. A contested deployment
nstallsn+1…indefinitely. To unblock them, someone must decide to abandonnand reuse its number, and that decision is exactly the coordination fight the mechanism was meant to remove. - Number reuse is unsafe with persistent ballots (U2). A staker who set
level_target = 5for release X's deployment 5 is counted for release Y's different deployment 5. The note's "since it never activated, nothing is ambiguous" overlooks the ballots. - Fix for U2, which changes the genesis format:
- Bind each level to a deployment ID, a 32-byte hash of the deployment's specification.
- The ballot carries
(level, deployment_id), and only matching ballots count. - At a lock-in boundary, the coinbase carries the ID in a zero-value
IS_BURNcommitment output (branches[0] = id). P01's grammar already allows these outputs, so this adds no new grammar. UpgradeStatereplaceslevel_pending:u32withdeployment_root = H(prev_root ‖ id), or carries the root as well as the level.- A node whose release defines level
nwith a different ID treats the mismatch as an unknown deployment and warns or stops safely, instead of silently enforcing different rules. - Numbers stay sequential, but they can no longer be ambiguous.
- The stake-free route to activation (U3): see section 1.3.
- The threshold (U5). Part 1 of
voterecord_sim.pymodels one node polling stake in which a shareurejects a block:
Upgraded share u |
P(rejection finalized) | Median votes needed |
|---|---|---|
| 0.55 | about 0.02 within 60k votes | more than 60k |
| 0.60 | 0.98 | about 13,000 |
| 0.67 | 1.00 | about 780 |
| 0.80 | 1.00 | about 264 |
| 0.875 | 1.00 | about 182 |
Safety against breaking blocks needs about 2/3, not 7/8. The threshold is a free choice. A lower one, such as 3/4 or 2/3, gives a smaller veto. Alternatively, keep 7/8 with a bounded signalling window after which the deployment is withdrawn, never forced. Withdrawal frees its level without reusing its ID, which removes the head-of-line block without BIP8's LOT fight, because the fallback is fixed in advance as "withdraw".
1.3 Offline stake, partitions and no quorum (U3, U4)
- The tally only sees connected stake.
getTreasuryVotesiteratespeers, which are proofs bound to connected nodes; dangling proofs leave afterDANGLING_TIMEOUT= 15 min. Eligibility needsregistration_time < min(parent time, now) − 1 h. That time is local, and it resets whenever the proof re-registers, after a restart without persisted peers or after a reconnection. - So stake that goes offline is subtracted from
W, not counted as the status quo. - An attacker who eclipses or DoSes status-quo stakers' nodes about an hour before a boundary lowers the share the movers need.
- The bribery row ("must pay more than half of all eligible stake") is accurate only for the connected, aged subset.
- The quorum is latched.
isQuorumEstablishedlatches after the first success, re-checking only the node count. So "mass staker loss: nothing is parked" (§4.8) is wrong for running nodes. They keep parking and tallying over whatever stake remains, and as few as 8 nodes keep it alive. - Its thresholds (
-avaminquorumstake,-avaminquorumconnectedstakeratio, the supply permille) are local arguments. - The note's "no quorum constant" is true only of the rule. The gate is a set of configurable magic numbers (X23).
- Fix for U4:
- Tally over finalized, non-conflicting proofs known to the node, whether connected or dangling, with each proof's age measured in blocks from its finalization, not from local wall-clock registration.
- Better still, make the ballot set deterministic: count only proofs finalized before the parent of the previous boundary, and only ballots unchanged since then. Churn just before a boundary then counts for nothing, and every honest node computes the same
W. - Specify an unlatched gate for the vote: a minimum share of the previous epoch's
W, derived, not a new constant. - The pre-quorum miner path (U3). Consensus accepts any in-bounds signal, so with no quorum one miner can:
- lock in level
l+1, which activates a defined deployment afterstart_nwith no staker vote; - before
start_n, write a lock-in that upgraded nodes reject and old nodes accept, splitting the chain on a single miner's whim; - move scalars one way only, since honest software writes "hold" and never reverses. A miner group with hash share
hdriftsAby abouthsteps per epoch. - Fix for U3:
- Require a stake certificate for a lock-in only, not for scalar steps. It is a rare event, once per deployment.
- The note dismisses a certificate as "tens of MB per epoch", but that figure is for every epoch and every step. Signatures from 7/8 of stake, once per deployment, are small enough to carry in the boundary block.
- Without one, at least make honest template software revert pre-quorum scalar moves toward the last staker-finalized value, and write U3 into the spec as a known activation path rather than as residual risk.
1.4 Reorgs, IBD and parking
- Reorgs.
UpgradeStatelives inMonetaryStateand is undone with it. The tally is keyed byprevblockhash. Missing case: a reorg that connects a boundary block whose parent was never the active tip.computeTreasuryWinnerruns only fromupdatedBlockTip, so the policy has no tally. The note must say what happens; the fix above (park only impossible signals) covers it. A reorg deeper thanPre-tallies old boundaries from today's proof set, which is acceptable because finalization prevents it. - IBD. It rebuilds the state from the chain and needs no Avalanche history. Its exposure is the general one: a heavier chain whose signals stakers rejected. The note states this correctly.
- Parking a boundary block can stall the chain. The mechanism is U1 above. With the fixes, a boundary block that is valid in consensus and inside the possible outcomes is decided by ordinary block polling, which already handles competing blocks.
2. The scalar rule under manipulation
| Vector | Assessment |
|---|---|
| Re-registering a proof | It drops the staker from W for an hour. Under the current rule that helps the side the staker opposes (U4). With the deterministic ballot set, it simply defers the new ballot by one epoch. |
| Stake churn before a boundary | A proof is eligible an hour after registration. Stakes need 2,016 confirmations at registration, measured from the coin's height, not aligned to the epoch. Old coins can therefore be staked and counted within about an hour, and custodians and lenders hold old coins. The note's claim that a coin "cannot be counted until the next epoch" holds only for freshly moved coins. |
| Stake reused across proofs | Handled. Conflicting proofs go to the conflicting pool, and only finalized proofs count. |
| Sybil splitting | Weight is by amount, so splitting has no effect on the sums. It can help satisfy the 8-node quorum gate. |
| Miner signal against the Avalanche outcome | Parked with a quorum and accepted without one (U3). Under the current policy, a miner who races the poll causes U1-type parking churn rather than a wrong outcome. |
| O10, miners steering with no quorum | One direction only, at about the miner's hash share in steps per epoch, and lock-ins cannot be undone (U3). |
| Pooled staking | The ballot is the proof master's, and stake signatures do not commit to it (U13). Either accept this and document it, or add H(ballot) to the StakeCommitment. The second option costs a re-sign by the coin owners to change the ballot, which is defensible for a rarely changed ballot. |
| How bounded is capture | One factor of 2 per epoch, with one epoch's notice. The payment fee is 25,100 atoms at launch prices. +10 steps make it 25.7 XPI (about $0.51 at 2 cents), and +15 make it about 822 XPI. A majority prices out payments in 4 to 6 weeks. A majority is cheaper than the roughly 2/3 that a parking halt needs (part 1 of the simulation: 55% yields no finalization). The result is consensus state, so after the coalition loses, undoing it takes the same 10 to 15 epochs. The lower direction is a DoS lever: at A = 0 byte and cu prices are 512× cheaper for state bloat, and the per-block backstop does not bind below E_min (U9). |
3. Format and consensus
- The ballot and the ProofId.
computeProofIdhashessequence, expirationTime, payoutScript, treasuryPayouts, stakes(proof.cpp:81-95), so appending the ballot is straightforward. It must also be added to: - the V2 adapter
src/lotus_v2/avalanche_proof.*(ProofEnvelope); test_framework/messages.pyandavatools.py;- every hex-pinned proof in the tests.
- The coinbase
sequencehas no existing meaning. For consuming inputs,sequenceencodes the BIP68-like relative lock (P01, "Absolute and relative locks"). A coinbase input is not a consuming input, P01 fixes itssequenceatffffffff, and no other rule or note uses it. The mint input also fixessequence = ffffffffand is unaffected. The signal word is mostly bit patterns that are invalid on consuming inputs, so explorers and PSBT tools must not decode it as a lock. That is a documentation point. - MonetaryState 56/88 → 68/100. Three problems:
- Stale sizes. The revised fee floor adds
ema_miner_fees:u64, so under both proposals the record is 76/108 bytes. The re-review's option (c) drops that field again, so the size depends on an open owner decision. Decide the two together. - Order and alignment are unspecified. Place the level and root fields before the
u8fields, or widen theu8fields, so that the record stays naturally aligned. - The size is pinned widely:
block.h:55,70,disk_block.h:29,fast_sync.{h,cpp}(wire messages,protocol.h:390-396),BLOCKUNDO(validation.cpp:4818), the compiled-in anchor (validation.cpp:12192),sparse_state.cpp:437-493(the CompactSize length bytes 56/88),reorg_recovery.cpp:120and six or more tests. The reference hasmonetary.py:90andblock_seal.py. Every dev-genesis state root and pinned vector changes. - Consider a separate
Bytes(UpgradeState)element in theStateRootenvelope. It is the same cost, and it keeps governance out of the monetary record. - Integer bounds:
A. The scaling is2^(A−A_0), so atA = 62a base of 1 atom costs 2^53 atoms, which is payable. The width bound isA − A_0 ≤ 62, soA ≤ A_0 + 62. As written, 62 is a cap that the note labels a width.G.E_min = 2^(34+G) ≤ 2^63is a true width. The F1 term's divisorE_min²reaches 2^126, so intermediates need u256.- Liveness. Coinbase-only blocks pay only
K,L_ownand the backstop. None of them is voted, so G3 holds for every reachable(A, G). That claim is correct. The users' liveness is a separate matter (U9).
4. Owner-goal fit, and the smaller design
Does the mechanism create politics?
- It moves the fight to three places the note does not name:
- who numbers and writes deployments (U2);
- the 12.5% veto, with no exit (U5);
- the local quorum flags that gate the vote (U4).
- The mechanism ratifies; it does not author. That is fine, but the spec should say so.
- O11 ("no soft fork shortens a lifespan without a rescue path designed first") is a social norm. A soft fork can drop it, and "designed first" is a judgement call. Keep it, but call it a norm.
A and G against the fee floor.
- The re-review recommends either (c),
√I_subplusAfor ASIC steps, or (a), fixed atoms plusA. Either way,Ais the one scalar the fee design needs. Astacks multiplicatively on√Iover the same amounts:x · √I · 2^(A−A_0). That is consistent, provided both apply to the same set (C14b, ordinary dust, the token burn, rent, the bounty, the transactions' linear term).Gdoes not conflict with the fee floor, but it is ineffective (U8). The fixedC²>>32backstop gives:E_min= 2^34 cu → 2^36 atoms ≈ 68,700 XPI;- 2^35 cu → about 275k XPI (about 1.8 bootstrap subsidies);
- 2^36 cu → about 1.1M XPI;
- in the tail era (378 XPI subsidy), the design block alone already costs about 180 subsidies.
Raising G lowers only the linear and F1 terms, which this backstop dominates once a block passes E_min. Capacity politics lives in S_quad, which is unvoted. Drop G. The fee-floor note's usage-relative knee, or a later deployment, can address capacity.
Smallest sound design.
- One scalar,
A, signed and centred atA_0 = 0, so there is no headroom constant: - every scaled amount is
max(1, …)atoms; - the range is the full width;
- whether
Amay go below 0 is the owner's choice between DoS safety (tightening only, C14a's original intent) and correcting launch overpricing. Under rule (a) launch is not overpriced. Under (c) it is about 20× (2^4.3). - Binary agreement items (U1).
- A deterministic ballot set (U4).
- Deployment IDs (U2).
- A lock-in certificate, or a documented stake-free path (U3).
"None" (no voted scalar) is viable only under (c), accepting the unanchored ASIC drift of about 14×. The re-review's reasons for keeping A stand.
O9 is not enforceable as stated (U10). The 25/25 split is enforced by StakingRewardsPolicy and TreasuryPolicy, which are the stakers' own parking. Stakers can raise their share by running different policy, and nothing in consensus stops them. Freezing the split protects against the self-dealing O9 worries about only if consensus enforces it: a coinbase rule with treasury and staker outputs whose script choice is policy and whose amounts are consensus. Otherwise O9 should say "the stakers' policy, not voted", and accept that it is staker-controlled.
5. Prior art accuracy
Most of it is correct, checked against the cited sources and the record:
- BIP9: 95% over 2,016 blocks with a timeout; CSV in 2016; SegWit stalled at about 30%.
- BIP66: the July 2015 invalid-chain fork, six blocks.
- BIP91, BCH (1 August 2017), SegWit active at block 481,824 and SegWit2x cancelled in November 2017.
- The LOT dispute of 2021.
- Speedy Trial: 90%, lock-in in June 2021, active at block 709,632.
- The BCH/BSV split (November 2018) and ABC against BCHN (November 2020, over the coinbase rule).
- Decred: 75% of votes cast over 8,064 blocks, with a quorum.
- Tezos: 80% supermajority, adaptive quorum.
- XRPL: more than 80% for two weeks; reserves lowered in 2021 and 2024.
- The Yellow Paper's
parent/1024gas-limit step. - The Avalanche details: more than 6 of the last 8 votes, confidence 128, 2,016 stake confirmations, 8 quorum nodes, 4 × 15 min, 1‰ supply.
Corrections:
- BIP34 belongs with IsSuperMajority (it introduced it), not with the flag days.
- The Ethereum gas limit went 36M → 45M → 60M (late 2025).
- eCash activation is by median-time-past, which the note does say. "Avalanche makes the result stick" applies to online nodes only.
- Monero: the fee is self-indexed to the base reward and the median block weight. The long-term median exists to stop ratcheting.
- "Speedy Trial (BIP341 deployment)" should cite the Speedy Trial deployment parameters (BIP9 with a minimum activation height), not BIP341's text.
- The note's own lesson, "fixed in advance", argues for a predeclared withdrawal fallback (U5's fix), not for no timeout at all.
6. Implementation estimate
The note gives about 1,050 lines of code plus 1,500 of tests, in 8 to 10 days. For comparison, the treasury split commit fcb7aeb8c4 touched 105 files (+2,295/−828), and the epoch vote is a treasury-sized policy plus a genesis-format consensus change. A realistic figure is 4,000 to 5,500 lines including tests and the reference, and 15 to 20 days, plus review, more if U1 and U3 are fixed as proposed.
The riskiest parts, in order:
- Contender agreement and parking interplay (U1). It is new semantics, it has no simulation, and its failure halts the chain.
- The MonetaryState layout change, coordinated with the fee-floor field, across the fast-sync wire format, undo, disk, the snapshot anchor, dev genesis and every pinned root.
- Threading
A(andG) through about 100 non-test call sites. The policy shadows (fee_hysteresis.h, X29), wallet fee estimation, mempool admission againstmax(active, pending)with eviction at boundaries, and Chronik/RPC are all included. - Level-dependent script rules. The script execution cache must key on the active level's flags, the classic source of soft-fork cache bugs.
- The second proof codec, in
src/lotus_v2/avalanche_proof.*and the Python test framework, and the hex proof fixtures. - Functional tests. They need short regtest epochs, mocktime for the one-hour registration delay, and multi-node quorum setups, as the existing treasury tests do.
Suggested owner questions
- Binary agreement items with a deterministic ballot set (U1, U4): yes?
- Deployment IDs in the ballot and in
UpgradeState(U2), which is a genesis-format change: yes? - A lock-in certificate (U3), or accept and document a stake-free activation path when there is no quorum?
- The lock-in threshold: 7/8 with a predeclared withdrawal window, or a lower threshold such as 3/4 (U5)?
- Drop
G(U8): yes? - May
Ago below its launch value at all? This trades launch correction against a DoS lever (U7, U9). - O9: enforce the split in consensus, or label it staker policy (U10)?
Reproduce
Scripts in tools/lotus-v2-reference/research/upgrade/ (uncommitted), run from that directory:
python3 -I voterecord_sim.py 2 # threshold table (part 1); two-contender convergence (part 2)
python3 -I multi_contender_sim.py # three-way splits: all contenders finalize rejected
python3 -I stale_items_sim.py # addendum: items under inconclusive answers, with lotusd's staleness rule
Both scripts model avalanche::VoteRecord as in voterecord.cpp at fd10cf77a7: 8-vote window, more than 6 to agree, finalization at 128. They use uniform stake per node and random pollees. They are qualitative models, not network simulations.
Addendum: re-review of the revised note (2026-11-18)
This addendum re-reviews the revised upgrade-mechanisms note (712 lines, findings mapped U1–U15). Code was re-read at lotusd fd10cf77a7. The new check script is stale_items_sim.py, and the scripts moved to tools/lotus-v2-reference/research/upgrade/ (see Reproduce).
Verdict on the revision
Sound with fixes. The revision answers U1–U6, U8, U11 and U13 in substance:
- the binary items converge where the old contenders rejected everything;
- deployments are named by content;
- every move needs a consensus-checked certificate, so a miner with no stake moves nothing;
W = 0moves nothing;Gis gone;- the message type and the state layout are fixed.
Four problems remain, and one is new and serious:
- The new "inconclusive until the items finalize" block-poll rule can stop Avalanche finality for good (R1). An item that never finalizes goes stale under lotusd's rule. The boundary block, and every block after it, is then never finalized. The most likely trigger is launch itself: the gate
W ≥ q·Supplyfails, nobody polls the items, and no rule says what follows. - The miner's-half rule does not protect miners (R2). Consensus cannot tell whose script
vout[0]pays, so stakers' policy can simply requirevout[0]to be a staker or treasury payout. - The snapshot is less deterministic than claimed (R3). Dangling proofs are invalidated and not relayed in lotusd, so new and old nodes systematically disagree about offline stake. Proofs with
expirationTime = 0never expire, so dormant stake becomes permanent veto weight against lock-ins. A_0 = 4is justified by a byte fee that is not the owner's (R4). The derivation happens to survive at 1,000 atoms/kB, but what it buys is a permanent 16× downward lever sized by a launch transient.A_0 = 0, tightening only, is the non-magic choice, and launch is exactly when the certificate floor will fail anyway.
On size (R10): the minimum genesis format is smaller than the note's phase 1. It needs UpgradeState, the signal word, a certificate signed by the coin keys rather than built from proofs, deployment-root hashing, and A ≥ 0. That is about 2,300–3,200 lines in 8–11 lane-days, which fits before the 2026-12-10 go/no-go with two lanes. Everything else, including the ballot in the proof, can ship in a later policy release.
Findings at a glance
| # | Severity | Finding |
|---|---|---|
| R1 | High (finality-halt class) | "Until its items finalize, a node answers block polls for the boundary block and its descendants inconclusively." Items whose pollees are at least about 50% inconclusive go stale and never finalize (simulated with lotusd's staleness rule: at 60% inconclusive, 200 of 200 records went stale). Under the gate W ≥ q·Supply, which will likely fail at launch, no node polls the items at all. Every block from the first boundary on is then never finalized, and no rule maps "stale" or "not polled" to "hold". |
| R2 | Medium | 2·value(vout[0]) ≥ Σ value(vout) constrains only that some single output holds half. Staker policy can require vout[0] to pay the treasury or the stakers, so the rule does not cap staker self-dealing. It also breaks pools that pay several miners directly from the coinbase, and a burn-commitment output placed first. |
| R3 | Medium–High | The snapshot is "proofs seen finalized" with dangling proofs included. In lotusd a dangling proof is rejectProof(INVALIDATE)d into the dangling pool, losing hasFinalized, and is not shared by avaproofs. A node that joined after a staker went offline never learns that proof. Never-expiring proofs (expirationTime = 0, proof.cpp:253) of lost-key stakers count as "no" on every lock-in forever. |
| R4 | Medium | A_0 = ⌊log2 √(S_0/T_g)⌋ = 4 does not depend on MIN_FEE_PER_KB at all: A scales the cu term, which sets the fee at 1,000. The note's label ("down to the approved 100,000 atoms per kB") is wrong, and scalar_bounds.py hard-codes 100,000 and treats the byte fee as the payment fee, so its fee and capture tables are 2.16× high. The figure is derived, but its effect is a permanent 16× downward lever after the launch transient has gone. |
| R5 | Medium | Consensus checks only q/2·Supply (1/16 of coins) behind a scalar move and 3q/4·Supply (3/32) behind a lock-in. It does not check the tally's "more than half of W" or "3/4 of W". When Avalanche is not parking for any reason (fewer than 8 nodes, a partition, IBD, a bug, a miner the network cannot see), 6.25% of coins plus one boundary block can move A, and 9.4% can lock in a deployment. The holder exception ("more than half of all stake") holds only when the cause is W < q·Supply. |
| R6 | Medium | q = 1/8 (D1) is a magic number, as the note admits. It also gates the vote at exactly the time A_0's headroom was meant for: at launch the staked share is likely below 1/8 of supply. |
| R7 | Low–Medium | Supply is under-specified. The code (SnapshotSupply) is the UTXO tree's total_value plus pending coinbase, in u64. The note says "spendable coins". With no supply cap, u64 overflows within about a decade at Bitcoin-scale work. Whether expired, unswept coins count is not stated. |
| R8 | Low–Medium | The certificate has no size bound. A proof may hold 1,000 stakes (about 145 KB each). A move needing 1/16 of supply in small pooled stakes can run to MBs, which conflicts with the transaction-size limits (X2) unless the coinbase is exempt. |
| R9 | Low | "Lock X" is polled for every ID with nonzero snapshot support, so a Sybil naming many IDs from minimum-stake proofs inflates the item set. Poll only IDs at or above 3/4 of the local tally, plus the ID in the received block. |
| R10 | — | Size against benefit: see below. |
R1: inconclusive block answers and stale items
The revision's agreement layer is right: binary items converge, and "every combination of finalized items is a valid outcome". But it assumes the items finalize. Lotusd has a third ending. VoteRecord::isStale (voterecord.h:103-107) drops an item once successfulVotes > 4096 and successfulVotes > confidence × 64, and inconclusive answers count as votes. stale_items_sim.py adds that rule to the reviewer's Record model:
| Inconclusive share of pollees | Yes share among conclusive answers | Finalized | Stale |
|---|---|---|---|
| 0.4 | 1.0 / 0.9 | 200 / 200 | 0 / 0 |
| 0.5 | 1.0 / 0.9 | 200 / 70 | 0 / 130 |
| 0.6 | 1.0 / 0.9 | 0 / 0 | 200 / 200 |
Inconclusive answers come from nodes with no snapshot and from nodes whose gate fails. The gate is the main case: at launch, staked coins below 1/8 of supply means no node polls the items at all (section 4.7: "Nodes do not vote on the items"). Yet section 4.5 still answers block polls for the boundary block and its descendants inconclusively "until its items finalize". As written, Avalanche finality stops at height 2,016 if the gate fails then, and stays stopped. That in turn takes down staking rewards, treasury cleanup (both keyed on block finalization, net_processing.cpp:9337-9340) and the preconsensus code that tracks the finalized tip.
Fix, all policy:
- A hold block (
ffffffff, empty certificate) is answered normally from the start. It is always a valid outcome, and the miner gains nothing by racing it. - Only a moving boundary block is held inconclusive.
- When the gate fails, or an item goes stale, treat that item as finalized "no".
- A moving block whose items end up "no" is parked. A miner then re-mines with hold, at the cost of one block.
R2: the miner's half
Section 5 concedes that "consensus cannot tell a staker-reward output from a treasury output". It cannot tell the miner's output from either. 2·value(vout[0]) ≥ Σ vout holds just as well when vout[0] is the treasury slate, and TreasuryPolicy and StakingRewardsPolicy are exactly where stakers would make that demand. The rule therefore caps nothing against stakers. Its only effect is to forbid coinbase layouts: pools that pay several participants directly from the coinbase (P2Pool style), or a burn-commitment output placed first.
Fix: drop it, and label the whole 50/25/25 split as staker policy, as U10's second option said. Its cost, 80–120 lines, buys nothing.
R3: the snapshot's determinism
The intended rule, finalized and non-conflicting proofs with dangling ones counted, is sound. Lotusd's state does not support it:
cleanupDanglingProofs(peermanager.cpp:548-600) callsrejectProof(…, INVALIDATE)and then moves the proof todanglingProofPool. ThePeerentry, and with ithasFinalized, is gone.- Dangling proofs are not offered in
avaproofs. A node that starts after a staker went offline never sees that proof, so its snapshot lacks stake that long-running nodes count as status quo. Honest tallies then differ systematically, which is the condition under which the binary items pick either side (the note's own §4.5 caveat). expirationTime = 0means the proof never expires (proof.cpp:253). Lost-key or abandoned stake stays inWindefinitely: for scalars it is status-quo weight, and for lock-ins it is veto weight. Once dormant stake reaches 25% ofW, nothing can lock in.
Fix:
- Keep a separate snapshot registry of once-finalized proofs. Proofs leave it only on spend, expiry or replacement, not on dangling.
- Relay registry membership with the snapshot block, as compact proof ids.
- Count a proof only if it is live within the window: it attested, or was re-registered, within the last 66 epochs, the note's own withdrawal window. Alternatively, require
expirationTime ≤ MTP + 66·P·τfor a proof to be counted. Either way, dormant stake ages out with no new constant.
R4: what A_0 should be
Under fee rule (c) at the owner's MIN_FEE_PER_KB = 1,000 (fee-floor note §9.1), the byte fee is 251·√I for a payment and never binds. A payment pays its cu share: 11,633·√I + 12 atoms on a quiet chain, 11,645 at I = 1, for the bare-key payment (the standard keyhash payment: about 12,296·√I + 13, 12,309 at I = 1).
AmultipliesL_tx, soA_0 = ⌊log2 √(S_0/T_g)⌋ = 4gives, atA = 0and genesis work,232k/16 ≈ 14.5katoms. That is 1.25× the approved cu price. The derivation is independent ofMIN_FEE_PER_KB. Only the note's wording andscalar_bounds.py's numbers are wrong.scalar_bounds.pyhard-codes 100,000 and prices the payment by the byte fee.- Corrected figures: 11,645 atoms at
I = 1(not 25,100), and about 830 after a 200× ASIC step (not 1,793). - Capture: 11 steps reach 23.8 XPI (about $0.48), and $1 takes 12 steps, about 36 days. The conclusions stand, shifted by one step.
- Is
A_0 = 4a magic number? Its value is derived. Its use is a choice. Once hash has arrived (√I → 1), it remains a permanent licence to price 16× below the approved cu price, sized by a transient that has gone. The note's own "lower direction is a bounded DoS lever" names the cost. - Non-magic alternatives:
- (i)
A_0 = 0,A ≥ 0, tightening only. Recommended. The vote can only raise prices, which is what the ASIC case needs (4 steps). Launch overpricing is left to (c) itself, which removes it as hash arrives (2× at 100× the launch fleet). This is C14a's original "frozen minimum, the vote only tightens" principle. It removes the DoS lever, needs no headroom constant, and makes raisingAa tightening, which matters for R10. - (ii) A signed
Abounded by the index, not a constant. ForA < 0:L_tx(A) = max(⌊L_tx·2^A⌋, min(L_tx, X)), whereXis the approved, unindexed price. The vote can then cancel launch overpricing but never price below the index or the approved calibration, whichever is lower. No headroom constant is needed, and it costs onemax/min. - The launch use-case is moot in practice (R6). The certificate floor and the gate need a staked share that launch is unlikely to have, so the 16× headroom would be unusable when it is wanted. Choose (i).
R5 and R6: what consensus actually guarantees
- The certificate is the only consensus guarantee, and it measures stake against circulating supply (
q/2,3q/4), not againstW. - With Avalanche parking working, the tally's majority and 3/4 rules hold through
UpgradePolicy. - Without parking, for any reason, consensus alone admits:
- a
±1step backed by 6.25% of coins; - a lock-in backed by 9.4% of coins.
A lock-in made that way can activate rules that well under 2/3 of the online stake enforces, which is the split condition of §1.2. The note's "the holder then has more than half of all the stake there is" is true only when the outage is W < q·Supply on the honest nodes, and other outages (a partition, too few nodes, a bug) do not imply it.
- Fix:
- Write the bound down as the consensus guarantee: "without Avalanche,
q/2of supply moves a step and3q/4locks in". - Consider a higher floor for lock-ins only, for example
q·Supplyrather than3q/4. Lock-ins are rare, and they are the dangerous case. qitself (D1) is a value judgement and a magic number. No on-chain fact fixes it. If the owner rejects that, the only alternative is a floor relative to the stake that actually exists, which consensus cannot see.
The other new pieces
- Deployment IDs, 3/4 and the 66-epoch window. Sound.
- Hashing the spec, including its
predecessor, closes U2. - The "unknown root → warn and keep enforcing" path is BIP9's.
- Two deployments with the same predecessor can run in parallel, and the loser must rebase under a new ID. That removes most of the head-of-line blocking.
- The window is
⌈131,400/2,016⌉ = 66✓. The tie to the coin lifespan is a rationalisation, but it reuses an existing constant. - Withdrawal and
startare enforced only by releases that know the deployment. That is acceptable, because an unknown ID has no rules. - Attestation replay. The attestation binds
ChainID ‖ BlockID(b−P) ‖ ProofId, so it is valid at boundarybonly, and on either side of a fork atb. - A ballot changed after
b−Pis ignored by design, consistent with the snapshot. - Consensus cannot know that a proof has been superseded, so a miner can certify with the snapshot ballot. That is the intended behaviour, not a replay.
- Earlier epochs' attestations name a different
b−Pand fail. - The 72-byte
UpgradeStatein theStateRootpreimage. - It is unambiguous: a fixed length after a length-prefixed
MonetaryState. - The preimage grows from 130/162 to 202/234 bytes, one more BLAKE3 block, which is negligible.
deployment_countis redundant with the root, but harmless.- It is the right place, outside the monetary record.
- The pin list in §11 matches what I found.
- Underclaim, coinbase dust and the cleaning bounty under R2's rule. The rule is relative to the coinbase's own outputs, so underclaim and the bounty are unaffected, and dust-dropped slate outputs go to the miner as now. The objections are R2's, not these.
Size against benefit, and the minimum genesis format
What must be in the genesis format is what a later soft fork cannot add. A soft fork cannot add a StateRoot element, a coinbase grammar field, or a new meaning for a signal bit that old nodes reject. Each of those changes what old nodes compute or accept. So:
| Must be in genesis | Why | Lines |
|---|---|---|
UpgradeState in the StateRoot preimage, including the A fields |
Old nodes must compute the same root | 900–1,200 (note item 1) |
| The signal word with the price and lock bits, and the transition (apply pending, ±1 bounds, root hashing) | Old nodes must accept moves | part of the next row |
The UpgradeCertificate field in the coinbase grammar, verified at genesis |
Without verification any miner moves and locks, and junk roots break predecessor targeting |
500–700 grammar plus 600–800 verification |
A applied to L_tx and the byte fee, with A_0 = 0, A ≥ 0 (R4 (i)) |
Small. It could even be deferred, because with A ≥ 0 enabling it is a tightening |
250–350 |
A smaller certificate.
- Sign the attestation with the stake coins' own keys, not as Avalanche proofs plus a master-key attestation: ``
text CertEntry = outpoint || pubkey:33 || ballot:33 || sig64`The signature is overH_tag(ChainID ‖ BlockID(b−P) ‖ ballot)`, and consensus checks that the coin is unspent, old enough and locked to that keyhash. - This removes the Avalanche proof format from consensus, the second proof codec from phase 1, and D2. Coin owners sign by construction.
- The size is about the same as the proof route: roughly 166 bytes per coin, against 145 bytes per stake plus each proof's overhead.
- The ballot in the proof (note item 3) moves to the policy release.
Not needed at genesis:
- item 3, the ballot in the proof;
- item 6, the miner's half (R2: drop it);
- item 7, the deployment-dependent script cache, needed only once a first deployment exists;
- all of phase 2.
Until phase 2 ships, no attestations are relayed, so nothing moves and the certificate keeps it that way. That matches the note's D4.
Minimum: about 2,300–3,200 lines and 8–11 lane-days, against the note's phase 1 of 3,300–4,700 lines and 9–12 days, plus independent review. It fits before the 2026-12-10 go/no-go with two lanes, with little slack.
The even smaller option, which conflicts with the owner's decision:
- Drop the
Afields and the price bits, and handle price raises as ordinary deployments. P05 already allowsC_enforceraises as soft forks, and a deployment that says "multiplyL_txand the byte fee by 16" covers the ASIC case. - That removes the scalar half of the certificate check, the
Afields and item 5, about 400–600 lines. - The cost: raises then need 3/4 rather than a simple majority, and there is no symmetric scalar protocol.
- Because
Awould only ever tighten under R4 (i), the two designs differ only in threshold and speed. That makes it a legitimate fallback if the go/no-go is at risk. It must be chosen before genesis, since addingAlater would need the reserved fields.