chore: run gofumpt for non-generated files & fix tools/tools.go (#1590)
* fix comment in tools/tools.go * run gofumpt for all non-generated files
This commit is contained in:
parent
0f7bdceaa0
commit
5f0acd8c6f
@ -88,7 +88,6 @@ func (suite *BackendTestSuite) SetupTest() {
|
|||||||
// Add codec
|
// Add codec
|
||||||
encCfg := encoding.MakeConfig(app.ModuleBasics)
|
encCfg := encoding.MakeConfig(app.ModuleBasics)
|
||||||
suite.backend.clientCtx.Codec = encCfg.Codec
|
suite.backend.clientCtx.Codec = encCfg.Codec
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildEthereumTx returns an example legacy Ethereum transaction
|
// buildEthereumTx returns an example legacy Ethereum transaction
|
||||||
|
@ -489,5 +489,4 @@ func (suite *BackendTestSuite) TestGasPrice() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,6 @@ func (suite *BackendTestSuite) TestChainId() {
|
|||||||
var header metadata.MD
|
var header metadata.MD
|
||||||
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
|
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
|
||||||
RegisterParamsInvalidHeight(queryClient, &header, int64(1))
|
RegisterParamsInvalidHeight(queryClient, &header, int64(1))
|
||||||
|
|
||||||
},
|
},
|
||||||
expChainId,
|
expChainId,
|
||||||
true,
|
true,
|
||||||
@ -387,7 +386,7 @@ func (suite *BackendTestSuite) TestFeeHistory() {
|
|||||||
{
|
{
|
||||||
"fail - Invalid base fee",
|
"fail - Invalid base fee",
|
||||||
func(validator sdk.AccAddress) {
|
func(validator sdk.AccAddress) {
|
||||||
//baseFee := sdk.NewInt(1)
|
// baseFee := sdk.NewInt(1)
|
||||||
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
|
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
|
||||||
client := suite.backend.clientCtx.Client.(*mocks.Client)
|
client := suite.backend.clientCtx.Client.(*mocks.Client)
|
||||||
suite.backend.cfg.JSONRPC.FeeHistoryCap = 2
|
suite.backend.cfg.JSONRPC.FeeHistoryCap = 2
|
||||||
|
@ -2,6 +2,8 @@ package backend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
|
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
@ -18,7 +20,6 @@ import (
|
|||||||
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
|
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||||
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
|
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client defines a mocked object that implements the Tendermint JSON-RPC Client
|
// Client defines a mocked object that implements the Tendermint JSON-RPC Client
|
||||||
@ -97,6 +98,7 @@ func RegisterBlockMultipleTxs(
|
|||||||
client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil)
|
client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil)
|
||||||
return resBlock, nil
|
return resBlock, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterBlock(
|
func RegisterBlock(
|
||||||
client *mocks.Client,
|
client *mocks.Client,
|
||||||
height int64,
|
height int64,
|
||||||
|
@ -4,6 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
"testing"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
|
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
||||||
@ -18,8 +21,6 @@ import (
|
|||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"strconv"
|
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// QueryClient defines a mocked object that implements the ethermint GRPC
|
// QueryClient defines a mocked object that implements the ethermint GRPC
|
||||||
|
@ -2,6 +2,7 @@ package backend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/evmos/ethermint/rpc/backend/mocks"
|
"github.com/evmos/ethermint/rpc/backend/mocks"
|
||||||
@ -11,7 +12,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (suite *BackendTestSuite) TestGetLogs() {
|
func (suite *BackendTestSuite) TestGetLogs() {
|
||||||
|
|
||||||
_, bz := suite.buildEthereumTx()
|
_, bz := suite.buildEthereumTx()
|
||||||
block := tmtypes.MakeBlock(1, []tmtypes.Tx{bz}, nil, nil)
|
block := tmtypes.MakeBlock(1, []tmtypes.Tx{bz}, nil, nil)
|
||||||
logs := make([]*evmtypes.Log, 0, 1)
|
logs := make([]*evmtypes.Log, 0, 1)
|
||||||
|
@ -2,6 +2,8 @@ package backend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/big"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
@ -11,7 +13,6 @@ import (
|
|||||||
ethermint "github.com/evmos/ethermint/types"
|
ethermint "github.com/evmos/ethermint/types"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
|
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||||
"math/big"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *BackendTestSuite) TestRPCMinGasPrice() {
|
func (suite *BackendTestSuite) TestRPCMinGasPrice() {
|
||||||
@ -190,7 +191,6 @@ func (suite *BackendTestSuite) TestSyncing() {
|
|||||||
RegisterStatus(client)
|
RegisterStatus(client)
|
||||||
status, _ := client.Status(suite.backend.ctx)
|
status, _ := client.Status(suite.backend.ctx)
|
||||||
status.SyncInfo.CatchingUp = true
|
status.SyncInfo.CatchingUp = true
|
||||||
|
|
||||||
},
|
},
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"startingBlock": hexutil.Uint64(0),
|
"startingBlock": hexutil.Uint64(0),
|
||||||
@ -254,7 +254,7 @@ func (suite *BackendTestSuite) TestSetEtherbase() {
|
|||||||
c := sdk.NewDecCoin("aphoton", sdk.NewIntFromBigInt(big.NewInt(1)))
|
c := sdk.NewDecCoin("aphoton", sdk.NewIntFromBigInt(big.NewInt(1)))
|
||||||
suite.backend.cfg.SetMinGasPrices(sdk.DecCoins{c})
|
suite.backend.cfg.SetMinGasPrices(sdk.DecCoins{c})
|
||||||
delAddr, _ := suite.backend.GetCoinbase()
|
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())
|
delCommonAddr := common.BytesToAddress(delAddr.Bytes())
|
||||||
request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(delCommonAddr.Bytes()).String()}
|
request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(delCommonAddr.Bytes()).String()}
|
||||||
requestMarshal, _ := request.Marshal()
|
requestMarshal, _ := request.Marshal()
|
||||||
|
@ -2,6 +2,7 @@ package backend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/crypto"
|
"github.com/cosmos/cosmos-sdk/crypto"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
@ -2,6 +2,7 @@ package backend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/crypto"
|
"github.com/cosmos/cosmos-sdk/crypto"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||||
@ -79,7 +80,7 @@ func (suite *BackendTestSuite) TestTraceTransaction() {
|
|||||||
{
|
{
|
||||||
"fail - block not found",
|
"fail - block not found",
|
||||||
func() {
|
func() {
|
||||||
//var header metadata.MD
|
// var header metadata.MD
|
||||||
client := suite.backend.clientCtx.Client.(*mocks.Client)
|
client := suite.backend.clientCtx.Client.(*mocks.Client)
|
||||||
RegisterBlockError(client, 1)
|
RegisterBlockError(client, 1)
|
||||||
},
|
},
|
||||||
@ -180,7 +181,7 @@ func (suite *BackendTestSuite) TestTraceTransaction() {
|
|||||||
suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx)
|
suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx)
|
||||||
|
|
||||||
err := suite.backend.indexer.IndexBlock(tc.block, tc.responseBlock)
|
err := suite.backend.indexer.IndexBlock(tc.block, tc.responseBlock)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
txResult, err := suite.backend.TraceTransaction(txHash, nil)
|
txResult, err := suite.backend.TraceTransaction(txHash, nil)
|
||||||
|
|
||||||
if tc.expPass {
|
if tc.expPass {
|
||||||
@ -223,7 +224,6 @@ func (suite *BackendTestSuite) TestTraceBlock() {
|
|||||||
func() {
|
func() {
|
||||||
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
|
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
|
||||||
RegisterTraceBlock(queryClient, []*evmtypes.MsgEthereumTx{msgEthTx})
|
RegisterTraceBlock(queryClient, []*evmtypes.MsgEthereumTx{msgEthTx})
|
||||||
|
|
||||||
},
|
},
|
||||||
[]*evmtypes.TxTraceResult{},
|
[]*evmtypes.TxTraceResult{},
|
||||||
&resBlockFilled,
|
&resBlockFilled,
|
||||||
|
@ -2,6 +2,8 @@ package backend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/big"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
@ -16,7 +18,6 @@ import (
|
|||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
dbm "github.com/tendermint/tm-db"
|
dbm "github.com/tendermint/tm-db"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"math/big"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *BackendTestSuite) TestGetTransactionByHash() {
|
func (suite *BackendTestSuite) TestGetTransactionByHash() {
|
||||||
@ -299,7 +300,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockAndIndex() {
|
|||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
big.NewInt(1),
|
big.NewInt(1),
|
||||||
suite.backend.chainID,
|
suite.backend.chainID,
|
||||||
)
|
)
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@ -393,7 +394,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockNumberAndIndex() {
|
|||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
big.NewInt(1),
|
big.NewInt(1),
|
||||||
suite.backend.chainID,
|
suite.backend.chainID,
|
||||||
)
|
)
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@ -554,7 +555,6 @@ func (suite *BackendTestSuite) TestGetTransactionReceipt() {
|
|||||||
RegisterParamsWithoutHeader(queryClient, 1)
|
RegisterParamsWithoutHeader(queryClient, 1)
|
||||||
RegisterBlock(client, 1, txBz)
|
RegisterBlock(client, 1, txBz)
|
||||||
RegisterBlockResults(client, 1)
|
RegisterBlockResults(client, 1)
|
||||||
|
|
||||||
},
|
},
|
||||||
msgEthereumTx,
|
msgEthereumTx,
|
||||||
&types.Block{Header: types.Header{Height: 1}, Data: types.Data{Txs: []types.Tx{txBz}}},
|
&types.Block{Header: types.Header{Height: 1}, Data: types.Data{Txs: []types.Tx{txBz}}},
|
||||||
@ -585,8 +585,8 @@ func (suite *BackendTestSuite) TestGetTransactionReceipt() {
|
|||||||
|
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx)
|
suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx)
|
||||||
err := suite.backend.indexer.IndexBlock(tc.block, tc.blockResult)
|
err := suite.backend.indexer.IndexBlock(tc.block, tc.blockResult)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
txReceipt, err := suite.backend.GetTransactionReceipt(common.HexToHash(tc.tx.Hash))
|
txReceipt, err := suite.backend.GetTransactionReceipt(common.HexToHash(tc.tx.Hash))
|
||||||
if tc.expPass {
|
if tc.expPass {
|
||||||
|
@ -21,20 +21,5 @@ import (
|
|||||||
_ "github.com/onsi/ginkgo/v2"
|
_ "github.com/onsi/ginkgo/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This file imports // Copyright 2021 Evmos Foundation
|
// This file imports packages that are used when running go generate, or used
|
||||||
// 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
|
|
||||||
// during the development process but not otherwise depended on by built code.
|
// during the development process but not otherwise depended on by built code.
|
||||||
|
Loading…
Reference in New Issue
Block a user