Skip to content

Commit

Permalink
feat: fix and enable block timestamp indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
vacekj committed Jul 17, 2024
1 parent c689972 commit a802d8d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/bin/pindexer/src/block/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub struct Block {}

#[async_trait]
impl AppView for Block {
async fn init_chain(&self, dbtx: &mut PgTransaction) -> Result<(), anyhow::Error> {
async fn init_chain(&self, dbtx: &mut PgTransaction, _: &serde_json::Value) -> Result<(), anyhow::Error> {
sqlx::query(
// table name is module path + struct name
"
Expand All @@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS block_details (
}

fn is_relevant(&self, type_str: &str) -> bool {
type_str == "penumbra.core.component.sct.v1.EventBlockTimestamp.timestamp"
type_str == "penumbra.core.component.sct.v1.EventBlockRoot"
}

async fn index_event(
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pindexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ mod indexer_ext;
pub use indexer_ext::IndexerExt;

pub mod shielded_pool;

pub mod stake;
pub mod block;
3 changes: 3 additions & 0 deletions crates/bin/pindexer/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use anyhow::Result;
use pindexer::{Indexer, IndexerExt as _};
use pindexer::block::block::Block;

#[tokio::main]
async fn main() -> Result<()> {
dbg!("hello");
Indexer::new()
.with_default_tracing()
.with_default_penumbra_app_views()
.with_index(Block {})
.run()
.await?;

Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/sct/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ serde = {workspace = true, features = ["derive"]}
tendermint = {workspace = true}
tonic = {workspace = true, optional = true}
tracing = {workspace = true}
chrono = { workspace = true, default-features = false, features = ["serde"] }
chrono = { workspace = true, default-features = false, features = ["serde", "now"] }

[dev-dependencies]
getrandom = {workspace = true}
1 change: 0 additions & 1 deletion crates/core/component/sct/src/component/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use penumbra_proto::{StateReadProto, StateWriteProto};
use penumbra_tct as tct;
use tct::builder::{block, epoch};
use tracing::{instrument};
use tracing::field::debug;

use crate::{
component::clock::EpochRead, event, state_key, CommitmentSource, NullificationInfo, Nullifier,
Expand Down

0 comments on commit a802d8d

Please sign in to comment.