genesis Ed25519 verification — working against live mainnet + preprod

- verify package: ComputeProtocolMessageHash mirrors Rust's BTreeMap-ordered
  SHA256 over key||value concatenation (enum declaration order, not alpha)
- DecodeGenesisVerifyKey unpacks Mithril's 'hex of ASCII [b0,b1,...,b31]'
  wrapping convention; also accepts plain 64-char hex
- Genesis() verifies the Ed25519 signature over the ASCII BYTES of the
  signed_message HEX string (critical subtlety from upstream)
- networks: real genesis vkeys for mainnet + preprod + preview from
  mithril-infra/configuration/*/genesis.vkey
- cmd: 'verify genesis' walks head→genesis chain, verifies the terminal cert;
  'verify head' and 'verify <hash>' also wired; JSON output supported
- exit codes honored: 3 network, 4 integrity, 5 bad sig

verified:
  mainnet  genesis cert 25acfcfe…  epoch 539  Ed25519 ✓
  preprod  genesis cert 69bc3bdf…  epoch 196  Ed25519 ✓

next: STM BLS12-381 aggregate verification (the big one)
This commit is contained in:
Kayos 2026-04-23 15:33:41 -07:00
parent 326d75d91a
commit 97a9434106
3 changed files with 273 additions and 34 deletions

View file

@ -18,12 +18,13 @@ var (
Preprod = Network{
Name: "preprod",
AggregatorURL: "https://aggregator.release-preprod.api.mithril.network/aggregator",
GenesisVerifyKey: "5b3132372c37332c3132342c3136312c31362c38372c3133332c3136372c3135352c3138362c3138372c36372c3231322c37382c3131372c3230352c3234362c35322c35312c31372c3138302c38372c3130342c3139362c3131332c3130332c3239355d", // placeholder — replace with known-good key at implementation time
GenesisVerifyKey: "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d",
}
Preview = Network{
Name: "preview",
AggregatorURL: "https://aggregator.pre-release-preview.api.mithril.network/aggregator",
GenesisVerifyKey: "5b3132372c37332c3132342c3136312c31362c38372c3133332c3136372c3135352c3138362c3138372c36372c3231322c37382c3131372c3230352c3234362c35322c35312c31372c3138302c38372c3130342c3139362c3131332c3130332c3239355d", // placeholder
// Pre-release/preview uses the same genesis key as preprod.
GenesisVerifyKey: "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d",
}
)