From 556815f8449eab665ed22db9d38c4aae5069cebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 8 Aug 2023 15:12:50 +0200 Subject: [PATCH] sealing pipeline: Set commd in precommit params --- .../storageadapter/ondealsectorcommitted.go | 21 ++++++++++++++++++- storage/pipeline/states_sealing.go | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/markets/storageadapter/ondealsectorcommitted.go b/markets/storageadapter/ondealsectorcommitted.go index a8b22c62a..54ddb73b3 100644 --- a/markets/storageadapter/ondealsectorcommitted.go +++ b/markets/storageadapter/ondealsectorcommitted.go @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/builtin" + miner2 "github.com/filecoin-project/go-state-types/builtin/v11/miner" "github.com/filecoin-project/go-state-types/builtin/v8/miner" "github.com/filecoin-project/go-state-types/builtin/v9/market" @@ -107,7 +108,10 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context, // Watch for a pre-commit message to the provider. matchEvent := func(msg *types.Message) (bool, error) { - matched := msg.To == provider && (msg.Method == builtin.MethodsMiner.PreCommitSector || msg.Method == builtin.MethodsMiner.PreCommitSectorBatch || msg.Method == builtin.MethodsMiner.ProveReplicaUpdates) + matched := msg.To == provider && (msg.Method == builtin.MethodsMiner.PreCommitSector || + msg.Method == builtin.MethodsMiner.PreCommitSectorBatch || + msg.Method == builtin.MethodsMiner.PreCommitSectorBatch2 || + msg.Method == builtin.MethodsMiner.ProveReplicaUpdates) return matched, nil } @@ -333,6 +337,21 @@ func dealSectorInPreCommitMsg(msg *types.Message, res pipeline.CurrentDealInfo) return nil, xerrors.Errorf("unmarshal pre commit: %w", err) } + for _, precommit := range params.Sectors { + // Check through the deal IDs associated with this message + for _, did := range precommit.DealIDs { + if did == res.DealID { + // Found the deal ID in this message. Callback with the sector ID. + return &precommit.SectorNumber, nil + } + } + } + case builtin.MethodsMiner.PreCommitSectorBatch2: + var params miner2.PreCommitSectorBatchParams2 + if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { + return nil, xerrors.Errorf("unmarshal pre commit: %w", err) + } + for _, precommit := range params.Sectors { // Check through the deal IDs associated with this message for _, did := range precommit.DealIDs { diff --git a/storage/pipeline/states_sealing.go b/storage/pipeline/states_sealing.go index eed7a5ac6..d4e844a00 100644 --- a/storage/pipeline/states_sealing.go +++ b/storage/pipeline/states_sealing.go @@ -366,6 +366,8 @@ func (m *Sealing) preCommitInfo(ctx statemachine.Context, sector SectorInfo) (*m SealedCID: *sector.CommR, SealRandEpoch: sector.TicketEpoch, DealIDs: sector.dealIDs(), + + UnsealedCid: sector.CommD, } collateral, err := m.Api.StateMinerPreCommitDepositForPower(ctx.Context(), m.maddr, *params, ts.Key())