v0 (v2.5.0-rfc) · archived baseline · superseded
Part 5: Detailed go-zenon Node Upgrade Specification
Document Class: Engineering Upgrade Blueprint (v2.5.0-rfc)
Inspected Ground-Truth Branches in go-zenon:
origin/release/0.0.11-rc1:f19955f3d28a35868b0488fd7010073241561a7f(Normative U0 release baseline)origin/dev:770e893a0aa78240685043c1d396c65caa1a6635(Alldev:file & line citations below verified directly against770e893/f19955f)master:e8986a63f164259053e0342ceaf9a68cb85d649e(v0.0.10-alphanet, legacy reference only)
1. Baseline Delta Matrix (master vs release/0.0.11-rc1 / dev vs Upgrades)
| Capability | master (e8986a6) | release/0.0.11-rc1 (f19955f) & dev (770e893) | Phase |
|---|---|---|---|
AcceleratorSpork, HtlcSpork, BridgeAndLiquiditySpork | Active | Active | Live |
PtlcSpork (e59f1e97...), DynamicPlasmaSpork (v2 + EmbeddedSendBasePlasma at dev:vm/plasma.go:192), EmbeddedRefundSpork, Libp2pSpork, EpochRewardTermsSpork, composable embeddedVariants (dev:vm/embedded/embedded.go:246) | Missing (16 KiB embedded bypass) | Implemented | Phase U0 |
StateRootSpork (v3, common/trie/smtcore + proof-format.md V1, chain/state_tree.go) | Missing | Missing | Phase U1 |
CommitteeRootSpork (v4: 30-day BLS12-381 min-sig FinalityCommitteeRoot w/ distinct POP DSTs & depth-5 SHA-256 tree, ContentRoot, U2 finality gadget, pillars.go RegisterFinalityKey+PoP, RequestExitCommittee, historical-root full-preimage SubmitInvalidCertProof + SubmitEquivocationProof, 72d post-service stake lock, A-PILLAR-1) | Missing | Missing | Phase U2 |
OffchainExecutionSpork & MintedZbtcSpork (SettlementContract, TokenContract.IssueMinted → single-use ReceiveTreasury(), monotonic batchId + domainInputSeq, latency- & reservation-aware G-21, multi-gen VaultUtxoSet, aligned state machine + RepointTrappedPegOut + ResetFailedReimbursementSlot + SlotBondZnn + SyncPendingTrapVault + SyncRetiredLane + SyncVaultGraphEpoch, ChallengeDepositZnn priority lane) | Missing | Missing | Phase U3 |
OptimisticRefereeSpork (panic-free vm/embedded/btcspv/ 17 tags incl. decoupled 0x06, full-status SMT absence/inclusion 0x08, strict multi-gen 0x0D incl. RELEASED, 0x10, bounded Multi-Tx Sessions + ancestor refunds, commit-reveal, streaming SHA-256 verifier) | Missing | Missing | Phase U4 |
GovernanceContract + MultisigContract (HARD GATE before Stage 1B), DeleteMomentum WS reorg push (dev:rpc/api/subscribe/api.go:357), HTLC/PTLC indexes, optional BtcAnchorSpork | Missing | Missing | Phase U5 |
2. Phase U0 — Release release/0.0.11-rc1 (f19955f) Prerequisites
- Ship
origin/release/0.0.11-rc1(f19955f) /origin/dev(770e893) to mainnet. - Calibrate
PlasmaVariables(dp/dp.go,PlasmaContract.SetVariables) to prevent multi-month decay lockup and 2-heavy-tx saturation. - Verify
PtlcSpork(e59f1e97...) on-chain status; activateDynamicPlasmaSpork,EmbeddedRefundSpork,Libp2pSpork,EpochRewardTermsSpork.
3. Phase U1 — StateRootSpork (Momentum Version 3 & common/trie/smtcore)
common/trie/smtcore/(shared frozen core for L1 &d_btc_asset):hash.go,compute.go,proof.goimplementingproof-format.mdV1 byte-exact (flags || key || leaf_hash || deepest-first bitmap || sib_count || siblings [|| value_len || value],VerifyProofByPath,VerifyAbsenceByPath).common/trie/(L1 Momentum adapter):FoldFilter(excludes{0}/{1}/{2}), empty-value-as-deletion convention, LevelDBNodeTree.chain/state_tree.go:InitStateTree,UpdateStateTree,TruncateStateTreeTo,17,380-momentum retention (StateTreeArchive: truedisables pruning).chain/nom/protobuf.proto&momentum.go: Tag14(types.HashProto stateRoot = 14),StateRootMomentumVersion = 3,rlp:"optional", appended inComputeHash()iffVersion >= 3.verifier/momentum.go&pillar/worker_momentum.go: Stamp/verifyStateRoot(ErrMStateRootInvalid,ErrMStateRootMustBeZero).rpc/api/ledger.go:ledger.getStateRoot(height),ledger.getProof(height, key).
4. Phase U2 — CommitteeRootSpork (Momentum v4, 30-Day BLS12-381 Finality, Full-Preimage Slashing & 72-Day Lock)
chain/nom/protobuf.proto&momentum.go:- Tag
15:types.HashProto finalityCommitteeRoot = 15;(immutable per 30-day finality epoch) - Tag
16:types.HashProto contentRoot = 16;(domain-separated Merkle root ofMomentumContent) CommitteeRootMomentumVersion = 4; bothrlp:"optional", appended inComputeHash()iffVersion >= 4.
- Tag
consensus/finality_committee.go(NEW):- Derived from
dev:consensus/consensus.go:45,86:finalityEpochIndex = consensusEpoch / 30(finalityEpochStartTs(E) = genesis.TimestampUnix + E * 30 * 86400). - At exact transition Momentum
h_trans(E), snapshots top30active BLS12-381-registered Pillars (excludingExitCommitteeRequested == true) by(totalDelegatedZnn desc, producerAddress asc), recordsLastFinalityCommitteeEpoch = E, and defines canonicalnextFinalityCommitteeRoot(h)at EVERY heighth(spec/04 §3.2).
- Derived from
consensus/finality_cert.go(NEW), BLS12-381min-sig, Finality Gadget &/zenon/finality/v1topic:- Fixed
204 BBLS12-381min-sigFinalityCertificate(48 BG1 agg sig +4 Bbitfield for up to all 30 signers), signed ONLY at depth>= 6Momentums every30Momentums and ath_trans(E). - Finality Gadget (
chain/momentum_pool.go&chain/account_pool.go): RefuseDeleteMomentum/ fork switch across any Momentum backed by a valid dual-supermajorityFinalityCertificate.
- Fixed
- Full-Preimage Slashing, BLS Key Registration &
72-Day Lock (dev:vm/embedded/{definition,implementation}/pillars.go,A-PILLAR-1):RegisterFinalityKey(blsPubKey96, popSig48): Verifies BLS12-381 Proof-of-Possession (distinct IETF POP DST —R6-L7) before allowing finality committee eligibility.RequestExitCommittee(): Opts Pillar out of future 30-day finality snapshots.SubmitEquivocationProof(certA, certB): Slashes conflicting signatures for same(finalityEpochIndex, height).SubmitInvalidCertProof(cert)(R6-H1): Looks up historical Tag-15 committee matchingcert.FinalityCommitteeRoot, verifies valid dual-supermajority BLS12-381 signature under THAT historical committee (NOT merelycanonicalSigningCommitteeRoot(cert.Height)!), and checks ALL 7 certificate fields in Case A (finalityEpochIndex,height,timestampUnix,momentumHash,stateRoot,finalityCommitteeRoot,nextFinalityCommitteeRoot— slashing committee-Eforged handoffs ath_trans(E+1)+1AND targets in epochE+1!) plus Case B (cert.Height > frontier.Height + 60). Forfeits 100% of15,000 ZNN(dev:vm/constants/embedded.go:108), revokes Pillar, triggers Settlement pause.72-Day Post-Service Lock & Clean Exit: ModifiesPillarContract.Revoke(dev:vm/embedded/implementation/pillars.go:132-138,395-400) to holdPillarStakeAmountuntilnow >= finalityEpochEndTs(LastFinalityCommitteeEpoch) + 72 days; onceExitCommitteeRequested == trueand72delapses, allows immediate withdrawal without waiting another% 90dcycle!
rpc/api/ledger.go:ledger.getFinalityCommittee(finalityEpochIndex),ledger.getFinalityCertificate(height),ledger.getContentProof(height, accountBlockHash).
5. Phase U3 — OffchainExecutionSpork & MintedZbtcSpork (SettlementContract & Treasury zBTC)
5.1 Embedded Address, Sporks & Registry
common/types/address.go: AddSettlementContract = parseEmbedded("z1qxemdeddedxsettlementxxxxxxxxxxx<checksum>")toEmbeddedContracts.common/types/spork.go: AddOffchainExecutionSpork(...000A) andMintedZbtcSpork(...000B).vm/embedded/embedded.go: Add spork bits atdev:vm/embedded/embedded.go:246wiringSettlementContractandTokenContract.IssueMinted.
5.2 Exact TokenContract Modifications (dev Ground Truth)
TokenContract.IssueMinted(name, symbol, domain, decimals, maxSupply):- Guard:
if sendBlock.Address != types.SettlementContract { return nil, constants.ErrPermissionDenied }. - Exempts
checkTokenregexes (dev:vm/embedded/implementation/token.go:40,43), requires1 ZNNfee, setsTotalSupply = MaxSupply = 21M*10^8,IsMintable = false,IsBurnable = false,Owner = types.SettlementContract. - Descendant
ContractSendcarrying21M*10^8 zBTCpacksData = ABISettlement.PackMethod("ReceiveTreasury")(dev:vm/vm.go:204-226).
- Guard:
- Sealing
TokenContract.Burn(dev:vm/embedded/implementation/token.go:330) ANDTokenContract.UpdateToken:- Both reject if
context.IsMintedZbtcSporkEnforced() && tokenInfo.Owner == types.SettlementContract.
- Both reject if
5.3 SettlementContract Files & ChallengeDepositZnn Priority Lane
vm/embedded/definition/settlement.go: ABI (ABISettlement, includingReceiveTreasury(),ClaimInputDepositRefund(),DispatchDeferredLock(),ClaimFrontingSlot(),SlashLapsedSlot(),ClaimReimbursementSlot(),ResetFailedReimbursementSlot(),RepointTrappedPegOut(),RegisterOperatorRound(),SyncRetiredLane(),SlashOperatorBond(),SyncPendingTrapVault(),SyncRecoveredVaultOutpoint(),SyncVaultGraphEpoch(),QuarantineExpiredVault(),SyncOrphanedVaultOutpoint(),CommitChallenge(),ExpireChallengeCommit(),OpenChallenge(),UploadWitnessProof(),ExecuteChallenge(),ExpireChallengeSession(),RefundRejectedBatchChallenge(),ChallengeStep(),ChallengeContinuity()), storage prefixes0x01–0x17(spec/03 §2.1), canonical binary codecs (StepTraceLeaf328 B,BatchCommitmentV3).vm/embedded/implementation/settlement_core.go:RegisterDomain,SubmitInput(ALWAYS open, contiguousdomainInputSeq),SubmitBatch(monotonicbatchId,parentBatchId,PreStateRootchaining,finalLeaf, per-executor + aggregate caps, dispatch-onlydispatchFrozenByBatch),FinalizeBatch(Shadow Mode active, freezing batch exempt, session/commit guard, exposure release),ClaimInputDepositRefund(<= 16global duplicates/batch).vm/embedded/implementation/settlement_minted.go:InitiateMintedToken, single-useReceiveTreasury,BindMintedAsset(GOVERNANCE_ADD_BINDING),RequestPegOut(open duringDRAINING_*,+3.0dlatency-aware per-epoch eligibility), anti-censorshipClaimFrontingSlot(500 ZNNSlotBondZnn, reservation, no consecutive re-claim, single-authority expiry),SlashLapsedSlot,RegisterOperatorRound(OperatorBond >= 31,500 ZNN,epoch < 4096, exactanchorExpiryTs == finalityEpochStartTs(epoch) + 58d,CommSig),SyncRetiredLane,ClaimReimbursementSlot,ResetFailedReimbursementSlot,RepointTrappedPegOut,SlashOperatorBond,SyncPendingTrapVault,SyncRecoveredVaultOutpoint,SyncVaultGraphEpoch(unrotatedVaultCount--iffUNROTATED),QuarantineExpiredVault(day >= T_cutoff + 60h,UNASSIGNED/ASSIGNED), deterministicSyncOrphanedVaultOutpoint, closed handlers (MINTED_LOCK_V1latency-awareG-21,MINTED_RELEASE_V1keying strictly on domainoperatorId,MINTED_REFUND_V1).chain/account_pool.goPriority Lane: Reserve10of100Momentum slots ordered byChallengeDepositZnndescending; paired with 48h (+12hsession) window.
6. Phase U4 — OptimisticRefereeSpork (vm/embedded/btcspv/ & Bounded Multi-Tx Sessions)
vm/embedded/btcspv/(pure Go, zerocommon.DealWithErrpanics, importsdev:go.mod:7btcec/v2+btcec/v2/schnorrandcommon/trie/smtcore):header.go(ActiveChainByHeight68 Bincl.blockTime,BTC_PRUNE_STEPrejecting whileReorgActive == 1),stream.go(BTC_TX_STREAM_CHUNK),tx.go(len != 64,txIndex != 0, CVE-2012-2459),taproot.go(mandatory 2-inRolloverTx, BIP-68/112 CSV,Q_vault_d/Q_rec_dtweaks,CommitteeIdentityKeysig verification),apply.go(all 17 tags0x00..0x10, multi-epochTrackedVaultRecord, SMT absence/inclusionBTC_VAULT_SPEND_PROOF,BTC_ROUND_RETIRED).
vm/embedded/implementation/settlement_challenge.go(OptimisticRefereeSpork...000C):CommitChallenge(T_reveal = 1h),ChallengeContinuity(1,700 B), 1-txChallengeStep, bounded Multi-Tx Sessions (T_session = 12h,UploadWitnessProof = 8,676 B@ depth 256,ExecuteChallengere-verifying(batchId, traceRoot)), blockingFinalizeBatchwhile open, andRefundRejectedBatchChallenge.
7. Phase U5 — Governance Decentralization (Stage 1B Hard Gate), Reorg Push & Indexes
GovernanceContract&MultisigContract(Stage 1B Hard Gate):MultisigContract(Guardian M-of-N Ed25519, e.g.5-of-9): Narrowing actions ONLY (GuardianPause,GuardianLowerSupplyCapon> +10%24h TWAP deviation across>= 3venues,GuardianBeginDrainwith mandatory7-dayexpiry timer).GovernanceContract(Pillar stake-weighted voting replacing singleSporkAddressatdev:chain/genesis/embedded_genesis_string.go:7): Proposal deposit,>= 33%quorum,> 66%approval, weekly supply-cap &MinOperatorBondZnnreview cadence, pre-halvingK/cap rule,GOVERNANCE_ADD_BINDING(0x0E), on-chain timelocks (>= 48hsporks/resume,>= 7dasset bind, cap raises,ORPHANEDvault disposition, migrations). Hard Gate before Stage 1B!
- Fix
DeleteMomentumReorg Push (dev:rpc/api/subscribe/api.go:357): EmitmomentumsRevertedWebSocket event{height, hash, previousHash}. - HTLC/PTLC Local Indexer (
chain/index/,rpc/api/embedded/{htlc,ptlc}.go):getByDestination,getByPointLock,getByHashLock. - Optional
BtcAnchorSpork(...000D): Structured<= 64 Banchor receipts relaxingdev:verifier/momentum.go:198(ErrMDataMustBeZero) ONLY for valid receipts +ledger.getLatestBtcAnchor().
8. Spork Release Flow & Automated Conformance Gates
Follows dev:common/types/spork.go:17-34 4-step choreography (placeholder → CreateSpork → pin real hash & upgrade >= 90% Pillars → ActivateSpork → SporkMinHeightDelay = 6 Momentums; un-upgraded nodes halt via dev:chain/momentum_pool.go:254-283).
Mandatory CI & Testnet Gates before Stage 1A:
- Full Genesis-to-Tip historical replay parity across v1 → v2 → v3 → v4.
common/trie/smtcorepasses upstreamsmt-v1-test-vectors.jsonbyte-for-byte.go-zenonunit test (G-11):InitiateMintedToken→IssueMinted→ single-useReceiveTreasury()→BindMintedAsset→ atomic mint/burn/rollback +Burn/UpdateTokenrejection.- 30-day BLS12-381
FinalityCommitteeRootPoP (distinct DSTs) + depth-5 SHA-256 tree + U2 finality gadget reorg protection + historical-rootSubmitInvalidCertProofMUST-fail tests (R6-H1: committee-Eforged handoff ath_trans(E+1)+1with canonical momentum/state ⇒ slashable; committee-Etarget in epochE+1⇒ slashable!) +72-day post-service lock &RequestExitCommitteeexit test. - All 15 MUST-fail bullets + 18 conformance vectors (
MINTEDv0.1.1 §13–§14) + all 29 SPV vectors + cross-store vault state machine tests (decoupledBTC_RELEASE_PROOF+RepointTrappedPegOut,PENDING_TRAPmirror,unrotatedVaultCountinc/dec without underflow, deterministicSyncOrphanedVaultOutpoint), latency- & reservation-awareG-21+BTC_ROUND_RETIRED, anti-censorshipClaimFrontingSlot(500 ZNNSlotBondZnn+lastLapsedOperatorId), bounded Multi-Tx Session atT-1+ depth-256 ground-tree fuzzer (G-9). - Signet↔Zenon PTLC (Bob-locks-first, BIP-327
PartialSigAgg, odd-$y$) & HTLC (hashType = 1, LN Hold Invoice) adversarial swap suite (G-18).
Attack this spec & submit feedback
This is a Public RFC updated to v2 (v3.1.0-rfc) in response to Consolidated Hostile Review R8 (redlining against archived v1 / v3.0.0-rfc). Humans and AI review agents are invited to run python3 -I scripts/verify_spec_bounds.py, inspect the v1 → v2 changelog & redlines, file findings, or open pull requests.