Summary
scripts/genesis/ValidatorManager.ts types a validator publicKey as schemaHex — any 0x plus an even number of hex digits — while the chain only accepts 32-byte keys:
// contracts/src/validator-manager/ValidatorRegistry.sol
require(publicKey.length == ED25519_PUBLIC_KEY_LENGTH, InvalidPublicKeyFormat());
The 32-byte rule exists in the genesis tooling only as a throw new Error('Public key must be 32 bytes') inside buildValidatorManagerGenesisAllocs. genesis.ts parses the whole config with schemaGenesisConfig.parse first (line 161) and builds later (line 188), so a 31-byte key passes validation, passes the public-key uniqueness check, and only fails afterwards with an error that names no path.
Steps to reproduce
import { schemaValidatorManager } from './scripts/genesis/ValidatorManager'
schemaValidatorManager.safeParse({ ...validConfig, validators: [{ publicKey: `0x${'11'.repeat(31)}`, votingPower: 20n, controllers: [...] }] })
// => success: true (expected: false, path validators.0.publicKey)
Expected behavior
The schema rejects any publicKey that is not exactly 32 bytes, with a path, the same way #359 moved the consensus-timeout and base-fee range checks into the schema. schemaBytes32 already exists in scripts/genesis/types.ts and is exactly {32} bytes.
Every key in assets/*/genesis.config.ts is already 64 hex characters, so no shipped config changes.
Related
#346, #359 (same class: genesis schema aligned with a runtime check). Does not overlap #374, which normalizes hex casing and leaves the field type alone.
I have a fix ready in #401 and would like to be assigned.
Summary
scripts/genesis/ValidatorManager.tstypes a validatorpublicKeyasschemaHex— any0xplus an even number of hex digits — while the chain only accepts 32-byte keys:The 32-byte rule exists in the genesis tooling only as a
throw new Error('Public key must be 32 bytes')insidebuildValidatorManagerGenesisAllocs.genesis.tsparses the whole config withschemaGenesisConfig.parsefirst (line 161) and builds later (line 188), so a 31-byte key passes validation, passes the public-key uniqueness check, and only fails afterwards with an error that names no path.Steps to reproduce
Expected behavior
The schema rejects any
publicKeythat is not exactly 32 bytes, with a path, the same way #359 moved the consensus-timeout and base-fee range checks into the schema.schemaBytes32already exists inscripts/genesis/types.tsand is exactly{32}bytes.Every key in
assets/*/genesis.config.tsis already 64 hex characters, so no shipped config changes.Related
#346, #359 (same class: genesis schema aligned with a runtime check). Does not overlap #374, which normalizes hex casing and leaves the field type alone.
I have a fix ready in #401 and would like to be assigned.