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:" - text: "ST1003:"
linters: linters:
- stylecheck - stylecheck
- text: "SA1019:"
linters:
- staticcheck
max-issues-per-linter: 10000 max-issues-per-linter: 10000
max-same-issues: 10000 max-same-issues: 10000

View File

@ -162,7 +162,7 @@ var (
var _ simapp.App = (*EthermintApp)(nil) var _ simapp.App = (*EthermintApp)(nil)
//var _ server.Application (*EthermintApp)(nil) // var _ server.Application (*EthermintApp)(nil)
// EthermintApp implements an extended ABCI application. It is an application // EthermintApp implements an extended ABCI application. It is an application
// that may process transactions through Ethereum's EVM running atop of // that may process transactions through Ethereum's EVM running atop of
@ -358,7 +358,7 @@ func NewEthermintApp(
// TODO: do properly // TODO: do properly
// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
// we prefer to be more strict in what arguments the modules expect. // we prefer to be more strict in what arguments the modules expect.
//var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) // var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))
skipGenesisInvariants := true skipGenesisInvariants := true
// NOTE: Any module instantiated in the module manager that is later modified // NOTE: Any module instantiated in the module manager that is later modified
@ -425,10 +425,10 @@ func NewEthermintApp(
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
app.mm.RegisterServices(module.NewConfigurator(app.MsgServiceRouter(), app.GRPCQueryRouter())) app.mm.RegisterServices(module.NewConfigurator(app.MsgServiceRouter(), app.GRPCQueryRouter()))
//add test gRPC service for testing gRPC queries in isolation // add test gRPC service for testing gRPC queries in isolation
// testdata.RegisterTestServiceServer(app.GRPCQueryRouter(), testdata.TestServiceImpl{}) // testdata.RegisterTestServiceServer(app.GRPCQueryRouter(), testdata.TestServiceImpl{})
//create the simulation manager and define the order of the modules for deterministic simulations // create the simulation manager and define the order of the modules for deterministic simulations
//NOTE: this is not required apps that don't use the simulator for fuzz testing //NOTE: this is not required apps that don't use the simulator for fuzz testing
// transactions // transactions

View File

@ -62,16 +62,16 @@ func addTxFlags(cmd *cobra.Command) *cobra.Command {
cmd.PersistentFlags().BoolVar(&logJSON, "log-json", false, "Use JSON as the output format of the own logger (default: text)") cmd.PersistentFlags().BoolVar(&logJSON, "log-json", false, "Use JSON as the output format of the own logger (default: text)")
cmd.PersistentFlags().BoolVar(&evmDebug, "evm-debug", false, "Enable EVM debug traces") cmd.PersistentFlags().BoolVar(&evmDebug, "evm-debug", false, "Enable EVM debug traces")
cmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "Sets the level of the own logger (error, warn, info, debug)") cmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "Sets the level of the own logger (error, warn, info, debug)")
//cmd.PersistentFlags().Bool(flags.FlagTrustNode, true, "Trust connected full node (don't verify proofs for responses)") // cmd.PersistentFlags().Bool(flags.FlagTrustNode, true, "Trust connected full node (don't verify proofs for responses)")
cmd.PersistentFlags().String(flags.FlagKeyringBackend, keyring.BackendFile, "Select keyring's backend") cmd.PersistentFlags().String(flags.FlagKeyringBackend, keyring.BackendFile, "Select keyring's backend")
// --gas can accept integers and "simulate" // --gas can accept integers and "simulate"
//cmd.PersistentFlags().Var(&flags.GasFlagVar, "gas", fmt.Sprintf( // cmd.PersistentFlags().Var(&flags.GasFlagVar, "gas", fmt.Sprintf(
// "gas limit to set per-transaction; set to %q to calculate required gas automatically (default %d)", // "gas limit to set per-transaction; set to %q to calculate required gas automatically (default %d)",
// flags.GasFlagAuto, flags.DefaultGasLimit, // flags.GasFlagAuto, flags.DefaultGasLimit,
//)) // ))
//viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode)) // viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode))
// TODO: we need to handle the errors for these, decide if we should return error upward and handle // TODO: we need to handle the errors for these, decide if we should return error upward and handle
// nolint: errcheck // nolint: errcheck

View File

@ -198,7 +198,7 @@ func (e *PublicAPI) Accounts() ([]common.Address, error) {
// BlockNumber returns the current block number. // BlockNumber returns the current block number.
func (e *PublicAPI) BlockNumber() (hexutil.Uint64, error) { func (e *PublicAPI) BlockNumber() (hexutil.Uint64, error) {
//e.logger.Debugln("eth_blockNumber") // e.logger.Debugln("eth_blockNumber")
return e.backend.BlockNumber() return e.backend.BlockNumber()
} }

View File

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

View File

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

View File

@ -81,7 +81,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
types.RegisterInterfaces(registry) types.RegisterInterfaces(registry)
} }
//____________________________________________________________________________ // ____________________________________________________________________________
// AppModule implements an application module for the evm module. // AppModule implements an application module for the evm module.
type AppModule struct { type AppModule struct {

View File

@ -29,7 +29,7 @@ func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig {
IstanbulBlock: getBlockValue(cc.IstanbulBlock), IstanbulBlock: getBlockValue(cc.IstanbulBlock),
MuirGlacierBlock: getBlockValue(cc.MuirGlacierBlock), MuirGlacierBlock: getBlockValue(cc.MuirGlacierBlock),
BerlinBlock: getBlockValue(cc.BerlinBlock), BerlinBlock: getBlockValue(cc.BerlinBlock),
//TODO(xlab): after upgrading ethereum to newer version, this should be set to YoloV2Block // TODO(xlab): after upgrading ethereum to newer version, this should be set to YoloV2Block
YoloV3Block: getBlockValue(cc.YoloV3Block), YoloV3Block: getBlockValue(cc.YoloV3Block),
EWASMBlock: getBlockValue(cc.EWASMBlock), EWASMBlock: getBlockValue(cc.EWASMBlock),
CatalystBlock: getBlockValue(cc.CatalystBlock), CatalystBlock: getBlockValue(cc.CatalystBlock),