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

trying to reduce window periods #595

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion actors/builtin/miner/miner_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package miner
import (
"fmt"
"reflect"
"sort"

addr "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
Expand Down Expand Up @@ -577,7 +578,17 @@ func (st *State) RemoveFaults(store adt.Store, sectorNos *abi.BitField) error {
return err
}

for i, newFaults := range epochsChanged {
epochsChangedKeys := make([]uint64, 0, len(epochsChanged))
for k := range epochsChanged {
epochsChangedKeys = append(epochsChangedKeys, k)
}
sort.Slice(epochsChangedKeys, func(i, j int) bool {
return epochsChangedKeys[i] < epochsChangedKeys[j]
})

for _, i := range epochsChangedKeys {
newFaults := epochsChanged[i]

if empty, err := newFaults.IsEmpty(); err != nil {
return err
} else if empty {
Expand Down
12 changes: 0 additions & 12 deletions actors/builtin/miner/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ import (
builtin "github.com/filecoin-project/specs-actors/actors/builtin"
)

// The period over which all a miner's active sectors will be challenged.
const WPoStProvingPeriod = abi.ChainEpoch(builtin.EpochsInDay) // 24 hours

// The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
const WPoStChallengeWindow = abi.ChainEpoch(40 * 60 / builtin.EpochDurationSeconds) // 40 minutes (36 per day)

// The number of non-overlapping PoSt deadlines in each proving period.
const WPoStPeriodDeadlines = uint64(WPoStProvingPeriod / WPoStChallengeWindow)

func init() {
// Check that the challenge windows divide the proving period evenly.
if WPoStProvingPeriod%WPoStChallengeWindow != 0 {
Expand Down Expand Up @@ -81,9 +72,6 @@ const WPoStChallengeLookback = abi.ChainEpoch(20) // PARAM_FINISH
// epoch completed, and hence before the challenge was knowable.
const FaultDeclarationCutoff = WPoStChallengeLookback // PARAM_FINISH

// The maximum age of a fault before the sector is terminated.
const FaultMaxAge = WPoStProvingPeriod*14 - 1

// Staging period for a miner worker key change.
const WorkerKeyChangeDelay = 2 * ElectionLookback // PARAM_FINISH

Expand Down
20 changes: 20 additions & 0 deletions actors/builtin/miner/policy_params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// +build !testground

package miner

import (
abi "github.com/filecoin-project/specs-actors/actors/abi"
builtin "github.com/filecoin-project/specs-actors/actors/builtin"
)

// The period over which all a miner's active sectors will be challenged.
const WPoStProvingPeriod = abi.ChainEpoch(builtin.EpochsInDay) // 24 hours

// The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
const WPoStChallengeWindow = abi.ChainEpoch(40 * 60 / builtin.EpochDurationSeconds) // 40 minutes (36 per day)

// The number of non-overlapping PoSt deadlines in each proving period.
const WPoStPeriodDeadlines = uint64(WPoStProvingPeriod / WPoStChallengeWindow)

// The maximum age of a fault before the sector is terminated.
const FaultMaxAge = WPoStProvingPeriod*14 - 1
19 changes: 19 additions & 0 deletions actors/builtin/miner/policy_params_testground.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// +build testground

package miner

import (
abi "github.com/filecoin-project/specs-actors/actors/abi"
)

// The period over which all a miner's active sectors will be challenged.
const WPoStProvingPeriod = abi.ChainEpoch(360) // proving period set to 360 epochs ~ 6min. instead of 24 hours (assuming block time delay of 1sec.)

// The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
const WPoStChallengeWindow = abi.ChainEpoch(10) // challenge window set to 10 epochs ~ 10sec. instead of 40 minutes (assuming block time delay of 1sec.)

// The number of non-overlapping PoSt deadlines in each proving period.
const WPoStPeriodDeadlines = uint64(WPoStProvingPeriod / WPoStChallengeWindow) // Again 36 non-overlapping windows, same as production.

// The maximum age of a fault before the sector is terminated.
const FaultMaxAge = WPoStProvingPeriod*14 - 1
7 changes: 7 additions & 0 deletions actors/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ type Runtime interface {

// Starts a new tracing span. The span must be End()ed explicitly, typically with a deferred invocation.
StartSpan(name string) TraceSpan

// ChargeGas charges specified amount of `gas` for execution.
// `name` provides information about gas charging point
// `virtual` sets virtual amount of gas to charge, this amount is not counted
// toward execution cost. This functionality is used for observing global changes
// in total gas charged if amount of gas charged was to be changed.
ChargeGas(name string, gas int64, virtual int64)
}

// Store defines the storage module exposed to actors.
Expand Down
2 changes: 2 additions & 0 deletions support/mock/mockrt.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,8 @@ func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount {
panic("todo crypto econ")
}

func (rt *Runtime) ChargeGas(_ string, _, _ int64) {}

type ReturnWrapper struct {
V runtime.CBORMarshaler
}
Expand Down