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

Commit

Permalink
implement reward and add a base penalty
Browse files Browse the repository at this point in the history
* The reward ensures that, at a minimum, the gas fees for disputing a
  proof is covered.
* The base penalty ensures that the dispute method cannot be used to
  "take an advance" on vesting rewards.
  • Loading branch information
Stebalien committed Jan 14, 2021
1 parent 9ca6d38 commit 8bb8458
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions actors/builtin/miner/miner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ func TestWindowPost(t *testing.T) {
result = &poStDisputeResult{
expectedPowerDelta: pwr.Neg(),
expectedPenalty: expectedFee,
expectedReward: big.Zero(),
expectedReward: miner.BaseRewardForDisputedWindowPoSt,
expectedPledgeDelta: big.Zero(),
}
}
Expand Down Expand Up @@ -2494,7 +2494,7 @@ func TestWindowPost(t *testing.T) {
result = &poStDisputeResult{
expectedPowerDelta: pwr.Neg(),
expectedPenalty: expectedFee,
expectedReward: big.Zero(),
expectedReward: miner.BaseRewardForDisputedWindowPoSt,
expectedPledgeDelta: big.Zero(),
}

Expand Down
10 changes: 9 additions & 1 deletion actors/builtin/miner/monies.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const ConsensusFaultFactor = 5
var LockedRewardFactorNum = big.NewInt(75)
var LockedRewardFactorDenom = big.NewInt(100)

// Base reward for successfully disputing a window posts proofs.
var BaseRewardForDisputedWindowPoSt = big.Lsh(big.NewInt(4), math.Precision128) // PARAM_SPEC
// Base penalty for a successful disputed window post proof.
var BasePenaltyForDisputedWindowPoSt = big.Lsh(big.NewInt(20), math.Precision128) // PARAM_SPEC

// The projected block reward a sector would earn over some period.
// Also known as "BR(t)".
// BR(t) = ProjectedRewardFraction(t) * SectorQualityAdjustedPower
Expand Down Expand Up @@ -123,7 +128,10 @@ func PledgePenaltyForTermination(dayReward abi.TokenAmount, sectorAge abi.ChainE

// The penalty for optimistically proving a sector with an invalid window PoSt.
func PledgePenaltyForInvalidWindowPoSt(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower) abi.TokenAmount {
return ExpectedRewardForPower(rewardEstimate, networkQAPowerEstimate, qaSectorPower, InvalidWindowPoStProjectionPeriod)
return big.Add(
ExpectedRewardForPower(rewardEstimate, networkQAPowerEstimate, qaSectorPower, InvalidWindowPoStProjectionPeriod),
BasePenaltyForDisputedWindowPoSt,
)
}

// Computes the PreCommit deposit given sector qa weight and current network conditions.
Expand Down
5 changes: 2 additions & 3 deletions actors/builtin/miner/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ func RewardForConsensusSlashReport(elapsedEpoch abi.ChainEpoch, collateral abi.T

// The reward given for successfully disputing a window post.
func RewardForDisputedWindowPoSt(proofType abi.RegisteredPoStProof, disputedPower PowerPair) abi.TokenAmount {
// This is currently zero but may be raised at some point to
// ensure that disputing proofs rational.
return big.Zero()
// This is currently just the base. In the future, the fee may scale based on the disputed power.
return BaseRewardForDisputedWindowPoSt
}

0 comments on commit 8bb8458

Please sign in to comment.