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
377 stars 294 forks source link

pindexer: name the database in error messages #4881

Open conorsch opened 1 week ago

conorsch commented 1 week ago

Someone running pindexer for the first time reported a first-run error, which read:

Error: error returned from database: relation "block_details" does not exist

Any pindexer instance requires two (2) databases: read-only access to the raw CometBFT ABCI events db, and full write access (with schema creation privileges) to its own database, to store the munged events. The table block_details only exists in the latter, so that's what the error message is pointing to, but a user likely won't know that ahead of time. Let's wrap the error message with more context to guide the user.

Given how frequently we're updating the pindexer schema, recommending resetting that db from scratch is maybe a good idea too.

cronokirby commented 4 days ago

An idea here is that we can maybe add some things to the app view trait to give each component a name and monotonic version, so that we can store metadata about which views the database was compiled with, and then error if the set has changed, and the database is not empty.

This would allow us to give a detailed error explaining what needs to be done.