sealing pipeline: Drop legacy single-pc1 submit path
This commit is contained in:
parent
79b6ffe651
commit
ecb6deea09
@ -581,12 +581,6 @@
|
|||||||
# env var: LOTUS_SEALING_DISABLECOLLATERALFALLBACK
|
# env var: LOTUS_SEALING_DISABLECOLLATERALFALLBACK
|
||||||
#DisableCollateralFallback = false
|
#DisableCollateralFallback = false
|
||||||
|
|
||||||
# enable / disable precommit batching (takes effect after nv13)
|
|
||||||
#
|
|
||||||
# type: bool
|
|
||||||
# env var: LOTUS_SEALING_BATCHPRECOMMITS
|
|
||||||
#BatchPreCommits = true
|
|
||||||
|
|
||||||
# maximum precommit batch size - batches will be sent immediately above this size
|
# maximum precommit batch size - batches will be sent immediately above this size
|
||||||
#
|
#
|
||||||
# type: int
|
# type: int
|
||||||
|
@ -138,7 +138,6 @@ func DefaultStorageMiner() *StorageMiner {
|
|||||||
AvailableBalanceBuffer: types.FIL(big.Zero()),
|
AvailableBalanceBuffer: types.FIL(big.Zero()),
|
||||||
DisableCollateralFallback: false,
|
DisableCollateralFallback: false,
|
||||||
|
|
||||||
BatchPreCommits: true,
|
|
||||||
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, // up to 256 sectors
|
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, // up to 256 sectors
|
||||||
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
|
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
|
||||||
// XXX snap deals wait deals slack if first
|
// XXX snap deals wait deals slack if first
|
||||||
|
@ -1204,12 +1204,6 @@ This is useful for forcing all deals to be assigned as snap deals to sectors mar
|
|||||||
|
|
||||||
Comment: `Don't send collateral with messages even if there is no available balance in the miner actor`,
|
Comment: `Don't send collateral with messages even if there is no available balance in the miner actor`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "BatchPreCommits",
|
|
||||||
Type: "bool",
|
|
||||||
|
|
||||||
Comment: `enable / disable precommit batching (takes effect after nv13)`,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "MaxPreCommitBatch",
|
Name: "MaxPreCommitBatch",
|
||||||
Type: "int",
|
Type: "int",
|
||||||
|
@ -387,8 +387,6 @@ type SealingConfig struct {
|
|||||||
// Don't send collateral with messages even if there is no available balance in the miner actor
|
// Don't send collateral with messages even if there is no available balance in the miner actor
|
||||||
DisableCollateralFallback bool
|
DisableCollateralFallback bool
|
||||||
|
|
||||||
// enable / disable precommit batching (takes effect after nv13)
|
|
||||||
BatchPreCommits bool
|
|
||||||
// maximum precommit batch size - batches will be sent immediately above this size
|
// maximum precommit batch size - batches will be sent immediately above this size
|
||||||
MaxPreCommitBatch int
|
MaxPreCommitBatch int
|
||||||
// how long to wait before submitting a batch after crossing the minimum batch size
|
// how long to wait before submitting a batch after crossing the minimum batch size
|
||||||
|
@ -1000,7 +1000,6 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error
|
|||||||
AvailableBalanceBuffer: types.FIL(cfg.AvailableBalanceBuffer),
|
AvailableBalanceBuffer: types.FIL(cfg.AvailableBalanceBuffer),
|
||||||
DisableCollateralFallback: cfg.DisableCollateralFallback,
|
DisableCollateralFallback: cfg.DisableCollateralFallback,
|
||||||
|
|
||||||
BatchPreCommits: cfg.BatchPreCommits,
|
|
||||||
MaxPreCommitBatch: cfg.MaxPreCommitBatch,
|
MaxPreCommitBatch: cfg.MaxPreCommitBatch,
|
||||||
PreCommitBatchWait: config.Duration(cfg.PreCommitBatchWait),
|
PreCommitBatchWait: config.Duration(cfg.PreCommitBatchWait),
|
||||||
PreCommitBatchSlack: config.Duration(cfg.PreCommitBatchSlack),
|
PreCommitBatchSlack: config.Duration(cfg.PreCommitBatchSlack),
|
||||||
@ -1045,7 +1044,6 @@ func ToSealingConfig(dealmakingCfg config.DealmakingConfig, sealingCfg config.Se
|
|||||||
AvailableBalanceBuffer: types.BigInt(sealingCfg.AvailableBalanceBuffer),
|
AvailableBalanceBuffer: types.BigInt(sealingCfg.AvailableBalanceBuffer),
|
||||||
DisableCollateralFallback: sealingCfg.DisableCollateralFallback,
|
DisableCollateralFallback: sealingCfg.DisableCollateralFallback,
|
||||||
|
|
||||||
BatchPreCommits: sealingCfg.BatchPreCommits,
|
|
||||||
MaxPreCommitBatch: sealingCfg.MaxPreCommitBatch,
|
MaxPreCommitBatch: sealingCfg.MaxPreCommitBatch,
|
||||||
PreCommitBatchWait: time.Duration(sealingCfg.PreCommitBatchWait),
|
PreCommitBatchWait: time.Duration(sealingCfg.PreCommitBatchWait),
|
||||||
PreCommitBatchSlack: time.Duration(sealingCfg.PreCommitBatchSlack),
|
PreCommitBatchSlack: time.Duration(sealingCfg.PreCommitBatchSlack),
|
||||||
|
@ -53,7 +53,6 @@ func TestCommitBatcher(t *testing.T) {
|
|||||||
WaitDealsDelay: time.Hour * 6,
|
WaitDealsDelay: time.Hour * 6,
|
||||||
AlwaysKeepUnsealedCopy: true,
|
AlwaysKeepUnsealedCopy: true,
|
||||||
|
|
||||||
BatchPreCommits: true,
|
|
||||||
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize,
|
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize,
|
||||||
PreCommitBatchWait: 24 * time.Hour,
|
PreCommitBatchWait: 24 * time.Hour,
|
||||||
PreCommitBatchSlack: 3 * time.Hour,
|
PreCommitBatchSlack: 3 * time.Hour,
|
||||||
|
@ -90,7 +90,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
|
|||||||
on(SectorOldTicket{}, GetTicket),
|
on(SectorOldTicket{}, GetTicket),
|
||||||
),
|
),
|
||||||
PreCommit2: planOne(
|
PreCommit2: planOne(
|
||||||
on(SectorPreCommit2{}, PreCommitting),
|
on(SectorPreCommit2{}, SubmitPreCommitBatch),
|
||||||
on(SectorSealPreCommit2Failed{}, SealPreCommit2Failed),
|
on(SectorSealPreCommit2Failed{}, SealPreCommit2Failed),
|
||||||
on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed),
|
on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed),
|
||||||
),
|
),
|
||||||
|
@ -56,7 +56,6 @@ func TestPrecommitBatcher(t *testing.T) {
|
|||||||
WaitDealsDelay: time.Hour * 6,
|
WaitDealsDelay: time.Hour * 6,
|
||||||
AlwaysKeepUnsealedCopy: true,
|
AlwaysKeepUnsealedCopy: true,
|
||||||
|
|
||||||
BatchPreCommits: true,
|
|
||||||
MaxPreCommitBatch: maxBatch,
|
MaxPreCommitBatch: maxBatch,
|
||||||
PreCommitBatchWait: 24 * time.Hour,
|
PreCommitBatchWait: 24 * time.Hour,
|
||||||
PreCommitBatchSlack: 3 * time.Hour,
|
PreCommitBatchSlack: 3 * time.Hour,
|
||||||
|
@ -42,7 +42,6 @@ type Config struct {
|
|||||||
AvailableBalanceBuffer abi.TokenAmount
|
AvailableBalanceBuffer abi.TokenAmount
|
||||||
DisableCollateralFallback bool
|
DisableCollateralFallback bool
|
||||||
|
|
||||||
BatchPreCommits bool
|
|
||||||
MaxPreCommitBatch int
|
MaxPreCommitBatch int
|
||||||
PreCommitBatchWait time.Duration
|
PreCommitBatchWait time.Duration
|
||||||
PreCommitBatchSlack time.Duration
|
PreCommitBatchSlack time.Duration
|
||||||
|
@ -82,7 +82,7 @@ const (
|
|||||||
PreCommit1 SectorState = "PreCommit1" // do PreCommit1
|
PreCommit1 SectorState = "PreCommit1" // do PreCommit1
|
||||||
PreCommit2 SectorState = "PreCommit2" // do PreCommit2
|
PreCommit2 SectorState = "PreCommit2" // do PreCommit2
|
||||||
|
|
||||||
PreCommitting SectorState = "PreCommitting" // on chain pre-commit
|
PreCommitting SectorState = "PreCommitting" // on chain pre-commit (deprecated)
|
||||||
PreCommitWait SectorState = "PreCommitWait" // waiting for precommit to land on chain
|
PreCommitWait SectorState = "PreCommitWait" // waiting for precommit to land on chain
|
||||||
|
|
||||||
SubmitPreCommitBatch SectorState = "SubmitPreCommitBatch"
|
SubmitPreCommitBatch SectorState = "SubmitPreCommitBatch"
|
||||||
|
@ -377,62 +377,10 @@ func (m *Sealing) preCommitInfo(ctx statemachine.Context, sector SectorInfo) (*m
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInfo) error {
|
func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInfo) error {
|
||||||
cfg, err := m.getConfig()
|
// note: this is a legacy state handler, normally new sectors won't enter this state
|
||||||
if err != nil {
|
// but we keep this handler in order to not break existing sector state machines.
|
||||||
return xerrors.Errorf("getting config: %w", err)
|
// todo: drop after nv21
|
||||||
}
|
return ctx.Send(SectorPreCommitBatch{})
|
||||||
|
|
||||||
if cfg.BatchPreCommits {
|
|
||||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return xerrors.Errorf("getting network version: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if nv >= network.Version13 {
|
|
||||||
return ctx.Send(SectorPreCommitBatch{})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
info, pcd, tsk, err := m.preCommitInfo(ctx, sector)
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitInfo: %w", err)})
|
|
||||||
}
|
|
||||||
if info == nil {
|
|
||||||
return nil // event was sent in preCommitInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
params := infoToPreCommitSectorParams(info)
|
|
||||||
|
|
||||||
deposit, err := collateralSendAmount(ctx.Context(), m.Api, m.maddr, cfg, pcd)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
enc := new(bytes.Buffer)
|
|
||||||
if err := params.MarshalCBOR(enc); err != nil {
|
|
||||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("could not serialize pre-commit sector parameters: %w", err)})
|
|
||||||
}
|
|
||||||
|
|
||||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tsk)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
goodFunds := big.Add(deposit, big.Int(m.feeCfg.MaxPreCommitGasFee))
|
|
||||||
|
|
||||||
from, _, err := m.addrSel.AddressFor(ctx.Context(), m.Api, mi, api.PreCommitAddr, goodFunds, deposit)
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("no good address to send precommit message from: %w", err)})
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit)
|
|
||||||
mcid, err := sendMsg(ctx.Context(), m.Api, from, m.maddr, builtin.MethodsMiner.PreCommitSector, deposit, big.Int(m.feeCfg.MaxPreCommitGasFee), enc.Bytes())
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})
|
|
||||||
}
|
|
||||||
|
|
||||||
return ctx.Send(SectorPreCommitted{Message: mcid, PreCommitDeposit: pcd, PreCommitInfo: *info})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector SectorInfo) error {
|
func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector SectorInfo) error {
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -127,14 +126,3 @@ func sendMsg(ctx context.Context, sa interface {
|
|||||||
|
|
||||||
return smsg.Cid(), nil
|
return smsg.Cid(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func infoToPreCommitSectorParams(info *miner.SectorPreCommitInfo) *miner.PreCommitSectorParams {
|
|
||||||
return &miner.PreCommitSectorParams{
|
|
||||||
SealProof: info.SealProof,
|
|
||||||
SectorNumber: info.SectorNumber,
|
|
||||||
SealedCID: info.SealedCID,
|
|
||||||
SealRandEpoch: info.SealRandEpoch,
|
|
||||||
DealIDs: info.DealIDs,
|
|
||||||
Expiration: info.Expiration,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user