From a4ec17258a78c147a5774fde07edeb7a5455287e Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Mon, 18 Mar 2024 17:46:09 -0400 Subject: [PATCH] staking: move tracking to NV storage --- .../component/validator_handler/validator_store.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/core/component/stake/src/component/validator_handler/validator_store.rs b/crates/core/component/stake/src/component/validator_handler/validator_store.rs index a385375287..edfda2bf18 100644 --- a/crates/core/component/stake/src/component/validator_handler/validator_store.rs +++ b/crates/core/component/stake/src/component/validator_handler/validator_store.rs @@ -10,7 +10,7 @@ use async_trait::async_trait; use cnidarium::{StateRead, StateWrite}; use futures::{Future, FutureExt, TryStreamExt}; use penumbra_num::Amount; -use penumbra_proto::{state::future::DomainFuture, StateReadProto, StateWriteProto}; +use penumbra_proto::{state::future::DomainFuture, DomainType, StateReadProto, StateWriteProto}; use std::pin::Pin; use tendermint::PublicKey; use tracing::instrument; @@ -113,7 +113,8 @@ pub trait ValidatorDataRead: StateRead { &self, identity_key: &IdentityKey, ) -> DomainFuture { - self.get(&state_key::validators::uptime::by_id(identity_key)) + let key = state_key::validators::uptime::by_id(identity_key); + self.nonverifiable_get(key.as_bytes()) } // Tendermint validators are referenced to us by their Tendermint consensus key, @@ -204,7 +205,12 @@ impl ValidatorDataRead for T {} #[async_trait] pub(crate) trait ValidatorDataWrite: StateWrite { fn set_validator_uptime(&mut self, identity_key: &IdentityKey, uptime: Uptime) { - self.put(state_key::validators::uptime::by_id(identity_key), uptime); + self.nonverifiable_put_raw( + state_key::validators::uptime::by_id(identity_key) + .as_bytes() + .to_vec(), + uptime.encode_to_vec(), + ); } fn set_validator_bonding_state(