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

Use abstract types for Dont recompute post on revert #4022

Merged
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
4 changes: 4 additions & 0 deletions chain/actors/builtin/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import (
// Unchanged between v0 and v1 actors
var PreCommitChallengeDelay = miner0.PreCommitChallengeDelay
var WPoStProvingPeriod = miner0.WPoStProvingPeriod
var WPoStPeriodDeadlines = miner0.WPoStPeriodDeadlines
var WPoStChallengeWindow = miner0.WPoStChallengeWindow
var WPoStChallengeLookback = miner0.WPoStChallengeLookback
var FaultDeclarationCutoff = miner0.FaultDeclarationCutoff

const MinSectorExpiration = miner0.MinSectorExpiration

Expand Down
8 changes: 6 additions & 2 deletions storage/wdpost_changehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"

"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/types"
Expand Down Expand Up @@ -529,5 +529,9 @@ func nextDeadline(currentDeadline *dline.Info) *dline.Info {
periodStart = periodStart + miner.WPoStProvingPeriod
}

return miner.NewDeadlineInfo(periodStart, newDeadline, currentDeadline.CurrentEpoch)
return NewDeadlineInfo(periodStart, newDeadline, currentDeadline.CurrentEpoch)
}

func NewDeadlineInfo(periodStart abi.ChainEpoch, deadlineIdx uint64, currEpoch abi.ChainEpoch) *dline.Info {
return dline.NewInfo(periodStart, deadlineIdx, currEpoch, miner.WPoStPeriodDeadlines, miner.WPoStProvingPeriod, miner.WPoStChallengeWindow, miner.WPoStChallengeLookback, miner.FaultDeclarationCutoff)
}
8 changes: 4 additions & 4 deletions storage/wdpost_changehandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
)

var dummyCid cid.Cid
Expand Down Expand Up @@ -90,7 +90,7 @@ func (m *mockAPI) getDeadline(currentEpoch abi.ChainEpoch) *dline.Info {
close += miner.WPoStChallengeWindow
dlIdx++
}
return miner.NewDeadlineInfo(0, dlIdx, currentEpoch)
return NewDeadlineInfo(0, dlIdx, currentEpoch)
}

func (m *mockAPI) StateMinerProvingDeadline(ctx context.Context, address address.Address, key types.TipSetKey) (*dline.Info, error) {
Expand Down Expand Up @@ -355,7 +355,7 @@ func TestChangeHandlerDontStartUntilProvingPeriod(t *testing.T) {
periodStart := miner.WPoStProvingPeriod
dlIdx := uint64(1)
currentEpoch := abi.ChainEpoch(10)
di := miner.NewDeadlineInfo(periodStart, dlIdx, currentEpoch)
di := NewDeadlineInfo(periodStart, dlIdx, currentEpoch)
mock.setDeadline(di)

defer s.ch.shutdown()
Expand All @@ -375,7 +375,7 @@ func TestChangeHandlerDontStartUntilProvingPeriod(t *testing.T) {

// Advance the head to the next proving period's first epoch
currentEpoch = periodStart + miner.WPoStChallengeWindow
di = miner.NewDeadlineInfo(periodStart, dlIdx, currentEpoch)
di = NewDeadlineInfo(periodStart, dlIdx, currentEpoch)
mock.setDeadline(di)
go triggerHeadAdvance(t, s, currentEpoch)

Expand Down
4 changes: 2 additions & 2 deletions storage/wdpost_nextdl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
)

func TestNextDeadline(t *testing.T) {
periodStart := abi.ChainEpoch(0)
deadlineIdx := 0
currentEpoch := abi.ChainEpoch(10)

di := miner.NewDeadlineInfo(periodStart, uint64(deadlineIdx), currentEpoch)
di := NewDeadlineInfo(periodStart, uint64(deadlineIdx), currentEpoch)
require.EqualValues(t, 0, di.Index)
require.EqualValues(t, 0, di.PeriodStart)
require.EqualValues(t, -20, di.Challenge)
Expand Down