Skip to content

Commit

Permalink
staking: move tracking to NV storage
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Mar 18, 2024
1 parent 9c16b44 commit a4ec172
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -113,7 +113,8 @@ pub trait ValidatorDataRead: StateRead {
&self,
identity_key: &IdentityKey,
) -> DomainFuture<Uptime, Self::GetRawFut> {
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,
Expand Down Expand Up @@ -204,7 +205,12 @@ impl<T: StateRead + ?Sized> 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(
Expand Down

0 comments on commit a4ec172

Please sign in to comment.