Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
fix: lint issues (#1731)
Browse files Browse the repository at this point in the history
  • Loading branch information
facs95 authored Mar 28, 2023
1 parent 2e6e863 commit 7947515
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
// Get bip39 mnemonic
var mnemonic, bip39Passphrase string

recover, _ := cmd.Flags().GetBool(flagRecover)
if recover {
recoverKey, _ := cmd.Flags().GetBool(flagRecover)
if recoverKey {
mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf)
if err != nil {
return err
Expand Down Expand Up @@ -258,7 +258,7 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
}

// Recover key from seed passphrase
if recover {
if recoverKey {
// Hide mnemonic from output
showMnemonic = false
mnemonic = ""
Expand Down
6 changes: 3 additions & 3 deletions ethereum/eip712/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,16 @@ func jsonNameFromTag(tag reflect.StructTag) string {

// Unpack the given Any value with Type/Value deconstruction
func unpackAny(cdc codectypes.AnyUnpacker, field reflect.Value) (reflect.Type, reflect.Value, error) {
any, ok := field.Interface().(*codectypes.Any)
anyData, ok := field.Interface().(*codectypes.Any)
if !ok {
return nil, reflect.Value{}, errorsmod.Wrapf(errortypes.ErrPackAny, "%T", field.Interface())
}

anyWrapper := &cosmosAnyWrapper{
Type: any.TypeUrl,
Type: anyData.TypeUrl,
}

if err := cdc.UnpackAny(any, &anyWrapper.Value); err != nil {
if err := cdc.UnpackAny(anyData, &anyWrapper.Value); err != nil {
return nil, reflect.Value{}, errorsmod.Wrap(err, "failed to unpack Any in msg struct")
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/backend/node_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (b *Backend) ListAccounts() ([]common.Address, error) {

// NewAccount will create a new account and returns the address for the new account.
func (b *Backend) NewMnemonic(uid string,
language keyring.Language,
_ keyring.Language,
hdPath,
bip39Passphrase string,
algo keyring.SignatureAlgo,
Expand Down
8 changes: 4 additions & 4 deletions rpc/namespaces/ethereum/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,22 +353,22 @@ func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint
///////////////////////////////////////////////////////////////////////////////

// GetUncleByBlockHashAndIndex returns the uncle identified by hash and index. Always returns nil.
func (e *PublicAPI) GetUncleByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) map[string]interface{} {
func (e *PublicAPI) GetUncleByBlockHashAndIndex(_ common.Hash, _ hexutil.Uint) map[string]interface{} {
return nil
}

// GetUncleByBlockNumberAndIndex returns the uncle identified by number and index. Always returns nil.
func (e *PublicAPI) GetUncleByBlockNumberAndIndex(number, idx hexutil.Uint) map[string]interface{} {
func (e *PublicAPI) GetUncleByBlockNumberAndIndex(_, _ hexutil.Uint) map[string]interface{} {
return nil
}

// GetUncleCountByBlockHash returns the number of uncles in the block identified by hash. Always zero.
func (e *PublicAPI) GetUncleCountByBlockHash(hash common.Hash) hexutil.Uint {
func (e *PublicAPI) GetUncleCountByBlockHash(_ common.Hash) hexutil.Uint {
return 0
}

// GetUncleCountByBlockNumber returns the number of uncles in the block identified by number. Always zero.
func (e *PublicAPI) GetUncleCountByBlockNumber(blockNum rpctypes.BlockNumber) hexutil.Uint {
func (e *PublicAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.Uint {
return 0
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/namespaces/ethereum/eth/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const (

// Logs searches the blockchain for matching log entries, returning all from the
// first block that contains matches, updating the start of the filter accordingly.
func (f *Filter) Logs(ctx context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) {
func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) {
logs := []*ethtypes.Log{}
var err error

Expand Down
6 changes: 3 additions & 3 deletions rpc/namespaces/ethereum/miner/unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func (api *API) GetHashrate() uint64 {

// SetExtra sets the extra data string that is included when this miner mines a block.
// Unsupported in Ethermint
func (api *API) SetExtra(extra string) (bool, error) {
func (api *API) SetExtra(_ string) (bool, error) {
api.logger.Debug("miner_setExtra")
api.logger.Debug("Unsupported rpc function: miner_setExtra")
return false, errors.New("unsupported rpc function: miner_setExtra")
}

// SetGasLimit sets the gaslimit to target towards during mining.
// Unsupported in Ethermint
func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool {
func (api *API) SetGasLimit(_ hexutil.Uint64) bool {
api.logger.Debug("miner_setGasLimit")
api.logger.Debug("Unsupported rpc function: miner_setGasLimit")
return false
Expand All @@ -51,7 +51,7 @@ func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool {
// number of threads allowed to use and updates the minimum price required by the
// transaction pool.
// Unsupported in Ethermint
func (api *API) Start(threads *int) error {
func (api *API) Start(_ *int) error {
api.logger.Debug("miner_start")
api.logger.Debug("Unsupported rpc function: miner_start")
return errors.New("unsupported rpc function: miner_start")
Expand Down
2 changes: 1 addition & 1 deletion rpc/websockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn, subID rpc.ID)
return unsubFn, nil
}

func (api *pubSubAPI) subscribeSyncing(wsConn *wsConn, subID rpc.ID) (pubsub.UnsubscribeFunc, error) {
func (api *pubSubAPI) subscribeSyncing(_ *wsConn, _ rpc.ID) (pubsub.UnsubscribeFunc, error) {
return nil, errors.New("syncing subscription is not implemented")
}

Expand Down
2 changes: 1 addition & 1 deletion tests/importer/chain_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (cc *ChainContext) Seal(_ ethcons.ChainHeaderReader, _ *ethtypes.Block, _ c

// SealHash implements Ethereum's consensus.Engine interface. It returns the
// hash of a block prior to it being sealed.
func (cc *ChainContext) SealHash(header *ethtypes.Header) common.Hash {
func (cc *ChainContext) SealHash(_ *ethtypes.Header) common.Hash {
return common.Hash{}
}

Expand Down
4 changes: 2 additions & 2 deletions x/evm/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import (
)

// BeginBlock sets the sdk Context and EIP155 chain id to the Keeper.
func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
func (k *Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
k.WithChainID(ctx)
}

// EndBlock also retrieves the bloom filter value from the transient store and commits it to the
// KVStore. The EVM end block logic doesn't update the validator set, thus it returns
// an empty slice.
func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
// Gas costs are handled within msg handler so costs should be ignored
infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter())

Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig

// VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the
// module parameters. The config generated uses the default JumpTable from the EVM.
func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger) vm.Config {
func (k Keeper) VMConfig(ctx sdk.Context, _ core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger) vm.Config {
noBaseFee := true
if types.IsLondon(cfg.ChainConfig, ctx.BlockHeight()) {
noBaseFee = k.feeMarketKeeper.GetParams(ctx).NoBaseFee
Expand Down
12 changes: 6 additions & 6 deletions x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type

// Binary search the gas requirement, as it may be higher than the amount used
var (
lo = ethparams.TxGas - 1
hi uint64
cap uint64
lo = ethparams.TxGas - 1
hi uint64
gasCap uint64
)

// Determine the highest gas limit can be used during the estimation.
Expand All @@ -314,7 +314,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
if req.GasCap != 0 && hi > req.GasCap {
hi = req.GasCap
}
cap = hi
gasCap = hi
cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress), chainID)
if err != nil {
return nil, status.Error(codes.Internal, "failed to load evm config")
Expand Down Expand Up @@ -370,7 +370,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
}

// Reject the transaction as invalid if it still fails at the highest allowance
if hi == cap {
if hi == gasCap {
failed, result, err := executable(hi)
if err != nil {
return nil, err
Expand All @@ -384,7 +384,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
return nil, errors.New(result.VmError)
}
// Otherwise, the specified gas cap is too low
return nil, fmt.Errorf("gas required exceeds allowance (%d)", cap)
return nil, fmt.Errorf("gas required exceeds allowance (%d)", gasCap)
}
}
return &types.EstimateGasResponse{Gas: hi}, nil
Expand Down
2 changes: 1 addition & 1 deletion x/evm/statedb/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (s *StateDB) HasSuicided(addr common.Address) bool {
// AddPreimage performs a no-op since the EnablePreimageRecording flag is disabled
// on the vm.Config during state transitions. No store trie preimages are written
// to the database.
func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {}
func (s *StateDB) AddPreimage(_ common.Hash, _ []byte) {}

// getStateObject retrieves a state object given by the address, returning nil if
// the object is not found.
Expand Down
6 changes: 3 additions & 3 deletions x/evm/types/access_list_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,16 @@ func (tx AccessListTx) Cost() *big.Int {
}

// EffectiveGasPrice is the same as GasPrice for AccessListTx
func (tx AccessListTx) EffectiveGasPrice(baseFee *big.Int) *big.Int {
func (tx AccessListTx) EffectiveGasPrice(_ *big.Int) *big.Int {
return tx.GetGasPrice()
}

// EffectiveFee is the same as Fee for AccessListTx
func (tx AccessListTx) EffectiveFee(baseFee *big.Int) *big.Int {
func (tx AccessListTx) EffectiveFee(_ *big.Int) *big.Int {
return tx.Fee()
}

// EffectiveCost is the same as Cost for AccessListTx
func (tx AccessListTx) EffectiveCost(baseFee *big.Int) *big.Int {
func (tx AccessListTx) EffectiveCost(_ *big.Int) *big.Int {
return tx.Cost()
}
6 changes: 3 additions & 3 deletions x/evm/types/legacy_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ func (tx LegacyTx) Cost() *big.Int {
}

// EffectiveGasPrice is the same as GasPrice for LegacyTx
func (tx LegacyTx) EffectiveGasPrice(baseFee *big.Int) *big.Int {
func (tx LegacyTx) EffectiveGasPrice(_ *big.Int) *big.Int {
return tx.GetGasPrice()
}

// EffectiveFee is the same as Fee for LegacyTx
func (tx LegacyTx) EffectiveFee(baseFee *big.Int) *big.Int {
func (tx LegacyTx) EffectiveFee(_ *big.Int) *big.Int {
return tx.Fee()
}

// EffectiveCost is the same as Cost for LegacyTx
func (tx LegacyTx) EffectiveCost(baseFee *big.Int) *big.Int {
func (tx LegacyTx) EffectiveCost(_ *big.Int) *big.Int {
return tx.Cost()
}
28 changes: 14 additions & 14 deletions x/evm/types/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,35 +75,35 @@ func NewNoOpTracer() *NoOpTracer {
}

// CaptureStart implements vm.Tracer interface
func (dt NoOpTracer) CaptureStart(env *vm.EVM,
from common.Address,
to common.Address,
create bool,
input []byte,
gas uint64,
value *big.Int) {
func (dt NoOpTracer) CaptureStart(_ *vm.EVM,
_ common.Address,
_ common.Address,
_ bool,
_ []byte,
_ uint64,
_ *big.Int) {
}

// CaptureState implements vm.Tracer interface
func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
func (dt NoOpTracer) CaptureState(_ uint64, _ vm.OpCode, _, _ uint64, _ *vm.ScopeContext, _ []byte, _ int, _ error) {
}

// CaptureFault implements vm.Tracer interface
func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) {
func (dt NoOpTracer) CaptureFault(_ uint64, _ vm.OpCode, _, _ uint64, _ *vm.ScopeContext, _ int, _ error) {
}

// CaptureEnd implements vm.Tracer interface
func (dt NoOpTracer) CaptureEnd(output []byte, gasUsed uint64, tm time.Duration, err error) {}
func (dt NoOpTracer) CaptureEnd(_ []byte, _ uint64, _ time.Duration, _ error) {}

// CaptureEnter implements vm.Tracer interface
func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
func (dt NoOpTracer) CaptureEnter(_ vm.OpCode, _ common.Address, _ common.Address, _ []byte, _ uint64, _ *big.Int) {
}

// CaptureExit implements vm.Tracer interface
func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error) {}
func (dt NoOpTracer) CaptureExit(_ []byte, _ uint64, _ error) {}

// CaptureTxStart implements vm.Tracer interface
func (dt NoOpTracer) CaptureTxStart(gasLimit uint64) {}
func (dt NoOpTracer) CaptureTxStart(_ uint64) {}

// CaptureTxEnd implements vm.Tracer interface
func (dt NoOpTracer) CaptureTxEnd(restGas uint64) {}
func (dt NoOpTracer) CaptureTxEnd(_ uint64) {}
4 changes: 2 additions & 2 deletions x/evm/types/tx_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (args *TransactionArgs) ToTransaction() *MsgEthereumTx {
}
}

any, err := PackTxData(data)
anyData, err := PackTxData(data)
if err != nil {
return nil
}
Expand All @@ -160,7 +160,7 @@ func (args *TransactionArgs) ToTransaction() *MsgEthereumTx {
}

msg := MsgEthereumTx{
Data: any,
Data: anyData,
From: from,
}
msg.Hash = msg.AsTransaction().Hash().Hex()
Expand Down
4 changes: 2 additions & 2 deletions x/feemarket/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

// BeginBlock updates base fee
func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
func (k *Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
baseFee := k.CalculateBaseFee(ctx)

// return immediately if base fee is nil
Expand All @@ -52,7 +52,7 @@ func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
// EndBlock update block gas wanted.
// The EVM end block logic doesn't update the validator set, thus it returns
// an empty slice.
func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) {
func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) {
if ctx.BlockGasMeter() == nil {
k.Logger(ctx).Error("block gas meter is nil when setting block gas wanted")
return
Expand Down

0 comments on commit 7947515

Please sign in to comment.