Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Set ConsensusMinerMinPower to 10 TiB for all PoStProofPolicies (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek authored May 26, 2021
1 parent 0bf4d26 commit d03ede5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
21 changes: 8 additions & 13 deletions actors/builtin/power/power_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ func TestPowerAndPledgeAccounting(t *testing.T) {
proof abi.RegisteredPoStProof
expectedMiners int64
}{{
proof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, // 2K sectors have zero consensus minimum
expectedMiners: 1,
proof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
expectedMiners: 0,
}, {
proof: abi.RegisteredPoStProof_StackedDrgWindow32GiBV1,
expectedMiners: 0,
Expand Down Expand Up @@ -411,7 +411,7 @@ func TestPowerAndPledgeAccounting(t *testing.T) {
actor.checkState(rt)
})

t.Run("consensus minimum power depends on proof type", func(t *testing.T) {
t.Run("power gets added when miner crosses minPower but not before", func(t *testing.T) {
// Setup four miners above threshold
rt := builder.Build(t)
actor.constructAndVerify(rt)
Expand All @@ -431,29 +431,24 @@ func TestPowerAndPledgeAccounting(t *testing.T) {
expectedTotal := mul(powerUnit, 4)
actor.expectTotalPowerEager(rt, expectedTotal, expectedTotal)

// miner 5 uses 64GiB sectors and has a higher minimum
actor.createMiner(rt, owner, owner, miner5, tutil.NewActorAddr(t, "m5"), abi.PeerID("m5"),
nil, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, big.Zero())

power64Unit, err := builtin.ConsensusMinerMinPower(abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
require.NoError(t, err)
assert.True(t, power64Unit.GreaterThan(powerUnit))
actor.createMinerBasic(rt, owner, owner, miner5)
belowLimitUnit := big.Div(powerUnit, big.NewInt(2))

// below limit actors power is not added
actor.updateClaimedPower(rt, miner5, powerUnit, powerUnit)
actor.updateClaimedPower(rt, miner5, belowLimitUnit, belowLimitUnit)
actor.expectMinersAboveMinPower(rt, 4)
actor.expectTotalPowerEager(rt, expectedTotal, expectedTotal)

// just below limit
delta := big.Subtract(power64Unit, powerUnit, big.NewInt(1))
delta := big.Subtract(powerUnit, belowLimitUnit, big.NewInt(1))
actor.updateClaimedPower(rt, miner5, delta, delta)
actor.expectMinersAboveMinPower(rt, 4)
actor.expectTotalPowerEager(rt, expectedTotal, expectedTotal)

// at limit power is added
actor.updateClaimedPower(rt, miner5, big.NewInt(1), big.NewInt(1))
actor.expectMinersAboveMinPower(rt, 5)
newExpectedTotal := big.Add(expectedTotal, power64Unit)
newExpectedTotal := big.Add(expectedTotal, powerUnit)
actor.expectTotalPowerEager(rt, newExpectedTotal, newExpectedTotal)
actor.checkState(rt)
})
Expand Down
8 changes: 4 additions & 4 deletions actors/builtin/sector.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,23 @@ type PoStProofPolicy struct {
var PoStProofPolicies = map[stabi.RegisteredPoStProof]*PoStProofPolicy{
stabi.RegisteredPoStProof_StackedDrgWindow2KiBV1: {
WindowPoStPartitionSectors: 2,
ConsensusMinerMinPower: stabi.NewStoragePower(0),
ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
},
stabi.RegisteredPoStProof_StackedDrgWindow8MiBV1: {
WindowPoStPartitionSectors: 2,
ConsensusMinerMinPower: stabi.NewStoragePower(16 << 20),
ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
},
stabi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
WindowPoStPartitionSectors: 2,
ConsensusMinerMinPower: stabi.NewStoragePower(1 << 30),
ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
},
stabi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
WindowPoStPartitionSectors: 2349,
ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
},
stabi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
WindowPoStPartitionSectors: 2300,
ConsensusMinerMinPower: stabi.NewStoragePower(20 << 40),
ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
},
// Winning PoSt proof types omitted.
}
Expand Down
7 changes: 0 additions & 7 deletions actors/states/election_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ func TestMinerEligibleAtLookback(t *testing.T) {
power: pow32GiBMin,
eligible: true,
}, {
// bigger sector size requires higher minimum
consensusMiners: power.ConsensusMinerMinMiners,
minerProof: abi.RegisteredPoStProof_StackedDrgWindow64GiBV1,
power: pow32GiBMin,
eligible: false,
}, {
// bigger sector size requires higher minimum
consensusMiners: power.ConsensusMinerMinMiners,
minerProof: abi.RegisteredPoStProof_StackedDrgWindow64GiBV1,
power: pow64GiBMin,
Expand Down

0 comments on commit d03ede5

Please sign in to comment.