Skip to content

Commit

Permalink
WIP continuing update
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Sep 28, 2023
1 parent c9c589d commit cca37af
Show file tree
Hide file tree
Showing 2 changed files with 776 additions and 361 deletions.
28 changes: 11 additions & 17 deletions proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4445,12 +4445,6 @@ where
r#type: enqueued_slash.r#type,
rate: slash_rate,
};
tracing::debug!(
"Slash for validator {} committed in epoch {} has rate {}",
&validator,
enqueued_slash.epoch,
slash_rate
);

let cur_slashes = eager_validator_slashes
.entry(validator.clone())
Expand Down Expand Up @@ -5740,15 +5734,24 @@ where
tracing::debug!("\nRedeleg dest bonds before incrementing: {bonds:#?}");
}

// `updatedDelegator` with updates to `bonded`
let bond_handle = bond_handle(delegator, dest_validator);
if !amount_after_slashing.is_zero() {
// `updatedDelegator` with updates to `bonded`
let bond_handle = bond_handle(delegator, dest_validator);
bond_handle.add(
storage,
amount_after_slashing,
current_epoch,
params.pipeline_len,
)?;
// `updatedDestValidator` --> `with("totalVBonded")`
// Add the amount to the dest validator total bonded
let dest_total_bonded = total_bonded_handle(dest_validator);
dest_total_bonded.add(
storage,
amount_after_slashing,
current_epoch,
params.pipeline_len,
)?;
}

if tracing::level_enabled!(tracing::Level::DEBUG) {
Expand All @@ -5769,15 +5772,6 @@ where
)?;
}

// `updatedDestValidator`
// Add the amount to the dest validator total bonded
let dest_total_bonded = total_bonded_handle(dest_validator);
dest_total_bonded.add(
storage,
amount_after_slashing,
current_epoch,
params.pipeline_len,
)?;
// Add the amount to the dest validator total redelegated bonds.
let dest_total_redelegated_bonded =
validator_total_redelegated_bonded_handle(dest_validator)
Expand Down
Loading

0 comments on commit cca37af

Please sign in to comment.