Lotus V2 conformance and compiler gap audit
2026-10-15. Audit checkpoint: monorepo 8914db5177d7b97fa7aa7d04172f71ead633775c; ABC 1fb7db17c176cdea8a2c60d887891589382ee4e3; ordered maintained mailboxes 000–056; replay tree 9a3e3e57aa6ee0c0430144ee1200ab9cbe48f6e7. The latter was checked with git rev-parse HEAD^{tree} in /private/tmp/lotus-v2-series-replay-056. Source paths beginning src/ below refer to that ABC tree, not monorepo files.
This is a source audit and work allocation, not new build, fuzz, runtime or network evidence. Findings marked demonstrated follow directly from executable branches or explicit API contracts. Coverage gap means the requested conformance gate is absent or narrower; it is not proof of a failing implementation. Hypothesis requires a retained reproducer before repair. Existing isolated modules and sealed development fixtures do not establish lotusd V2 acceptance. No implementation or consensus changes belong in this audit.
Normative basis and constraints
Read against docs/lotus-v2/consensus.md C01–C28, decisions.md, P01 encoding-and-signatures.md, P02 commitments-and-state.md, P03 vm-semantics.md, P04 header-and-mining.md, P05 resources-and-parameters.md, P06 issuance-and-time.md, and docs/plans/lotus-v2-compiler-abi.md (CABI milestones and named paragraphs below). D10–D14 remain open where the register says so. Half-life 172800 and spacing 120 are explicit caller test arguments, never frozen network defaults. Current isolated conformance packets use no peers, Chronik, production data, mainnet parameters, release operations or existing-workspace reset. Subsequently authorized peering specification is owned separately in new docs/lotus-v2/peering.md and docs/plans/lotus-v2-peering-milestones.md: milestone one adapts ABC TCP/compact blocks with new development magic and Lotus defaults P2P 10605/RPC 10604; isolated testing must avoid live bindings. Milestone two investigates QUIC. Runtime peering work waits on that specification gate. Preserve the binary CSV payload in 033 byte for byte.
Issue 22 supplies no absolute-tail consensus rule. P06 “Adaptive tail recurrence” defines stored inductive tail state with parent-work update and exact restoration. No memoryless K√W replacement or stronger absolute-tail rejection is authorized. Issue 21 is research only: no lowering, opcode assignment, OP_DEFINE/OP_INVOKE emission or speculative consensus change.
Concrete ABC and reference gaps
| ID / evidence | Exact normative paragraph | Missing behavior or check; acceptance evidence required | Owning files | ||||
|---|---|---|---|---|---|---|---|
| B01 demonstrated | C26 “first-and-only coinbase”; P01 “Complete transaction grammar”; P02 “Coinbase and root dependency order” | CoinbasePlacement in final block.cpp returns true when no coinbase was seen. Its comment says missing front coinbase rejects, but the function ends return true. Ordinary-only development blocks remain deliberately accepted. Add a separate complete-block acceptance boundary requiring exactly one first coinbase; retain ordinary-slice tests under their narrower API. Baseline valid block, empty body, missing/second/misplaced coinbase, derived-u32-height overflow and parent-ID mutations must be distinguished. |
src/lotus_v2/block.{cpp,h}, test_block_dev_coinbase.cpp, new complete-block parser/tests; Python block.py, tests/test_dev_coinbase.py |
||||
| B02 demonstrated | P04 “Concrete recursive candidate (134 bytes)” block framing paragraph; C04, C06, C26 | Header parsing and transaction parsing exist independently. Connector accepts vector<Transaction>; no complete `Header |
count:u32 | Bytes(Tx)... acceptance checks exact block size, shortest frame lengths, exact consumption, count/allocation bounds, fixed version, supplied child roots, target and PoW together before commit. SealChildHeader` copies caller size/bits/root; 045 derives a root from caller projections, not the accepted full frames. Reject truncation/trailing data and inconsistent root/size/projection mutations. |
new src/lotus_v2/block_wire.{cpp,h} and tests; block.cpp, tx_root_seal.{cpp,h}; Python new complete-block codec, block_seal.py |
||
| H01 demonstrated | P04 “ASERT arithmetic candidate”, “Timestamp eligibility candidate”; C26/C27 | 055 provides a standalone ASERT function but connector/sealer do not require candidate bits equal parent/genesis-derived required bits or PoW against the decoded required target. Add contextual header validator accepting explicit chain profile/history. Cover zero/±H/negative-fraction drift, compact rounding, saturation and huge bounded shifts independently. Existence of arithmetic tests does not establish invocation from acceptance. | src/lotus_v2/asert_candidate.{cpp,h}, header.{cpp,h}, new header_context.{cpp,h}, header/ASERT tests; Python asert.py, new header-context tests |
||||
| H02 demonstrated | P01 “Absolute and relative locks” MTP definition; P04 timestamp median paragraph; C12/C13/C27 | ConnectOrdinaryBlock requires profile.parent_mtp == parent.header.time. A single parent timestamp is not median of up to eleven ancestor timestamps. Supply authenticated parent MTP/history, use it for minimum timestamp eligibility, relative-lock context and coin creation parent MTP. Test nonmonotone timestamps and eleven-ancestor boundaries; do not require child time ≥ parent time. |
new header-context module; block.cpp, ordinary_validation.cpp; Python block.py, lock tests |
||||
| H03 coverage gap / open decision | P04 “Target encoding and chainwork candidate” and “Timestamp eligibility candidate and open parameters”; D12 | Accumulated nonwrapping chainwork and greatest fully valid eligible chain selection, equal-work current-tip retention, temporary future deferral/reconsideration, rollback/restart/ancestor eligibility and overflow semantics are not complete node behavior. Draft operational semantics require maintainer decision before production implementation. Retain deterministic header validity separately from external eligibility result. | later src/chain.*, validation.cpp, net_processing.cpp, new V2 header index; isolated history fixtures first |
||||
| M01 demonstrated | C23–C25; P05 “Unified Cost Units”, “Minimum byte fees and coinbase reward deduction”, “Parabolic transaction and block cost curves” | Final connector passes invocation sum as both accounting/enforcement block cost, parent work as next work, and synthetic frame/envelope inputs to monetary arithmetic. No authenticated complete L(tx) aggregation of wire/proofs/commitments/state writes/coinbase/envelope and parabolic per-tx costs is connected. Derive accounting and enforcement independently, include coinbase data and frames, then derive work from accepted child bits. Assert charges and exact EMA bytes under success scan, explicit burns, underclaim and cost boundaries. | src/lotus_v2/block.cpp, monetary.{cpp,h}, new block_cost.{cpp,h}, monetary/block tests; Python monetary.py, block.py, vm_cost.py |
||||
| M02 coverage gap | C07 duplicate TxIDs and overwrite prohibition; C12 ordered resolution; C26 | Complete-block validator needs block-wide TxID uniqueness even where outputs are absent, burned or already consumed. Outpoint insertion collision checks alone cannot establish this. Keep a transaction-ID set at acceptance and test duplicate all-burn/zero-output transactions, same-block parent-child order, conflicting spends and coinbase identity collisions. Whether current slice admits a particular duplicate requires a runnable fixture; do not claim that as demonstrated here. | new complete-block verifier, block.cpp, test_block.cpp; Python block codec/validator tests |
||||
| S01 demonstrated | C01/C03/C26 commit-after-all-checks; P02 “Full state root”, “Genesis and monetary indexing”; P06 tail restoration paragraph | Per-transaction UTXO commits, final monetary snapshot and independent header snapshot are separate renames. API explicitly says monetary rename is not atomic with UTXO; in-memory disconnect does not update stores. Restart tests of matching snapshots do not prove crash consistency or durable reorg. Add a single tip-generation commit/journal protocol, fault injection at every persistence boundary, durable undo and restart selection of one matching header/UTXO/56-byte monetary tuple. | later coordinator new src/lotus_v2/chainstate_store.*, persistent_{utxo,monetary,header}.*, block integration and persistence tests |
||||
| V01 demonstrated reference coverage gap | P03 “Transaction”, “Input”, “Output”, “Invocation And Locks”, “Tree-hash opcodes”; C18–C23 | Native coverage inventory includes assigned opcodes; Python vm.py still falls through to UnsupportedFeature for multiple assigned introspection/lock/Merkle instructions (e.g. c8 and f3/f4). Complete independent reference semantics and context authentication before calling native coverage conformance. Enumerate registry byte → native/reference/direct/negative/context/cost test, distinguishing unsupported tool result from consensus rejection. |
tools/lotus-v2-reference/lotus_v2_reference/{vm,vm_context,vm_cost}.py, their tests; native vm_test/opcode_coverage.json, differential harness |
||||
| V02 coverage gap | P01 “Exact CHECKSIG message”; C18; C02/C10/C11; P03 extension and CHECKDATASIG paragraphs | General native argv VM runner has no authenticated signing context (U on signed CABI08 scripts). Dedicated native transaction checkers already test signatures; extend runner with exact resolved transaction/coin/path/branch context, not a caller digest advertised as authentication. Differential tests must cover FULL, both partial modes, SINGLE absent output, mint restrictions, 64/65-byte framing, wrong chain/key/branch/coin and arguments changing TxHash while retaining TxID. Preserve outer membership/budgets for automatic success. |
native vm_test/runner.cpp, signing.{cpp,h}, VM/ordinary tests; compiler test/run-native-calls.mjs, generated-client tests; Python signing/context tests |
||||
| V03 hypothesis / calibration gap | P03 “Charges”; P05 “Size-bounded charging”, “Extension-safe accounting and enforcement”; C23–C25 | Recheck selector max-profile charge, constant-index path reads, field-size pass widening/BREAK and accounting/enforcement split across both engines. Old AGENTS caveats are not proof of surviving bugs after 033/035. Need independent expected charge vectors before changing code. Primitive schedule, hard limits and hardware calibration remain open, so no measured resource-safety claim. | src/lotus_v2/{vm_cost.inc,field_size.cpp}, VM differential cost tests; Python vm_cost.py; docs calibration evidence |
||||
| D01 coverage gap / deferred | C28; D10–D14; P06 “Avalanche-controlled payouts”; C01 | No frozen launch profile, snapshot trust contract, final address format or V2 payout-policy integration. Development genesis/root fixtures are test fixtures. Existing ABC parking removal is not D11 implementation: map optional winner policy against resource-adjusted entitlement and test absent/alternative winners and reorg without adding hard consensus dependence on polling. | later chainparams/profile manifest, src/policy/block/stakingrewards.*, validation.cpp; explicit reviewed decisions |
Compiler gaps and acceptance packets
Existing CABI07 deterministic packages and CABI08 local libraries are implemented; do not rewrite them. Helpers are inlined, recursion rejects, helper/control nesting is bounded at 16. Signed native CABI08 remains a runner coverage gap. Registry/discovery/trust-policy work is separate and open.
| Packet | Exact CABI paragraph / consensus basis | Concrete remaining work and gate | Exclusive proposed files |
|---|---|---|---|
| C04 examples | CABI04 row; “Language and lowering boundaries” continuation/termination and pairing paragraphs; “Dogfooding and stress corpus” | Gallery has payment, recovery-shaped scripts, fungible mint/transfer/merge and upgrade. Add executed stateful counter/vault, limit order partial fill, two-input successor ownership, and input×output enumeration examples with one-mutation negatives: weaker successor paths, asset/root swap, missing continuation, unauthorized termination, wrong counterpart/index, duplicate successor claim, arithmetic extrema. Establish each baseline in supported native/reference stages; contextual recovery boundary is not just compilation. Do not weaken consensus to fit examples. | new tools/lotus-v2-compiler/examples/gallery/{counter,vault,limit-order,merge-policy,cartesian}.lotus, companion scenario JSON; new test/cabi04-*.test.mjs. Frontend changes, if necessary, require a separate reviewed packet in src/generic.ts, not concurrent example ownership. |
| C05 independent harness | CABI05 row; “Dogfooding and stress corpus” generation/fuzz paragraphs | Existing deterministic expression and VM tests cover a subset. Add durable seed/corpus schema, independent hand-bytecode inputs, minimized discrepancy artifacts and process resource bounds. Compare accept/reject, stacks, roots, frozen/enforcement charges and supported-stage result; report unsupported separately. Stress maximum loops/bytes/proofs and mixed transactions with recorded device/profile/time/memory. Never auto-regenerate expectations to erase disagreement. | new tools/lotus-v2-compiler/test/conformance/ and fixtures/conformance/; new standalone harness CLI under tools/lotus-v2-conformance/ |
| C06 optimizer equivalence | CABI06 row; “Language and lowering boundaries” optimization paragraph | Existing pipeline test compares Python VM success/stack and allows optimized charges ≤ original; this is useful but narrower than exact-profile acceptance/accounting/enforcement preservation. Add native and reference contexts, cost/fee boundary cases, loops/BREAK/skipped malformed/overflow/success-scan cases and commitment/signing effects. State what equivalence means when bytes/roots/costs change: reinstantiate/re-sign each artifact, compare contract obligations; do not assert identical roots. Frank pilot and durable connect/undo/reorg are future gates, not current completion. | tools/lotus-v2-compiler/src/optimizer.ts, test/{optimizer-vm,pipeline-differential}.test.mjs, test/optimizer-vm.py, new optimizer corpus. No Frank files in this packet. |
| Offline fixture bundles | “V2-native test fixture infrastructure” versioned offline JSON paragraph; “Binding generation and signing flow” finalization/cross-consumption paragraphs | Expand payment/token fixtures into versioned bundles with source/spec/compiler/profile digests, exact full/core bytes, both IDs, resolved coins, proofs, signing requests/public fixture signatures, charges and supported-stage expectations. Cover payment/recovery/mint/transfer/native+token burns/stateful covenant and partial modes. Python prepares→TS finalizes and converse. C++/Python consume checked-in bytes with no Node at validation runtime. Independently validate baselines before named negative mutations. | tools/lotus-v2-compiler/src/{fixtures,fixture-cli}.ts, fixtures/, new test/offline-bundles.test.mjs; native fixture import and Python consumer are later sequential integration owners |
| Artifact completeness | “Versioned ABI and artifact contract” identity/resource/canonical JSON paragraphs; CABI00/01/03 | Audit target P01–P06 digest/profile compatibility, source maps after optimization, duplicate JSON keys, canonical large integers, incompatible schemas and imported artifacts. Existing target string does not alone prove complete profile binding. Test assigned-instruction/push round trips, independent invalid schema cases, non-number amounts and bool/int confusion. These are acceptance gaps until measured, not demonstrated import vulnerabilities. | artifact*.schema.json, src/{bindings,call-runtime,transaction-runtime}.ts, Python generated runtimes; new artifact corpus, coordinated with offline bundle schema |
| Issue21 research note | “Spec feedback from executable contracts”; C22 no dynamic execution; current helper inlining boundary | Write an offline research note identifying motivating source examples, existing inlining expansion/byte costs and bounded alternative designs with unchanged P03 baseline. Retain exact bytes/profile/charge observations; classify compiler limitation versus ambiguous rule versus proposed protocol change. No issue21 lowering or OP_DEFINE/OP_INVOKE emitted bytes. | new docs/plans/lotus-v2-issue21-research.md only |
Ordered mailbox review ledger
Reviewed the maintained manifest in numeric order, not the other historical files beside it. The ledger records topic and residual review scope; it is not 57 independent behavioral approvals. Earlier topics must be evaluated after later amendments (especially 019, 031/035, 033, 048/049, 055/056).
| Patch | Review disposition and remaining boundary |
|---|---|
| 000 decouple avalanche consensus | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 001 nlogn block construction | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 002 remove chaintx limit | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 003 remove ecash activations and enforce from genesis | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 004 remove legacy daa and set 120s blocktime | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 005 chain identity | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 006 miner test fixtures | Inherited ABC development changes; not V2 wire/header acceptance; D01. |
| 007 isolated header primitives | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 008 output codec | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 009 add v2 commitment primitives | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 010 add v2 sparse state and coin bound | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 011 add v2 transaction framing | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 012 complete v2 input identity bytes | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 013 add v2 signing hash domains | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 014 add v2 identity and signing | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 015 bound indexed proof count | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 016 bound witness arguments | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 017 prepare signing context | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 018 incremental utxo tree | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 019 safe utxo leaf collapse | Isolated codec/hash/state/signing primitives; complete acceptance requires B02/V02. |
| 020 bounded vm core | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 021 vm differential corpus | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 022 vm invocation context | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 023 static vm accounting | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 024 composed invocation cap | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 025 vm signing cache and stack | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 026 vm byte numeric operations | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 027 vm independent arithmetic oracle | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 028 ordinary transaction validation | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 029 monetary arithmetic | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 030 vm context and merkle proofs | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 031 validate field size hints | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 032 ordinary compiler token merge | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 033 wide arithmetic and checkdatasig | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 034 connect ordinary block | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 035 derive p05 field sizes | VM/static-cost/ordinary slice; independent context/cost coverage V01–V03 and M01. |
| 036 development genesis | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 037 child header template | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 038 header nonce search | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 039 file backed utxo store | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 040 two commit spend test | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 041 failing script rollback | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 042 header parser boundary | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 043 seal child header | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 044 link field size harness | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 045 ordered transaction root | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 046 persistent monetary snapshot | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 047 checksig ordinary connect | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 048 per tx utxo commit | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 049 monetary connect snapshot | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 050 pin development genesis root | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 051 reopen utxo monetary stores | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 052 persistent header snapshot | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 053 store sealed header | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 054 two sealed headers | Development genesis/header/persistence composition; B01–B02, H01–H03, S01 remain. |
| 055 genesis anchored asert candidate | Standalone caller-parameter ASERT; H01 integration remains. |
| 056 development coinbase | Development coinbase inserted; missing-coinbase return and complete accounting B01/M01 remain. |
Specific ordered-review mistakes and qualifications: 002 changes only src/test/mempool_tests.cpp, so its “Remove inherited chain-transaction limit” subject is not evidence of a new production removal at this pin. 019 repairs leaf-collapse ownership after 018; audit final code rather than rediscovering the superseded state. 031 validates hints and 035 derives authenticated field bounds; old hint concerns require new reproducers. 033 adds wide arithmetic/CHECKDATASIG and its binary vector corpus; the old “six unsupported opcodes” summary is stale for native code. 044 supplies missing harness linkage. 045 improves ordered commitment construction but still takes caller projections. 048 commits per transaction and 049 snapshots monetary state; neither creates cross-store atomicity. 050/051/053/054 strengthen deterministic genesis/reopen/two-header evidence without proving durable reorg/crash consistency. 055 is not called by acceptance. 056's CoinbasePlacement comment promises missing-coinbase rejection but its final return does not implement it.
Disjoint implementation ownership and merge gates
- Header/PoW packet: only
src/lotus_v2/{header,asert_candidate,block_template,block_seal}.{cpp,h}, newheader_context.{cpp,h}, their direct tests andasert_test/, plus Pythonasert.pyand dedicated new header-context tests. Supply explicit history/profile API. Do not editblock.cpp, monetary or VM files. - Monetary/block/Python packet: only
src/lotus_v2/{block,monetary,tx_root_seal}.{cpp,h}, newblock_wire.*,block_cost.*, their direct tests andblock_test/; Python{block,block_seal,monetary,dev_genesis}.pyand their tests. Consume header-context API after review. No header/VM edits. Python reference VM remains with VM packet. - VM/signing packet: only
src/lotus_v2/{vm.cpp,vm.h,vm_cost.inc,field_size.cpp,field_size.h,signing.cpp,signing.h,ordinary_validation.cpp,ordinary_validation.h}, direct VM/signing/ordinary tests andvm_test/; Python{vm,vm_context,vm_cost,vm_runner,signing}.pyand their direct tests. Runner signing-context export must land before full native CABI08 claims. - Later daemon integration packet: only after isolated acceptance gates:
src/{validation.cpp,validation.h,chain.cpp,chain.h,init.cpp,net_processing.cpp},src/primitives/{block,transaction}.*,src/node/miner.*,src/kernel/chainparams.cpp, RPC/functional builders, new chainstate coordinator,persistent_{utxo,monetary,header}.*and persistence tests. Wire complete validator, header index/chainwork, atomic durable connect/disconnect, mining job/submission and migration intent inventory. No mainnet parameters during current work. Runtime peering is later work gated by the separately authorized peering specification; live port bindings remain protected. Chronik has no owner in this scope.
Shared CMakeLists.txt, daemon/patches/v2/series, mailbox exports/provenance, opcode registry/profile updates and acceptance fixture generation are root integration only, sequential after reviewed source packets. Workers propose exact new target/dependency lines instead of racing on shared build/manifest files. Changes to frozen-registry interpretation or open decisions require explicit spec review; normal implementation repair does not silently redefine them.
Compiler packets above have disjoint paths except artifact/bundle interfaces; settle their schema first, then integrate consumers. Examples do not edit frontend/optimizer/runtime. Optimizer does not edit generic frontend. Harness consumes engine protocols rather than modifying engines concurrently. Research note does not emit code.
Release gates: exact mailbox replay including intermediate provenance and final-tree comparison; Release/Debug targeted native suites; independent Python corpus; complete-block negative mutations and exact charges/roots; durable restart/reorg fault tests; then disposable daemon acceptance with no production state. Report application/build/module tests/daemon acceptance separately. This audit itself reran no behavioral suites and makes no performance claim.
Root verification evidence supplied after initial audit: all 57 intermediate replay trees match ancestors of integrated replay eadd2b5293f722dfca80237f3ea44c3c784cdf92; final tree matches 9a3e3e57aa6ee0c0430144ee1200ab9cbe48f6e7. Evidence: /private/tmp/lotus-v2-audit-replay-20261015.json. Mailbox From commits can identify pre-integration sources (including 030), so compare against integrated replay provenance rather than assuming those original trees are final intermediate trees. Root reports Python reference 78 tests and compiler 99/99 tests passing without skips in its isolated venv; this audit did not rerun those suites. Native signed CABI08 execution remains unperformed.
Detailed source review follow-up: 000–019
Reviewed final source in fresh isolated replay /private/tmp/lotus-v2-audit-replay-20261015, using the ordered patches to identify ownership. The following are inspected invariants and concrete integration hazards, not additional test runs.
| Patch | Source-level review result |
|---|---|
| 000 | Removes rejected/invalid Avalanche vote parking, the finalized-fork parking check in FindMostWorkChain, and ConnectTip's four parking policies. AvalancheFinalizeBlock still records/signals a finalized index. That is coordination metadata, not proof that every downstream finalization consumer is harmless. D11 mapping must deliberately restore optional payout-policy evaluation against adjusted entitlement; do not describe this deletion as payout integration. |
| 001 | Snapshot derives counts from unique direct-parent sets, uses salted TxId lookup, and releases a child only after successful AddToBlock; rejected/nonfitting ancestors cannot release descendants. Demonstrated later-integration hazard: CreateNewBlock subsequently sorts ordinary selected transactions by TxId (src/node/miner.cpp around147), and shouldAddFinalizedTxs can choose the separate radix/finalized path. C12 requires sequential evolving-UTXO evaluation, so importing this assembler as V2 mining does not preserve its dependency order. V2 integration must review both paths and emit parent-before-child body order; this is not a failure of the current isolated connector. |
| 002 | Mailbox changes only mempool tests. This pin already lacks the old production mechanism that its historical topic name suggests removing; retain exact-base evidence rather than counting it as new executable policy implementation. |
| 003 | Deliberately removes inherited activation dispatch and hardens inherited ABC rules from genesis. The resulting src/validation.cpp still calls ABC CheckProofOfWork(block.GetHash(),...), and the inherited block/transaction structures remain active. Native V2 primitives do not replace those paths. Deletions of legacy tests are history-bound migration, not C28 conformance evidence. |
| 004 | Removes DAA/EDA/Grasberg and updates inherited spacing/RTT fixtures. This does not select P04's new fixed-genesis ASERT anchor; 055 owns that standalone candidate. Do not infer a frozen half-life or production V2 network from inherited120s settings. |
| 005 | Brands daemon/client and dependencies while preserving upstream development version. Branding cannot establish a V2 chain identity: existing inherited chainparams are still distinct from the all-zero development fixture ChainID. |
| 006 | Repairs inherited regtest mining fixtures for from-genesis cleanstack/CTOR/BIP68. Inherited CTOR expectations must be explicitly migrated for C12 ordered V2 blocks, not mechanically reused as required V2 ordering. |
| 007 | Header codec writes offsets 0/32/36/42/50/54/62/70/102 and exactly134 bytes; time is six-byte bounded before hashing/serialization. Header parser checks nonnull pointer and exact size. Target decode rejects sign, zero, out-of-range significant bytes, noncanonical re-encoding and powLimit overflow; comparison is unsigned little-endian and inclusive. Version/context/PoW acceptance intentionally remains outside parser. No demonstrated target/offset defect found in this read. |
| 008 | Output codec checks flags0xfc, nonzero token ID only when present, pairwise distinct branch roots, spendable nonempty paths, burn empty paths, in-range strictly increasing indices and strict lexicographic path order. Count checks precede reserves; division bounds branch bytes before multiplication. Encode and decode both enforce812-byte maximum. No demonstrated policy-canonicality bypass found. |
| 009 | Branch nodes sort unsigned little-endian hashes; branch leaf includes type0 plus Bytes(script). Indexed nodes include type1 and layeru16, pad odd layers with zero, and singleton root is the leaf. Ordered transaction root binds countu32 and preserves (TxHash,TxID) order with largest-power split. These trees have distinct domains and cannot be interchanged by a compliant caller. APIs accepting projections still need authenticated complete-block callers (B02). |
| 010 | Coin serializer validates output and rejects burns before forming bounded868-byte record. Leaf binds outpoint-key plus Bytes(Coin); state envelope includes type0, ChainID, height, UtxoRoot, length56 and exact monetary bytes. Reference vector set rejects duplicate outpoints/keys before recursive root building. VerifyCoinProof checks presence/coin consistency, bitmap popcount, bottom-up sibling length, explicit empty sibling rejection, and OtherLeaf shared prefix. No demonstrated absence-proof forgery found; trusted root provenance remains external. |
| 011 | Tx reader bounds fixedu16 counts before reserve, caps script/proof/argument reads, requires shortest CompactSize, and checks exact consumption. It re-encodes parsed structure to validate flag-dependent input invariants, packed lock kind, consuming ordinary input and native-only nonempty-output coinbase. Unknown versions/flags reject. Output count uses a conservative43-byte minimum; it is not an overrestriction for valid outputs. |
| 012 | Core input preserves entire outpoint/sequence/flags, path index, scripts and siblings; omits only spend/mint arguments. Coinbase data remains in both core/full encodings. P01 explicitly prohibits repeated (prev_txid,prev_index) pairs whatever flags, so the encoder's single cross-kind set is intentional, not a spend/mint collision bug. |
| 013 | Domain registry uses exact ASCII Lotus/v2/... tags followed by one zero byte under unkeyed BLAKE3, not keyed hash or BIP340 challenge substitution. Sighash/owninput domains are distinct from identities. Unknown internal enum abort is not a wire extension behavior. |
| 014 | ComputeIdentities validates full transaction encoding before constructing fixed112-byte identity preimages. ComputeCoinsRoot uses CoinEntryLeaf(empty) for mint and serialized resolved Output for spend, as P01 specifies. Spend selector uses input index and actual branch index, not witness position; mint includes tokenID/deltau128/leaf. CHECKSIG encoding helper rejects explicit00 mode byte, bad lengths/mode and invalid x-only keys; well-framed cryptographic failure is distinct. Signature helper assumes caller supplied digest, so digest authentication remains enclosing-validator responsibility. |
| 015 | Indexed proof rejects count0, index≥count, missing/extra siblings and nonzero padding when sibling is beyond odd width. Width update uses division plus odd bit rather than overflowing count+1. Caller profile must bound proof material before construction; this helper is not a framed transaction parser. |
| 016 | Profile rejects argument-byte cap above8192 and full witness encoding checks each argument against chosen cap. Scripts have a separate caller cap. Core-only projection does not serialize arguments; full transaction validation precedes identity/signing preparation, so use that validated entry point for untrusted transaction objects. |
| 017 | Prepared context caches roots/own-input hashes and binds positional witness count, path index, branch membership and exact leaf. Repeated signing hashes only fixed138/150/178-byte preimages; mint requires positive delta and FULL, SINGLE absent output rejects. Resolved Output and positive delta are external assertions at this API; ordinary validator must derive them from immutable resolved coins/accounting. API does not authenticate confirmation metadata, consistent with exclusion from sighash. |
| 018 | Incremental insertion validates leaf before mutation, rejects equal keys, and allocates new branch path before moving existing leaf. Child counts drive collapse; proof ancestors are emitted bottom-up. Linear reference UTXO implementation and incremental implementation share hash helpers, so their agreement alone is not independent hash-domain evidence. |
| 019 | Collapse moves surviving child to a local unique_ptr before overwriting parent ownership, avoiding destroying the source while moving from it. This fixes a historical ownership bug; do not report the pre019 form as current behavior. |
New actionable integration item I01: later daemon mining owner must remove inherited CTOR sorting for V2 bodies and review finalized selection ordering against C12/C26. Required regression: two valid same-block transactions whose child TxID sorts before its parent, executed from the generated mining body, plus the alternative finalized-selection path. Current primitive tests do not cover this integration. No new source defect in007–019 is asserted without a failing reproducer.
Additional actionable source findings after foundation review
V04 — repeated whole-transaction preparation (demonstrated source complexity, no timing claim). P01 “Exact CHECKSIG message”, paragraph beginning “Every SigMessage preimage”, requires the transaction/coin commitments to be computed in strictly linear transaction-plus-resolved-coin bytes, followed by constant-size per-signature hashing. In final src/lotus_v2/vm.cpp around1586–1614, every contextual EvaluateVmCharged creates a new PreparedSigningContext and calls PrepareSigningContext before success scanning. ordinary_validation.cpp invokes that entry point for every input witness. Preparation traverses/encodes the full transaction, computes all identities/coin roots/own-input hashes and verifies every input's memberships. For n constant-size spending inputs with one trivial witness each, whole-transaction work is repeated n times, producing quadratic preparation work before any signature opcode. ApplyDerivedFieldSizes additionally traverses all coins/outputs per invocation. Existing caching only reuses preparation for opcodes within one invocation; it does not establish transaction-wide linear preparation. The connector preview plus ApplyOrdinaryCandidate repeats ordinary validation again, multiplying this work without changing its asymptotic form.
VM/signing owner: authenticate a reusable immutable prepared transaction context once at the ordinary validator boundary, including commitments/memberships/field-size vectors, then bind each invocation without recomputing unrelated inputs. Preserve direct standalone API authentication and stale-context rejection. Add an instrumented work-count regression across increasing input/branch counts and repeated CHECKSIG/SIGHASH; independently preserve both signature correctness and P05 charges. A host-time benchmark can supplement a deterministic counted-work test. Do not fix this by bypassing outer membership on OP_SUCCESS or merely caching one signature within an invocation. Finding sent to root and VM owner before implementation.
S02 — header store rejects complete block size (demonstrated restriction). P04 “Concrete recursive candidate” defines header size as exact complete encoded block length including header, count and transaction frames. persistent_header.cpp DecodeHeaderBytes around106 and Commit around464 reject header.size != HEADER_SIZE, i.e. anything other than134. The store format stores134 header bytes, but that is different from the header's declared full-block size. Therefore the existing store cannot persist a header for a real nonempty complete block. Later durable/daemon integration owns adapting semantic validation while retaining fixed134-byte header framing, and a store/reopen fixture with a valid full-block size greater than134. Existing header-only fixtures must remain explicitly scoped. Finding sent to root and header owner.
H04 — ASERT caller-profile validation (demonstrated API permissiveness; repair underway elsewhere). 055 validates positive half-life and bounded target/powLimit, but does not reject nonpositive spacing or genesis target above powLimit. These are not failures of ASERT arithmetic under a valid profile. Contextual profile must require positive spacing and a canonical accepted genesis target. Root reports the header owner has already added these validations in its separate candidate; this audit changes no source and does not count the pending candidate as merged evidence.
M03 — token units counted as native explicit burn (demonstrated arithmetic path). In029 monetary.cpp, AccountValidatedOrdinary unconditionally adds every output value to total_outputs, and every IsBurn value to explicit_burn, including outputs with HasToken. It reconstructs native_inputs = effects.native_fee + total_outputs, so fee subtraction still yields the expected native fee; fee-only tests can miss the error. AdvanceMonetary subsequently subtracts the supplied explicit_native_burn from spendable_supply_delta, so burning q token units spuriously subtracts q native atoms. This contradicts C04's asset distinction, C14's separate native/token sums and P05/P06 native monetary accounting. Monetary owner must derive native aggregates only from outputs without HasToken; test a signed/validated mixed transaction with a token-burn output and assert adapter native fields plus native supply delta against independently resolved coins. Reported immediately to root/monetary owner. No runtime execution or measured impact asserted by this source audit.
Detailed source review follow-up: 020–056
| Patch topic | Inspected invariant or concrete remaining issue |
|---|---|
| 020 bounded VM core | Framing/argument/stack caps precede execution, success scan is instruction-boundary based and structured decoding precedes ordinary execution. Active context authentication precedes success scan, preserving membership checks, but its repeated whole-transaction preparation is V04. |
| 021 differential corpus | Harness explicitly avoids contextual opcodes and P05-only rejection; it compares a limited deterministic Python/native corpus. This supports core semantics, not all assigned-byte/context/charge conformance. |
| 022 invocation context | Ordinary validation derives mint positive delta from token totals and supplies immutable resolved outputs; injected mint delta is bounded as positive int128 by VM. Caller-supplied standalone contexts remain assertions until authenticated by the enclosing transaction validator. |
| 023 static accounting | Size pass tracks stack bounds, falls back to conservative Unknown shapes, includes maximum conditional branch and full loop bound. That is VM charge only; complete outer commitments/proofs/state costs are M01. |
| 024 composed cap | Ordinary/block aggregation uses checked u128 addition and rejects cost exceeding supplied cap. Equal cap is accepted. A cap on VM sums does not replace full P05 accounting. |
| 025 signing cache/stack | Machine reuses prepared signing data and signature verification cache during one invocation. It does not prevent transaction-sized context preparation for every separate branch (V04). |
| 026 numeric/bytes | Native int128 decoder requires exact16 bytes, Boolean accepts only0/1, and arithmetic implementations preserve explicit signed bounds. No Bitcoin ScriptNum conversion is authorized. Wide limbs require separate unsigned encoding semantics. |
| 027 independent arithmetic oracle | Oracle distinguishes independent arithmetic expected values from shared hash/codec services. Generated arithmetic coverage does not prove full transaction/block resource enforcement. |
| 028 ordinary transactions | Checks framing, resolved Coin well-formedness, maturity/locks, native conservation, positive-delta mint coverage, all witness branches and occupied outpoints; stages effects and applies via copy/swap. No block-wide TxID set is supplied by this API. |
| 029 monetary arithmetic | Bootstrap recurrence stops at reserve0, uses max1 for positive reserve; tail uses bounded384-bit numerator and integer square root; next EMA checks u64 width. Work is a caller integer, not derived accepted child work. Native output adapter mixes token units into native explicit burns: M03. |
| 030 context/Merkle | Tree opcode cost pass adds bounded per-step costs using selector-specific tagged/untagged preimage lengths. Unknown selector charge uses maximum across four configured profiles, appropriate for arbitrary draft schedules; old complaint alone is not a proved surviving undercharge. |
| 031 hint validation | Caller size hints cannot understate authenticated field sizes. Larger hints remain and overcharge; hint rejection is input-profile validation, not a new consensus state rule. |
| 032 compiler merge fixture | Tests actual emitted token merge witnesses in ordinary validation. Compiler fixture import is not independent generation of those scripts; retain hand-assembled policy negatives. |
| 033 wide arithmetic/CHECKDATASIG | Assigned native coverage now includes prior missing wide/data-signature operations; preserve binary CSV exactly. Opcode inventory is implementation status, not proof every selector/key/message/cost edge is covered independently. |
| 034 ordinary connect | Applies transaction order against evolving view, records reverse undo and monetary predecessor. Parent timestamp substitution H02 and missing complete-block framing B02 remain. Disconnection mutates incrementally and is intended for trusted internal undo, not arbitrary untrusted undo objects. |
| 035 field-size derivation | Encodes actual outputs/coins for exact record bounds, aggregates path-slot maximum across all fields and authenticates hints. This work is repeated per invocation (V04). |
| 036 development genesis | Isolated all-zero ChainID and explicit test monetary profile; no production genesis selection. A known state root commits the chosen test state, not arbitrary snapshot trust. |
| 037 child template | Copies parent version, supplied roots/time/size/bits and computes parent BlockID/height with overflow checks. Canonical target ceiling alone does not check chain powLimit or required ASERT target. |
| 038 nonce search | Bounded256 attempts, rejects excessive requests before hashing and avoids nonce wrapping. Searches a caller target; accepted chain target equality belongs to contextual validator. |
| 039 UTXO file store | Canonical bounded Coin decode is re-encoded and compared; record/checksum/root validation protects corruption detection. Filesystem checksum is not a consensus/authenticated snapshot authority. Cross-store atomicity remains S01. |
| 040 two-commit test | Adds parent-output spend across successive store commits; it does not establish one complete-block transaction, crash recovery or durable reorg. |
| 041 rollback test | Script failure demonstrates same-process rollback path. Crash between independent renames remains separate evidence requirement. |
| 042 parser boundary | Exact134-byte header boundary checks do not validate declared complete-body size or accepted context. |
| 043 seal child | StateRoot binds connected UTXO/monetary at derived height; caller tx_root/size/bits are copied. Must be compared against actual accepted body by B02. |
| 044 field harness link | Repairs test linkage, adding no consensus behavior. |
| 045 ordered root | Computes count-bound ordered root from supplied header/core/full/output projections. Projection authentication against exact accepted transaction bytes is still caller obligation. |
| 046 monetary store | Stores caller state_root; API explicitly does not recompute StateRoot. Cross-store generation matching and trusted profile validation belong to coordinator. |
| 047 CHECKSIG connect | Signed fixture exercises VM in connector. It does not equip generic native argv runner with signing context or prove all partial/mint signing modes. |
| 048 per-tx commits | Allows same-block child spends across separate durable commits. Failure rollback invokes store undo then in-memory undo; failed store undo is reported but cannot magically restore durable consistency. |
| 049 monetary connect snapshot | Final monetary write occurs after UTXO writes; callback failure attempts reverse UTXO commits. Process-crash atomicity remains absent. |
| 050 fixed genesis root | Hardcoded expected root protects fixture drift. Changing profile/encoding requires explicit expected-vector review, not routine regeneration. |
| 051 reopen stores | Reopens matching UTXO/monetary snapshots and compares state; no injected interrupted generation demonstrates crash atomicity. |
| 052 header store | Fixed134-byte header framing is correct; requiring header.size==134 is complete-block restriction S02. Header checksum/BlockID verification is not PoW or body acceptance. |
| 053 sealed header store | Demonstrates separately sealed header persisted with matching fixture state; three independent stores still lack one committed-tip protocol. |
| 054 two sealed headers | Extends fixture lineage/reopen coverage; no fork-choice/durable disconnect/crash gate established. |
| 055 ASERT | Uses signed wide drift, truncating exponent then floor quotient decomposition, bounded huge-shift saturation and canonical compact encoding. Nonpositive spacing/profile mismatch permissiveness H04 is separately being repaired. |
| 056 development coinbase | Checks coinbase parent/derived-u32 height, native outputs and burn pruning, marks created Coin coinbase and charges coinbase bytes in monetary adapter. Placement helper still returns true without any coinbase (B01); accepted child work/full framing/cost integration remain absent. |
This follow-up establishes reviewed code paths, not independent behavioral approval for every patch. Potential exception/allocation-failure behavior and adversarial filesystem concurrency have not been tested here; do not describe them as discovered acceptance defects. Current repair branches require separate before/after tests and exact mailbox replay evidence.