Documentation
¶
Overview ¶
Built-in FEVM warm-set (lantern#69).
The prefetcher warms whatever contract addresses its consumer injects via Config.Addrs. curio-core injects the PDP contract set; stock upstream Curio injects nothing, so without a built-in default its Settle / provider-lookup eth_calls local-miss and fall back to the bridge ("FEVM method requires --vm-bridge-rpc"). To keep the zero-Glif read path working for any Lotus-API consumer, Lantern ships a small, stable, per-network default set of the well-known Filecoin PDP contracts and merges it with the consumer-supplied addresses.
The list is deliberately tiny and matches curio-core's cmd/curio-core/fevm_prefetch.go set. Addresses are the deployed proxies (storage is read through the proxy), sourced from filecoin-project/curio pdp/contract/addresses.go.
FEVM contract state prefetcher (lantern#44).
On every chain head advance the prefetcher walks a configured set of EVM contract addresses and pulls their bytecode + storage-trie nodes into the local blockstore cache. The goal is "block availability for local eth_call": when curio-core (or filcensus) reads a contract shortly after a head advance, the read should hit the cache rather than fall back to Bitswap (or, with --vm-bridge-rpc-disable, fail).
This is a best-effort warming step. It must NEVER block the head-advance path, NEVER affect the proof loop, and NEVER replace the authoritative read path (kamt.Get still does the cryptographic descent + verification on every eth_call).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuiltinWarmSet ¶
BuiltinWarmSet returns Lantern's built-in FEVM prefetch warm-set for the given network name ("mainnet" or "calibration"; case-insensitive, "calibnet" accepted as an alias). Unknown networks (devnet, "") return nil — those contract addresses aren't fixed and must come from the consumer via Config.Addrs.
The returned slice is a fresh copy the caller may mutate.
func MergeWarmSets ¶
MergeWarmSets returns the union of two address lists, de-duplicated by canonical (lowercase, 0x-stripped) form, preserving first-seen order. Unparseable entries are kept verbatim (the prefetcher logs+skips them later) so this function never silently drops a consumer's input.
Types ¶
type Config ¶
type Config struct {
// Addrs is the list of 20-byte hex eth addresses to prefetch.
// Strings are accepted in 0x-prefixed or bare form. Anything that
// fails to parse is logged once and skipped.
Addrs []string
// MaxBlocksPerAddr caps the BFS node-count per address per run.
// Default 256 (covers PDPVerifier + similar proxy-impl contracts
// at their current depth with margin). 0 -> use default.
MaxBlocksPerAddr int
// PerAddrTimeout bounds one address's walk. Default 20s.
PerAddrTimeout time.Duration
// MinInterval coalesces rapid head advances: prefetch runs at most
// once per MinInterval per address. Default 60s. 0 disables
// coalescing (run every head advance).
MinInterval time.Duration
}
Config controls a Prefetcher.
type Pinner ¶
Pinner pins CIDs in the persistent block cache so they are never LRU-evicted. Satisfied by *state/cache.Store. Optional: nil on the memory-cached light node.
type Prefetcher ¶
type Prefetcher struct {
// contains filtered or unexported fields
}
Prefetcher walks contract state subtrees through a BlockGetter on every Trigger() call.
func New ¶
func New(cfg Config, bg hamt.BlockGetter) *Prefetcher
New constructs a Prefetcher. bg must be a cache-fronted BlockGetter (typically the combined fetcher) so walks actually populate the cache.
func (*Prefetcher) AddAddr ¶
func (p *Prefetcher) AddAddr(raw string)
AddAddr registers a contract address discovered at runtime (typically from an eth_call local miss) so the prefetcher warms its state subtree on the next head advance. Idempotent, thread-safe, cheap, and bounded by maxDynAddrs. Unparseable input is ignored. This is the seam curio-core wires to ChainAPI.OnLocalMiss for self-expanding read-path coverage (lantern#44).
func (*Prefetcher) SetPinner ¶
func (p *Prefetcher) SetPinner(pn Pinner)
SetPinner attaches a persistent-cache Pinner (PDP tier). When set, the walked nodes of STATIC configured contracts are pinned so the warm set survives restart un-evicted. Call once at wiring time before Trigger.
func (*Prefetcher) Stats ¶
func (p *Prefetcher) Stats() Stats
Stats returns a snapshot of prefetcher counters.