Skip to content

Commit

Permalink
fip-0100: update total power and record a TODO
Browse files Browse the repository at this point in the history
1. We need to add to the total power when adding sectors, and deduct
when deleting partitions.
2. We're going to need to figure out some way to handle fees when we
compact partitions.
  • Loading branch information
Stebalien committed Feb 15, 2025
1 parent 9fe997b commit aeb15d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions actors/miner/src/deadline_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ impl Deadline {
.map_err(|e| e.downcast_wrap("failed to add expirations for new deadlines"))?;
self.expirations_epochs = deadline_expirations.amt.flush()?;
self.daily_fee += &total_daily_fee;
self.total_power += &total_power;

Ok(total_power)
}
Expand Down Expand Up @@ -763,6 +764,15 @@ impl Deadline {

self.live_sectors -= removed_live_sectors;
self.total_sectors -= removed_live_sectors + removed_dead_sectors;
// we can leave faulty power alone because there can be no faults here.
self.total_power -= &removed_power;
// XXX: we need to either:
//
// 1. Update the daily fee here (which means we need to add this information to the partitions).
// 2. Add a flag to `Deadline::add_sectors` indicating that we don't want the fee updated
// (because it has already been accounted for.
//
// The first option is nice and symmetric. The second saves us some state.

// Update expiration bitfields.
let mut expiration_epochs = BitFieldQueue::new(store, &self.expirations_epochs, quant)
Expand Down

0 comments on commit aeb15d4

Please sign in to comment.