2021-05-17 10:13:08 +00:00
|
|
|
package keeper_test
|
|
|
|
|
|
|
|
import (
|
2021-07-23 14:24:36 +00:00
|
|
|
"encoding/json"
|
2021-05-17 10:13:08 +00:00
|
|
|
"fmt"
|
2021-07-23 14:24:36 +00:00
|
|
|
"math/big"
|
2021-05-17 10:13:08 +00:00
|
|
|
|
2021-06-08 17:10:29 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2021-07-23 14:24:36 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
2022-01-05 07:28:27 +00:00
|
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
2021-09-03 18:06:36 +00:00
|
|
|
"github.com/ethereum/go-ethereum/crypto"
|
2022-04-30 16:11:28 +00:00
|
|
|
ethparams "github.com/ethereum/go-ethereum/params"
|
2022-01-05 07:28:27 +00:00
|
|
|
"github.com/tharsis/ethermint/x/evm/statedb"
|
2021-05-17 10:13:08 +00:00
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
|
2022-01-04 10:55:30 +00:00
|
|
|
"github.com/tharsis/ethermint/crypto/ethsecp256k1"
|
|
|
|
"github.com/tharsis/ethermint/server/config"
|
2021-06-22 10:49:18 +00:00
|
|
|
ethermint "github.com/tharsis/ethermint/types"
|
|
|
|
"github.com/tharsis/ethermint/x/evm/types"
|
2021-05-17 10:13:08 +00:00
|
|
|
)
|
|
|
|
|
2021-09-05 11:03:06 +00:00
|
|
|
// Not valid Ethereum address
|
2021-06-29 15:08:07 +00:00
|
|
|
const invalidAddress = "0x0000"
|
|
|
|
|
2021-05-17 10:13:08 +00:00
|
|
|
func (suite *KeeperTestSuite) TestQueryAccount() {
|
|
|
|
var (
|
|
|
|
req *types.QueryAccountRequest
|
|
|
|
expAccount *types.QueryAccountResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
}{
|
2021-06-30 15:28:38 +00:00
|
|
|
{
|
|
|
|
"invalid address",
|
2021-05-17 10:13:08 +00:00
|
|
|
func() {
|
|
|
|
expAccount = &types.QueryAccountResponse{
|
2021-07-02 09:29:47 +00:00
|
|
|
Balance: "0",
|
2021-09-03 18:06:36 +00:00
|
|
|
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).Hex(),
|
2021-05-17 10:13:08 +00:00
|
|
|
Nonce: 0,
|
|
|
|
}
|
|
|
|
req = &types.QueryAccountRequest{
|
2021-06-29 15:08:07 +00:00
|
|
|
Address: invalidAddress,
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
|
|
|
func() {
|
2021-06-29 17:02:21 +00:00
|
|
|
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)}
|
2021-06-30 15:28:38 +00:00
|
|
|
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
|
2021-05-17 10:13:08 +00:00
|
|
|
expAccount = &types.QueryAccountResponse{
|
2021-07-02 09:29:47 +00:00
|
|
|
Balance: "100",
|
2021-09-03 18:06:36 +00:00
|
|
|
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).Hex(),
|
2021-05-17 10:13:08 +00:00
|
|
|
Nonce: 0,
|
|
|
|
}
|
|
|
|
req = &types.QueryAccountRequest{
|
|
|
|
Address: suite.address.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
res, err := suite.queryClient.Account(ctx, req)
|
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
|
|
|
|
suite.Require().Equal(expAccount, res)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryCosmosAccount() {
|
|
|
|
var (
|
|
|
|
req *types.QueryCosmosAccountRequest
|
|
|
|
expAccount *types.QueryCosmosAccountResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
}{
|
2021-09-05 11:03:06 +00:00
|
|
|
{
|
|
|
|
"invalid address",
|
2021-05-17 10:13:08 +00:00
|
|
|
func() {
|
|
|
|
expAccount = &types.QueryCosmosAccountResponse{
|
2021-09-03 18:06:36 +00:00
|
|
|
CosmosAddress: sdk.AccAddress(common.Address{}.Bytes()).String(),
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
req = &types.QueryCosmosAccountRequest{
|
2021-06-29 15:08:07 +00:00
|
|
|
Address: invalidAddress,
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
|
|
|
func() {
|
|
|
|
expAccount = &types.QueryCosmosAccountResponse{
|
|
|
|
CosmosAddress: sdk.AccAddress(suite.address.Bytes()).String(),
|
|
|
|
Sequence: 0,
|
|
|
|
AccountNumber: 0,
|
|
|
|
}
|
|
|
|
req = &types.QueryCosmosAccountRequest{
|
|
|
|
Address: suite.address.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success with seq and account number",
|
|
|
|
func() {
|
|
|
|
acc := suite.app.AccountKeeper.GetAccount(suite.ctx, suite.address.Bytes())
|
|
|
|
suite.Require().NoError(acc.SetSequence(10))
|
|
|
|
suite.Require().NoError(acc.SetAccountNumber(1))
|
|
|
|
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
|
|
|
|
|
|
|
expAccount = &types.QueryCosmosAccountResponse{
|
|
|
|
CosmosAddress: sdk.AccAddress(suite.address.Bytes()).String(),
|
|
|
|
Sequence: 10,
|
|
|
|
AccountNumber: 1,
|
|
|
|
}
|
|
|
|
req = &types.QueryCosmosAccountRequest{
|
|
|
|
Address: suite.address.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
res, err := suite.queryClient.CosmosAccount(ctx, req)
|
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
|
|
|
|
suite.Require().Equal(expAccount, res)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryBalance() {
|
|
|
|
var (
|
|
|
|
req *types.QueryBalanceRequest
|
2021-07-02 09:29:47 +00:00
|
|
|
expBalance string
|
2021-05-17 10:13:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
}{
|
2021-09-05 11:03:06 +00:00
|
|
|
{
|
|
|
|
"invalid address",
|
2021-05-17 10:13:08 +00:00
|
|
|
func() {
|
2021-07-02 09:29:47 +00:00
|
|
|
expBalance = "0"
|
2021-05-17 10:13:08 +00:00
|
|
|
req = &types.QueryBalanceRequest{
|
2021-06-29 15:08:07 +00:00
|
|
|
Address: invalidAddress,
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
|
|
|
func() {
|
2021-06-29 17:02:21 +00:00
|
|
|
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)}
|
2021-06-30 15:28:38 +00:00
|
|
|
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
|
2021-07-02 09:29:47 +00:00
|
|
|
expBalance = "100"
|
2021-05-17 10:13:08 +00:00
|
|
|
req = &types.QueryBalanceRequest{
|
|
|
|
Address: suite.address.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
res, err := suite.queryClient.Balance(ctx, req)
|
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
|
|
|
|
suite.Require().Equal(expBalance, res.Balance)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryStorage() {
|
|
|
|
var (
|
|
|
|
req *types.QueryStorageRequest
|
|
|
|
expValue string
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
2022-01-05 07:28:27 +00:00
|
|
|
malleate func(vm.StateDB)
|
2021-05-17 10:13:08 +00:00
|
|
|
expPass bool
|
|
|
|
}{
|
2021-09-05 11:03:06 +00:00
|
|
|
{
|
|
|
|
"invalid address",
|
2022-01-05 07:28:27 +00:00
|
|
|
func(vm.StateDB) {
|
2021-05-17 10:13:08 +00:00
|
|
|
req = &types.QueryStorageRequest{
|
2021-06-29 15:08:07 +00:00
|
|
|
Address: invalidAddress,
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
2022-01-05 07:28:27 +00:00
|
|
|
func(vmdb vm.StateDB) {
|
2021-09-03 18:06:36 +00:00
|
|
|
key := common.BytesToHash([]byte("key"))
|
|
|
|
value := common.BytesToHash([]byte("value"))
|
2021-05-17 10:13:08 +00:00
|
|
|
expValue = value.String()
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb.SetState(suite.address, key, value)
|
2021-05-17 10:13:08 +00:00
|
|
|
req = &types.QueryStorageRequest{
|
|
|
|
Address: suite.address.String(),
|
|
|
|
Key: key.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb := suite.StateDB()
|
|
|
|
tc.malleate(vmdb)
|
|
|
|
suite.Require().NoError(vmdb.Commit())
|
|
|
|
|
2021-05-17 10:13:08 +00:00
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
res, err := suite.queryClient.Storage(ctx, req)
|
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
|
|
|
|
suite.Require().Equal(expValue, res.Value)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryCode() {
|
|
|
|
var (
|
|
|
|
req *types.QueryCodeRequest
|
|
|
|
expCode []byte
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
2022-01-05 07:28:27 +00:00
|
|
|
malleate func(vm.StateDB)
|
2021-05-17 10:13:08 +00:00
|
|
|
expPass bool
|
|
|
|
}{
|
2021-09-05 11:03:06 +00:00
|
|
|
{
|
|
|
|
"invalid address",
|
2022-01-05 07:28:27 +00:00
|
|
|
func(vm.StateDB) {
|
2021-05-17 10:13:08 +00:00
|
|
|
req = &types.QueryCodeRequest{
|
2021-06-29 15:08:07 +00:00
|
|
|
Address: invalidAddress,
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
exp := &types.QueryCodeResponse{}
|
|
|
|
expCode = exp.Code
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
2022-01-05 07:28:27 +00:00
|
|
|
func(vmdb vm.StateDB) {
|
2021-05-17 10:13:08 +00:00
|
|
|
expCode = []byte("code")
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb.SetCode(suite.address, expCode)
|
2021-05-17 10:13:08 +00:00
|
|
|
|
|
|
|
req = &types.QueryCodeRequest{
|
|
|
|
Address: suite.address.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb := suite.StateDB()
|
|
|
|
tc.malleate(vmdb)
|
|
|
|
suite.Require().NoError(vmdb.Commit())
|
|
|
|
|
2021-05-17 10:13:08 +00:00
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
res, err := suite.queryClient.Code(ctx, req)
|
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
|
|
|
|
suite.Require().Equal(expCode, res.Code)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryTxLogs() {
|
2022-01-05 18:18:02 +00:00
|
|
|
var expLogs []*types.Log
|
2022-01-05 07:28:27 +00:00
|
|
|
txHash := common.BytesToHash([]byte("tx_hash"))
|
|
|
|
txIndex := uint(1)
|
|
|
|
logIndex := uint(1)
|
2021-05-17 10:13:08 +00:00
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
2022-01-05 07:28:27 +00:00
|
|
|
malleate func(vm.StateDB)
|
2021-05-17 10:13:08 +00:00
|
|
|
}{
|
2021-09-05 11:03:06 +00:00
|
|
|
{
|
2021-09-15 09:45:03 +00:00
|
|
|
"empty logs",
|
2022-01-05 07:28:27 +00:00
|
|
|
func(vm.StateDB) {
|
2021-09-15 09:45:03 +00:00
|
|
|
expLogs = nil
|
2021-05-17 10:13:08 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
2022-01-05 07:28:27 +00:00
|
|
|
func(vmdb vm.StateDB) {
|
2021-05-17 10:13:08 +00:00
|
|
|
expLogs = []*types.Log{
|
|
|
|
{
|
|
|
|
Address: suite.address.String(),
|
2021-09-03 18:06:36 +00:00
|
|
|
Topics: []string{common.BytesToHash([]byte("topic")).String()},
|
2021-05-17 10:13:08 +00:00
|
|
|
Data: []byte("data"),
|
|
|
|
BlockNumber: 1,
|
2021-09-15 09:45:03 +00:00
|
|
|
TxHash: txHash.String(),
|
2022-01-05 07:28:27 +00:00
|
|
|
TxIndex: uint64(txIndex),
|
2021-09-15 09:45:03 +00:00
|
|
|
BlockHash: common.BytesToHash(suite.ctx.HeaderHash()).Hex(),
|
2022-01-05 07:28:27 +00:00
|
|
|
Index: uint64(logIndex),
|
2021-05-17 10:13:08 +00:00
|
|
|
Removed: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-09-15 09:45:03 +00:00
|
|
|
for _, log := range types.LogsToEthereum(expLogs) {
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb.AddLog(log)
|
2021-05-17 10:13:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb := statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()), txHash, txIndex, logIndex))
|
|
|
|
tc.malleate(vmdb)
|
|
|
|
suite.Require().NoError(vmdb.Commit())
|
|
|
|
|
|
|
|
logs := vmdb.Logs()
|
2021-09-15 09:45:03 +00:00
|
|
|
suite.Require().Equal(expLogs, types.NewLogsFromEth(logs))
|
2021-05-17 10:13:08 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryParams() {
|
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
expParams := types.DefaultParams()
|
|
|
|
|
|
|
|
res, err := suite.queryClient.Params(ctx, &types.QueryParamsRequest{})
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().Equal(expParams, res.Params)
|
|
|
|
}
|
2021-06-22 10:14:40 +00:00
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryValidatorAccount() {
|
|
|
|
var (
|
|
|
|
req *types.QueryValidatorAccountRequest
|
|
|
|
expAccount *types.QueryValidatorAccountResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
}{
|
2021-09-05 11:03:06 +00:00
|
|
|
{
|
|
|
|
"invalid address",
|
2021-06-22 10:14:40 +00:00
|
|
|
func() {
|
|
|
|
expAccount = &types.QueryValidatorAccountResponse{
|
2021-09-03 18:06:36 +00:00
|
|
|
AccountAddress: sdk.AccAddress(common.Address{}.Bytes()).String(),
|
2021-06-22 10:14:40 +00:00
|
|
|
}
|
|
|
|
req = &types.QueryValidatorAccountRequest{
|
|
|
|
ConsAddress: "",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success",
|
|
|
|
func() {
|
|
|
|
expAccount = &types.QueryValidatorAccountResponse{
|
|
|
|
AccountAddress: sdk.AccAddress(suite.address.Bytes()).String(),
|
2021-06-22 10:49:18 +00:00
|
|
|
Sequence: 0,
|
|
|
|
AccountNumber: 0,
|
2021-06-22 10:14:40 +00:00
|
|
|
}
|
|
|
|
req = &types.QueryValidatorAccountRequest{
|
|
|
|
ConsAddress: suite.consAddress.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"success with seq and account number",
|
|
|
|
func() {
|
|
|
|
acc := suite.app.AccountKeeper.GetAccount(suite.ctx, suite.address.Bytes())
|
|
|
|
suite.Require().NoError(acc.SetSequence(10))
|
|
|
|
suite.Require().NoError(acc.SetAccountNumber(1))
|
|
|
|
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
|
|
|
|
|
|
|
expAccount = &types.QueryValidatorAccountResponse{
|
|
|
|
AccountAddress: sdk.AccAddress(suite.address.Bytes()).String(),
|
2021-06-22 10:49:18 +00:00
|
|
|
Sequence: 10,
|
|
|
|
AccountNumber: 1,
|
2021-06-22 10:14:40 +00:00
|
|
|
}
|
|
|
|
req = &types.QueryValidatorAccountRequest{
|
|
|
|
ConsAddress: suite.consAddress.String(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
suite.SetupTest() // reset
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
ctx := sdk.WrapSDKContext(suite.ctx)
|
|
|
|
res, err := suite.queryClient.ValidatorAccount(ctx, req)
|
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
|
|
|
|
suite.Require().Equal(expAccount, res)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2021-06-22 10:49:18 +00:00
|
|
|
}
|
2021-07-23 14:24:36 +00:00
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestEstimateGas() {
|
|
|
|
gasHelper := hexutil.Uint64(20000)
|
|
|
|
|
|
|
|
var (
|
2021-10-05 15:38:20 +00:00
|
|
|
args types.TransactionArgs
|
2021-07-23 14:24:36 +00:00
|
|
|
gasCap uint64
|
|
|
|
)
|
|
|
|
testCases := []struct {
|
2021-12-28 07:59:28 +00:00
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
expGas uint64
|
|
|
|
enableFeemarket bool
|
2021-07-23 14:24:36 +00:00
|
|
|
}{
|
|
|
|
// should success, because transfer value is zero
|
|
|
|
{"default args", func() {
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}}
|
2021-10-19 08:49:29 +00:00
|
|
|
}, true, 21000, false},
|
2021-07-23 14:24:36 +00:00
|
|
|
// should fail, because the default From address(zero address) don't have fund
|
|
|
|
{"not enough balance", func() {
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}, Value: (*hexutil.Big)(big.NewInt(100))}
|
2021-10-19 08:49:29 +00:00
|
|
|
}, false, 0, false},
|
2021-07-23 14:24:36 +00:00
|
|
|
// should success, enough balance now
|
|
|
|
{"enough balance", func() {
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}, From: &suite.address, Value: (*hexutil.Big)(big.NewInt(100))}
|
2021-10-19 08:49:29 +00:00
|
|
|
}, false, 0, false},
|
2021-07-23 14:24:36 +00:00
|
|
|
// should success, because gas limit lower than 21000 is ignored
|
|
|
|
{"gas exceed allowance", func() {
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}, Gas: &gasHelper}
|
2021-10-19 08:49:29 +00:00
|
|
|
}, true, 21000, false},
|
2021-07-23 14:24:36 +00:00
|
|
|
// should fail, invalid gas cap
|
|
|
|
{"gas exceed global allowance", func() {
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}}
|
2021-07-23 14:24:36 +00:00
|
|
|
gasCap = 20000
|
2021-10-19 08:49:29 +00:00
|
|
|
}, false, 0, false},
|
2021-07-23 14:24:36 +00:00
|
|
|
// estimate gas of an erc20 contract deployment, the exact gas number is checked with geth
|
|
|
|
{"contract deployment", func() {
|
2021-10-20 19:00:17 +00:00
|
|
|
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
2021-07-23 14:24:36 +00:00
|
|
|
suite.Require().NoError(err)
|
2021-10-20 19:00:17 +00:00
|
|
|
data := append(types.ERC20Contract.Bin, ctorArgs...)
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{
|
2021-07-23 14:24:36 +00:00
|
|
|
From: &suite.address,
|
|
|
|
Data: (*hexutil.Bytes)(&data),
|
|
|
|
}
|
2021-10-19 08:49:29 +00:00
|
|
|
}, true, 1186778, false},
|
2021-07-23 14:24:36 +00:00
|
|
|
// estimate gas of an erc20 transfer, the exact gas number is checked with geth
|
|
|
|
{"erc20 transfer", func() {
|
2021-08-30 03:14:58 +00:00
|
|
|
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
2021-07-23 14:24:36 +00:00
|
|
|
suite.Commit()
|
2021-10-20 19:00:17 +00:00
|
|
|
transferData, err := types.ERC20Contract.ABI.Pack("transfer", common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(1000))
|
2021-07-23 14:24:36 +00:00
|
|
|
suite.Require().NoError(err)
|
2021-10-05 15:38:20 +00:00
|
|
|
args = types.TransactionArgs{To: &contractAddr, From: &suite.address, Data: (*hexutil.Bytes)(&transferData)}
|
2021-10-19 08:49:29 +00:00
|
|
|
}, true, 51880, false},
|
|
|
|
|
2021-12-28 07:59:28 +00:00
|
|
|
// repeated tests with enableFeemarket
|
|
|
|
{"default args w/ enableFeemarket", func() {
|
2021-10-19 08:49:29 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}}
|
|
|
|
}, true, 21000, true},
|
2021-12-28 07:59:28 +00:00
|
|
|
{"not enough balance w/ enableFeemarket", func() {
|
2021-10-19 08:49:29 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}, Value: (*hexutil.Big)(big.NewInt(100))}
|
|
|
|
}, false, 0, true},
|
2021-12-28 07:59:28 +00:00
|
|
|
{"enough balance w/ enableFeemarket", func() {
|
2021-10-19 08:49:29 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}, From: &suite.address, Value: (*hexutil.Big)(big.NewInt(100))}
|
|
|
|
}, false, 0, true},
|
2021-12-28 07:59:28 +00:00
|
|
|
{"gas exceed allowance w/ enableFeemarket", func() {
|
2021-10-19 08:49:29 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}, Gas: &gasHelper}
|
|
|
|
}, true, 21000, true},
|
2021-12-28 07:59:28 +00:00
|
|
|
{"gas exceed global allowance w/ enableFeemarket", func() {
|
2021-10-19 08:49:29 +00:00
|
|
|
args = types.TransactionArgs{To: &common.Address{}}
|
|
|
|
gasCap = 20000
|
|
|
|
}, false, 0, true},
|
2021-12-28 07:59:28 +00:00
|
|
|
{"contract deployment w/ enableFeemarket", func() {
|
2021-10-20 19:00:17 +00:00
|
|
|
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
2021-10-19 08:49:29 +00:00
|
|
|
suite.Require().NoError(err)
|
2021-10-20 19:00:17 +00:00
|
|
|
data := append(types.ERC20Contract.Bin, ctorArgs...)
|
2021-10-19 08:49:29 +00:00
|
|
|
args = types.TransactionArgs{
|
|
|
|
From: &suite.address,
|
|
|
|
Data: (*hexutil.Bytes)(&data),
|
|
|
|
}
|
|
|
|
}, true, 1186778, true},
|
2021-12-28 07:59:28 +00:00
|
|
|
{"erc20 transfer w/ enableFeemarket", func() {
|
2021-10-19 08:49:29 +00:00
|
|
|
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
|
|
|
suite.Commit()
|
2021-10-20 19:00:17 +00:00
|
|
|
transferData, err := types.ERC20Contract.ABI.Pack("transfer", common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(1000))
|
2021-10-19 08:49:29 +00:00
|
|
|
suite.Require().NoError(err)
|
|
|
|
args = types.TransactionArgs{To: &contractAddr, From: &suite.address, Data: (*hexutil.Bytes)(&transferData)}
|
|
|
|
}, true, 51880, true},
|
2021-07-23 14:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
2021-12-28 07:59:28 +00:00
|
|
|
suite.enableFeemarket = tc.enableFeemarket
|
2021-07-23 14:24:36 +00:00
|
|
|
suite.SetupTest()
|
2021-08-18 14:11:51 +00:00
|
|
|
gasCap = 25_000_000
|
2021-07-23 14:24:36 +00:00
|
|
|
tc.malleate()
|
|
|
|
|
|
|
|
args, err := json.Marshal(&args)
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
req := types.EthCallRequest{
|
|
|
|
Args: args,
|
|
|
|
GasCap: gasCap,
|
|
|
|
}
|
|
|
|
|
2021-09-27 10:26:45 +00:00
|
|
|
rsp, err := suite.queryClient.EstimateGas(sdk.WrapSDKContext(suite.ctx), &req)
|
2021-07-23 14:24:36 +00:00
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
2022-01-05 18:18:02 +00:00
|
|
|
suite.Require().Equal(int64(tc.expGas), int64(rsp.Gas))
|
2021-07-23 14:24:36 +00:00
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2021-12-28 07:59:28 +00:00
|
|
|
suite.enableFeemarket = false // reset flag
|
2021-07-23 14:24:36 +00:00
|
|
|
}
|
2021-09-04 20:33:06 +00:00
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestTraceTx() {
|
2021-09-05 11:03:06 +00:00
|
|
|
// TODO deploy contract that triggers internal transactions
|
2021-09-04 20:33:06 +00:00
|
|
|
var (
|
2021-11-09 18:38:22 +00:00
|
|
|
txMsg *types.MsgEthereumTx
|
|
|
|
traceConfig *types.TraceConfig
|
|
|
|
predecessors []*types.MsgEthereumTx
|
2021-09-04 20:33:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
2021-12-28 07:59:28 +00:00
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
traceResponse []byte
|
|
|
|
enableFeemarket bool
|
2021-09-04 20:33:06 +00:00
|
|
|
}{
|
|
|
|
{
|
|
|
|
msg: "default trace",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = nil
|
2021-11-09 18:38:22 +00:00
|
|
|
predecessors = []*types.MsgEthereumTx{}
|
2021-09-04 20:33:06 +00:00
|
|
|
},
|
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55, 0x53, 0x48, 0x31, 0x22, 0x2c, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a},
|
2021-11-16 08:57:03 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
msg: "default trace with filtered response",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
DisableStack: true,
|
|
|
|
DisableStorage: true,
|
|
|
|
EnableMemory: false,
|
|
|
|
}
|
|
|
|
predecessors = []*types.MsgEthereumTx{}
|
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55, 0x53, 0x48, 0x31, 0x22, 0x2c, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a},
|
2021-12-28 07:59:28 +00:00
|
|
|
enableFeemarket: false,
|
2021-11-17 11:58:52 +00:00
|
|
|
},
|
|
|
|
{
|
2021-09-04 20:33:06 +00:00
|
|
|
msg: "javascript tracer",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
Tracer: "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}",
|
|
|
|
}
|
2021-11-09 18:38:22 +00:00
|
|
|
predecessors = []*types.MsgEthereumTx{}
|
2021-09-04 20:33:06 +00:00
|
|
|
},
|
|
|
|
expPass: true,
|
|
|
|
traceResponse: []byte{0x5b, 0x5d},
|
|
|
|
},
|
2021-10-19 08:49:29 +00:00
|
|
|
{
|
2021-12-28 07:59:28 +00:00
|
|
|
msg: "default trace with enableFeemarket",
|
2021-10-19 08:49:29 +00:00
|
|
|
malleate: func() {
|
2021-11-16 08:57:03 +00:00
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
DisableStack: true,
|
|
|
|
DisableStorage: true,
|
|
|
|
EnableMemory: false,
|
|
|
|
}
|
2021-11-09 18:38:22 +00:00
|
|
|
predecessors = []*types.MsgEthereumTx{}
|
2021-10-19 08:49:29 +00:00
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55, 0x53, 0x48, 0x31, 0x22, 0x2c, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a},
|
2021-12-28 07:59:28 +00:00
|
|
|
enableFeemarket: true,
|
2021-11-17 11:58:52 +00:00
|
|
|
},
|
|
|
|
{
|
2021-12-28 07:59:28 +00:00
|
|
|
msg: "javascript tracer with enableFeemarket",
|
2021-10-19 08:49:29 +00:00
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
Tracer: "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}",
|
|
|
|
}
|
2021-11-09 18:38:22 +00:00
|
|
|
predecessors = []*types.MsgEthereumTx{}
|
2021-10-19 08:49:29 +00:00
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
|
|
|
traceResponse: []byte{0x5b, 0x5d},
|
|
|
|
enableFeemarket: true,
|
2021-10-19 08:49:29 +00:00
|
|
|
},
|
2021-11-09 18:38:22 +00:00
|
|
|
{
|
|
|
|
msg: "default tracer with predecessors",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = nil
|
2022-01-05 07:28:27 +00:00
|
|
|
|
2021-12-16 22:35:28 +00:00
|
|
|
// increase nonce to avoid address collision
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb := suite.StateDB()
|
|
|
|
vmdb.SetNonce(suite.address, vmdb.GetNonce(suite.address)+1)
|
|
|
|
suite.Require().NoError(vmdb.Commit())
|
2021-11-09 18:38:22 +00:00
|
|
|
|
|
|
|
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
// Generate token transfer transaction
|
|
|
|
firstTx := suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
|
|
|
txMsg = suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
|
|
|
|
predecessors = append(predecessors, firstTx)
|
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55, 0x53, 0x48, 0x31, 0x22, 0x2c, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a},
|
2021-12-28 07:59:28 +00:00
|
|
|
enableFeemarket: false,
|
2021-11-09 18:38:22 +00:00
|
|
|
},
|
2021-09-04 20:33:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
2021-12-28 07:59:28 +00:00
|
|
|
suite.enableFeemarket = tc.enableFeemarket
|
2021-09-04 20:33:06 +00:00
|
|
|
suite.SetupTest()
|
2021-09-05 11:03:06 +00:00
|
|
|
// Deploy contract
|
2021-09-04 20:33:06 +00:00
|
|
|
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
|
|
|
suite.Commit()
|
2021-09-05 11:03:06 +00:00
|
|
|
// Generate token transfer transaction
|
2021-09-04 20:33:06 +00:00
|
|
|
txMsg = suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
traceReq := types.QueryTraceTxRequest{
|
2021-11-09 18:38:22 +00:00
|
|
|
Msg: txMsg,
|
|
|
|
TraceConfig: traceConfig,
|
|
|
|
Predecessors: predecessors,
|
2021-09-04 20:33:06 +00:00
|
|
|
}
|
2021-11-16 08:57:03 +00:00
|
|
|
res, err := suite.queryClient.TraceTx(sdk.WrapSDKContext(suite.ctx), &traceReq)
|
|
|
|
suite.Require().NoError(err)
|
2021-09-04 20:33:06 +00:00
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
2021-11-16 08:57:03 +00:00
|
|
|
// if data is to big, slice the result
|
|
|
|
if len(res.Data) > 150 {
|
|
|
|
suite.Require().Equal(tc.traceResponse, res.Data[:150])
|
|
|
|
} else {
|
|
|
|
suite.Require().Equal(tc.traceResponse, res.Data)
|
|
|
|
}
|
2021-09-04 20:33:06 +00:00
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2021-10-19 08:49:29 +00:00
|
|
|
|
2021-12-28 07:59:28 +00:00
|
|
|
suite.enableFeemarket = false // reset flag
|
2021-09-04 20:33:06 +00:00
|
|
|
}
|
2021-11-09 18:38:22 +00:00
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestTraceBlock() {
|
|
|
|
var (
|
|
|
|
txs []*types.MsgEthereumTx
|
|
|
|
traceConfig *types.TraceConfig
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
2021-12-28 07:59:28 +00:00
|
|
|
msg string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
traceResponse []byte
|
|
|
|
enableFeemarket bool
|
2021-11-09 18:38:22 +00:00
|
|
|
}{
|
|
|
|
{
|
|
|
|
msg: "default trace",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = nil
|
|
|
|
},
|
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x5b, 0x7b, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55},
|
2021-11-09 18:38:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
msg: "filtered trace",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
DisableStack: true,
|
|
|
|
DisableStorage: true,
|
|
|
|
EnableMemory: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x5b, 0x7b, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55},
|
2021-11-17 11:58:52 +00:00
|
|
|
},
|
|
|
|
{
|
2021-11-09 18:38:22 +00:00
|
|
|
msg: "javascript tracer",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
Tracer: "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
expPass: true,
|
|
|
|
traceResponse: []byte{0x5b, 0x7b, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x5b, 0x5d, 0x7d, 0x5d},
|
|
|
|
},
|
|
|
|
{
|
2021-12-28 07:59:28 +00:00
|
|
|
msg: "default trace with enableFeemarket and filtered return",
|
2021-11-09 18:38:22 +00:00
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
DisableStack: true,
|
|
|
|
DisableStorage: true,
|
|
|
|
EnableMemory: false,
|
|
|
|
}
|
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x5b, 0x7b, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55},
|
2021-12-28 07:59:28 +00:00
|
|
|
enableFeemarket: true,
|
2021-11-17 11:58:52 +00:00
|
|
|
},
|
|
|
|
{
|
2021-12-28 07:59:28 +00:00
|
|
|
msg: "javascript tracer with enableFeemarket",
|
2021-11-09 18:38:22 +00:00
|
|
|
malleate: func() {
|
|
|
|
traceConfig = &types.TraceConfig{
|
|
|
|
Tracer: "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}",
|
|
|
|
}
|
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
|
|
|
traceResponse: []byte{0x5b, 0x7b, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x5b, 0x5d, 0x7d, 0x5d},
|
|
|
|
enableFeemarket: true,
|
2021-11-09 18:38:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
msg: "tracer with multiple transactions",
|
|
|
|
malleate: func() {
|
|
|
|
traceConfig = nil
|
2022-01-05 07:28:27 +00:00
|
|
|
|
2021-12-16 22:35:28 +00:00
|
|
|
// increase nonce to avoid address collision
|
2022-01-05 07:28:27 +00:00
|
|
|
vmdb := suite.StateDB()
|
|
|
|
vmdb.SetNonce(suite.address, vmdb.GetNonce(suite.address)+1)
|
|
|
|
suite.Require().NoError(vmdb.Commit())
|
|
|
|
|
2021-11-09 18:38:22 +00:00
|
|
|
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
// create multiple transactions in the same block
|
|
|
|
firstTx := suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
|
|
|
secondTx := suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
// overwrite txs to include only the ones on new block
|
|
|
|
txs = append([]*types.MsgEthereumTx{}, firstTx, secondTx)
|
|
|
|
},
|
2021-12-28 07:59:28 +00:00
|
|
|
expPass: true,
|
2022-03-02 02:14:21 +00:00
|
|
|
traceResponse: []byte{0x5b, 0x7b, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x67, 0x61, 0x73, 0x22, 0x3a, 0x33, 0x34, 0x38, 0x32, 0x38, 0x2c, 0x22, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x63, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x22, 0x50, 0x55},
|
2021-12-28 07:59:28 +00:00
|
|
|
enableFeemarket: false,
|
2021-11-09 18:38:22 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
|
|
|
txs = []*types.MsgEthereumTx{}
|
2021-12-28 07:59:28 +00:00
|
|
|
suite.enableFeemarket = tc.enableFeemarket
|
2021-11-09 18:38:22 +00:00
|
|
|
suite.SetupTest()
|
|
|
|
// Deploy contract
|
|
|
|
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
// Generate token transfer transaction
|
|
|
|
txMsg := suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
|
|
|
suite.Commit()
|
|
|
|
|
|
|
|
txs = append(txs, txMsg)
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
traceReq := types.QueryTraceBlockRequest{
|
|
|
|
Txs: txs,
|
|
|
|
TraceConfig: traceConfig,
|
|
|
|
}
|
2021-11-16 08:57:03 +00:00
|
|
|
res, err := suite.queryClient.TraceBlock(sdk.WrapSDKContext(suite.ctx), &traceReq)
|
2021-11-09 18:38:22 +00:00
|
|
|
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NoError(err)
|
2021-11-16 08:57:03 +00:00
|
|
|
// if data is to big, slice the result
|
|
|
|
if len(res.Data) > 150 {
|
|
|
|
suite.Require().Equal(tc.traceResponse, res.Data[:150])
|
|
|
|
} else {
|
|
|
|
suite.Require().Equal(tc.traceResponse, res.Data)
|
|
|
|
}
|
2021-11-09 18:38:22 +00:00
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-12-28 07:59:28 +00:00
|
|
|
suite.enableFeemarket = false // reset flag
|
2021-11-09 18:38:22 +00:00
|
|
|
}
|
2022-01-04 10:55:30 +00:00
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestNonceInQuery() {
|
|
|
|
suite.SetupTest()
|
|
|
|
priv, err := ethsecp256k1.GenerateKey()
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
address := common.BytesToAddress(priv.PubKey().Address().Bytes())
|
2022-01-05 07:28:27 +00:00
|
|
|
suite.Require().Equal(uint64(0), suite.app.EvmKeeper.GetNonce(suite.ctx, address))
|
2022-01-04 10:55:30 +00:00
|
|
|
supply := sdk.NewIntWithDecimal(1000, 18).BigInt()
|
|
|
|
|
|
|
|
// accupy nonce 0
|
|
|
|
_ = suite.DeployTestContract(suite.T(), address, supply)
|
|
|
|
|
|
|
|
// do an EthCall/EstimateGas with nonce 0
|
|
|
|
ctorArgs, err := types.ERC20Contract.ABI.Pack("", address, supply)
|
|
|
|
data := append(types.ERC20Contract.Bin, ctorArgs...)
|
|
|
|
args, err := json.Marshal(&types.TransactionArgs{
|
|
|
|
From: &address,
|
|
|
|
Data: (*hexutil.Bytes)(&data),
|
|
|
|
})
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
|
|
|
|
_, err = suite.queryClient.EstimateGas(sdk.WrapSDKContext(suite.ctx), &types.EthCallRequest{
|
|
|
|
Args: args,
|
|
|
|
GasCap: uint64(config.DefaultGasCap),
|
|
|
|
})
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
|
|
|
|
_, err = suite.queryClient.EthCall(sdk.WrapSDKContext(suite.ctx), &types.EthCallRequest{
|
|
|
|
Args: args,
|
|
|
|
GasCap: uint64(config.DefaultGasCap),
|
|
|
|
})
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
}
|
2022-04-30 16:11:28 +00:00
|
|
|
|
|
|
|
func (suite *KeeperTestSuite) TestQueryBaseFee() {
|
|
|
|
var (
|
|
|
|
aux sdk.Int
|
|
|
|
expRes *types.QueryBaseFeeResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
testCases := []struct {
|
|
|
|
name string
|
|
|
|
malleate func()
|
|
|
|
expPass bool
|
|
|
|
enableFeemarket bool
|
|
|
|
enableLondonHF bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
"pass - default Base Fee",
|
|
|
|
func() {
|
|
|
|
initialBaseFee := sdk.NewInt(ethparams.InitialBaseFee)
|
|
|
|
expRes = &types.QueryBaseFeeResponse{BaseFee: &initialBaseFee}
|
|
|
|
},
|
|
|
|
true, true, true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pass - non-nil Base Fee",
|
|
|
|
func() {
|
|
|
|
baseFee := sdk.OneInt().BigInt()
|
|
|
|
suite.app.FeeMarketKeeper.SetBaseFee(suite.ctx, baseFee)
|
|
|
|
|
|
|
|
aux = sdk.NewIntFromBigInt(baseFee)
|
|
|
|
expRes = &types.QueryBaseFeeResponse{BaseFee: &aux}
|
|
|
|
},
|
|
|
|
true, true, true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pass - nil Base Fee when london hardfork not activated",
|
|
|
|
func() {
|
|
|
|
baseFee := sdk.OneInt().BigInt()
|
|
|
|
suite.app.FeeMarketKeeper.SetBaseFee(suite.ctx, baseFee)
|
|
|
|
|
|
|
|
expRes = &types.QueryBaseFeeResponse{}
|
|
|
|
},
|
|
|
|
true, true, false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pass - zero Base Fee when feemarket not activated",
|
|
|
|
func() {
|
|
|
|
baseFee := sdk.ZeroInt()
|
|
|
|
expRes = &types.QueryBaseFeeResponse{BaseFee: &baseFee}
|
|
|
|
},
|
|
|
|
true, false, true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
|
|
suite.Run(tc.name, func() {
|
|
|
|
suite.enableFeemarket = tc.enableFeemarket
|
|
|
|
suite.enableLondonHF = tc.enableLondonHF
|
|
|
|
suite.SetupTest()
|
|
|
|
|
|
|
|
tc.malleate()
|
|
|
|
|
|
|
|
res, err := suite.queryClient.BaseFee(suite.ctx.Context(), &types.QueryBaseFeeRequest{})
|
|
|
|
if tc.expPass {
|
|
|
|
suite.Require().NotNil(res)
|
|
|
|
suite.Require().Equal(expRes, res, tc.name)
|
|
|
|
suite.Require().NoError(err)
|
|
|
|
} else {
|
|
|
|
suite.Require().Error(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
suite.enableFeemarket = false
|
|
|
|
suite.enableLondonHF = true
|
|
|
|
}
|