Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set WinningPoStSectorSetLookback to finality post-v2 actors #4190

Merged
merged 1 commit into from
Oct 6, 2020
Merged
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
2 changes: 0 additions & 2 deletions build/params_shared_vals.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ const SealRandomnessLookback = policy.SealRandomnessLookback
// Epochs
const TicketRandomnessLookback = abi.ChainEpoch(1)

const WinningPoStSectorSetLookback = abi.ChainEpoch(10)

// /////
// Address

Expand Down
3 changes: 1 addition & 2 deletions build/params_testground.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ var (

SealRandomnessLookback = policy.SealRandomnessLookback

TicketRandomnessLookback = abi.ChainEpoch(1)
WinningPoStSectorSetLookback = abi.ChainEpoch(10)
TicketRandomnessLookback = abi.ChainEpoch(1)

FilBase uint64 = 2_000_000_000
FilAllocStorageMining uint64 = 1_400_000_000
Expand Down
8 changes: 8 additions & 0 deletions chain/actors/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
miner2.WPoStChallengeWindow = period
miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines)
}

func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
if nwVer <= network.Version3 {
return 10
}

return ChainFinality
}
7 changes: 4 additions & 3 deletions chain/stmgr/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-state-types/big"

"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors/policy"

cid "github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
Expand All @@ -29,7 +30,6 @@ import (
exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
Expand Down Expand Up @@ -413,8 +413,9 @@ func ComputeState(ctx context.Context, sm *StateManager, height abi.ChainEpoch,

func GetLookbackTipSetForRound(ctx context.Context, sm *StateManager, ts *types.TipSet, round abi.ChainEpoch) (*types.TipSet, error) {
var lbr abi.ChainEpoch
if round > build.WinningPoStSectorSetLookback {
lbr = round - build.WinningPoStSectorSetLookback
lb := policy.GetWinningPoStSectorSetLookback(sm.GetNtwkVersion(ctx, round))
if round > lb {
lbr = round - lb
}

// more null blocks than our lookback
Expand Down