lint: fix many broken lint issues (#49)

* lint: fix many broken lint issues

* more lint issues resolved

* more lint issues resolved

* all actions issues fixed

* pin variables for websocket

* Update .github/workflows/lint.yml

* more fixes

* fix lint issues in pubsub, rpc, types

* fix lint issues in statedb, journal, pubsub, cli

* fix comment

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Akash Khosla
2021-06-08 03:07:11 -04:00
committed by GitHub
co-authored by Federico Kunze
parent fcb7c114d0
commit e3270aee5d
19 changed files with 81 additions and 198 deletions
+1 -3
View File
@@ -6,7 +6,6 @@ import (
"fmt"
"math/big"
"strings"
"sync"
"github.com/gogo/protobuf/jsonpb"
"github.com/pkg/errors"
@@ -45,7 +44,6 @@ type PublicEthAPI struct {
logger log.Logger
backend Backend
nonceLock *rpctypes.AddrLocker
keyringLock sync.Mutex
}
// NewPublicEthAPI creates an instance of the public ETH Web3 API.
@@ -736,7 +734,7 @@ func (e *PublicEthAPI) GetTransactionReceipt(hash common.Hash) (map[string]inter
return nil, err
}
cumulativeGasUsed := uint64(tx.Receipt.Result.GasUsed)
cumulativeGasUsed := tx.Receipt.Result.GasUsed
if tx.Receipt.Index != 0 {
cumulativeGasUsed += rpctypes.GetBlockCumulativeGas(e.clientCtx, block.Block, int(tx.Receipt.Index))
}
+8 -12
View File
@@ -86,19 +86,15 @@ func (m *memEventBus) Subscribe(name string) (<-chan coretypes.ResultEvent, erro
func (m *memEventBus) publishTopic(name string, src <-chan coretypes.ResultEvent) {
for {
select {
case msg, ok := <-src:
if !ok {
m.closeAllSubscribers(name)
m.topicsMux.Lock()
delete(m.topics, name)
m.topicsMux.Unlock()
return
}
m.publishAllSubscribers(name, msg)
msg, ok := <-src
if !ok {
m.closeAllSubscribers(name)
m.topicsMux.Lock()
delete(m.topics, name)
m.topicsMux.Unlock()
return
}
m.publishAllSubscribers(name, msg)
}
}
+8 -16
View File
@@ -65,7 +65,7 @@ type websocketsServer struct {
logger log.Logger
}
func NewWebsocketsServer(tmWSClient *rpcclient.WSClient, rpcAddr, wsAddr string) *websocketsServer {
func NewWebsocketsServer(tmWSClient *rpcclient.WSClient, rpcAddr, wsAddr string) WebsocketsServer {
return &websocketsServer{
rpcAddr: rpcAddr,
wsAddr: wsAddr,
@@ -174,7 +174,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) {
continue
}
connId := msg["id"].(float64)
connID := msg["id"].(float64)
if method == "eth_subscribe" {
params := msg["params"].([]interface{})
if len(params) == 0 {
@@ -190,7 +190,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) {
res := &SubscriptionResponseJSON{
Jsonrpc: "2.0",
ID: connId,
ID: connID,
Result: id,
}
@@ -210,7 +210,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) {
ok = s.api.unsubscribe(rpc.ID(ids[0].(string)))
res := &SubscriptionResponseJSON{
Jsonrpc: "2.0",
ID: connId,
ID: connID,
Result: ok,
}
@@ -325,18 +325,6 @@ func (api *pubSubAPI) unsubscribe(id rpc.ID) bool {
return true
}
func (api *pubSubAPI) getSubscriptionByQuery(query string) *Subscription {
api.filtersMu.Lock()
defer api.filtersMu.Unlock()
for _, wsSub := range api.filters {
if wsSub.query == query {
return wsSub.sub
}
}
return nil
}
func (api *pubSubAPI) subscribeNewHeads(wsConn *wsConn) (rpc.ID, error) {
var query = "subscribeNewHeads"
var subID = rpc.NewID()
@@ -378,6 +366,8 @@ func (api *pubSubAPI) subscribeNewHeads(wsConn *wsConn) (rpc.ID, error) {
api.filtersMu.RLock()
for subID, wsSub := range api.filters {
subID := subID
wsSub := wsSub
if wsSub.query != query {
continue
}
@@ -696,6 +686,8 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn) (rpc.ID, erro
api.filtersMu.RLock()
for subID, wsSub := range api.filters {
subID := subID
wsSub := wsSub
if wsSub.query != query {
continue
}