fix: sealing: Use PRU3 After Nv22 (#11831)

This commit is contained in:
Łukasz Magiera 2024-04-05 20:58:00 +02:00 committed by GitHub
parent 8163e6a91e
commit dd6fef807b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 22 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -170,7 +171,12 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
// figure out message type // figure out message type
pams, deals, err := m.processPieces(ctx.Context(), sector) nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
if err != nil {
log.Errorf("failed to get network version: %+v", err)
}
pams, deals, err := m.processPieces(ctx.Context(), sector, nv >= network.Version22)
if err != nil { if err != nil {
log.Errorf("failed to process pieces: %+v", err) log.Errorf("failed to process pieces: %+v", err)
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) return ctx.Send(SectorSubmitReplicaUpdateFailed{})

View File

@ -748,11 +748,13 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
// processPieces returns either: // processPieces returns either:
// - a list of piece activation manifests // - a list of piece activation manifests
// - a list of deal IDs, if all non-filler pieces are deal-id pieces // - a list of deal IDs, if all non-filler pieces are deal-id pieces
func (m *Sealing) processPieces(ctx context.Context, sector SectorInfo) ([]miner.PieceActivationManifest, []abi.DealID, error) { func (m *Sealing) processPieces(ctx context.Context, sector SectorInfo, forceDDO bool) ([]miner.PieceActivationManifest, []abi.DealID, error) {
pams := make([]miner.PieceActivationManifest, 0, len(sector.Pieces)) pams := make([]miner.PieceActivationManifest, 0, len(sector.Pieces))
dealIDs := make([]abi.DealID, 0, len(sector.Pieces)) dealIDs := make([]abi.DealID, 0, len(sector.Pieces))
var hasDDO bool hasDDO := forceDDO
if !forceDDO {
// if not forcing DDO, check if we have any DDO pieces
for _, piece := range sector.Pieces { for _, piece := range sector.Pieces {
piece := piece piece := piece
@ -774,6 +776,7 @@ func (m *Sealing) processPieces(ctx context.Context, sector SectorInfo) ([]miner
return nil, nil, xerrors.Errorf("handleDealInfo: %w", err) return nil, nil, xerrors.Errorf("handleDealInfo: %w", err)
} }
} }
}
for _, piece := range sector.Pieces { for _, piece := range sector.Pieces {
piece := piece piece := piece
@ -847,7 +850,7 @@ func (m *Sealing) handleSubmitCommitAggregate(ctx statemachine.Context, sector S
return ctx.Send(SectorCommitFailed{xerrors.Errorf("sector had nil commR or commD")}) return ctx.Send(SectorCommitFailed{xerrors.Errorf("sector had nil commR or commD")})
} }
pams, dealIDs, err := m.processPieces(ctx.Context(), sector) pams, dealIDs, err := m.processPieces(ctx.Context(), sector, false)
if err != nil { if err != nil {
return err return err
} }