diff --git a/crates/bin/pindexer/README.md b/crates/bin/pindexer/README.md new file mode 100644 index 0000000000..3e94221e2e --- /dev/null +++ b/crates/bin/pindexer/README.md @@ -0,0 +1,11 @@ +# pindexer + +A indexer that ingests ABCI events emitted by pd and transforms them into useful data. + +## Usage + +1. Follow the setup instructions in cometindex README +2. `cargo run --bin pindexer -- -s "postgresql://localhost:5432/testnet_raw?sslmode=disable" -d "postgresql://localhost:5432/testnet_compiled?sslmode=disable"` + +## pd compatibility + diff --git a/crates/bin/pindexer/src/block.rs b/crates/bin/pindexer/src/block.rs index 6f3aa3b676..21ee69dc79 100644 --- a/crates/bin/pindexer/src/block.rs +++ b/crates/bin/pindexer/src/block.rs @@ -1,3 +1,4 @@ +use crate::PD_COMPAT; use anyhow::anyhow; use cometindex::{async_trait, sqlx, AppView, ContextualizedEvent, PgTransaction}; use penumbra_proto::{core::component::sct::v1 as pb, event::ProtoEvent}; @@ -52,7 +53,7 @@ CREATE TABLE IF NOT EXISTS block_details ( .bind(i64::try_from(pe.height)?) .bind( DateTime::from_timestamp(timestamp.seconds, u32::try_from(timestamp.nanos)?) - .ok_or(anyhow!("failed to convert timestamp"))?, + .ok_or(anyhow!(format!("failed to convert timestamp. {PD_COMPAT}")))?, ) .bind(pe.root.unwrap().inner) .execute(dbtx.as_mut()) diff --git a/crates/bin/pindexer/src/lib.rs b/crates/bin/pindexer/src/lib.rs index 9c443724d8..b4e5b3c89e 100644 --- a/crates/bin/pindexer/src/lib.rs +++ b/crates/bin/pindexer/src/lib.rs @@ -7,3 +7,5 @@ pub mod dex; pub mod shielded_pool; mod sql; pub mod stake; + +pub(crate) const PD_COMPAT: &'static str = "Check that your pd and pindexer versions match. See pd compatibility section in README for more information.";