netparams

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package netparams makes ShadowLedger self-tuning: the erasure parameters (K data / M parity shards) and the shard replication factor are derived from the LIVE node count, not pinned in any config file. The network decides.

The block producer stamps the chosen ShardSpec into each block header, so the rest of the network simply reads it — no agreement protocol needed for the erasure shape. Replication is a placement policy each node computes locally from its current view of membership (eventually consistent under churn).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenesisSpec

func GenesisSpec() types.ShardSpec

GenesisSpec is a FIXED erasure shape for block 0. Genesis must be identical on every node (so block-1's prev-hash links agree), so it cannot depend on a node's live membership view — it uses a constant shape regardless of n.

func Replication

func Replication(n int) int

Replication chooses how many holders each shard gets, scaling with the net so shards gain redundancy as more nodes join.

n<3  -> 1   (too few nodes to replicate meaningfully)
n<8  -> 2
else -> 3

func Spec

func Spec(n int) types.ShardSpec

Spec chooses (K, M) for the current network size n (number of known nodes).

Policy: total shards T scales with n (clamped); ~1/3 are parity so the block tolerates losing ~1/3 of the shards (and thus that fraction of holders).

n=1  -> K=2 M=1   (single node holds all 3; self-reconstruct)
n=6  -> K=4 M=2
n=24+-> K=16 M=8

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL