cmd/ghash: production genesis block-0 hash verifier (evm/geth-v1.20.1)

Computes core.Genesis.ToBlock().Hash() on the maintained EVM path, replacing
the legacy coreth-based state/cmd verifiers (which no longer build against the
current stack). Used to close the mainnet regenesis launch gate: canonical
genesis/configs/mainnet/cchain.json and the deployed k8s cChainGenesis both
compute 0x3f4fa2a0...ec61e (== RLP block-0), state root 0x2d1cedac.

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-07-17 16:28:53 -07:00
co-authored by Hanzo Dev
parent 5cee788895
commit 93590168d0
+37
View File
@@ -0,0 +1,37 @@
// Command ghash computes the canonical block-0 hash of one or more C-Chain
// genesis JSON files via luxfi/evm core.Genesis.ToBlock — the production path
// (geth v1.20.1), replacing the legacy coreth-based verifier.
package main
import (
"encoding/json"
"fmt"
"os"
"github.com/luxfi/evm/core"
)
func hashOf(path string) (out string) {
defer func() {
if r := recover(); r != nil {
out = fmt.Sprintf("panic: %v", r)
}
}()
data, err := os.ReadFile(path)
if err != nil {
return fmt.Sprintf("read error: %v", err)
}
var g core.Genesis
if err := json.Unmarshal(data, &g); err != nil {
return fmt.Sprintf("unmarshal error: %v", err)
}
b := g.ToBlock()
return fmt.Sprintf("block-0 = %s (allocs=%d ts=0x%x skipPMF=%v)",
b.Hash().Hex(), len(g.Alloc), g.Timestamp, g.SkipPostMergeFields)
}
func main() {
for _, path := range os.Args[1:] {
fmt.Printf("%s\n %s\n", path, hashOf(path))
}
}