Skip to content

Genesis::validate accepts a malformed eth_genesis_hash, so a genesis the loader accepts panics the node at startup #464

Description

@erkancamli

Genesis::validate (types/src/genesis.rs) checks every other genesis field but never eth_genesis_hash. Genesis::genesis_hash reads it with a double expect and documents it as "validated at load time", so a genesis with, for example, eth_genesis_hash = "0xdead" loads cleanly and the node panics at startup (bad eth_genesis_hash).

This contradicts three contracts the repo states:

  • sendGenesis validates and atomically installs the file so startup does not risk "a crash loop", yet it installs this one and the node crash-loops on it.
  • summit genesis digest says "anything this accepts a validator accepts", yet it prints a digest for this file.
  • summit genesis set-validators re-parses its output to avoid "emitting a genesis no node can load", but copies the hash through unchecked.

Repro: load example_genesis.toml, set eth_genesis_hash = "0xdead", call validate(): it returns Ok, and genesis_hash() then panics.

Fix: reject a non-hex or non-32-byte value in validate, next to the existing treasury_address check. I have this ready with regression tests: they fail on main and pass with the fix, and summit-types (479), summit-rpc (22) and summit --lib (83) are green. Since external contributors can keep one PR open at a time, I'll open it once one of #458 / #460 / #461 is resolved, or sooner if you'd prefer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions