Fix even more lint warnings

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-02 16:29:39 +02:00
parent c6b6c2990c
commit 5605aae269
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
44 changed files with 204 additions and 216 deletions

View File

@ -38,6 +38,10 @@ issues:
linters:
- golint
- path: api/apistruct/struct.go
linters:
- golint
- path: .*_test.go
linters:
- gosec

View File

@ -193,8 +193,7 @@ func (v *Visitor) Visit(node ast.Node) ast.Visitor {
const noComment = "There are not yet any comments for this method."
func parseApiASTInfo() (map[string]string, map[string]string) {
func parseApiASTInfo() (map[string]string, map[string]string) { //nolint:golint
fset := token.NewFileSet()
pkgs, err := parser.ParseDir(fset, "./api", nil, parser.AllErrors|parser.ParseComments)
if err != nil {

View File

@ -35,7 +35,7 @@ func init() {
}
func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport bool) {
os.Setenv("BELLMAN_NO_GPU", "1")
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 1, oneMiner)
@ -72,7 +72,7 @@ func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport
}
func TestDoubleDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration) {
os.Setenv("BELLMAN_NO_GPU", "1")
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 1, oneMiner)

View File

@ -82,7 +82,7 @@ func (ts *testSuite) testMiningReal(t *testing.T) {
}
func TestDealMining(t *testing.T, b APIBuilder, blocktime time.Duration, carExport bool) {
os.Setenv("BELLMAN_NO_GPU", "1")
_ = os.Setenv("BELLMAN_NO_GPU", "1")
// test making a deal with a fresh miner, and see if it starts to mine

View File

@ -55,7 +55,7 @@ func (ve Version) EqMajorMinor(v2 Version) bool {
// APIVersion is a semver version of the rpc api exposed
var APIVersion Version = newVer(0, 3, 0)
//nolint:varcheck
//nolint:varcheck,deadcode
const (
majorMask = 0xff0000
minorMask = 0xffff00

View File

@ -561,27 +561,31 @@ func (bpt *bsPeerTracker) logSuccess(p peer.ID, dur time.Duration) {
bpt.lk.Lock()
defer bpt.lk.Unlock()
if pi, ok := bpt.peers[p]; !ok {
var pi *peerStats
var ok bool
if pi, ok = bpt.peers[p]; !ok {
log.Warnw("log success called on peer not in tracker", "peerid", p.String())
return
} else {
pi.successes++
logTime(pi, dur)
}
pi.successes++
logTime(pi, dur)
}
func (bpt *bsPeerTracker) logFailure(p peer.ID, dur time.Duration) {
bpt.lk.Lock()
defer bpt.lk.Unlock()
if pi, ok := bpt.peers[p]; !ok {
var pi *peerStats
var ok bool
if pi, ok = bpt.peers[p]; !ok {
log.Warn("log failure called on peer not in tracker", "peerid", p.String())
return
} else {
}
pi.failures++
logTime(pi, dur)
}
}
func (bpt *bsPeerTracker) removePeer(p peer.ID) {
bpt.lk.Lock()

View File

@ -19,7 +19,7 @@ import (
var log = logging.Logger("events")
// `curH`-`ts.Height` = `confidence`
// HeightHandler `curH`-`ts.Height` = `confidence`
type HeightHandler func(ctx context.Context, ts *types.TipSet, curH abi.ChainEpoch) error
type RevertHandler func(ctx context.Context, ts *types.TipSet) error
@ -31,7 +31,7 @@ type heightHandler struct {
revert RevertHandler
}
type eventApi interface {
type eventAPI interface {
ChainNotify(context.Context) (<-chan []*api.HeadChange, error)
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
ChainGetTipSetByHeight(context.Context, abi.ChainEpoch, types.TipSetKey) (*types.TipSet, error)
@ -42,7 +42,7 @@ type eventApi interface {
}
type Events struct {
api eventApi
api eventAPI
tsc *tipSetCache
lk sync.Mutex
@ -54,7 +54,7 @@ type Events struct {
calledEvents
}
func NewEvents(ctx context.Context, api eventApi) *Events {
func NewEvents(ctx context.Context, api eventAPI) *Events {
gcConfidence := 2 * build.ForkLengthThreshold
tsc := newTSCache(gcConfidence, api.ChainGetTipSetByHeight)
@ -82,9 +82,9 @@ func NewEvents(ctx context.Context, api eventApi) *Events {
confQueue: map[triggerH]map[msgH][]*queuedEvent{},
revertQueue: map[msgH][]triggerH{},
triggers: map[triggerId]*callHandler{},
matchers: map[triggerId][]MatchFunc{},
timeouts: map[abi.ChainEpoch]map[triggerId]int{},
triggers: map[triggerID]*callHandler{},
matchers: map[triggerID][]MatchFunc{},
timeouts: map[abi.ChainEpoch]map[triggerID]int{},
},
}

View File

@ -14,7 +14,7 @@ import (
const NoTimeout = math.MaxInt64
type triggerId = uint64
type triggerID = uint64
// msgH is the block height at which a message was present / event has happened
type msgH = abi.ChainEpoch
@ -23,6 +23,7 @@ type msgH = abi.ChainEpoch
// message (msgH+confidence)
type triggerH = abi.ChainEpoch
// CalledHandler
// `ts` is the tipset, in which the `msg` is included.
// `curH`-`ts.Height` = `confidence`
type CalledHandler func(msg *types.Message, rec *types.MessageReceipt, ts *types.TipSet, curH abi.ChainEpoch) (more bool, err error)
@ -48,7 +49,7 @@ type callHandler struct {
}
type queuedEvent struct {
trigger triggerId
trigger triggerID
h abi.ChainEpoch
msg *types.Message
@ -57,7 +58,7 @@ type queuedEvent struct {
}
type calledEvents struct {
cs eventApi
cs eventAPI
tsc *tipSetCache
ctx context.Context
gcConfidence uint64
@ -66,10 +67,10 @@ type calledEvents struct {
lk sync.Mutex
ctr triggerId
ctr triggerID
triggers map[triggerId]*callHandler
matchers map[triggerId][]MatchFunc
triggers map[triggerID]*callHandler
matchers map[triggerID][]MatchFunc
// maps block heights to events
// [triggerH][msgH][event]
@ -78,8 +79,8 @@ type calledEvents struct {
// [msgH][triggerH]
revertQueue map[msgH][]triggerH
// [timeoutH+confidence][triggerId]{calls}
timeouts map[abi.ChainEpoch]map[triggerId]int
// [timeoutH+confidence][triggerID]{calls}
timeouts map[abi.ChainEpoch]map[triggerID]int
}
func (e *calledEvents) headChangeCalled(rev, app []*types.TipSet) error {
@ -157,8 +158,8 @@ func (e *calledEvents) checkNewCalls(ts *types.TipSet) {
})
}
func (e *calledEvents) queueForConfidence(triggerId uint64, msg *types.Message, ts *types.TipSet) {
trigger := e.triggers[triggerId]
func (e *calledEvents) queueForConfidence(trigID uint64, msg *types.Message, ts *types.TipSet) {
trigger := e.triggers[trigID]
appliedH := ts.Height()
@ -171,7 +172,7 @@ func (e *calledEvents) queueForConfidence(triggerId uint64, msg *types.Message,
}
byOrigH[appliedH] = append(byOrigH[appliedH], &queuedEvent{
trigger: triggerId,
trigger: trigID,
h: appliedH,
msg: msg,
})
@ -231,11 +232,11 @@ func (e *calledEvents) applyTimeouts(ts *types.TipSet) {
return // nothing to do
}
for triggerId, calls := range triggers {
for triggerID, calls := range triggers {
if calls > 0 {
continue // don't timeout if the method was called
}
trigger := e.triggers[triggerId]
trigger := e.triggers[triggerID]
if trigger.disabled {
continue
}

View File

@ -15,12 +15,12 @@ type heightEvents struct {
tsc *tipSetCache
gcConfidence abi.ChainEpoch
ctr triggerId
ctr triggerID
heightTriggers map[triggerId]*heightHandler
heightTriggers map[triggerID]*heightHandler
htTriggerHeights map[triggerH][]triggerId
htHeights map[msgH][]triggerId
htTriggerHeights map[triggerH][]triggerID
htHeights map[msgH][]triggerID
ctx context.Context
}

View File

@ -219,7 +219,7 @@ func (fcs *fakeCS) notifDone() {
fcs.sync.Unlock()
}
var _ eventApi = &fakeCS{}
var _ eventAPI = &fakeCS{}
func TestAt(t *testing.T) {
fcs := &fakeCS{

View File

@ -431,7 +431,7 @@ func (cg *ChainGen) makeBlock(parents *types.TipSet, m address.Address, vrfticke
return fblk, err
}
// This function is awkward. It's used to deal with messages made when
// ResyncBankerNonce is used for dealing with messages made when
// simulating forks
func (cg *ChainGen) ResyncBankerNonce(ts *types.TipSet) error {
act, err := cg.sm.GetActor(cg.banker, ts)
@ -538,13 +538,6 @@ func (wpp *wppProvider) ComputeProof(context.Context, []abi.SectorInfo, abi.PoSt
}}, nil
}
type ProofInput struct {
sectors []abi.SectorInfo
hvrf []byte
challengedSectors []uint64
vrfout []byte
}
func IsRoundWinner(ctx context.Context, ts *types.TipSet, round abi.ChainEpoch,
miner address.Address, brand types.BeaconEntry, mbi *api.MiningBaseInfo, a MiningCheckAPI) (*types.ElectionProof, error) {

View File

@ -16,7 +16,7 @@ import (
"github.com/ipfs/go-datastore"
)
type testMpoolApi struct {
type testMpoolAPI struct {
cb func(rev, app []*types.TipSet) error
bmsgs map[cid.Cid][]*types.SignedMessage
@ -25,68 +25,68 @@ type testMpoolApi struct {
tipsets []*types.TipSet
}
func newTestMpoolApi() *testMpoolApi {
return &testMpoolApi{
func newTestMpoolApi() *testMpoolAPI {
return &testMpoolAPI{
bmsgs: make(map[cid.Cid][]*types.SignedMessage),
statenonce: make(map[address.Address]uint64),
}
}
func (tma *testMpoolApi) applyBlock(t *testing.T, b *types.BlockHeader) {
func (tma *testMpoolAPI) applyBlock(t *testing.T, b *types.BlockHeader) {
t.Helper()
if err := tma.cb(nil, []*types.TipSet{mock.TipSet(b)}); err != nil {
t.Fatal(err)
}
}
func (tma *testMpoolApi) revertBlock(t *testing.T, b *types.BlockHeader) {
func (tma *testMpoolAPI) revertBlock(t *testing.T, b *types.BlockHeader) {
t.Helper()
if err := tma.cb([]*types.TipSet{mock.TipSet(b)}, nil); err != nil {
t.Fatal(err)
}
}
func (tma *testMpoolApi) setStateNonce(addr address.Address, v uint64) {
func (tma *testMpoolAPI) setStateNonce(addr address.Address, v uint64) {
tma.statenonce[addr] = v
}
func (tma *testMpoolApi) setBlockMessages(h *types.BlockHeader, msgs ...*types.SignedMessage) {
func (tma *testMpoolAPI) setBlockMessages(h *types.BlockHeader, msgs ...*types.SignedMessage) {
tma.bmsgs[h.Cid()] = msgs
tma.tipsets = append(tma.tipsets, mock.TipSet(h))
}
func (tma *testMpoolApi) SubscribeHeadChanges(cb func(rev, app []*types.TipSet) error) *types.TipSet {
func (tma *testMpoolAPI) SubscribeHeadChanges(cb func(rev, app []*types.TipSet) error) *types.TipSet {
tma.cb = cb
return nil
}
func (tma *testMpoolApi) PutMessage(m types.ChainMsg) (cid.Cid, error) {
func (tma *testMpoolAPI) PutMessage(m types.ChainMsg) (cid.Cid, error) {
return cid.Undef, nil
}
func (tma *testMpoolApi) PubSubPublish(string, []byte) error {
func (tma *testMpoolAPI) PubSubPublish(string, []byte) error {
return nil
}
func (tma *testMpoolApi) StateGetActor(addr address.Address, ts *types.TipSet) (*types.Actor, error) {
func (tma *testMpoolAPI) StateGetActor(addr address.Address, ts *types.TipSet) (*types.Actor, error) {
return &types.Actor{
Nonce: tma.statenonce[addr],
Balance: types.NewInt(90000000),
}, nil
}
func (tma *testMpoolApi) StateAccountKey(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) {
func (tma *testMpoolAPI) StateAccountKey(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) {
if addr.Protocol() != address.BLS && addr.Protocol() != address.SECP256K1 {
return address.Undef, fmt.Errorf("given address was not a key addr")
}
return addr, nil
}
func (tma *testMpoolApi) MessagesForBlock(h *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) {
func (tma *testMpoolAPI) MessagesForBlock(h *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) {
return nil, tma.bmsgs[h.Cid()], nil
}
func (tma *testMpoolApi) MessagesForTipset(ts *types.TipSet) ([]types.ChainMsg, error) {
func (tma *testMpoolAPI) MessagesForTipset(ts *types.TipSet) ([]types.ChainMsg, error) {
if len(ts.Blocks()) != 1 {
panic("cant deal with multiblock tipsets in this test")
}
@ -108,7 +108,7 @@ func (tma *testMpoolApi) MessagesForTipset(ts *types.TipSet) ([]types.ChainMsg,
return out, nil
}
func (tma *testMpoolApi) LoadTipSet(tsk types.TipSetKey) (*types.TipSet, error) {
func (tma *testMpoolAPI) LoadTipSet(tsk types.TipSetKey) (*types.TipSet, error) {
for _, ts := range tma.tipsets {
if types.CidArrsEqual(tsk.Cids(), ts.Cids()) {
return ts, nil

View File

@ -21,7 +21,7 @@ import (
var log = logging.Logger("statetree")
// Stores actors state by their ID.
// StateTree stores actors state by their ID.
type StateTree struct {
root *hamt.Node
Store cbor.IpldStore
@ -149,7 +149,7 @@ func (st *StateTree) SetActor(addr address.Address, act *types.Actor) error {
return nil
}
// `LookupID` gets the ID address of this actor's `addr` stored in the `InitActor`.
// LookupID gets the ID address of this actor's `addr` stored in the `InitActor`.
func (st *StateTree) LookupID(addr address.Address) (address.Address, error) {
if addr.Protocol() == address.ID {
return addr, nil

View File

@ -326,7 +326,7 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.Bl
blkmsgs = append(blkmsgs, bm)
}
return sm.ApplyBlocks(ctx, pstate, blkmsgs, abi.ChainEpoch(blks[0].Height), r, cb)
return sm.ApplyBlocks(ctx, pstate, blkmsgs, blks[0].Height, r, cb)
}
func (sm *StateManager) parentState(ts *types.TipSet) cid.Cid {
@ -405,8 +405,8 @@ func (sm *StateManager) LoadActorStateRaw(ctx context.Context, a address.Address
return act, nil
}
// Similar to `vm.ResolveToKeyAddr` but does not allow `Actor` type of addresses. Uses the `TipSet` `ts`
// to generate the VM state.
// ResolveToKeyAddr is similar to `vm.ResolveToKeyAddr` but does not allow `Actor` type of addresses.
// Uses the `TipSet` `ts` to generate the VM state.
func (sm *StateManager) ResolveToKeyAddress(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) {
switch addr.Protocol() {
case address.BLS, address.SECP256K1:

View File

@ -286,7 +286,7 @@ func GetMinerRecoveries(ctx context.Context, sm *StateManager, ts *types.TipSet,
return mas.Recoveries, nil
}
func GetStorageDeal(ctx context.Context, sm *StateManager, dealId abi.DealID, ts *types.TipSet) (*api.MarketDeal, error) {
func GetStorageDeal(ctx context.Context, sm *StateManager, dealID abi.DealID, ts *types.TipSet) (*api.MarketDeal, error) {
var state market.State
if _, err := sm.LoadActorState(ctx, builtin.StorageMarketActorAddr, &state, ts); err != nil {
return nil, err
@ -298,7 +298,7 @@ func GetStorageDeal(ctx context.Context, sm *StateManager, dealId abi.DealID, ts
}
var dp market.DealProposal
if err := da.Get(ctx, uint64(dealId), &dp); err != nil {
if err := da.Get(ctx, uint64(dealID), &dp); err != nil {
return nil, err
}
@ -307,7 +307,7 @@ func GetStorageDeal(ctx context.Context, sm *StateManager, dealId abi.DealID, ts
return nil, err
}
st, found, err := sa.Get(dealId)
st, found, err := sa.Get(dealID)
if err != nil {
return nil, err
}

View File

@ -387,7 +387,7 @@ func (cs *ChainStore) LoadTipSet(tsk types.TipSetKey) (*types.TipSet, error) {
return ts, nil
}
// returns true if 'a' is an ancestor of 'b'
// IsAncestorOf returns true if 'a' is an ancestor of 'b'
func (cs *ChainStore) IsAncestorOf(a, b *types.TipSet) (bool, error) {
if b.Height() <= a.Height() {
return false, nil
@ -1154,7 +1154,6 @@ func (cr *chainRand) GetRandomness(ctx context.Context, pers crypto.DomainSepara
func (cs *ChainStore) GetTipSetFromKey(tsk types.TipSetKey) (*types.TipSet, error) {
if tsk.IsEmpty() {
return cs.GetHeaviestTipSet(), nil
} else {
}
return cs.LoadTipSet(tsk)
}
}

View File

@ -57,8 +57,7 @@ func HandleIncomingBlocks(ctx context.Context, bsub *pubsub.Subscription, s *cha
return
}
//nolint:golint
src := peer.ID(msg.GetFrom())
src := msg.GetFrom()
go func() {
log.Infof("New block over pubsub: %s", blk.Cid())
@ -207,7 +206,7 @@ func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub
}
}
err = sigs.CheckBlockSignature(blk.Header, ctx, key)
err = sigs.CheckBlockSignature(ctx, blk.Header, key)
if err != nil {
log.Errorf("block signature verification failed: %s", err)
recordFailure("signature_verification_failed")

View File

@ -526,7 +526,7 @@ func blockSanityChecks(h *types.BlockHeader) error {
return nil
}
// Should match up with 'Semantical Validation' in validation.md in the spec
// ValidateBlock should match up with 'Semantical Validation' in validation.md in the spec
func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) error {
ctx, span := trace.StartSpan(ctx, "validateBlock")
defer span.End()
@ -665,7 +665,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
})
blockSigCheck := async.Err(func() error {
if err := sigs.CheckBlockSignature(h, ctx, waddr); err != nil {
if err := sigs.CheckBlockSignature(ctx, h, waddr); err != nil {
return xerrors.Errorf("check block signature failed: %w", err)
}
return nil

View File

@ -74,8 +74,8 @@ type BlockHeader struct {
validated bool // true if the signature has been validated
}
func (b *BlockHeader) ToStorageBlock() (block.Block, error) {
data, err := b.Serialize()
func (blk *BlockHeader) ToStorageBlock() (block.Block, error) {
data, err := blk.Serialize()
if err != nil {
return nil, err
}
@ -89,8 +89,8 @@ func (b *BlockHeader) ToStorageBlock() (block.Block, error) {
return block.NewBlockWithCid(data, c)
}
func (b *BlockHeader) Cid() cid.Cid {
sb, err := b.ToStorageBlock()
func (blk *BlockHeader) Cid() cid.Cid {
sb, err := blk.ToStorageBlock()
if err != nil {
panic(err) // Not sure i'm entirely comfortable with this one, needs to be checked
}

View File

@ -41,20 +41,16 @@ type Message struct {
Params []byte
}
func (t *Message) BlockMiner() address.Address {
panic("implement me")
func (m *Message) Caller() address.Address {
return m.From
}
func (t *Message) Caller() address.Address {
return t.From
func (m *Message) Receiver() address.Address {
return m.To
}
func (t *Message) Receiver() address.Address {
return t.To
}
func (t *Message) ValueReceived() abi.TokenAmount {
return t.Value
func (m *Message) ValueReceived() abi.TokenAmount {
return m.Value
}
func DecodeMessage(b []byte) (*Message, error) {

View File

@ -9,12 +9,12 @@ import (
"github.com/multiformats/go-multihash"
)
func (m *SignedMessage) ToStorageBlock() (block.Block, error) {
if m.Signature.Type == crypto.SigTypeBLS {
return m.Message.ToStorageBlock()
func (sm *SignedMessage) ToStorageBlock() (block.Block, error) {
if sm.Signature.Type == crypto.SigTypeBLS {
return sm.Message.ToStorageBlock()
}
data, err := m.Serialize()
data, err := sm.Serialize()
if err != nil {
return nil, err
}
@ -28,12 +28,12 @@ func (m *SignedMessage) ToStorageBlock() (block.Block, error) {
return block.NewBlockWithCid(data, c)
}
func (m *SignedMessage) Cid() cid.Cid {
if m.Signature.Type == crypto.SigTypeBLS {
return m.Message.Cid()
func (sm *SignedMessage) Cid() cid.Cid {
if sm.Signature.Type == crypto.SigTypeBLS {
return sm.Message.Cid()
}
sb, err := m.ToStorageBlock()
sb, err := sm.ToStorageBlock()
if err != nil {
panic(err)
}

View File

@ -23,8 +23,6 @@ type TipSet struct {
height abi.ChainEpoch
}
// why didnt i just export the fields? Because the struct has methods with the
// same names already
type ExpTipSet struct {
Cids []cid.Cid
Blocks []*BlockHeader
@ -32,6 +30,8 @@ type ExpTipSet struct {
}
func (ts *TipSet) MarshalJSON() ([]byte, error) {
// why didnt i just export the fields? Because the struct has methods with the
// same names already
return json.Marshal(ExpTipSet{
Cids: ts.cids,
Blocks: ts.blks,

View File

@ -61,9 +61,9 @@ func TestTipSetKey(t *testing.T) {
t.Run("JSON", func(t *testing.T) {
k0 := NewTipSetKey()
verifyJson(t, "[]", k0)
verifyJSON(t, "[]", k0)
k3 := NewTipSetKey(c1, c2, c3)
verifyJson(t, `[`+
verifyJSON(t, `[`+
`{"/":"bafy2bzacecesrkxghscnq7vatble2hqdvwat6ed23vdu4vvo3uuggsoaya7ki"},`+
`{"/":"bafy2bzacebxfyh2fzoxrt6kcgc5dkaodpcstgwxxdizrww225vrhsizsfcg4g"},`+
`{"/":"bafy2bzacedwviarjtjraqakob5pslltmuo5n3xev3nt5zylezofkbbv5jclyu"}`+
@ -71,7 +71,7 @@ func TestTipSetKey(t *testing.T) {
})
}
func verifyJson(t *testing.T, expected string, k TipSetKey) {
func verifyJSON(t *testing.T, expected string, k TipSetKey) {
bytes, err := json.Marshal(k)
require.NoError(t, err)
assert.Equal(t, expected, string(bytes))

View File

@ -32,7 +32,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/aerrors"
)
type invoker struct {
type Invoker struct {
builtInCode map[cid.Cid]nativeCode
builtInState map[cid.Cid]reflect.Type
}
@ -40,8 +40,8 @@ type invoker struct {
type invokeFunc func(rt runtime.Runtime, params []byte) ([]byte, aerrors.ActorError)
type nativeCode []invokeFunc
func NewInvoker() *invoker {
inv := &invoker{
func NewInvoker() *Invoker {
inv := &Invoker{
builtInCode: make(map[cid.Cid]nativeCode),
builtInState: make(map[cid.Cid]reflect.Type),
}
@ -62,7 +62,7 @@ func NewInvoker() *invoker {
return inv
}
func (inv *invoker) Invoke(codeCid cid.Cid, rt runtime.Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) {
func (inv *Invoker) Invoke(codeCid cid.Cid, rt runtime.Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) {
code, ok := inv.builtInCode[codeCid]
if !ok {
@ -76,7 +76,7 @@ func (inv *invoker) Invoke(codeCid cid.Cid, rt runtime.Runtime, method abi.Metho
}
func (inv *invoker) Register(c cid.Cid, instance Invokee, state interface{}) {
func (inv *Invoker) Register(c cid.Cid, instance Invokee, state interface{}) {
code, err := inv.transform(instance)
if err != nil {
panic(xerrors.Errorf("%s: %w", string(c.Hash()), err))
@ -89,9 +89,7 @@ type Invokee interface {
Exports() []interface{}
}
var tAError = reflect.TypeOf((*aerrors.ActorError)(nil)).Elem()
func (*invoker) transform(instance Invokee) (nativeCode, error) {
func (*Invoker) transform(instance Invokee) (nativeCode, error) {
itype := reflect.TypeOf(instance)
exports := instance.Exports()
for i, m := range exports {

View File

@ -76,7 +76,7 @@ func (basicContract) InvokeSomething10(rt runtime.Runtime, params *basicParams)
}
func TestInvokerBasic(t *testing.T) {
inv := invoker{}
inv := Invoker{}
code, err := inv.transform(basicContract{})
assert.NoError(t, err)

View File

@ -2,6 +2,7 @@ package vm
import (
"context"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
@ -27,7 +28,7 @@ func init() {
var EmptyObjectCid cid.Cid
// Creates account actors from only BLS/SECP256K1 addresses.
// TryCreateAccountActor creates account actors from only BLS/SECP256K1 addresses.
func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, aerrors.ActorError) {
addrID, err := rt.state.RegisterNewAddress(addr)
if err != nil {

View File

@ -106,8 +106,8 @@ type notFoundErr interface {
IsNotFound() bool
}
func (rs *Runtime) Get(c cid.Cid, o vmr.CBORUnmarshaler) bool {
if err := rs.cst.Get(context.TODO(), c, o); err != nil {
func (rt *Runtime) Get(c cid.Cid, o vmr.CBORUnmarshaler) bool {
if err := rt.cst.Get(context.TODO(), c, o); err != nil {
var nfe notFoundErr
if xerrors.As(err, &nfe) && nfe.IsNotFound() {
if xerrors.As(err, new(cbor.SerializationError)) {
@ -121,8 +121,8 @@ func (rs *Runtime) Get(c cid.Cid, o vmr.CBORUnmarshaler) bool {
return true
}
func (rs *Runtime) Put(x vmr.CBORMarshaler) cid.Cid {
c, err := rs.cst.Put(context.TODO(), x)
func (rt *Runtime) Put(x vmr.CBORMarshaler) cid.Cid {
c, err := rt.cst.Put(context.TODO(), x)
if err != nil {
if xerrors.As(err, new(cbor.SerializationError)) {
panic(aerrors.Newf(exitcode.ErrSerialization, "failed to marshal cbor object %s", err))
@ -134,7 +134,7 @@ func (rs *Runtime) Put(x vmr.CBORMarshaler) cid.Cid {
var _ vmr.Runtime = (*Runtime)(nil)
func (rs *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.ActorError) {
func (rt *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.ActorError) {
defer func() {
if r := recover(); r != nil {
if ar, ok := r.(aerrors.ActorError); ok {
@ -149,8 +149,8 @@ func (rs *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.Act
ret := f()
if !rs.callerValidated {
rs.Abortf(exitcode.SysErrorIllegalActor, "Caller MUST be validated during method execution")
if !rt.callerValidated {
rt.Abortf(exitcode.SysErrorIllegalActor, "Caller MUST be validated during method execution")
}
switch ret := ret.(type) {
@ -171,25 +171,25 @@ func (rs *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.Act
}
}
func (rs *Runtime) Message() vmr.Message {
return rs.vmsg
func (rt *Runtime) Message() vmr.Message {
return rt.vmsg
}
func (rs *Runtime) ValidateImmediateCallerAcceptAny() {
rs.abortIfAlreadyValidated()
func (rt *Runtime) ValidateImmediateCallerAcceptAny() {
rt.abortIfAlreadyValidated()
return
}
func (rs *Runtime) CurrentBalance() abi.TokenAmount {
b, err := rs.GetBalance(rs.Message().Receiver())
func (rt *Runtime) CurrentBalance() abi.TokenAmount {
b, err := rt.GetBalance(rt.Message().Receiver())
if err != nil {
rs.Abortf(err.RetCode(), "get current balance: %v", err)
rt.Abortf(err.RetCode(), "get current balance: %v", err)
}
return b
}
func (rs *Runtime) GetActorCodeCID(addr address.Address) (ret cid.Cid, ok bool) {
act, err := rs.state.GetActor(addr)
func (rt *Runtime) GetActorCodeCID(addr address.Address) (ret cid.Cid, ok bool) {
act, err := rt.state.GetActor(addr)
if err != nil {
if xerrors.Is(err, types.ErrActorNotFound) {
return cid.Undef, false
@ -209,8 +209,8 @@ func (rt *Runtime) GetRandomness(personalization crypto.DomainSeparationTag, ran
return res
}
func (rs *Runtime) Store() vmr.Store {
return rs
func (rt *Runtime) Store() vmr.Store {
return rt
}
func (rt *Runtime) NewActorAddress() address.Address {
@ -235,12 +235,12 @@ func (rt *Runtime) NewActorAddress() address.Address {
return addr
}
func (rt *Runtime) CreateActor(codeId cid.Cid, address address.Address) {
if !builtin.IsBuiltinActor(codeId) {
func (rt *Runtime) CreateActor(codeID cid.Cid, address address.Address) {
if !builtin.IsBuiltinActor(codeID) {
rt.Abortf(exitcode.SysErrorIllegalArgument, "Can only create built-in actors.")
}
if builtin.IsSingletonActor(codeId) {
if builtin.IsSingletonActor(codeID) {
rt.Abortf(exitcode.SysErrorIllegalArgument, "Can only have one instance of singleton actors.")
}
@ -252,7 +252,7 @@ func (rt *Runtime) CreateActor(codeId cid.Cid, address address.Address) {
rt.ChargeGas(rt.Pricelist().OnCreateActor())
err = rt.state.SetActor(address, &types.Actor{
Code: codeId,
Code: codeID,
Head: EmptyObjectCid,
Nonce: 0,
Balance: big.Zero(),
@ -282,12 +282,12 @@ func (rt *Runtime) DeleteActor(addr address.Address) {
}
}
func (rs *Runtime) Syscalls() vmr.Syscalls {
func (rt *Runtime) Syscalls() vmr.Syscalls {
// TODO: Make sure this is wrapped in something that charges gas for each of the calls
return rs.sys
return rt.sys
}
func (rs *Runtime) StartSpan(name string) vmr.TraceSpan {
func (rt *Runtime) StartSpan(name string) vmr.TraceSpan {
panic("implement me")
}
@ -307,12 +307,12 @@ func (rt *Runtime) Context() context.Context {
return rt.ctx
}
func (rs *Runtime) Abortf(code exitcode.ExitCode, msg string, args ...interface{}) {
func (rt *Runtime) Abortf(code exitcode.ExitCode, msg string, args ...interface{}) {
log.Error("Abortf: ", fmt.Sprintf(msg, args...))
panic(aerrors.NewfSkip(2, code, msg, args...))
}
func (rs *Runtime) AbortStateMsg(msg string) {
func (rt *Runtime) AbortStateMsg(msg string) {
panic(aerrors.NewfSkip(3, 101, msg))
}
@ -330,8 +330,8 @@ func (rt *Runtime) ValidateImmediateCallerType(ts ...cid.Cid) {
rt.Abortf(exitcode.SysErrForbidden, "caller cid type %q was not one of %v", callerCid, ts)
}
func (rs *Runtime) CurrEpoch() abi.ChainEpoch {
return rs.height
func (rt *Runtime) CurrEpoch() abi.ChainEpoch {
return rt.height
}
type dumbWrapperType struct {
@ -342,20 +342,20 @@ func (dwt *dumbWrapperType) Into(um vmr.CBORUnmarshaler) error {
return um.UnmarshalCBOR(bytes.NewReader(dwt.val))
}
func (rs *Runtime) Send(to address.Address, method abi.MethodNum, m vmr.CBORMarshaler, value abi.TokenAmount) (vmr.SendReturn, exitcode.ExitCode) {
if !rs.allowInternal {
rs.Abortf(exitcode.SysErrorIllegalActor, "runtime.Send() is currently disallowed")
func (rt *Runtime) Send(to address.Address, method abi.MethodNum, m vmr.CBORMarshaler, value abi.TokenAmount) (vmr.SendReturn, exitcode.ExitCode) {
if !rt.allowInternal {
rt.Abortf(exitcode.SysErrorIllegalActor, "runtime.Send() is currently disallowed")
}
var params []byte
if m != nil {
buf := new(bytes.Buffer)
if err := m.MarshalCBOR(buf); err != nil {
rs.Abortf(exitcode.SysErrInvalidParameters, "failed to marshal input parameters: %s", err)
rt.Abortf(exitcode.SysErrInvalidParameters, "failed to marshal input parameters: %s", err)
}
params = buf.Bytes()
}
ret, err := rs.internalSend(rs.Message().Receiver(), to, method, value, params)
ret, err := rt.internalSend(rt.Message().Receiver(), to, method, value, params)
if err != nil {
if err.IsFatal() {
panic(err)
@ -422,48 +422,48 @@ func (rt *Runtime) internalSend(from, to address.Address, method abi.MethodNum,
return ret, errSend
}
func (rs *Runtime) State() vmr.StateHandle {
return &shimStateHandle{rs: rs}
func (rt *Runtime) State() vmr.StateHandle {
return &shimStateHandle{rt: rt}
}
type shimStateHandle struct {
rs *Runtime
rt *Runtime
}
func (ssh *shimStateHandle) Create(obj vmr.CBORMarshaler) {
c := ssh.rs.Put(obj)
c := ssh.rt.Put(obj)
// TODO: handle error below
ssh.rs.stateCommit(EmptyObjectCid, c)
ssh.rt.stateCommit(EmptyObjectCid, c)
}
func (ssh *shimStateHandle) Readonly(obj vmr.CBORUnmarshaler) {
act, err := ssh.rs.state.GetActor(ssh.rs.Message().Receiver())
act, err := ssh.rt.state.GetActor(ssh.rt.Message().Receiver())
if err != nil {
ssh.rs.Abortf(exitcode.SysErrorIllegalArgument, "failed to get actor for Readonly state: %s", err)
ssh.rt.Abortf(exitcode.SysErrorIllegalArgument, "failed to get actor for Readonly state: %s", err)
}
ssh.rs.Get(act.Head, obj)
ssh.rt.Get(act.Head, obj)
}
func (ssh *shimStateHandle) Transaction(obj vmr.CBORer, f func() interface{}) interface{} {
if obj == nil {
ssh.rs.Abortf(exitcode.SysErrorIllegalActor, "Must not pass nil to Transaction()")
ssh.rt.Abortf(exitcode.SysErrorIllegalActor, "Must not pass nil to Transaction()")
}
act, err := ssh.rs.state.GetActor(ssh.rs.Message().Receiver())
act, err := ssh.rt.state.GetActor(ssh.rt.Message().Receiver())
if err != nil {
ssh.rs.Abortf(exitcode.SysErrorIllegalActor, "failed to get actor for Transaction: %s", err)
ssh.rt.Abortf(exitcode.SysErrorIllegalActor, "failed to get actor for Transaction: %s", err)
}
baseState := act.Head
ssh.rs.Get(baseState, obj)
ssh.rt.Get(baseState, obj)
ssh.rs.allowInternal = false
ssh.rt.allowInternal = false
out := f()
ssh.rs.allowInternal = true
ssh.rt.allowInternal = true
c := ssh.rs.Put(obj)
c := ssh.rt.Put(obj)
// TODO: handle error below
ssh.rs.stateCommit(baseState, c)
ssh.rt.stateCommit(baseState, c)
return out
}

View File

@ -184,7 +184,7 @@ func (ss *syscallShim) VerifyBlockSig(blk *types.BlockHeader) error {
return err
}
if err := sigs.CheckBlockSignature(blk, ss.ctx, waddr); err != nil {
if err := sigs.CheckBlockSignature(ss.ctx, blk, waddr); err != nil {
return err
}
@ -202,20 +202,6 @@ func (ss *syscallShim) VerifyPoSt(proof abi.WindowPoStVerifyInfo) error {
return nil
}
func cidToCommD(c cid.Cid) [32]byte {
b := c.Bytes()
var out [32]byte
copy(out[:], b[len(b)-32:])
return out
}
func cidToCommR(c cid.Cid) [32]byte {
b := c.Bytes()
var out [32]byte
copy(out[:], b[len(b)-32:])
return out
}
func (ss *syscallShim) VerifySeal(info abi.SealVerifyInfo) error {
//_, span := trace.StartSpan(ctx, "ValidatePoRep")
//defer span.End()

View File

@ -131,7 +131,7 @@ type VM struct {
cst *cbor.BasicIpldStore
buf *bufbstore.BufferedBS
blockHeight abi.ChainEpoch
inv *invoker
inv *Invoker
rand Rand
Syscalls runtime.Syscalls
@ -454,7 +454,7 @@ func (vm *VM) Flush(ctx context.Context) (cid.Cid, error) {
return root, nil
}
// vm.MutateState(idAddr, func(cst cbor.IpldStore, st *ActorStateType) error {...})
// MutateState usage: MutateState(ctx, idAddr, func(cst cbor.IpldStore, st *ActorStateType) error {...})
func (vm *VM) MutateState(ctx context.Context, addr address.Address, fn interface{}) error {
act, err := vm.cstate.GetActor(addr)
if err != nil {
@ -591,7 +591,7 @@ func (vm *VM) Invoke(act *types.Actor, rt *Runtime, method abi.MethodNum, params
return ret, nil
}
func (vm *VM) SetInvoker(i *invoker) {
func (vm *VM) SetInvoker(i *Invoker) {
vm.inv = i
}
@ -607,17 +607,17 @@ func (vm *VM) transfer(from, to address.Address, amt types.BigInt) aerrors.Actor
return nil
}
fromId, err := vm.cstate.LookupID(from)
fromID, err := vm.cstate.LookupID(from)
if err != nil {
return aerrors.Fatalf("transfer failed when resolving sender address: %s", err)
}
toId, err := vm.cstate.LookupID(to)
toID, err := vm.cstate.LookupID(to)
if err != nil {
return aerrors.Fatalf("transfer failed when resolving receiver address: %s", err)
}
if fromId == toId {
if fromID == toID {
return nil
}
@ -625,12 +625,12 @@ func (vm *VM) transfer(from, to address.Address, amt types.BigInt) aerrors.Actor
return aerrors.Newf(exitcode.SysErrForbidden, "attempted to transfer negative value: %s", amt)
}
f, err := vm.cstate.GetActor(fromId)
f, err := vm.cstate.GetActor(fromID)
if err != nil {
return aerrors.Fatalf("transfer failed when retrieving sender actor: %s", err)
}
t, err := vm.cstate.GetActor(toId)
t, err := vm.cstate.GetActor(toID)
if err != nil {
return aerrors.Fatalf("transfer failed when retrieving receiver actor: %s", err)
}
@ -640,11 +640,11 @@ func (vm *VM) transfer(from, to address.Address, amt types.BigInt) aerrors.Actor
}
depositFunds(t, amt)
if err := vm.cstate.SetActor(fromId, f); err != nil {
if err := vm.cstate.SetActor(fromID, f); err != nil {
return aerrors.Fatalf("transfer failed when setting receiver actor: %s", err)
}
if err := vm.cstate.SetActor(toId, t); err != nil {
if err := vm.cstate.SetActor(toID, t); err != nil {
return aerrors.Fatalf("transfer failed when setting sender actor: %s", err)
}

View File

@ -21,7 +21,7 @@ func subBlocks(ctx context.Context, api aapi.FullNode, st *storage) {
bh.Cid(): bh,
}, false)
if err != nil {
//log.Errorf("%+v", err)
log.Errorf("%+v", err)
}
}
}

View File

@ -20,7 +20,13 @@ var dotCmd = &cli.Command{
}
minH, err := strconv.ParseInt(cctx.Args().Get(0), 10, 32)
if err != nil {
return err
}
tosee, err := strconv.ParseInt(cctx.Args().Get(1), 10, 32)
if err != nil {
return err
}
maxH := minH + tosee
res, err := st.db.Query(`select block, parent, b.miner, b.height, p.height from block_parents

View File

@ -17,7 +17,7 @@ import (
var log = logging.Logger("chainwatch")
func main() {
logging.SetLogLevel("*", "INFO")
_ = logging.SetLogLevel("*", "INFO")
log.Info("Starting chainwatch")

View File

@ -146,7 +146,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
}
if len(bh.Parents) == 0 { // genesis case
ts, err := types.NewTipSet([]*types.BlockHeader{bh})
ts, _ := types.NewTipSet([]*types.BlockHeader{bh})
aadrs, err := api.StateListActors(ctx, ts.Key())
if err != nil {
log.Error(err)

View File

@ -215,14 +215,14 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
owner, err := address.NewFromString(r.FormValue("address"))
if err != nil {
w.WriteHeader(400)
w.Write([]byte(err.Error()))
_, _ = w.Write([]byte(err.Error()))
return
}
if owner.Protocol() != address.BLS {
w.WriteHeader(400)
w.Write([]byte("Miner address must use BLS. A BLS address starts with the prefix 't3'."))
w.Write([]byte("Please create a BLS address by running \"lotus wallet new bls\" while connected to a Lotus node."))
_, _ = w.Write([]byte("Miner address must use BLS. A BLS address starts with the prefix 't3'."))
_, _ = w.Write([]byte("Please create a BLS address by running \"lotus wallet new bls\" while connected to a Lotus node."))
return
}

View File

@ -5,6 +5,7 @@ import (
"sync"
)
// MapArr transforms map into slice of map values
func MapArr(in interface{}) interface{} {
rin := reflect.ValueOf(in)
rout := reflect.MakeSlice(reflect.SliceOf(rin.Type().Elem()), rin.Len(), rin.Len())
@ -19,6 +20,7 @@ func MapArr(in interface{}) interface{} {
return rout.Interface()
}
// KMapArr transforms map into slice of map keys
func KMapArr(in interface{}) interface{} {
rin := reflect.ValueOf(in)
rout := reflect.MakeSlice(reflect.SliceOf(rin.Type().Key()), rin.Len(), rin.Len())
@ -33,7 +35,8 @@ func KMapArr(in interface{}) interface{} {
return rout.Interface()
}
// map[k]v => []func() (k, v)
// KMapArr transforms map into slice of functions returning (key, val) pairs.
// map[A]B => []func()(A, B)
func KVMapArr(in interface{}) interface{} {
rin := reflect.ValueOf(in)

View File

@ -1,4 +1,4 @@
// Sigs package allows for signing, verifying signatures and key generation
// Package sigs allows for signing, verifying signatures and key generation
// using key types selected by package user.
//
// For support of secp256k1 import:

View File

@ -68,7 +68,7 @@ func ToPublic(sigType crypto.SigType, pk []byte) ([]byte, error) {
return sv.ToPublic(pk)
}
func CheckBlockSignature(blk *types.BlockHeader, ctx context.Context, worker address.Address) error {
func CheckBlockSignature(ctx context.Context, blk *types.BlockHeader, worker address.Address) error {
_, span := trace.StartSpan(ctx, "checkBlockSignature")
defer span.End()
@ -103,7 +103,7 @@ type SigShim interface {
var sigs map[crypto.SigType]SigShim
// RegisterSig should be only used during init
// RegisterSignature should be only used during init
func RegisterSignature(typ crypto.SigType, vs SigShim) {
if sigs == nil {
sigs = make(map[crypto.SigType]SigShim)

View File

@ -32,7 +32,7 @@ type api struct {
type nodeInfo struct {
Repo string
ID int32
ApiPort int32
APIPort int32
State NodeState
FullNode string // only for storage nodes

View File

@ -37,7 +37,7 @@ var onCmd = &cli.Command{
return err
}
node := nodeById(client.Nodes(), int(nd))
node := nodeByID(client.Nodes(), int(nd))
var cmd *exec.Cmd
if !node.Storage {
cmd = exec.Command("./lotus", cctx.Args().Slice()[1:]...)
@ -75,7 +75,7 @@ var shCmd = &cli.Command{
return err
}
node := nodeById(client.Nodes(), int(nd))
node := nodeByID(client.Nodes(), int(nd))
shcmd := exec.Command("/bin/bash")
if !node.Storage {
shcmd.Env = []string{
@ -102,7 +102,7 @@ var shCmd = &cli.Command{
},
}
func nodeById(nodes []nodeInfo, i int) nodeInfo {
func nodeByID(nodes []nodeInfo, i int) nodeInfo {
for _, n := range nodes {
if n.ID == int32(i) {
return n

View File

@ -3,7 +3,6 @@ package main
import (
"encoding/json"
"fmt"
"github.com/filecoin-project/lotus/chain/types"
"io"
"io/ioutil"
"os"
@ -12,6 +11,8 @@ import (
"sync/atomic"
"time"
"github.com/filecoin-project/lotus/chain/types"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
@ -122,7 +123,7 @@ func (api *api) Spawn() (nodeInfo, error) {
info := nodeInfo{
Repo: dir,
ID: id,
ApiPort: 2500 + id,
APIPort: 2500 + id,
State: NodeRunning,
}
@ -198,7 +199,7 @@ func (api *api) SpawnStorage(fullNodeRepo string) (nodeInfo, error) {
info := nodeInfo{
Repo: dir,
ID: id,
ApiPort: 2500 + id,
APIPort: 2500 + id,
State: NodeRunning,
FullNode: fullNodeRepo,

View File

@ -682,7 +682,7 @@ func (a *StateAPI) MsigGetAvailableBalance(ctx context.Context, addr address.Add
return act.Balance, nil
}
minBalance := types.BigDiv(types.BigInt(st.InitialBalance), types.NewInt(uint64(st.UnlockDuration)))
minBalance := types.BigDiv(st.InitialBalance, types.NewInt(uint64(st.UnlockDuration)))
minBalance = types.BigMul(minBalance, types.NewInt(uint64(offset)))
return types.BigSub(act.Balance, minBalance), nil
}

View File

@ -46,7 +46,7 @@ type StorageMinerAPI struct {
func (sm *StorageMinerAPI) ServeRemote(w http.ResponseWriter, r *http.Request) {
if !auth.HasPerm(r.Context(), nil, apistruct.PermAdmin) {
w.WriteHeader(401)
json.NewEncoder(w).Encode(struct{ Error string }{"unauthorized: missing write permission"})
_ = json.NewEncoder(w).Encode(struct{ Error string }{"unauthorized: missing write permission"})
return
}
@ -185,7 +185,7 @@ func (sm *StorageMinerAPI) MarketImportDealData(ctx context.Context, propCid cid
if err != nil {
return xerrors.Errorf("failed to open file: %w", err)
}
defer fi.Close()
defer fi.Close() //nolint:errcheck
return sm.StorageProvider.ImportDataForDeal(ctx, propCid, fi)
}
@ -211,7 +211,7 @@ func (sm *StorageMinerAPI) DealsImportData(ctx context.Context, deal cid.Cid, fn
if err != nil {
return xerrors.Errorf("failed to open given file: %w", err)
}
defer fi.Close()
defer fi.Close() //nolint:errcheck
return sm.StorageProvider.ImportDataForDeal(ctx, deal, fi)
}

View File

@ -64,7 +64,6 @@ var ErrRepoExists = xerrors.New("repo exists")
// FsRepo is struct for repo, use NewFS to create
type FsRepo struct {
path string
repoType RepoType
}
var _ Repo = &FsRepo{}

View File

@ -38,7 +38,6 @@ func (pl *PointList) Points() []models.Point {
}
type InfluxWriteQueue struct {
influx client.Client
ch chan client.BatchPoints
}