Skip to content

Commit

Permalink
pos: replace generic types with concrete types from core
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Nov 21, 2022
1 parent 7dd2d31 commit f5ec90c
Show file tree
Hide file tree
Showing 12 changed files with 571 additions and 1,608 deletions.
13 changes: 4 additions & 9 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ use namada::ledger::governance::parameters::GovParams;
use namada::ledger::governance::storage as gov_storage;
use namada::ledger::native_vp::governance::utils::Votes;
use namada::ledger::parameters::{storage as param_storage, EpochDuration};
use namada::ledger::pos::types::{
decimal_mult_u64, Epoch as PosEpoch, WeightedValidator,
};
use namada::ledger::pos::types::{decimal_mult_u64, WeightedValidator};
use namada::ledger::pos::{
self, is_validator_slashes_key, BondId, Bonds, PosParams, Slash, Unbonds,
};
Expand Down Expand Up @@ -2012,8 +2010,8 @@ pub async fn known_address(
fn apply_slashes(
slashes: &[Slash],
mut delta: token::Amount,
epoch_start: PosEpoch,
withdraw_epoch: Option<PosEpoch>,
epoch_start: Epoch,
withdraw_epoch: Option<Epoch>,
mut w: Option<&mut std::io::StdoutLock>,
) -> token::Amount {
let mut slashed = token::Amount::default();
Expand Down Expand Up @@ -2638,11 +2636,8 @@ pub async fn get_proposal_offline_votes(
.await
.unwrap_or_default();
let mut delegated_amount: token::Amount = 0.into();
let epoch = namada::ledger::pos::types::Epoch::from(
proposal.tally_epoch.0,
);
let bond = epoched_bonds
.get(epoch)
.get(proposal.tally_epoch)
.expect("Delegation bond should be defined.");
let mut to_deduct = bond.neg_deltas;
for (start_epoch, &(mut delta)) in
Expand Down
2 changes: 1 addition & 1 deletion proof_of_stake/src/epoched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use core::marker::PhantomData;
use core::{cmp, fmt, ops};

use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use namada_core::types::storage::Epoch;

use crate::types::Epoch;
use crate::PosParams;

/// Data that may have values set for future epochs, up to an epoch at offset as
Expand Down
Loading

0 comments on commit f5ec90c

Please sign in to comment.