Skip to content

Commit

Permalink
WIP need to update validator set after distributing rewards too
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Mar 17, 2023
1 parent 53de733 commit b2e7837
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions apps/src/lib/node/ledger/shell/finalize_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ use namada::proof_of_stake::{
delegator_rewards_products_handle, find_validator_by_raw_hash,
read_last_block_proposer_address, read_pos_params, read_total_stake,
read_validator_stake, rewards_accumulator_handle, update_total_deltas,
update_validator_deltas, validator_commission_rate_handle,
validator_rewards_products_handle, write_last_block_proposer_address,
update_validator_deltas, update_validator_set,
validator_commission_rate_handle, validator_rewards_products_handle,
write_last_block_proposer_address,
};
use namada::types::address::Address;
#[cfg(feature = "abcipp")]
Expand Down Expand Up @@ -732,6 +733,13 @@ where
current_epoch,
params.pipeline_len,
)?;
update_validator_set(
&mut self.wl_storage,
&params,
&validator,
token::Change::from(reward),
current_epoch,
)
}
update_total_deltas(
&mut self.wl_storage,
Expand Down
2 changes: 1 addition & 1 deletion proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ where

/// NEW: Update validator set when a validator receives a new bond and when
/// its bond is unbonded (self-bond or delegation).
fn update_validator_set<S>(
pub fn update_validator_set<S>(
storage: &mut S,
params: &PosParams,
validator: &Address,
Expand Down

0 comments on commit b2e7837

Please sign in to comment.