mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
Wires StateLoadFromLazy into the resident applier so the C-Chain, on restart, resumes cevm from a persisted checkpoint (bounded-RAM lazy load) instead of dumping the full Go state into cevm — the "own disk-backed state" evolution the seed-cap comment names. Removes the post-restart declined-too-large seed dump. - core/parallel/cevm_resident_store.go: SetCevmResidentStore(db) (the VM registers a durable KV; nil = off, unchanged behavior). tryLazyLoadCheckpoint pages the account trie from disk via cevmbridge.StateLoadFromLazy and sets the resident to the checkpoint height; persistCheckpoint writes StatePersist records + the height at a bounded cadence (default 4096 blocks). - cevm_shadow.go: getResident tries the checkpoint before a fresh handle; persistCheckpoint runs after a block's cevm root is VERIFIED against the header. - plugin/evm: CevmResidentStore config flag (default false) → registers a "cevmstate"- prefixed sub-DB before chain init. - cevmbridge/bridge_stub.go: StateLoadFromLazy no-op for the non-cevm build. Safe by construction + triple-gated: nothing runs unless built -tags cevm, the VM registered a store, AND a checkpoint exists; and the applier still verifies EVERY cevm root against the header, so a stale/wrong checkpoint only forces a resync (a Go-dump seed next block), never a wrong commit. nil store (the default) is the prior in-memory, seed-from-Go behavior byte-for-byte. Proof (cevm_resident_store_cevm_test.go, //go:build cevm): seed + apply a block, persistCheckpoint, simulate restart (free handles, retain store), getResident LAZY-LOADS the checkpoint (height + root recovered, no Go dump), then the next block applies to a byte-identical FULL root vs a full-reseed reference. Full parallel cevm suite green; default (non-cevm) plugin build unchanged. Co-authored-by: Hanzo Dev <[email protected]>