Fix lotus-miner proving check
This commit is contained in:
parent
950e6116e5
commit
95af40543a
@ -320,7 +320,7 @@ type StorageMiner interface {
|
|||||||
// the path specified when calling CreateBackup is within the base path
|
// the path specified when calling CreateBackup is within the base path
|
||||||
CreateBackup(ctx context.Context, fpath string) error //perm:admin
|
CreateBackup(ctx context.Context, fpath string) error //perm:admin
|
||||||
|
|
||||||
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin
|
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef) (map[abi.SectorNumber]string, error) //perm:admin
|
||||||
|
|
||||||
ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, poStEpoch abi.ChainEpoch, nv abinetwork.Version) ([]builtin.PoStProof, error) //perm:read
|
ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, poStEpoch abi.ChainEpoch, nv abinetwork.Version) ([]builtin.PoStProof, error) //perm:read
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ type StorageMinerStruct struct {
|
|||||||
|
|
||||||
BeneficiaryWithdrawBalance func(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) `perm:"admin"`
|
BeneficiaryWithdrawBalance func(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) `perm:"admin"`
|
||||||
|
|
||||||
CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"`
|
CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef) (map[abi.SectorNumber]string, error) `perm:"admin"`
|
||||||
|
|
||||||
ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) `perm:"admin"`
|
ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) `perm:"admin"`
|
||||||
|
|
||||||
@ -4134,14 +4134,14 @@ func (s *StorageMinerStub) BeneficiaryWithdrawBalance(p0 context.Context, p1 abi
|
|||||||
return *new(cid.Cid), ErrNotSupported
|
return *new(cid.Cid), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
|
func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef) (map[abi.SectorNumber]string, error) {
|
||||||
if s.Internal.CheckProvable == nil {
|
if s.Internal.CheckProvable == nil {
|
||||||
return *new(map[abi.SectorNumber]string), ErrNotSupported
|
return *new(map[abi.SectorNumber]string), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.CheckProvable(p0, p1, p2, p3)
|
return s.Internal.CheckProvable(p0, p1, p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
|
func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef) (map[abi.SectorNumber]string, error) {
|
||||||
return *new(map[abi.SectorNumber]string), ErrNotSupported
|
return *new(map[abi.SectorNumber]string), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -583,7 +583,7 @@ var provingCheckProvableCmd = &cli.Command{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
bad, err := minerApi.CheckProvable(ctx, info.WindowPoStProofType, tocheck, cctx.Bool("slow"))
|
bad, err := minerApi.CheckProvable(ctx, info.WindowPoStProofType, tocheck)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -415,8 +415,7 @@ Inputs:
|
|||||||
},
|
},
|
||||||
"ProofType": 8
|
"ProofType": 8
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
true
|
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ func checkSectors(ctx context.Context, t *testing.T, api kit.TestFullNode, miner
|
|||||||
|
|
||||||
require.Len(t, tocheck, expectChecked)
|
require.Len(t, tocheck, expectChecked)
|
||||||
|
|
||||||
bad, err := miner.CheckProvable(ctx, info.WindowPoStProofType, tocheck, true)
|
bad, err := miner.CheckProvable(ctx, info.WindowPoStProofType, tocheck)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, bad, expectBad)
|
require.Len(t, bad, expectBad)
|
||||||
}
|
}
|
||||||
|
@ -1295,20 +1295,17 @@ func (sm *StorageMinerAPI) CreateBackup(ctx context.Context, fpath string) error
|
|||||||
return backup(ctx, sm.DS, fpath)
|
return backup(ctx, sm.DS, fpath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) {
|
func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef) (map[abi.SectorNumber]string, error) {
|
||||||
var rg storiface.RGetter
|
rg := func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
||||||
if expensive {
|
si, err := sm.Miner.SectorsStatus(ctx, id.Number, false)
|
||||||
rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
if err != nil {
|
||||||
si, err := sm.Miner.SectorsStatus(ctx, id.Number, false)
|
return cid.Undef, false, err
|
||||||
if err != nil {
|
|
||||||
return cid.Undef, false, err
|
|
||||||
}
|
|
||||||
if si.CommR == nil {
|
|
||||||
return cid.Undef, false, xerrors.Errorf("commr is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
return *si.CommR, si.ReplicaUpdateMessage != nil, nil
|
|
||||||
}
|
}
|
||||||
|
if si.CommR == nil {
|
||||||
|
return cid.Undef, false, xerrors.Errorf("commr is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
return *si.CommR, si.ReplicaUpdateMessage != nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
bad, err := sm.StorageMgr.CheckProvable(ctx, pp, sectors, rg)
|
bad, err := sm.StorageMgr.CheckProvable(ctx, pp, sectors, rg)
|
||||||
|
Loading…
Reference in New Issue
Block a user