diff --git a/documentation/en/default-lotus-miner-config.toml b/documentation/en/default-lotus-miner-config.toml index 2bb920bfc..f887ee942 100644 --- a/documentation/en/default-lotus-miner-config.toml +++ b/documentation/en/default-lotus-miner-config.toml @@ -581,12 +581,6 @@ # env var: LOTUS_SEALING_DISABLECOLLATERALFALLBACK #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 # # type: int diff --git a/node/config/def.go b/node/config/def.go index 42b035c66..6df19665d 100644 --- a/node/config/def.go +++ b/node/config/def.go @@ -138,7 +138,6 @@ func DefaultStorageMiner() *StorageMiner { AvailableBalanceBuffer: types.FIL(big.Zero()), DisableCollateralFallback: false, - BatchPreCommits: true, 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 // XXX snap deals wait deals slack if first diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index 9cde4778f..a126efb0d 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -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`, }, - { - Name: "BatchPreCommits", - Type: "bool", - - Comment: `enable / disable precommit batching (takes effect after nv13)`, - }, { Name: "MaxPreCommitBatch", Type: "int", diff --git a/node/config/types.go b/node/config/types.go index 3350bb18c..dfdef5bb2 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -387,8 +387,6 @@ type SealingConfig struct { // Don't send collateral with messages even if there is no available balance in the miner actor DisableCollateralFallback bool - // enable / disable precommit batching (takes effect after nv13) - BatchPreCommits bool // maximum precommit batch size - batches will be sent immediately above this size MaxPreCommitBatch int // how long to wait before submitting a batch after crossing the minimum batch size diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 74251e21d..29345d035 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -1000,7 +1000,6 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error AvailableBalanceBuffer: types.FIL(cfg.AvailableBalanceBuffer), DisableCollateralFallback: cfg.DisableCollateralFallback, - BatchPreCommits: cfg.BatchPreCommits, MaxPreCommitBatch: cfg.MaxPreCommitBatch, PreCommitBatchWait: config.Duration(cfg.PreCommitBatchWait), PreCommitBatchSlack: config.Duration(cfg.PreCommitBatchSlack), @@ -1045,7 +1044,6 @@ func ToSealingConfig(dealmakingCfg config.DealmakingConfig, sealingCfg config.Se AvailableBalanceBuffer: types.BigInt(sealingCfg.AvailableBalanceBuffer), DisableCollateralFallback: sealingCfg.DisableCollateralFallback, - BatchPreCommits: sealingCfg.BatchPreCommits, MaxPreCommitBatch: sealingCfg.MaxPreCommitBatch, PreCommitBatchWait: time.Duration(sealingCfg.PreCommitBatchWait), PreCommitBatchSlack: time.Duration(sealingCfg.PreCommitBatchSlack), diff --git a/storage/pipeline/commit_batch_test.go b/storage/pipeline/commit_batch_test.go index 15c2100cb..5ae2f171a 100644 --- a/storage/pipeline/commit_batch_test.go +++ b/storage/pipeline/commit_batch_test.go @@ -53,7 +53,6 @@ func TestCommitBatcher(t *testing.T) { WaitDealsDelay: time.Hour * 6, AlwaysKeepUnsealedCopy: true, - BatchPreCommits: true, MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, PreCommitBatchWait: 24 * time.Hour, PreCommitBatchSlack: 3 * time.Hour, diff --git a/storage/pipeline/fsm.go b/storage/pipeline/fsm.go index 8ae18a9fd..ac3dafa86 100644 --- a/storage/pipeline/fsm.go +++ b/storage/pipeline/fsm.go @@ -90,7 +90,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto on(SectorOldTicket{}, GetTicket), ), PreCommit2: planOne( - on(SectorPreCommit2{}, PreCommitting), + on(SectorPreCommit2{}, SubmitPreCommitBatch), on(SectorSealPreCommit2Failed{}, SealPreCommit2Failed), on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed), ), diff --git a/storage/pipeline/precommit_batch_test.go b/storage/pipeline/precommit_batch_test.go index 6951faad7..d75104f7a 100644 --- a/storage/pipeline/precommit_batch_test.go +++ b/storage/pipeline/precommit_batch_test.go @@ -56,7 +56,6 @@ func TestPrecommitBatcher(t *testing.T) { WaitDealsDelay: time.Hour * 6, AlwaysKeepUnsealedCopy: true, - BatchPreCommits: true, MaxPreCommitBatch: maxBatch, PreCommitBatchWait: 24 * time.Hour, PreCommitBatchSlack: 3 * time.Hour, diff --git a/storage/pipeline/sealiface/config.go b/storage/pipeline/sealiface/config.go index dbdb91d54..99715fc28 100644 --- a/storage/pipeline/sealiface/config.go +++ b/storage/pipeline/sealiface/config.go @@ -42,7 +42,6 @@ type Config struct { AvailableBalanceBuffer abi.TokenAmount DisableCollateralFallback bool - BatchPreCommits bool MaxPreCommitBatch int PreCommitBatchWait time.Duration PreCommitBatchSlack time.Duration diff --git a/storage/pipeline/sector_state.go b/storage/pipeline/sector_state.go index 84c08f43b..e1f5bfd69 100644 --- a/storage/pipeline/sector_state.go +++ b/storage/pipeline/sector_state.go @@ -82,7 +82,7 @@ const ( PreCommit1 SectorState = "PreCommit1" // do PreCommit1 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 SubmitPreCommitBatch SectorState = "SubmitPreCommitBatch" diff --git a/storage/pipeline/states_sealing.go b/storage/pipeline/states_sealing.go index 0608ead07..eed7a5ac6 100644 --- a/storage/pipeline/states_sealing.go +++ b/storage/pipeline/states_sealing.go @@ -377,62 +377,10 @@ func (m *Sealing) preCommitInfo(ctx statemachine.Context, sector SectorInfo) (*m } func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInfo) error { - cfg, err := m.getConfig() - if err != nil { - return xerrors.Errorf("getting config: %w", err) - } - - 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}) + // note: this is a legacy state handler, normally new sectors won't enter this state + // but we keep this handler in order to not break existing sector state machines. + // todo: drop after nv21 + return ctx.Send(SectorPreCommitBatch{}) } func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector SectorInfo) error { diff --git a/storage/pipeline/utils.go b/storage/pipeline/utils.go index ce4283b6c..4b99a5bea 100644 --- a/storage/pipeline/utils.go +++ b/storage/pipeline/utils.go @@ -10,7 +10,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "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/chain/types" @@ -127,14 +126,3 @@ func sendMsg(ctx context.Context, sa interface { 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, - } -}