diff --git a/crates/core/app/src/app/mod.rs b/crates/core/app/src/app/mod.rs index f895c1d4b2..db113e46e2 100644 --- a/crates/core/app/src/app/mod.rs +++ b/crates/core/app/src/app/mod.rs @@ -690,7 +690,7 @@ pub trait StateReadExt: StateRead { let distributions_params = self.get_distributions_params().await?; let ibc_params = self.get_ibc_params().await?; let fee_params = self.get_fee_params().await?; - let funding_params = self.get_staking_funding_params().await?; + let funding_params = self.get_funding_params().await?; let governance_params = self.get_governance_params().await?; let sct_params = self.get_sct_params().await?; let shielded_pool_params = self.get_shielded_pool_params().await?; @@ -812,7 +812,7 @@ pub trait StateWriteExt: StateWrite { self.put_community_pool_params(community_pool_params); self.put_distributions_params(distributions_params); self.put_fee_params(fee_params); - self.put_staking_funding_params(funding_params); + self.put_funding_params(funding_params); self.put_governance_params(governance_params); self.put_ibc_params(ibc_params); self.put_sct_params(sct_params); diff --git a/crates/core/component/funding/src/component.rs b/crates/core/component/funding/src/component.rs index d2fd0ad3f2..f9b8c9d7ed 100644 --- a/crates/core/component/funding/src/component.rs +++ b/crates/core/component/funding/src/component.rs @@ -33,7 +33,7 @@ impl Component for Funding { match app_state { None => { /* no-op */ } Some(genesis) => { - state.put_staking_funding_params(genesis.funding_params.clone()); + state.put_funding_params(genesis.funding_params.clone()); } }; } diff --git a/crates/core/component/funding/src/component/liquidity_tournament/nullifier/mod.rs b/crates/core/component/funding/src/component/liquidity_tournament/nullifier/mod.rs index 9e86384013..c5e232aeed 100644 --- a/crates/core/component/funding/src/component/liquidity_tournament/nullifier/mod.rs +++ b/crates/core/component/funding/src/component/liquidity_tournament/nullifier/mod.rs @@ -9,8 +9,8 @@ use penumbra_sdk_sct::{component::clock::EpochRead, Nullifier}; #[allow(dead_code)] #[async_trait] pub trait NullifierRead: StateRead { - /// Gets the transaction id associated with the given nullifier from the JMT. - async fn get_txid_from_nullifier(&self, nullifier: Nullifier) -> Option { + /// Returns the `TransactionId` if the nullifier has been spent; otherwise, returns None. + async fn get_lqt_spent_nullifier(&self, nullifier: Nullifier) -> Option { // Grab the ambient epoch index. let epoch_index = self .get_current_epoch() @@ -18,8 +18,7 @@ pub trait NullifierRead: StateRead { .expect("epoch is always set") .index; - let nullifier_key = - &state_key::lqt::v1::nullifier::lqt_nullifier_lookup_for_txid(epoch_index, &nullifier); + let nullifier_key = &state_key::lqt::v1::nullifier::key(epoch_index, &nullifier); let tx_id: Option = self .nonverifiable_get(&nullifier_key.as_bytes()) @@ -35,12 +34,16 @@ impl NullifierRead for T {} #[allow(dead_code)] #[async_trait] pub trait NullifierWrite: StateWrite { - /// Sets the LQT nullifier in the JMT. - fn put_lqt_nullifier(&mut self, epoch_index: u64, nullifier: Nullifier, tx_id: TransactionId) { - let nullifier_key = - state_key::lqt::v1::nullifier::lqt_nullifier_lookup_for_txid(epoch_index, &nullifier); - - self.put(nullifier_key, tx_id); + /// Sets the LQT nullifier in the NV storage. + fn put_lqt_spent_nullifier( + &mut self, + epoch_index: u64, + nullifier: Nullifier, + tx_id: TransactionId, + ) { + let nullifier_key = state_key::lqt::v1::nullifier::key(epoch_index, &nullifier); + + self.nonverifiable_put(nullifier_key.into(), tx_id); } } diff --git a/crates/core/component/funding/src/component/state_key.rs b/crates/core/component/funding/src/component/state_key.rs index 8dfd89555b..80e57ebd36 100644 --- a/crates/core/component/funding/src/component/state_key.rs +++ b/crates/core/component/funding/src/component/state_key.rs @@ -7,10 +7,8 @@ pub mod lqt { pub mod nullifier { use penumbra_sdk_sct::Nullifier; - pub(crate) fn lqt_nullifier_lookup_for_txid( - epoch_index: u64, - nullifier: &Nullifier, - ) -> String { + /// A nullifier set indexed by epoch, mapping each epoch to its corresponding `TransactionId`. + pub(crate) fn key(epoch_index: u64, nullifier: &Nullifier) -> String { format!("funding/lqt/v1/nullifier/{epoch_index:020}/lookup/{nullifier}") } } diff --git a/crates/core/component/funding/src/component/view.rs b/crates/core/component/funding/src/component/view.rs index dac7d4b789..d8684b1493 100644 --- a/crates/core/component/funding/src/component/view.rs +++ b/crates/core/component/funding/src/component/view.rs @@ -7,7 +7,7 @@ use penumbra_sdk_proto::{StateReadProto, StateWriteProto}; #[async_trait] pub trait StateReadExt: StateRead { /// Gets the funding module chain parameters from the JMT. - async fn get_staking_funding_params(&self) -> Result { + async fn get_funding_params(&self) -> Result { self.get(state_key::staking_funding_parameters()) .await? .ok_or_else(|| anyhow::anyhow!("Missing FundingParameters")) @@ -19,7 +19,7 @@ impl StateReadExt for T {} #[async_trait] pub trait StateWriteExt: StateWrite + StateReadExt { /// Set the Funding parameters in the JMT. - fn put_staking_funding_params(&mut self, params: FundingParameters) { + fn put_funding_params(&mut self, params: FundingParameters) { self.put(state_key::staking_funding_parameters().into(), params) } }