espresso-sequencer icon indicating copy to clipboard operation
espresso-sequencer copied to clipboard

Genesis block

Open jbearer opened this issue 1 year ago • 1 comments

We should have a genesis block which identifies the chain and related information, including:

  • Chain ID
  • Fork ID (so the genesis block changes if we reset a testnet)
  • Timestamp?
  • Contract address

I don't think we need any special support from HotShot for this, once we have instance state. Here is how I propose to implement it:

  • Make chain ID, fork ID, contract address, and genesis timestamp command line arguments (can't sample timestamp because we need all the nodes to agree)
  • Make all of these fields of instance level state
  • Add a Genesis struct with these fields, add Option<Genesis> to Header
  • In Header::genesis(), pull these fields out of instance and set the genesis field to Some
  • In header validation, ensure genesis field is always None on the new proposal

jbearer avatar Jan 27 '24 19:01 jbearer

Once we have a genesis block with a unique hash (because the chain ID is unique, and probably the timestamp to), we should start putting the genesis block hash in the headers and validated state. This accomplishes two things:

  • Prevents cross-chain replay attacks against builders signing blocks (consider that we will eventually have a testnet and mainnet running at the same time, with some of the same builders participating in each)
  • Makes it easy to fetch the full genesis block and authenticate it against any committed header

jbearer avatar Feb 06 '24 21:02 jbearer