Skip to content

docs: update base layer RFCs (5.1–5.15.6) to match mainnet v5.5.0#191

Merged
SWvheerden merged 10 commits into
tari-project:mainfrom
m4r1m0:docs/update-base-layer-rfcs
Jul 24, 2026
Merged

docs: update base layer RFCs (5.1–5.15.6) to match mainnet v5.5.0#191
SWvheerden merged 10 commits into
tari-project:mainfrom
m4r1m0:docs/update-base-layer-rfcs

Conversation

@m4r1m0

@m4r1m0 m4r1m0 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Updates the base layer RFCs (sections 5.1–5.15.6) to match the current mainnet code (release v5.5.0). Every change is verified against the mainnet branch of tari-project/tari (identical to tag v5.5.0) and cited to file:line in the source.

15 files changed across 10 logical commits (one per RFC cluster). Highlights:

  • Index page (base_layer.md): "two PoW algorithms" → four (RandomXM, Sha3x, RandomXT, Cuckaroo), all active on mainnet, with the 120 s combined target; fixed the miner list (minotari_miner, minotari_merge_mining_proxy).
  • RFC-0120 (Consensus): removed phantom witness_mr; renamed script_kernel_offsettotal_script_offset and validator_sizevalidator_node_size; Output_mmr_sizeOutput_smt_size (sparse Merkle tree / JMT); fixed MTP window (11, not 90), FTL (hardcoded 540, not T*N/20), difficulty T (varies by height: 240/360/480), and the accumulated-difficulty formula (Cuckaroo conditionally included from height 126 000); coinbase extra data 64 → 256 bytes; added pow_data formats for RandomX-T and Cuckaroo.
  • RFC-0131/0132 (Mining): LWMA target 800 s → 480 s; "log-weighted" → "linear weighted"; genesis header version 1 → 0; C29 uses big-endian difficulty; merge-mining hash is Blake2b-256 over 14 header fields; MoneroPowData struct updated (8 fields); MerkleProof has no depth field; serialization is Borsh (not Monero varint); proxy path tari_merge_mining_proxyminotari_merge_mining_proxy.
  • RFC-0160 (Block serialization): varint (Base 128) → Borsh; header table corrected (no witness_mr; added block_output_mr/validator_node_mr/validator_node_size; output_smt_size); PoW algorithm (Monero or SHA3) → four (0–3); hash domains fixed.
  • RFC-0140 (Syncing): chain_metadata types fixed (best_block_hash 256-bit, accumulated_difficulty 512-bit, best_block_height); documented DecideNextSync/state machine; horizon sync direction corrected; "UTXO MMR" → Jellyfish Merkle Tree; reorg bound (max_reorg_depth_allowed) and pruning interval documented.
  • RFC-0170/0172/0173/0174 (Networking): Noise IXXX (+prologue); Network enum (removed Ridcully/Stibbons/Weatherwax/Dibbler, added StageNet/NextNet; LIVENESS_WIRE_MODE 0xa6 → 0xa7); Hamming → XOR/Kademlia distance; addresses use Multiaddr; MessageHeader types fixed; added missing message types (Chat=2, Text=225, TextAck=226); store-and-forward marked removed/legacy; fixed zero nonce (not CSRNG); broadcast strategies corrected; RFC-0174 "Depricated" → "Deprecated" + noted as unimplemented.
  • RFC-0190 (Mempool): sync is bidirectional inventory-based (not a pull); no persistence; reorg handling is local (drain + revalidate, discard double-spends); duplicate-UTXO transactions coexist; fee threshold is min_fee (50 uT); priority is a composite key; reorg expiry is block-height based.
  • RFC-0110/0111 (Base node): weight pseudocode PER_INPUT_GRAMS(9) → 8; removed store-and-forward description; noted UTXO set is a Jellyfish Merkle Tree backed by LMDB.
  • RFC-0182 (Commitment signatures): fixed broken cross-ref RFC-0120_TariScriptRFC-0201_TariScript; status image draft → stable (matches Implemented).
  • RFC-0202 (TariScript opcodes): script max serialised length 1 024 → 512 bytes (consensus-enforced; library hard cap 4 096). Opcode set verified to exactly match the code (all 33 opcodes). Covenants (RFC-0250), stealth addresses (RFC-0203), and hardware transactions (RFC-0205) verified implemented and accurate.
  • SUMMARY.md: fixed "Depricated" → "Deprecated" typo.

RFC-0181 (Bulletproofs+) and the wallets/addresses RFCs (5.7–5.9) were verified accurate against the code and left unchanged.

Motivation and Context

The base layer RFCs had fallen out of sync with the live mainnet code. The most visible example: the base layer index page stated Tari uses "two Proof of Work algorithms" (Monero merge-mining + SHA3x), while the released code defines and enables four (RandomXM, Sha3x, RandomXT, Cuckaroo). Similar staleness affected block header fields, the consensus/difficulty constants, the serialization format, networking protocol details, and the mempool behaviour. This PR brings the documentation in line with the code that mainnet is currently running (v5.5.0), so the RFCs accurately describe the network as it operates today.

How Has This Been Tested?

  • Source verification: every change was checked against the mainnet branch of tari-project/tari (== tag v5.5.0, the live mainnet release), with file:line citations.
  • mdbook build: the book builds cleanly (exit 0) after all changes; no broken links or structure errors.
  • Stale-value sweep: confirmed no leftover witness_mr, 800 seconds, Noise_IX, Hamming distance, Depricated, PROTOCOL_NOT_SUPPORTED, height_of_longest_chain, or 32-bit block-hash references remain in the updated RFCs.
  • No code impact: documentation-only changes.

m4r1m0 added 10 commits July 24, 2026 00:27
- Index page: two PoW algorithms -> four (RandomXM, Sha3x, RandomXT, Cuckaroo)
  with 120s combined target; fix miner list (minotari_miner, minotari_merge_mining_proxy)
- RFC-0131: linear (not log) weighted moving average; LWMA target 800s -> 480s;
  mining hash fields add block_output_mr/validator_node_mr/validator_node_size,
  remove phantom witness_mr; genesis header version 1 -> 0; C29 uses big-endian difficulty
- RFC-0132: four mining algorithms; merge mining hash is Blake2b-256 over 14 header
  fields; MoneroPowData struct updated (8 fields); MerkleProof has no depth field;
  serialization is Borsh (not Monero varint); fix proxy link path
- Block header fields: remove phantom witness_mr, rename script_kernel_offset
  -> total_script_offset and validator_size -> validator_node_size
- Output_mmr_size -> Output_smt_size (sparse Merkle tree / JMT, not MMR)
- block_output_mr construction (coinbase hashes + non-coinbase MMR root)
- coinbase extra data 64 -> 256 bytes
- nonce=0 applies to RandomX-M only (not RandomX-T)
- pow_data formats added for RandomX-T and Cuckaroo; C29 -> Cuckaroo (C29)
- difficulty: T varies by height (240/360/480); ST_max = 6xT (not fixed 2880)
- 'two PoW algorithms' -> four independent algorithms
- FTL hardcoded 540 (T_chain*N/20, not per-algo T*N/20)
- MTP uses median_timestamp_count (11), not difficulty window N
- accumulated difficulty: Cuckaroo conditionally included (height 126000+)
- Specification: varint (Base 128) encoding -> Borsh (fixed little-endian
  with 4-byte LE length prefixes for Vec/array)
- Block field ordering: match Borsh struct declaration order; remove phantom
  witness Merkle root; add block_output_mr, validator_node_mr, validator_node_size;
  rename Output MMR size -> Output SMT size
- Block Header table: same field corrections + reordering
- PoW algorithm description: (Monero or SHA3) -> four algorithms (0-3)
- Hash domains: remove witness MMR; output MMR -> sparse Merkle tree (JMT)
- chain_metadata: height_of_longest_chain -> best_block_height;
  best_block 32-bit -> best_block_hash 256-bit; accumulated_difficulty
  128-bit -> 512-bit
- Add base node state machine states (Starting/DecideNextSync/Waiting/Shutdown)
  and DecideNextSync strategy selection
- Complete sync: block download starts from local best block (not oldest)
- Horizon sync: kernels/UTXOs downloaded forwards (not tip->horizon);
  UTXO MMR -> Jellyfish Merkle Tree; balance equation expanded; finalize step
- Keeping in sync: chain length -> accumulated difficulty; add
  BehindButNotYetLagging thresholds
- Reorg bounded by max_reorg_depth_allowed (10000); pruning gated by
  pruning_interval with background task; archival = pruning_horizon 0
- RFC-0172: Noise IX -> XX (+prologue); add TorTcp/TcpTor/Memory transports;
  bitflags PROTOCOL_NOT_SUPPORTED -> NOT_SUPPORTED; DHT_STORE_FORWARD legacy;
  MessageHeader types (u8->int32, u32->uint64); fix PongPong typo; add
  Chat/Text/TextAck message types; SAF messages deprecated; fixed zero nonce
  (not CSRNG); broadcast strategies (split Direct, remove ClosestNodes)
- RFC-0173: Network enum (remove Ridcully/Stibbons/Weatherwax/Dibbler, add
  StageNet/NextNet); LIVENESS_WIRE_MODE 0xa6 -> 0xa7; wire byte != discriminant
- RFC-0170: Hamming distance -> XOR/Kademlia; address table -> Multiaddr
- RFC-0174: fix 'Depricated' -> 'Deprecated'; note chat metadata never implemented
- Mempool sync is bidirectional inventory-based (initial_sync_num_peers=2,
  initial_sync_max_transactions=10000), not a simple pull; no persistence
- Reorg pool queryable via public interface; reorg handling is local
  (drain+revalidate unconfirmed pool, discard double-spends)
- Reorg expiry is block-height based (expiry_height=5)
- Duplicate-UTXO transactions coexist; resolved at block construction
- Fee threshold is min_fee (50 uT), not min priority
- Priority is a composite key (fee/gram, age, sig tiebreaker)
- Storage capacity only for unconfirmed pool (40000); reorg uses expiry height
- Orphan/dependent transaction support; published block discards conflicts
- Propagation only for UnconfirmedPool-stored transactions
- RFC-0110: fix weight pseudocode PER_INPUT_GRAMS(9) -> 8 (matches table/code)
- RFC-0111: remove store-and-forward description (SAF removed); note UTXO set
  is now a Jellyfish Merkle Tree (JMT) backed by LMDB
- RFC-0181 (Bulletproofs+): verified accurate (Ristretto, BulletProofPlus, 64-bit)
- RFC-0182 (Commitment signatures): fix broken cross-ref RFC-0120_TariScript
  -> RFC-0201_TariScript; status image draft -> stable (matches Implemented)
- Script max serialised length 1024 -> 512 bytes (consensus-enforced;
  TariScript library hard-caps parsing at 4096 bytes)
- Opcode set verified to exactly match code (all 33 opcodes); stack height
  255 confirmed. Covenants (RFC-0250), stealth addresses (RFC-0203) and
  hardware transactions (RFC-0205) verified implemented and accurate
@m4r1m0
m4r1m0 marked this pull request as ready for review July 24, 2026 05:12
@SWvheerden
SWvheerden merged commit dc8a1f2 into tari-project:main Jul 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants