Buch of lint fixes
This commit is contained in:
parent
e239fe41d4
commit
d5b94884c8
@ -55,12 +55,12 @@ func (fcs *fakeCS) ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet
|
|||||||
func makeTs(t *testing.T, h uint64, msgcid cid.Cid) *types.TipSet {
|
func makeTs(t *testing.T, h uint64, msgcid cid.Cid) *types.TipSet {
|
||||||
a, _ := address.NewFromString("t00")
|
a, _ := address.NewFromString("t00")
|
||||||
b, _ := address.NewFromString("t02")
|
b, _ := address.NewFromString("t02")
|
||||||
ts, err := types.NewTipSet([]*types.BlockHeader{
|
var ts, err = types.NewTipSet([]*types.BlockHeader{
|
||||||
{
|
{
|
||||||
Height: h,
|
Height: h,
|
||||||
Miner: a,
|
Miner: a,
|
||||||
|
|
||||||
Ticket: &types.Ticket{[]byte{byte(h % 2)}},
|
Ticket: &types.Ticket{VRFProof: []byte{byte(h % 2)}},
|
||||||
|
|
||||||
ParentStateRoot: dummyCid,
|
ParentStateRoot: dummyCid,
|
||||||
Messages: msgcid,
|
Messages: msgcid,
|
||||||
@ -73,7 +73,7 @@ func makeTs(t *testing.T, h uint64, msgcid cid.Cid) *types.TipSet {
|
|||||||
Height: h,
|
Height: h,
|
||||||
Miner: b,
|
Miner: b,
|
||||||
|
|
||||||
Ticket: &types.Ticket{[]byte{byte((h + 1) % 2)}},
|
Ticket: &types.Ticket{VRFProof: []byte{byte((h + 1) % 2)}},
|
||||||
|
|
||||||
ParentStateRoot: dummyCid,
|
ParentStateRoot: dummyCid,
|
||||||
Messages: msgcid,
|
Messages: msgcid,
|
||||||
|
@ -448,13 +448,11 @@ type ElectionPoStProver interface {
|
|||||||
ComputeProof(context.Context, sectorbuilder.SortedPublicSectorInfo, []byte, []sectorbuilder.EPostCandidate) ([]byte, error)
|
ComputeProof(context.Context, sectorbuilder.SortedPublicSectorInfo, []byte, []sectorbuilder.EPostCandidate) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type eppProvider struct {
|
type eppProvider struct{}
|
||||||
sectors []ffi.PublicSectorInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
func (epp *eppProvider) GenerateCandidates(ctx context.Context, _ sectorbuilder.SortedPublicSectorInfo, eprand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
func (epp *eppProvider) GenerateCandidates(ctx context.Context, _ sectorbuilder.SortedPublicSectorInfo, eprand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
||||||
return []sectorbuilder.EPostCandidate{
|
return []sectorbuilder.EPostCandidate{
|
||||||
sectorbuilder.EPostCandidate{
|
{
|
||||||
SectorID: 1,
|
SectorID: 1,
|
||||||
PartialTicket: [32]byte{},
|
PartialTicket: [32]byte{},
|
||||||
Ticket: [32]byte{},
|
Ticket: [32]byte{},
|
||||||
@ -577,7 +575,7 @@ func hashVRFBase(personalization uint64, miner address.Address, input []byte) ([
|
|||||||
}
|
}
|
||||||
|
|
||||||
func VerifyVRF(ctx context.Context, worker, miner address.Address, p uint64, input, vrfproof []byte) error {
|
func VerifyVRF(ctx context.Context, worker, miner address.Address, p uint64, input, vrfproof []byte) error {
|
||||||
ctx, span := trace.StartSpan(ctx, "VerifyVRF")
|
_, span := trace.StartSpan(ctx, "VerifyVRF")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
vrfBase, err := hashVRFBase(p, miner, input)
|
vrfBase, err := hashVRFBase(p, miner, input)
|
||||||
|
@ -800,7 +800,7 @@ func drawRandomness(t *types.Ticket, round int64) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cs *ChainStore) GetRandomness(ctx context.Context, blks []cid.Cid, round int64) ([]byte, error) {
|
func (cs *ChainStore) GetRandomness(ctx context.Context, blks []cid.Cid, round int64) ([]byte, error) {
|
||||||
ctx, span := trace.StartSpan(ctx, "store.GetRandomness")
|
_, span := trace.StartSpan(ctx, "store.GetRandomness")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
span.AddAttributes(trace.Int64Attribute("round", round))
|
span.AddAttributes(trace.Int64Attribute("round", round))
|
||||||
|
|
||||||
|
@ -370,10 +370,10 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
} else {
|
}
|
||||||
if err := configureStorageMiner(ctx, api, a, peerid); err != nil {
|
|
||||||
return xerrors.Errorf("failed to configure storage miner: %w", err)
|
if err := configureStorageMiner(ctx, api, a, peerid); err != nil {
|
||||||
}
|
return xerrors.Errorf("failed to configure storage miner: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = a
|
addr = a
|
||||||
|
@ -122,8 +122,7 @@ func TestSealAndVerify(t *testing.T) {
|
|||||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||||
t.Skip("this is slow")
|
t.Skip("this is slow")
|
||||||
}
|
}
|
||||||
os.Setenv("BELLMAN_NO_GPU", "1")
|
_ = os.Setenv("RUST_LOG", "info")
|
||||||
os.Setenv("RUST_LOG", "info")
|
|
||||||
|
|
||||||
build.SectorSizes = []uint64{sectorSize}
|
build.SectorSizes = []uint64{sectorSize}
|
||||||
|
|
||||||
@ -192,8 +191,7 @@ func TestSealPoStNoCommit(t *testing.T) {
|
|||||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||||
t.Skip("this is slow")
|
t.Skip("this is slow")
|
||||||
}
|
}
|
||||||
os.Setenv("BELLMAN_NO_GPU", "1")
|
_ = os.Setenv("RUST_LOG", "info")
|
||||||
os.Setenv("RUST_LOG", "info")
|
|
||||||
|
|
||||||
build.SectorSizes = []uint64{sectorSize}
|
build.SectorSizes = []uint64{sectorSize}
|
||||||
|
|
||||||
@ -255,8 +253,7 @@ func TestSealAndVerify2(t *testing.T) {
|
|||||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||||
t.Skip("this is slow")
|
t.Skip("this is slow")
|
||||||
}
|
}
|
||||||
os.Setenv("BELLMAN_NO_GPU", "1")
|
_ = os.Setenv("RUST_LOG", "info")
|
||||||
os.Setenv("RUST_LOG", "info")
|
|
||||||
|
|
||||||
build.SectorSizes = []uint64{sectorSize}
|
build.SectorSizes = []uint64{sectorSize}
|
||||||
|
|
||||||
|
@ -9,15 +9,14 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-blockservice"
|
"github.com/ipfs/go-blockservice"
|
||||||
"github.com/ipfs/go-car"
|
"github.com/ipfs/go-car"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
||||||
logging "github.com/ipfs/go-log"
|
logging "github.com/ipfs/go-log"
|
||||||
"github.com/ipfs/go-merkledag"
|
"github.com/ipfs/go-merkledag"
|
||||||
peer "github.com/libp2p/go-libp2p-peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/address"
|
"github.com/filecoin-project/lotus/chain/address"
|
||||||
"github.com/filecoin-project/lotus/chain/gen"
|
"github.com/filecoin-project/lotus/chain/gen"
|
||||||
|
@ -38,7 +38,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
logging.SetLogLevel("*", "INFO")
|
_ = logging.SetLogLevel("*", "INFO")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, act address.Address, pk crypto.PrivKey, tnd test.TestNode, mn mocknet.Mocknet) test.TestStorageNode {
|
func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, act address.Address, pk crypto.PrivKey, tnd test.TestNode, mn mocknet.Mocknet) test.TestStorageNode {
|
||||||
@ -121,7 +121,7 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return test.TestStorageNode{minerapi, mineOne}
|
return test.TestStorageNode{StorageMiner: minerapi, MineOne: mineOne}
|
||||||
}
|
}
|
||||||
|
|
||||||
func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.TestStorageNode) {
|
func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.TestStorageNode) {
|
||||||
|
@ -143,17 +143,17 @@ func (m *Miner) runPreflightChecks(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type sectorBuilderEpp struct {
|
type SectorBuilderEpp struct {
|
||||||
sb *sectorbuilder.SectorBuilder
|
sb *sectorbuilder.SectorBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewElectionPoStProver(sb *sectorbuilder.SectorBuilder) *sectorBuilderEpp {
|
func NewElectionPoStProver(sb *sectorbuilder.SectorBuilder) *SectorBuilderEpp {
|
||||||
return §orBuilderEpp{sb}
|
return &SectorBuilderEpp{sb}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ gen.ElectionPoStProver = (*sectorBuilderEpp)(nil)
|
var _ gen.ElectionPoStProver = (*SectorBuilderEpp)(nil)
|
||||||
|
|
||||||
func (epp *sectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
func (epp *SectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
||||||
var faults []uint64 // TODO
|
var faults []uint64 // TODO
|
||||||
|
|
||||||
var randbuf [32]byte
|
var randbuf [32]byte
|
||||||
@ -161,7 +161,7 @@ func (epp *sectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorb
|
|||||||
return epp.sb.GenerateEPostCandidates(ssi, randbuf, faults)
|
return epp.sb.GenerateEPostCandidates(ssi, randbuf, faults)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (epp *sectorBuilderEpp) ComputeProof(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte, winners []sectorbuilder.EPostCandidate) ([]byte, error) {
|
func (epp *SectorBuilderEpp) ComputeProof(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte, winners []sectorbuilder.EPostCandidate) ([]byte, error) {
|
||||||
if build.InsecurePoStValidation {
|
if build.InsecurePoStValidation {
|
||||||
log.Warn("Generating fake EPost proof! You should only see this while running tests!")
|
log.Warn("Generating fake EPost proof! You should only see this while running tests!")
|
||||||
return []byte("valid proof"), nil
|
return []byte("valid proof"), nil
|
||||||
|
@ -2,13 +2,13 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/filecoin-project/lotus/lib/padreader"
|
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
xerrors "golang.org/x/xerrors"
|
xerrors "golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
|
"github.com/filecoin-project/lotus/lib/padreader"
|
||||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -142,7 +142,8 @@ func (m *Miner) sectorStateLoop(ctx context.Context) error {
|
|||||||
// verify on-chain state
|
// verify on-chain state
|
||||||
trackedByID := map[uint64]*SectorInfo{}
|
trackedByID := map[uint64]*SectorInfo{}
|
||||||
for _, si := range trackedSectors {
|
for _, si := range trackedSectors {
|
||||||
trackedByID[si.SectorID] = &si
|
i := si
|
||||||
|
trackedByID[si.SectorID] = &i
|
||||||
}
|
}
|
||||||
|
|
||||||
curTs, err := m.api.ChainHead(ctx)
|
curTs, err := m.api.ChainHead(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user