mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
The G-Chain VM declared chain.ChainVM but stubbed the block methods: GetBlock/ParseBlock returned errNotImplemented, LastAccepted returned the unset preferredID (ids.Empty), and Block.Status() returned choices.Status (not the uint8 the block.Block interface requires, so *Block never satisfied the interface). At boot the ZAP VM server (vm/rpc/vm_server_zap.go handleInitialize) calls LastAccepted() then GetBlock(lastAccepted); the GetBlock stub produced 'get last accepted block: not implemented', failing G-Chain initialization and the lux-mainnet node health check. The G-Chain is a read-only query/index VM that never advances past genesis, but consensus still requires a resolvable last-accepted block. Build a deterministic genesis block (height 0, content-addressed ID = SHA-256 of its canonical encoding) in Initialize, pin it as lastAccepted, and serve it from GetBlock/ParseBlock/GetBlockIDAtHeight. Fix Status() to return uint8 and add the var _ block.Block compile assertion so this can't regress. Tests reproduce the exact handleInitialize sequence plus byte/ID round-trip and cross-validator determinism.