Actors update: MinerInfo.SealProofType has been removed
This commit is contained in:
parent
82635f2515
commit
ab90a3b2bc
@ -143,6 +143,24 @@ type DeclareFaultsRecoveredParams = miner0.DeclareFaultsRecoveredParams
|
|||||||
type SubmitWindowedPoStParams = miner0.SubmitWindowedPoStParams
|
type SubmitWindowedPoStParams = miner0.SubmitWindowedPoStParams
|
||||||
type ProveCommitSectorParams = miner0.ProveCommitSectorParams
|
type ProveCommitSectorParams = miner0.ProveCommitSectorParams
|
||||||
|
|
||||||
|
// TODO: This may need to be epoch-sensitive
|
||||||
|
func PreferredSealProofTypeFromWindowPoStType(proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
|
||||||
|
switch proof {
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
||||||
|
default:
|
||||||
|
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type MinerInfo struct {
|
type MinerInfo struct {
|
||||||
Owner address.Address // Must be an ID-address.
|
Owner address.Address // Must be an ID-address.
|
||||||
Worker address.Address // Must be an ID-address.
|
Worker address.Address // Must be an ID-address.
|
||||||
@ -151,7 +169,7 @@ type MinerInfo struct {
|
|||||||
WorkerChangeEpoch abi.ChainEpoch
|
WorkerChangeEpoch abi.ChainEpoch
|
||||||
PeerId *peer.ID
|
PeerId *peer.ID
|
||||||
Multiaddrs []abi.Multiaddrs
|
Multiaddrs []abi.Multiaddrs
|
||||||
SealProofType abi.RegisteredSealProof
|
WindowPoStProofType abi.RegisteredPoStProof
|
||||||
SectorSize abi.SectorSize
|
SectorSize abi.SectorSize
|
||||||
WindowPoStPartitionSectors uint64
|
WindowPoStPartitionSectors uint64
|
||||||
ConsensusFaultElapsed abi.ChainEpoch
|
ConsensusFaultElapsed abi.ChainEpoch
|
||||||
|
@ -297,6 +297,11 @@ func (s *state0) Info() (MinerInfo, error) {
|
|||||||
pid = &peerID
|
pid = &peerID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
||||||
|
if err != nil {
|
||||||
|
return MinerInfo{}, err
|
||||||
|
}
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
@ -307,7 +312,7 @@ func (s *state0) Info() (MinerInfo, error) {
|
|||||||
|
|
||||||
PeerId: pid,
|
PeerId: pid,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
SealProofType: info.SealProofType,
|
WindowPoStProofType: wpp,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||||
ConsensusFaultElapsed: -1,
|
ConsensusFaultElapsed: -1,
|
||||||
|
@ -296,6 +296,11 @@ func (s *state2) Info() (MinerInfo, error) {
|
|||||||
pid = &peerID
|
pid = &peerID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
||||||
|
if err != nil {
|
||||||
|
return MinerInfo{}, err
|
||||||
|
}
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
@ -306,7 +311,7 @@ func (s *state2) Info() (MinerInfo, error) {
|
|||||||
|
|
||||||
PeerId: pid,
|
PeerId: pid,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
SealProofType: info.SealProofType,
|
WindowPoStProofType: wpp,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
|
@ -207,17 +207,12 @@ func GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwra
|
|||||||
return nil, xerrors.Errorf("getting miner info: %w", err)
|
return nil, xerrors.Errorf("getting miner info: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
wpt, err := info.SealProofType.RegisteredWinningPoStProof()
|
|
||||||
if err != nil {
|
|
||||||
return nil, xerrors.Errorf("getting window proof type: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
mid, err := address.IDFromAddress(maddr)
|
mid, err := address.IDFromAddress(maddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("getting miner ID: %w", err)
|
return nil, xerrors.Errorf("getting miner ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ids, err := pv.GenerateWinningPoStSectorChallenge(ctx, wpt, abi.ActorID(mid), rand, numProvSect)
|
ids, err := pv.GenerateWinningPoStSectorChallenge(ctx, info.WindowPoStProofType, abi.ActorID(mid), rand, numProvSect)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("generating winning post challenges: %w", err)
|
return nil, xerrors.Errorf("generating winning post challenges: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -430,11 +430,6 @@ var provingCheckProvableCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pf, err := info.SealProofType.RegisteredWindowPoStProof()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
partitions, err := api.StateMinerPartitions(ctx, addr, dlIdx, types.EmptyTSK)
|
partitions, err := api.StateMinerPartitions(ctx, addr, dlIdx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -463,7 +458,7 @@ var provingCheckProvableCmd = &cli.Command{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
bad, err := sapi.CheckProvable(ctx, pf, tocheck, cctx.Bool("slow"))
|
bad, err := sapi.CheckProvable(ctx, info.WindowPoStProofType, tocheck, cctx.Bool("slow"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
2
extern/storage-sealing/sealing.go
vendored
2
extern/storage-sealing/sealing.go
vendored
@ -475,7 +475,7 @@ func (m *Sealing) currentSealProof(ctx context.Context) (abi.RegisteredSealProof
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return mi.SealProofType, nil
|
return miner.PreferredSealProofTypeFromWindowPoStType(mi.WindowPoStProofType)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storage.SectorRef {
|
func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storage.SectorRef {
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
miner2 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -179,7 +181,7 @@ func (n *ProviderNodeAdapter) GetProofType(ctx context.Context, miner address.Ad
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return mi.SealProofType, nil
|
return miner2.PreferredSealProofTypeFromWindowPoStType(mi.WindowPoStProofType)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*crypto.Signature, error) {
|
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*crypto.Signature, error) {
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-padreader"
|
"github.com/filecoin-project/go-padreader"
|
||||||
@ -157,6 +159,11 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams)
|
|||||||
dealStart = ts.Height() + abi.ChainEpoch(dealStartBufferHours*blocksPerHour) // TODO: Get this from storage ask
|
dealStart = ts.Height() + abi.ChainEpoch(dealStartBufferHours*blocksPerHour) // TODO: Get this from storage ask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
st, err := miner.PreferredSealProofTypeFromWindowPoStType(mi.WindowPoStProofType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to get seal proof type: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
result, err := a.SMDealClient.ProposeStorageDeal(ctx, storagemarket.ProposeStorageDealParams{
|
result, err := a.SMDealClient.ProposeStorageDeal(ctx, storagemarket.ProposeStorageDealParams{
|
||||||
Addr: params.Wallet,
|
Addr: params.Wallet,
|
||||||
Info: &providerInfo,
|
Info: &providerInfo,
|
||||||
@ -165,7 +172,7 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams)
|
|||||||
EndEpoch: calcDealExpiration(params.MinBlocksDuration, md, dealStart),
|
EndEpoch: calcDealExpiration(params.MinBlocksDuration, md, dealStart),
|
||||||
Price: params.EpochPrice,
|
Price: params.EpochPrice,
|
||||||
Collateral: params.ProviderCollateral,
|
Collateral: params.ProviderCollateral,
|
||||||
Rt: mi.SealProofType,
|
Rt: st,
|
||||||
FastRetrieval: params.FastRetrieval,
|
FastRetrieval: params.FastRetrieval,
|
||||||
VerifiedDeal: params.VerifiedDeal,
|
VerifiedDeal: params.VerifiedDeal,
|
||||||
StoreID: storeID,
|
StoreID: storeID,
|
||||||
|
@ -140,15 +140,10 @@ func (m *StateModule) StateMinerInfo(ctx context.Context, actor address.Address,
|
|||||||
return miner.MinerInfo{}, xerrors.Errorf("failed to load miner actor state: %w", err)
|
return miner.MinerInfo{}, xerrors.Errorf("failed to load miner actor state: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: You know, this is terrible.
|
|
||||||
// I mean, we _really_ shouldn't do this. Maybe we should convert somewhere else?
|
|
||||||
info, err := mas.Info()
|
info, err := mas.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return miner.MinerInfo{}, err
|
return miner.MinerInfo{}, err
|
||||||
}
|
}
|
||||||
if m.StateManager.GetNtwkVersion(ctx, ts.Height()) >= network.Version7 && info.SealProofType < abi.RegisteredSealProof_StackedDrg2KiBV1_1 {
|
|
||||||
info.SealProofType += abi.RegisteredSealProof_StackedDrg2KiBV1_1
|
|
||||||
}
|
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
miner2 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
"go.uber.org/multierr"
|
"go.uber.org/multierr"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -128,7 +130,7 @@ func SealProofType(maddr dtypes.MinerAddress, fnapi lapi.FullNode) (abi.Register
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return mi.SealProofType, nil
|
return miner2.PreferredSealProofTypeFromWindowPoStType(mi.WindowPoStProofType)
|
||||||
}
|
}
|
||||||
|
|
||||||
type sidsc struct {
|
type sidsc struct {
|
||||||
|
@ -225,18 +225,13 @@ func NewWinningPoStProver(api api.FullNode, prover storage.Prover, verifier ffiw
|
|||||||
return nil, xerrors.Errorf("getting sector size: %w", err)
|
return nil, xerrors.Errorf("getting sector size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
wpt, err := mi.SealProofType.RegisteredWinningPoStProof()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if build.InsecurePoStValidation {
|
if build.InsecurePoStValidation {
|
||||||
log.Warn("*****************************************************************************")
|
log.Warn("*****************************************************************************")
|
||||||
log.Warn(" Generating fake PoSt proof! You should only see this while running tests! ")
|
log.Warn(" Generating fake PoSt proof! You should only see this while running tests! ")
|
||||||
log.Warn("*****************************************************************************")
|
log.Warn("*****************************************************************************")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &StorageWpp{prover, verifier, abi.ActorID(miner), wpt}, nil
|
return &StorageWpp{prover, verifier, abi.ActorID(miner), mi.WindowPoStProofType}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ gen.WinningPoStProver = (*StorageWpp)(nil)
|
var _ gen.WinningPoStProver = (*StorageWpp)(nil)
|
||||||
|
@ -47,18 +47,13 @@ func NewWindowedPoStScheduler(api storageMinerApi, fc config.MinerFeeConfig, as
|
|||||||
return nil, xerrors.Errorf("getting sector size: %w", err)
|
return nil, xerrors.Errorf("getting sector size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
rt, err := mi.SealProofType.RegisteredWindowPoStProof()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &WindowPoStScheduler{
|
return &WindowPoStScheduler{
|
||||||
api: api,
|
api: api,
|
||||||
feeCfg: fc,
|
feeCfg: fc,
|
||||||
addrSel: as,
|
addrSel: as,
|
||||||
prover: sb,
|
prover: sb,
|
||||||
faultTracker: ft,
|
faultTracker: ft,
|
||||||
proofType: rt,
|
proofType: mi.WindowPoStProofType,
|
||||||
partitionSectors: mi.WindowPoStPartitionSectors,
|
partitionSectors: mi.WindowPoStPartitionSectors,
|
||||||
|
|
||||||
actor: actor,
|
actor: actor,
|
||||||
|
Loading…
Reference in New Issue
Block a user