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 {
|
||||
a, _ := address.NewFromString("t00")
|
||||
b, _ := address.NewFromString("t02")
|
||||
ts, err := types.NewTipSet([]*types.BlockHeader{
|
||||
var ts, err = types.NewTipSet([]*types.BlockHeader{
|
||||
{
|
||||
Height: h,
|
||||
Miner: a,
|
||||
|
||||
Ticket: &types.Ticket{[]byte{byte(h % 2)}},
|
||||
Ticket: &types.Ticket{VRFProof: []byte{byte(h % 2)}},
|
||||
|
||||
ParentStateRoot: dummyCid,
|
||||
Messages: msgcid,
|
||||
@ -73,7 +73,7 @@ func makeTs(t *testing.T, h uint64, msgcid cid.Cid) *types.TipSet {
|
||||
Height: h,
|
||||
Miner: b,
|
||||
|
||||
Ticket: &types.Ticket{[]byte{byte((h + 1) % 2)}},
|
||||
Ticket: &types.Ticket{VRFProof: []byte{byte((h + 1) % 2)}},
|
||||
|
||||
ParentStateRoot: dummyCid,
|
||||
Messages: msgcid,
|
||||
|
@ -448,13 +448,11 @@ type ElectionPoStProver interface {
|
||||
ComputeProof(context.Context, sectorbuilder.SortedPublicSectorInfo, []byte, []sectorbuilder.EPostCandidate) ([]byte, error)
|
||||
}
|
||||
|
||||
type eppProvider struct {
|
||||
sectors []ffi.PublicSectorInfo
|
||||
}
|
||||
type eppProvider struct{}
|
||||
|
||||
func (epp *eppProvider) GenerateCandidates(ctx context.Context, _ sectorbuilder.SortedPublicSectorInfo, eprand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
||||
return []sectorbuilder.EPostCandidate{
|
||||
sectorbuilder.EPostCandidate{
|
||||
{
|
||||
SectorID: 1,
|
||||
PartialTicket: [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 {
|
||||
ctx, span := trace.StartSpan(ctx, "VerifyVRF")
|
||||
_, span := trace.StartSpan(ctx, "VerifyVRF")
|
||||
defer span.End()
|
||||
|
||||
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) {
|
||||
ctx, span := trace.StartSpan(ctx, "store.GetRandomness")
|
||||
_, span := trace.StartSpan(ctx, "store.GetRandomness")
|
||||
defer span.End()
|
||||
span.AddAttributes(trace.Int64Attribute("round", round))
|
||||
|
||||
|
@ -370,10 +370,10 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode,
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -122,8 +122,7 @@ func TestSealAndVerify(t *testing.T) {
|
||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||
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}
|
||||
|
||||
@ -192,8 +191,7 @@ func TestSealPoStNoCommit(t *testing.T) {
|
||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||
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}
|
||||
|
||||
@ -255,8 +253,7 @@ func TestSealAndVerify2(t *testing.T) {
|
||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||
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}
|
||||
|
||||
|
@ -9,15 +9,14 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/ipfs/go-blockservice"
|
||||
"github.com/ipfs/go-car"
|
||||
"github.com/ipfs/go-cid"
|
||||
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
||||
logging "github.com/ipfs/go-log"
|
||||
"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/gen"
|
||||
|
@ -38,7 +38,7 @@ import (
|
||||
)
|
||||
|
||||
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 {
|
||||
@ -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) {
|
||||
|
@ -143,17 +143,17 @@ func (m *Miner) runPreflightChecks(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type sectorBuilderEpp struct {
|
||||
type SectorBuilderEpp struct {
|
||||
sb *sectorbuilder.SectorBuilder
|
||||
}
|
||||
|
||||
func NewElectionPoStProver(sb *sectorbuilder.SectorBuilder) *sectorBuilderEpp {
|
||||
return §orBuilderEpp{sb}
|
||||
func NewElectionPoStProver(sb *sectorbuilder.SectorBuilder) *SectorBuilderEpp {
|
||||
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 randbuf [32]byte
|
||||
@ -161,7 +161,7 @@ func (epp *sectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorb
|
||||
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 {
|
||||
log.Warn("Generating fake EPost proof! You should only see this while running tests!")
|
||||
return []byte("valid proof"), nil
|
||||
|
@ -2,13 +2,13 @@ package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/filecoin-project/lotus/lib/padreader"
|
||||
"io"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/lib/padreader"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
)
|
||||
|
||||
@ -142,7 +142,8 @@ func (m *Miner) sectorStateLoop(ctx context.Context) error {
|
||||
// verify on-chain state
|
||||
trackedByID := map[uint64]*SectorInfo{}
|
||||
for _, si := range trackedSectors {
|
||||
trackedByID[si.SectorID] = &si
|
||||
i := si
|
||||
trackedByID[si.SectorID] = &i
|
||||
}
|
||||
|
||||
curTs, err := m.api.ChainHead(ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user