From 6e6584a9c77b39993355230d469caf3383d756b4 Mon Sep 17 00:00:00 2001 From: Erwan Date: Thu, 1 Feb 2024 19:21:30 -0500 Subject: [PATCH] penumbra: misc small fixes --- crates/core/component/sct/Cargo.toml | 2 +- crates/core/component/sct/src/component/mod.rs | 16 ++++++++++------ crates/core/component/sct/src/component/rpc.rs | 5 ++--- crates/core/component/sct/src/component/sct.rs | 2 +- crates/core/component/sct/src/component/tree.rs | 2 +- crates/view/src/worker.rs | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/crates/core/component/sct/Cargo.toml b/crates/core/component/sct/Cargo.toml index 8a937f5271..2e5dc9f511 100644 --- a/crates/core/component/sct/Cargo.toml +++ b/crates/core/component/sct/Cargo.toml @@ -1,5 +1,4 @@ [package] -# TODO: merge with tct crate under a `component` feature flag? name = "penumbra-sct" version = "0.65.0-alpha.1" edition = "2021" @@ -11,6 +10,7 @@ component = [ "cnidarium", "cnidarium-component", "penumbra-proto/cnidarium", + "penumbra-proto/rpc", "tonic", ] default = ["std", "component"] diff --git a/crates/core/component/sct/src/component/mod.rs b/crates/core/component/sct/src/component/mod.rs index c3ea6b6182..e7d09bdf07 100644 --- a/crates/core/component/sct/src/component/mod.rs +++ b/crates/core/component/sct/src/component/mod.rs @@ -1,12 +1,16 @@ -// The SCT component implementation. -pub mod sct; -// Blockchain clocks: epoch indices, block heights and timestamps. +//! The Sct component contains the interface to the chain's state commitment tree +//! and nullifier set. It also serves as tracking the various chain clocks, whether +//! logical, like an epoch index, or a block height, or physical, like block timestamps. + +/// Blockchain clocks: epoch indices, block heights and timestamps. pub mod clock; -// Implementation of the SCT component query server. +/// Implementation of the SCT component query server. pub mod rpc; -// Tracking commitment sources within a block execution. +/// The SCT component implementation. +pub mod sct; +/// Tracking commitment sources within a block execution. pub mod source; -// Mediate access to the state commitment tree and related data. +/// Mediate access to the state commitment tree and related data. pub mod tree; // Access to configuration data for the component. diff --git a/crates/core/component/sct/src/component/rpc.rs b/crates/core/component/sct/src/component/rpc.rs index 2d541bbbf0..2f66be4331 100644 --- a/crates/core/component/sct/src/component/rpc.rs +++ b/crates/core/component/sct/src/component/rpc.rs @@ -1,7 +1,6 @@ use cnidarium::Storage; -use penumbra_proto::core::component::sct::v1alpha1::{ - query_service_server::QueryService, EpochByHeightRequest, EpochByHeightResponse, -}; +use penumbra_proto::core::component::sct::v1alpha1::query_service_server::QueryService; +use penumbra_proto::core::component::sct::v1alpha1::{EpochByHeightRequest, EpochByHeightResponse}; use tonic::Status; use tracing::instrument; diff --git a/crates/core/component/sct/src/component/sct.rs b/crates/core/component/sct/src/component/sct.rs index a00fa30562..ed7bf58a7c 100644 --- a/crates/core/component/sct/src/component/sct.rs +++ b/crates/core/component/sct/src/component/sct.rs @@ -42,7 +42,7 @@ impl Component for Sct { }, ); } - None => {} + None => { /* no-op until an upgrade occurs */ } } } diff --git a/crates/core/component/sct/src/component/tree.rs b/crates/core/component/sct/src/component/tree.rs index 1d4d8eaef6..897226d619 100644 --- a/crates/core/component/sct/src/component/tree.rs +++ b/crates/core/component/sct/src/component/tree.rs @@ -232,7 +232,7 @@ pub trait VerificationExt: StateRead { anyhow::bail!( "nullifier {} was already spent in {:?}", nullifier, - hex::encode(&info.id), + hex::encode(info.id), ); } Ok(()) diff --git a/crates/view/src/worker.rs b/crates/view/src/worker.rs index c86eafb798..a4928ee408 100644 --- a/crates/view/src/worker.rs +++ b/crates/view/src/worker.rs @@ -451,7 +451,7 @@ async fn sct_divergence_check( let value = client .key_value(penumbra_proto::cnidarium::v1alpha1::KeyValueRequest { - key: sct_state_key::anchor_by_height(height), + key: sct_state_key::tree::anchor_by_height(height), ..Default::default() }) .await?