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

Commit

Permalink
chore: run gofumpt for non-generated files & fix tools/tools.go (#1590)
Browse files Browse the repository at this point in the history
* fix comment in tools/tools.go

* run gofumpt for all non-generated files
  • Loading branch information
MalteHerrmann authored Jan 5, 2023
1 parent 0f7bdce commit 5f0acd8
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 36 deletions.
1 change: 0 additions & 1 deletion rpc/backend/backend_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func (suite *BackendTestSuite) SetupTest() {
// Add codec
encCfg := encoding.MakeConfig(app.ModuleBasics)
suite.backend.clientCtx.Codec = encCfg.Codec

}

// buildEthereumTx returns an example legacy Ethereum transaction
Expand Down
1 change: 0 additions & 1 deletion rpc/backend/call_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,5 +489,4 @@ func (suite *BackendTestSuite) TestGasPrice() {
}
})
}

}
3 changes: 1 addition & 2 deletions rpc/backend/chain_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ func (suite *BackendTestSuite) TestChainId() {
var header metadata.MD
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
RegisterParamsInvalidHeight(queryClient, &header, int64(1))

},
expChainId,
true,
Expand Down Expand Up @@ -387,7 +386,7 @@ func (suite *BackendTestSuite) TestFeeHistory() {
{
"fail - Invalid base fee",
func(validator sdk.AccAddress) {
//baseFee := sdk.NewInt(1)
// baseFee := sdk.NewInt(1)
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
client := suite.backend.clientCtx.Client.(*mocks.Client)
suite.backend.cfg.JSONRPC.FeeHistoryCap = 2
Expand Down
4 changes: 3 additions & 1 deletion rpc/backend/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package backend

import (
"context"
"testing"

"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
Expand All @@ -18,7 +20,6 @@ import (
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
"testing"
)

// Client defines a mocked object that implements the Tendermint JSON-RPC Client
Expand Down Expand Up @@ -97,6 +98,7 @@ func RegisterBlockMultipleTxs(
client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil)
return resBlock, nil
}

func RegisterBlock(
client *mocks.Client,
height int64,
Expand Down
5 changes: 3 additions & 2 deletions rpc/backend/evm_query_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
"strconv"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
Expand All @@ -18,8 +21,6 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"strconv"
"testing"
)

// QueryClient defines a mocked object that implements the ethermint GRPC
Expand Down
2 changes: 1 addition & 1 deletion rpc/backend/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package backend

import (
"encoding/json"

"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/evmos/ethermint/rpc/backend/mocks"
Expand All @@ -11,7 +12,6 @@ import (
)

func (suite *BackendTestSuite) TestGetLogs() {

_, bz := suite.buildEthereumTx()
block := tmtypes.MakeBlock(1, []tmtypes.Tx{bz}, nil, nil)
logs := make([]*evmtypes.Log, 0, 1)
Expand Down
6 changes: 3 additions & 3 deletions rpc/backend/node_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package backend

import (
"fmt"
"math/big"

sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/ethereum/go-ethereum/common"
Expand All @@ -11,7 +13,6 @@ import (
ethermint "github.com/evmos/ethermint/types"
"github.com/spf13/viper"
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
"math/big"
)

func (suite *BackendTestSuite) TestRPCMinGasPrice() {
Expand Down Expand Up @@ -190,7 +191,6 @@ func (suite *BackendTestSuite) TestSyncing() {
RegisterStatus(client)
status, _ := client.Status(suite.backend.ctx)
status.SyncInfo.CatchingUp = true

},
map[string]interface{}{
"startingBlock": hexutil.Uint64(0),
Expand Down Expand Up @@ -254,7 +254,7 @@ func (suite *BackendTestSuite) TestSetEtherbase() {
c := sdk.NewDecCoin("aphoton", sdk.NewIntFromBigInt(big.NewInt(1)))
suite.backend.cfg.SetMinGasPrices(sdk.DecCoins{c})
delAddr, _ := suite.backend.GetCoinbase()
//account, _ := suite.backend.clientCtx.AccountRetriever.GetAccount(suite.backend.clientCtx, delAddr)
// account, _ := suite.backend.clientCtx.AccountRetriever.GetAccount(suite.backend.clientCtx, delAddr)
delCommonAddr := common.BytesToAddress(delAddr.Bytes())
request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(delCommonAddr.Bytes()).String()}
requestMarshal, _ := request.Marshal()
Expand Down
1 change: 1 addition & 0 deletions rpc/backend/sign_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package backend

import (
"fmt"

"github.com/cosmos/cosmos-sdk/crypto"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
Expand Down
6 changes: 3 additions & 3 deletions rpc/backend/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package backend

import (
"fmt"

"github.com/cosmos/cosmos-sdk/crypto"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -79,7 +80,7 @@ func (suite *BackendTestSuite) TestTraceTransaction() {
{
"fail - block not found",
func() {
//var header metadata.MD
// var header metadata.MD
client := suite.backend.clientCtx.Client.(*mocks.Client)
RegisterBlockError(client, 1)
},
Expand Down Expand Up @@ -180,7 +181,7 @@ func (suite *BackendTestSuite) TestTraceTransaction() {
suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx)

err := suite.backend.indexer.IndexBlock(tc.block, tc.responseBlock)
suite.Require().NoError(err)
suite.Require().NoError(err)
txResult, err := suite.backend.TraceTransaction(txHash, nil)

if tc.expPass {
Expand Down Expand Up @@ -223,7 +224,6 @@ func (suite *BackendTestSuite) TestTraceBlock() {
func() {
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
RegisterTraceBlock(queryClient, []*evmtypes.MsgEthereumTx{msgEthTx})

},
[]*evmtypes.TxTraceResult{},
&resBlockFilled,
Expand Down
12 changes: 6 additions & 6 deletions rpc/backend/tx_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package backend

import (
"fmt"
"math/big"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand All @@ -16,7 +18,6 @@ import (
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"google.golang.org/grpc/metadata"
"math/big"
)

func (suite *BackendTestSuite) TestGetTransactionByHash() {
Expand Down Expand Up @@ -299,7 +300,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockAndIndex() {
1,
0,
big.NewInt(1),
suite.backend.chainID,
suite.backend.chainID,
)
testCases := []struct {
name string
Expand Down Expand Up @@ -393,7 +394,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockNumberAndIndex() {
1,
0,
big.NewInt(1),
suite.backend.chainID,
suite.backend.chainID,
)
testCases := []struct {
name string
Expand Down Expand Up @@ -554,7 +555,6 @@ func (suite *BackendTestSuite) TestGetTransactionReceipt() {
RegisterParamsWithoutHeader(queryClient, 1)
RegisterBlock(client, 1, txBz)
RegisterBlockResults(client, 1)

},
msgEthereumTx,
&types.Block{Header: types.Header{Height: 1}, Data: types.Data{Txs: []types.Tx{txBz}}},
Expand Down Expand Up @@ -585,8 +585,8 @@ func (suite *BackendTestSuite) TestGetTransactionReceipt() {

db := dbm.NewMemDB()
suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx)
err := suite.backend.indexer.IndexBlock(tc.block, tc.blockResult)
suite.Require().NoError(err)
err := suite.backend.indexer.IndexBlock(tc.block, tc.blockResult)
suite.Require().NoError(err)

txReceipt, err := suite.backend.GetTransactionReceipt(common.HexToHash(tc.tx.Hash))
if tc.expPass {
Expand Down
17 changes: 1 addition & 16 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,5 @@ import (
_ "github.com/onsi/ginkgo/v2"
)

// This file imports // Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
packages that are used when running go generate, or used
// This file imports packages that are used when running go generate, or used
// during the development process but not otherwise depended on by built code.

0 comments on commit 5f0acd8

Please sign in to comment.