Skip to content

Commit

Permalink
fix: sealing: Use PRU3 After Nv22 (#11831)
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k authored Apr 5, 2024
1 parent 8163e6a commit dd6fef8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
8 changes: 7 additions & 1 deletion storage/pipeline/states_replica_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin"
"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/lotus/api"
Expand Down Expand Up @@ -170,7 +171,12 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec

// 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 {
log.Errorf("failed to process pieces: %+v", err)
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
Expand Down
45 changes: 24 additions & 21 deletions storage/pipeline/states_sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,30 +748,33 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
// processPieces returns either:
// - a list of piece activation manifests
// - 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))
dealIDs := make([]abi.DealID, 0, len(sector.Pieces))
var hasDDO bool
hasDDO := forceDDO

for _, piece := range sector.Pieces {
piece := piece
if !forceDDO {
// if not forcing DDO, check if we have any DDO pieces
for _, piece := range sector.Pieces {
piece := piece

// first figure out if this is a ddo sector
err := piece.handleDealInfo(handleDealInfoParams{
FillerHandler: func(info UniversalPieceInfo) error {
// Fillers are implicit (todo review: Are they??)
return nil
},
BuiltinMarketHandler: func(info UniversalPieceInfo) error {
return nil
},
DDOHandler: func(info UniversalPieceInfo) error {
hasDDO = true
return nil
},
})
if err != nil {
return nil, nil, xerrors.Errorf("handleDealInfo: %w", err)
// first figure out if this is a ddo sector
err := piece.handleDealInfo(handleDealInfoParams{
FillerHandler: func(info UniversalPieceInfo) error {
// Fillers are implicit (todo review: Are they??)
return nil
},
BuiltinMarketHandler: func(info UniversalPieceInfo) error {
return nil
},
DDOHandler: func(info UniversalPieceInfo) error {
hasDDO = true
return nil
},
})
if err != nil {
return nil, nil, xerrors.Errorf("handleDealInfo: %w", err)
}
}
}
for _, piece := range sector.Pieces {
Expand Down Expand Up @@ -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")})
}

pams, dealIDs, err := m.processPieces(ctx.Context(), sector)
pams, dealIDs, err := m.processPieces(ctx.Context(), sector, false)
if err != nil {
return err
}
Expand Down

0 comments on commit dd6fef8

Please sign in to comment.