penumbra-zone / penumbra

Penumbra is a fully private proof-of-stake network and decentralized exchange for the Cosmos ecosystem.
https://penumbra.zone
Apache License 2.0
380 stars 295 forks source link

Unhelpful error message when migrated state is missing with post-migration genesis file #4202

Open plaidfinch opened 6 months ago

plaidfinch commented 6 months ago

Describe the bug

If you use a post-migration genesis file (such as the current one as of this writing) which refers only to hashed state but does not contain a bundle of genesis state, but you do not start pd with a snapshot of rocksdb (i.e. it has nothing in its state directory to start) then the resulting error message does not tell you what you did wrong; instead it is a panic from an expect that is asserting the presence of current consensus keys.

To Reproduce

  1. Start with a black state.
  2. Copy the latest genesis file to CometBFT's config directory.
  3. DON'T copy the latest migration snapshot to pd's home directory.
  4. Start pd.
  5. Observe the error message that results.

Expected behavior

It is correct that pd should fail to start in this situation, but it should provide direction to the user instructing them on how to resolve the issue, since it does know that the genesis file is post-migration. It should fail earlier with an informative error message if the state is missing.

erwanor commented 6 months ago

Good point, this will also show up if the state was corrupted during state export or during the migration. Ideally, we would take a couple flags about what we expect the pre-upgrade and what the post-upgrade states to be and fail early. This will require updating the various guides though.