fix linter issues (#184)

This commit is contained in:
Thomas Nguy 2021-06-25 17:31:57 +09:00 committed by GitHub
parent 365c96acfa
commit 61260dfda8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 19 deletions

View File

@ -52,6 +52,9 @@ issues:
- text: "ST1003:"
linters:
- stylecheck
- text: "SA1019:"
linters:
- staticcheck
max-issues-per-linter: 10000
max-same-issues: 10000

View File

@ -22,8 +22,8 @@ import (
evmtypes "github.com/tharsis/ethermint/x/evm/types"
)
// FiltersBackend defines the methods requided by the PublicFilterAPI backend
type FiltersBackend interface {
// Backend defines the methods requided by the PublicFilterAPI backend
type Backend interface {
GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error)
HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error)
HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)
@ -51,14 +51,14 @@ type filter struct {
// PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various
// information related to the Ethereum protocol such as blocks, transactions and logs.
type PublicFilterAPI struct {
backend FiltersBackend
backend Backend
events *EventSystem
filtersMu sync.Mutex
filters map[rpc.ID]*filter
}
// NewPublicAPI returns a new PublicFilterAPI instance.
func NewPublicAPI(tmWSClient *rpcclient.WSClient, backend FiltersBackend) *PublicFilterAPI {
func NewPublicAPI(tmWSClient *rpcclient.WSClient, backend Backend) *PublicFilterAPI {
api := &PublicFilterAPI{
backend: backend,
filters: make(map[rpc.ID]*filter),

View File

@ -18,21 +18,21 @@ import (
// Filter can be used to retrieve and filter logs.
type Filter struct {
backend FiltersBackend
backend Backend
criteria filters.FilterCriteria
matcher *bloombits.Matcher
}
// NewBlockFilter creates a new filter which directly inspects the contents of
// a block to figure out whether it is interesting or not.
func NewBlockFilter(backend FiltersBackend, criteria filters.FilterCriteria) *Filter {
func NewBlockFilter(backend Backend, criteria filters.FilterCriteria) *Filter {
// Create a generic filter and convert it into a block filter
return newFilter(backend, criteria, nil)
}
// NewRangeFilter creates a new filter which uses a bloom filter on blocks to
// figure out whether a particular block is interesting or not.
func NewRangeFilter(backend FiltersBackend, begin, end int64, addresses []common.Address, topics [][]common.Hash) *Filter {
func NewRangeFilter(backend Backend, begin, end int64, addresses []common.Address, topics [][]common.Hash) *Filter {
// Flatten the address and topic filter clauses into a single bloombits filter
// system. Since the bloombits are not positional, nil topics are permitted,
// which get flattened into a nil byte slice.
@ -67,7 +67,7 @@ func NewRangeFilter(backend FiltersBackend, begin, end int64, addresses []common
}
// newFilter returns a new Filter
func newFilter(backend FiltersBackend, criteria filters.FilterCriteria, matcher *bloombits.Matcher) *Filter {
func newFilter(backend Backend, criteria filters.FilterCriteria, matcher *bloombits.Matcher) *Filter {
return &Filter{
backend: backend,
criteria: criteria,