Skip to content

Commit

Permalink
docs: create pindexer readme and mention pindexer<>pd compat in errors (
Browse files Browse the repository at this point in the history
#4768)

## Describe your changes

adds some explanation for a common issue with pindexer

## Issue ticket number and link

fixes #4765 

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

indexer-only changes

---------

Signed-off-by: Lúcás Meier <[email protected]>
Co-authored-by: Lúcás Meier <[email protected]>
  • Loading branch information
vacekj and cronokirby committed Jul 25, 2024
1 parent 2500935 commit a4dc478
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions crates/bin/pindexer/README.md
Original file line number Diff line number Diff line change
@@ -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

3 changes: 2 additions & 1 deletion crates/bin/pindexer/src/block.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions crates/bin/pindexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.";

0 comments on commit a4dc478

Please sign in to comment.