Merge tag 'v0.20.0' into murali/update-fork

This commit is contained in:
0xmuralik
2023-01-04 16:34:38 +05:30
620 changed files with 72483 additions and 11437 deletions
+10 -2
View File
@@ -1,13 +1,21 @@
package cli
import (
<<<<<<< HEAD
rpctypes "github.com/cerc-io/laconicd/rpc/types"
=======
rpctypes "github.com/cerc-io/laconicd/rpc/types"
>>>>>>> v0.20.0
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
<<<<<<< HEAD
"github.com/cerc-io/laconicd/x/evm/types"
=======
"github.com/cerc-io/laconicd/x/evm/types"
>>>>>>> v0.20.0
)
// GetQueryCmd returns the parent command for all x/bank CLi query commands.
@@ -31,7 +39,7 @@ func GetQueryCmd() *cobra.Command {
// GetStorageCmd queries a key in an accounts storage
func GetStorageCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "storage [address] [key]",
Use: "storage ADDRESS KEY",
Short: "Gets storage for an account with a given key and height",
Long: "Gets storage for an account with a given key and height. If the height is not provided, it will use the latest height from context.", //nolint:lll
Args: cobra.ExactArgs(2),
@@ -71,7 +79,7 @@ func GetStorageCmd() *cobra.Command {
// GetCodeCmd queries the code field of a given address
func GetCodeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "code [address]",
Use: "code ADDRESS",
Short: "Gets code from an account",
Long: "Gets code from an account. If the height is not provided, it will use the latest height from context.",
Args: cobra.ExactArgs(1),
+6 -1
View File
@@ -12,8 +12,13 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
<<<<<<< HEAD
rpctypes "github.com/cerc-io/laconicd/rpc/types"
"github.com/cerc-io/laconicd/x/evm/types"
=======
rpctypes "github.com/cerc-io/laconicd/rpc/types"
"github.com/cerc-io/laconicd/x/evm/types"
>>>>>>> v0.20.0
)
// GetTxCmd returns the transaction commands for this module
@@ -32,7 +37,7 @@ func GetTxCmd() *cobra.Command {
// NewRawTxCmd command build cosmos transaction from raw ethereum transaction
func NewRawTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "raw [tx-hex]",
Use: "raw TX_HEX",
Short: "Build cosmos transaction from raw ethereum transaction",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
+6 -3
View File
@@ -48,11 +48,14 @@ func InitGenesis(
),
)
}
code := common.Hex2Bytes(account.Code)
codeHash := crypto.Keccak256Hash(code)
if !bytes.Equal(ethAcct.GetCodeHash().Bytes(), codeHash.Bytes()) {
panic("code don't match codeHash")
// we ignore the empty Code hash checking, see ethermint PR#1234
if len(account.Code) != 0 && !bytes.Equal(ethAcct.GetCodeHash().Bytes(), codeHash.Bytes()) {
s := "the evm state code doesn't match with the codehash\n"
panic(fmt.Sprintf("%s account: %s , evm state codehash: %v, ethAccount codehash: %v, evm state code: %s\n",
s, account.Address, codeHash, ethAcct.GetCodeHash(), account.Code))
}
k.SetCode(ctx, codeHash.Bytes(), code)
+40
View File
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
etherminttypes "github.com/cerc-io/laconicd/types"
"github.com/cerc-io/laconicd/x/evm"
"github.com/cerc-io/laconicd/x/evm/statedb"
"github.com/cerc-io/laconicd/x/evm/types"
@@ -96,6 +97,45 @@ func (suite *EvmTestSuite) TestInitGenesis() {
},
true,
},
{
"ignore empty account code checking",
func() {
acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, address.Bytes())
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
},
&types.GenesisState{
Params: types.DefaultParams(),
Accounts: []types.GenesisAccount{
{
Address: address.String(),
Code: "",
},
},
},
false,
},
{
"ignore empty account code checking with non-empty codehash",
func() {
ethAcc := &etherminttypes.EthAccount{
BaseAccount: authtypes.NewBaseAccount(address.Bytes(), nil, 0, 0),
CodeHash: common.BytesToHash([]byte{1, 2, 3}).Hex(),
}
suite.app.AccountKeeper.SetAccount(suite.ctx, ethAcc)
},
&types.GenesisState{
Params: types.DefaultParams(),
Accounts: []types.GenesisAccount{
{
Address: address.String(),
Code: "",
},
},
},
false,
},
}
for _, tc := range testCases {
+3 -2
View File
@@ -1,8 +1,9 @@
package evm
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cerc-io/laconicd/x/evm/types"
)
@@ -19,7 +20,7 @@ func NewHandler(server types.MsgServer) sdk.Handler {
return sdk.WrapServiceResult(ctx, res, err)
default:
err := sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg)
err := errorsmod.Wrapf(errortypes.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg)
return nil, err
}
}
+8 -1
View File
@@ -6,6 +6,8 @@ import (
"testing"
"time"
"github.com/cerc-io/laconicd/x/evm/keeper"
sdkmath "cosmossdk.io/math"
"github.com/gogo/protobuf/proto"
@@ -594,9 +596,14 @@ func (suite *EvmTestSuite) TestERC20TransferReverted() {
before := k.GetBalance(suite.ctx, suite.from)
ethCfg := suite.app.EvmKeeper.GetChainConfig(suite.ctx).EthereumConfig(nil)
baseFee := suite.app.EvmKeeper.GetBaseFee(suite.ctx, ethCfg)
txData, err := types.UnpackTxData(tx.Data)
suite.Require().NoError(err)
_, _, err = k.DeductTxCostsFromUserBalance(suite.ctx, *tx, txData, "aphoton", true, true, true)
fees, err := keeper.VerifyFee(txData, "aphoton", baseFee, true, true, suite.ctx.IsCheckTx())
suite.Require().NoError(err)
err = k.DeductTxCostsFromUserBalance(suite.ctx, fees, common.HexToAddress(tx.From))
suite.Require().NoError(err)
res, err := k.EthereumTx(sdk.WrapSDKContext(suite.ctx), tx)
+18
View File
@@ -0,0 +1,18 @@
package keeper_test
import (
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
"github.com/tendermint/tendermint/abci/types"
)
func (suite *KeeperTestSuite) TestEndBlock() {
em := suite.ctx.EventManager()
suite.Require().Equal(0, len(em.Events()))
res := suite.app.EvmKeeper.EndBlock(suite.ctx, types.RequestEndBlock{})
suite.Require().Equal([]types.ValidatorUpdate{}, res)
// should emit 1 EventTypeBlockBloom event on EndBlock
suite.Require().Equal(1, len(em.Events()))
suite.Require().Equal(evmtypes.EventTypeBlockBloom, em.Events()[0].Type)
}
+72 -27
View File
@@ -8,9 +8,8 @@ import (
"math/big"
"time"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -223,8 +222,11 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
cfg, err := k.EVMConfig(ctx)
chainID, err := getChainID(ctx, req.ChainId)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress), chainID)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
@@ -256,13 +258,17 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
}
ctx := sdk.UnwrapSDKContext(c)
chainID, err := getChainID(ctx, req.ChainId)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
if req.GasCap < ethparams.TxGas {
return nil, status.Error(codes.InvalidArgument, "gas cap cannot be lower than 21,000")
}
var args types.TransactionArgs
err := json.Unmarshal(req.Args, &args)
err = json.Unmarshal(req.Args, &args)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
@@ -294,8 +300,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
hi = req.GasCap
}
cap = hi
cfg, err := k.EVMConfig(ctx)
cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress), chainID)
if err != nil {
return nil, status.Error(codes.Internal, "failed to load evm config")
}
@@ -306,14 +311,31 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash().Bytes()))
// Create a helper to check if a gas allowance results in an executable transaction
executable := func(gas uint64) (vmerror bool, rsp *types.MsgEthereumTxResponse, err error) {
args.Gas = (*hexutil.Uint64)(&gas)
// convert the tx args to an ethereum message
msg, err := args.ToMessage(req.GasCap, cfg.BaseFee)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
msg, err := args.ToMessage(req.GasCap, cfg.BaseFee)
if err != nil {
return false, nil, err
}
// NOTE: the errors from the executable below should be consistent with go-ethereum,
// so we don't wrap them with the gRPC status code
// Create a helper to check if a gas allowance results in an executable transaction
executable := func(gas uint64) (vmError bool, rsp *types.MsgEthereumTxResponse, err error) {
// update the message with the new gas value
msg = ethtypes.NewMessage(
msg.From(),
msg.To(),
msg.Nonce(),
msg.Value(),
gas,
msg.GasPrice(),
msg.GasFeeCap(),
msg.GasTipCap(),
msg.Data(),
msg.AccessList(),
msg.IsFake(),
)
// pass false to not commit StateDB
rsp, err = k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig)
@@ -329,24 +351,25 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
// Execute the binary search and hone in on an executable gas limit
hi, err = types.BinSearch(lo, hi, executable)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
return nil, err
}
// Reject the transaction as invalid if it still fails at the highest allowance
if hi == cap {
failed, result, err := executable(hi)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
return nil, err
}
if failed {
if result != nil && result.VmError != vm.ErrOutOfGas.Error() {
if result.VmError == vm.ErrExecutionReverted.Error() {
return nil, types.NewExecErrorWithReason(result.Ret)
}
return nil, status.Error(codes.Internal, result.VmError)
return nil, errors.New(result.VmError)
}
// Otherwise, the specified gas cap is too low
return nil, status.Error(codes.Internal, fmt.Sprintf("gas required exceeds allowance (%d)", cap))
return nil, fmt.Errorf("gas required exceeds allowance (%d)", cap)
}
}
return &types.EstimateGasResponse{Gas: hi}, nil
@@ -375,8 +398,11 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
ctx = ctx.WithBlockHeight(contextHeight)
ctx = ctx.WithBlockTime(req.BlockTime)
ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash))
cfg, err := k.EVMConfig(ctx)
chainID, err := getChainID(ctx, req.ChainId)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress), chainID)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to load evm config: %s", err.Error())
}
@@ -404,7 +430,13 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
txConfig.TxIndex++
}
result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false)
var tracerConfig json.RawMessage
if req.TraceConfig != nil && req.TraceConfig.TracerJsonConfig != "" {
// ignore error. default to no traceConfig
_ = json.Unmarshal([]byte(req.TraceConfig.TracerJsonConfig), &tracerConfig)
}
result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false, tracerConfig)
if err != nil {
// error will be returned with detail status from traceTx
return nil, err
@@ -443,8 +475,12 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest)
ctx = ctx.WithBlockHeight(contextHeight)
ctx = ctx.WithBlockTime(req.BlockTime)
ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash))
chainID, err := getChainID(ctx, req.ChainId)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
cfg, err := k.EVMConfig(ctx)
cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress), chainID)
if err != nil {
return nil, status.Error(codes.Internal, "failed to load evm config")
}
@@ -458,13 +494,13 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest)
ethTx := tx.AsTransaction()
txConfig.TxHash = ethTx.Hash()
txConfig.TxIndex = uint(i)
traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true)
traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true, nil)
if err != nil {
result.Error = err.Error()
continue
} else {
txConfig.LogIndex = logIndex
result.Result = traceResult
}
txConfig.LogIndex = logIndex
result.Result = traceResult
results = append(results, &result)
}
@@ -487,6 +523,7 @@ func (k *Keeper) traceTx(
tx *ethtypes.Transaction,
traceConfig *types.TraceConfig,
commitMessage bool,
tracerJSONConfig json.RawMessage,
) (*interface{}, uint, error) {
// Assemble the structured logger or the JavaScript tracer
var (
@@ -527,7 +564,7 @@ func (k *Keeper) traceTx(
}
if traceConfig.Tracer != "" {
if tracer, err = tracers.New(traceConfig.Tracer, tCtx); err != nil {
if tracer, err = tracers.New(traceConfig.Tracer, tCtx, tracerJSONConfig); err != nil {
return nil, 0, status.Error(codes.Internal, err.Error())
}
}
@@ -580,3 +617,11 @@ func (k Keeper) BaseFee(c context.Context, _ *types.QueryBaseFeeRequest) (*types
return res, nil
}
// getChainID parse chainID from current context if not provided
func getChainID(ctx sdk.Context, chainID int64) (*big.Int, error) {
if chainID == 0 {
return ethermint.ParseChainID(ctx.ChainID())
}
return big.NewInt(chainID), nil
}
+512 -79
View File
@@ -7,6 +7,7 @@ import (
sdkmath "cosmossdk.io/math"
"github.com/cerc-io/laconicd/tests"
"github.com/cerc-io/laconicd/x/evm/statedb"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -17,7 +18,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
"github.com/cerc-io/laconicd/server/config"
ethermint "github.com/cerc-io/laconicd/types"
"github.com/cerc-io/laconicd/x/evm/types"
@@ -491,9 +491,11 @@ func (suite *KeeperTestSuite) TestQueryValidatorAccount() {
func (suite *KeeperTestSuite) TestEstimateGas() {
gasHelper := hexutil.Uint64(20000)
higherGas := hexutil.Uint64(25000)
hexBigInt := hexutil.Big(*big.NewInt(1))
var (
args types.TransactionArgs
args interface{}
gasCap uint64
)
testCases := []struct {
@@ -504,78 +506,223 @@ func (suite *KeeperTestSuite) TestEstimateGas() {
enableFeemarket bool
}{
// should success, because transfer value is zero
{"default args", func() {
args = types.TransactionArgs{To: &common.Address{}}
}, true, 21000, false},
{
"default args - special case for ErrIntrinsicGas on contract creation, raise gas limit",
func() {
args = types.TransactionArgs{}
},
true,
ethparams.TxGasContractCreation,
false,
},
// should success, because transfer value is zero
{
"default args with 'to' address",
func() {
args = types.TransactionArgs{To: &common.Address{}}
},
true,
ethparams.TxGas,
false,
},
// should fail, because the default From address(zero address) don't have fund
{"not enough balance", func() {
args = types.TransactionArgs{To: &common.Address{}, Value: (*hexutil.Big)(big.NewInt(100))}
}, false, 0, false},
{
"not enough balance",
func() {
args = types.TransactionArgs{To: &common.Address{}, Value: (*hexutil.Big)(big.NewInt(100))}
},
false,
0,
false,
},
// should success, enough balance now
{"enough balance", func() {
args = types.TransactionArgs{To: &common.Address{}, From: &suite.address, Value: (*hexutil.Big)(big.NewInt(100))}
}, false, 0, false},
{
"enough balance",
func() {
args = types.TransactionArgs{To: &common.Address{}, From: &suite.address, Value: (*hexutil.Big)(big.NewInt(100))}
}, false, 0, false},
// should success, because gas limit lower than 21000 is ignored
{"gas exceed allowance", func() {
args = types.TransactionArgs{To: &common.Address{}, Gas: &gasHelper}
}, true, 21000, false},
{
"gas exceed allowance",
func() {
args = types.TransactionArgs{To: &common.Address{}, Gas: &gasHelper}
},
true,
ethparams.TxGas,
false,
},
// should fail, invalid gas cap
{"gas exceed global allowance", func() {
args = types.TransactionArgs{To: &common.Address{}}
gasCap = 20000
}, false, 0, false},
{
"gas exceed global allowance",
func() {
args = types.TransactionArgs{To: &common.Address{}}
gasCap = 20000
},
false,
0,
false,
},
// estimate gas of an erc20 contract deployment, the exact gas number is checked with geth
{"contract deployment", func() {
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
args = types.TransactionArgs{
From: &suite.address,
Data: (*hexutil.Bytes)(&data),
}
}, true, 1186778, false},
{
"contract deployment",
func() {
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
args = types.TransactionArgs{
From: &suite.address,
Data: (*hexutil.Bytes)(&data),
}
},
true,
1186778,
false,
},
// estimate gas of an erc20 transfer, the exact gas number is checked with geth
{"erc20 transfer", func() {
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Commit()
transferData, err := types.ERC20Contract.ABI.Pack("transfer", common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(1000))
suite.Require().NoError(err)
args = types.TransactionArgs{To: &contractAddr, From: &suite.address, Data: (*hexutil.Bytes)(&transferData)}
}, true, 51880, false},
{
"erc20 transfer",
func() {
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Commit()
transferData, err := types.ERC20Contract.ABI.Pack("transfer", common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(1000))
suite.Require().NoError(err)
args = types.TransactionArgs{To: &contractAddr, From: &suite.address, Data: (*hexutil.Bytes)(&transferData)}
},
true,
51880,
false,
},
// repeated tests with enableFeemarket
{"default args w/ enableFeemarket", func() {
args = types.TransactionArgs{To: &common.Address{}}
}, true, 21000, true},
{"not enough balance w/ enableFeemarket", func() {
args = types.TransactionArgs{To: &common.Address{}, Value: (*hexutil.Big)(big.NewInt(100))}
}, false, 0, true},
{"enough balance w/ enableFeemarket", func() {
args = types.TransactionArgs{To: &common.Address{}, From: &suite.address, Value: (*hexutil.Big)(big.NewInt(100))}
}, false, 0, true},
{"gas exceed allowance w/ enableFeemarket", func() {
args = types.TransactionArgs{To: &common.Address{}, Gas: &gasHelper}
}, true, 21000, true},
{"gas exceed global allowance w/ enableFeemarket", func() {
args = types.TransactionArgs{To: &common.Address{}}
gasCap = 20000
}, false, 0, true},
{"contract deployment w/ enableFeemarket", func() {
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
args = types.TransactionArgs{
From: &suite.address,
Data: (*hexutil.Bytes)(&data),
}
}, true, 1186778, true},
{"erc20 transfer w/ enableFeemarket", func() {
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Commit()
transferData, err := types.ERC20Contract.ABI.Pack("transfer", common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(1000))
suite.Require().NoError(err)
args = types.TransactionArgs{To: &contractAddr, From: &suite.address, Data: (*hexutil.Bytes)(&transferData)}
}, true, 51880, true},
{
"default args w/ enableFeemarket",
func() {
args = types.TransactionArgs{To: &common.Address{}}
},
true,
ethparams.TxGas,
true,
},
{
"not enough balance w/ enableFeemarket",
func() {
args = types.TransactionArgs{To: &common.Address{}, Value: (*hexutil.Big)(big.NewInt(100))}
},
false,
0,
true,
},
{
"enough balance w/ enableFeemarket",
func() {
args = types.TransactionArgs{To: &common.Address{}, From: &suite.address, Value: (*hexutil.Big)(big.NewInt(100))}
},
false,
0,
true,
},
{
"gas exceed allowance w/ enableFeemarket",
func() {
args = types.TransactionArgs{To: &common.Address{}, Gas: &gasHelper}
},
true,
ethparams.TxGas,
true,
},
{
"gas exceed global allowance w/ enableFeemarket",
func() {
args = types.TransactionArgs{To: &common.Address{}}
gasCap = 20000
},
false,
0,
true,
},
{
"contract deployment w/ enableFeemarket",
func() {
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
args = types.TransactionArgs{
From: &suite.address,
Data: (*hexutil.Bytes)(&data),
}
},
true,
1186778,
true,
},
{
"erc20 transfer w/ enableFeemarket",
func() {
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Commit()
transferData, err := types.ERC20Contract.ABI.Pack("transfer", common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(1000))
suite.Require().NoError(err)
args = types.TransactionArgs{To: &contractAddr, From: &suite.address, Data: (*hexutil.Bytes)(&transferData)}
},
true,
51880,
true,
},
{
"contract creation but 'create' param disabled",
func() {
ctorArgs, err := types.ERC20Contract.ABI.Pack("", &suite.address, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
args = types.TransactionArgs{
From: &suite.address,
Data: (*hexutil.Bytes)(&data),
}
params := suite.app.EvmKeeper.GetParams(suite.ctx)
params.EnableCreate = false
suite.app.EvmKeeper.SetParams(suite.ctx, params)
},
false,
0,
false,
},
{
"specified gas in args higher than ethparams.TxGas (21,000)",
func() {
args = types.TransactionArgs{
To: &common.Address{},
Gas: &higherGas,
}
},
true,
ethparams.TxGas,
false,
},
{
"specified gas in args higher than request gasCap",
func() {
gasCap = 22_000
args = types.TransactionArgs{
To: &common.Address{},
Gas: &higherGas,
}
},
true,
ethparams.TxGas,
false,
},
{
"invalid args - specified both gasPrice and maxFeePerGas",
func() {
args = types.TransactionArgs{
To: &common.Address{},
GasPrice: &hexBigInt,
MaxFeePerGas: &hexBigInt,
}
},
false,
0,
false,
},
}
for _, tc := range testCases {
@@ -588,8 +735,9 @@ func (suite *KeeperTestSuite) TestEstimateGas() {
args, err := json.Marshal(&args)
suite.Require().NoError(err)
req := types.EthCallRequest{
Args: args,
GasCap: gasCap,
Args: args,
GasCap: gasCap,
ProposerAddress: suite.ctx.BlockHeader().ProposerAddress,
}
rsp, err := suite.queryClient.EstimateGas(sdk.WrapSDKContext(suite.ctx), &req)
@@ -610,6 +758,7 @@ func (suite *KeeperTestSuite) TestTraceTx() {
txMsg *types.MsgEthereumTx
traceConfig *types.TraceConfig
predecessors []*types.MsgEthereumTx
chainID *sdkmath.Int
)
testCases := []struct {
@@ -702,6 +851,86 @@ func (suite *KeeperTestSuite) TestTraceTx() {
traceResponse: "{\"gas\":34828,\"failed\":false,\"returnValue\":\"0000000000000000000000000000000000000000000000000000000000000001\",\"structLogs\":[{\"pc\":0,\"op\":\"PUSH1\",\"gas\":",
enableFeemarket: false,
},
{
msg: "invalid trace config - Negative Limit",
malleate: func() {
traceConfig = &types.TraceConfig{
DisableStack: true,
DisableStorage: true,
EnableMemory: false,
Limit: -1,
}
},
expPass: false,
},
{
msg: "invalid trace config - Invalid Tracer",
malleate: func() {
traceConfig = &types.TraceConfig{
DisableStack: true,
DisableStorage: true,
EnableMemory: false,
Tracer: "invalid_tracer",
}
},
expPass: false,
},
{
msg: "invalid trace config - Invalid Timeout",
malleate: func() {
traceConfig = &types.TraceConfig{
DisableStack: true,
DisableStorage: true,
EnableMemory: false,
Timeout: "wrong_time",
}
},
expPass: false,
},
{
msg: "default tracer with contract creation tx as predecessor but 'create' param disabled",
malleate: func() {
traceConfig = nil
// increase nonce to avoid address collision
vmdb := suite.StateDB()
vmdb.SetNonce(suite.address, vmdb.GetNonce(suite.address)+1)
suite.Require().NoError(vmdb.Commit())
chainID := suite.app.EvmKeeper.ChainID()
nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address)
data := types.ERC20Contract.Bin
contractTx := types.NewTxContract(
chainID,
nonce,
nil, // amount
ethparams.TxGasContractCreation, // gasLimit
nil, // gasPrice
nil, nil,
data, // input
nil, // accesses
)
predecessors = append(predecessors, contractTx)
suite.Commit()
params := suite.app.EvmKeeper.GetParams(suite.ctx)
params.EnableCreate = false
suite.app.EvmKeeper.SetParams(suite.ctx, params)
},
expPass: true,
traceResponse: "{\"gas\":34828,\"failed\":false,\"returnValue\":\"0000000000000000000000000000000000000000000000000000000000000001\",\"structLogs\":[{\"pc\":0,\"op\":\"PUSH1\",\"gas\":",
},
{
msg: "invalid chain id",
malleate: func() {
traceConfig = nil
predecessors = []*types.MsgEthereumTx{}
tmp := sdkmath.NewInt(1)
chainID = &tmp
},
expPass: false,
},
}
for _, tc := range testCases {
@@ -721,8 +950,11 @@ func (suite *KeeperTestSuite) TestTraceTx() {
TraceConfig: traceConfig,
Predecessors: predecessors,
}
if chainID != nil {
traceReq.ChainId = chainID.Int64()
}
res, err := suite.queryClient.TraceTx(sdk.WrapSDKContext(suite.ctx), &traceReq)
suite.Require().NoError(err)
if tc.expPass {
suite.Require().NoError(err)
@@ -740,6 +972,8 @@ func (suite *KeeperTestSuite) TestTraceTx() {
} else {
suite.Require().Error(err)
}
// Reset for next test case
chainID = nil
})
}
@@ -750,6 +984,7 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
var (
txs []*types.MsgEthereumTx
traceConfig *types.TraceConfig
chainID *sdkmath.Int
)
testCases := []struct {
@@ -836,6 +1071,41 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
traceResponse: "[{\"result\":{\"gas\":34828,\"failed\":false,\"returnValue\":\"0000000000000000000000000000000000000000000000000000000000000001\",\"structLogs\":[{\"pc\":0,\"op\":\"PU",
enableFeemarket: false,
},
{
msg: "invalid trace config - Negative Limit",
malleate: func() {
traceConfig = &types.TraceConfig{
DisableStack: true,
DisableStorage: true,
EnableMemory: false,
Limit: -1,
}
},
expPass: false,
},
{
msg: "invalid trace config - Invalid Tracer",
malleate: func() {
traceConfig = &types.TraceConfig{
DisableStack: true,
DisableStorage: true,
EnableMemory: false,
Tracer: "invalid_tracer",
}
},
expPass: true,
traceResponse: "[{\"error\":\"rpc error: code = Internal desc = tracer not found\"}]",
},
{
msg: "invalid chain id",
malleate: func() {
traceConfig = nil
tmp := sdkmath.NewInt(1)
chainID = &tmp
},
expPass: true,
traceResponse: "[{\"error\":\"rpc error: code = Internal desc = invalid chain id for signer\"}]",
},
}
for _, tc := range testCases {
@@ -857,6 +1127,11 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
Txs: txs,
TraceConfig: traceConfig,
}
if chainID != nil {
traceReq.ChainId = chainID.Int64()
}
res, err := suite.queryClient.TraceBlock(sdk.WrapSDKContext(suite.ctx), &traceReq)
if tc.expPass {
@@ -870,6 +1145,8 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
} else {
suite.Require().Error(err)
}
// Reset for next case
chainID = nil
})
}
@@ -877,10 +1154,7 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
}
func (suite *KeeperTestSuite) TestNonceInQuery() {
suite.SetupTest()
priv, err := ethsecp256k1.GenerateKey()
suite.Require().NoError(err)
address := common.BytesToAddress(priv.PubKey().Address().Bytes())
address := tests.GenerateAddress()
suite.Require().Equal(uint64(0), suite.app.EvmKeeper.GetNonce(suite.ctx, address))
supply := sdkmath.NewIntWithDecimal(1000, 18).BigInt()
@@ -889,22 +1163,26 @@ func (suite *KeeperTestSuite) TestNonceInQuery() {
// do an EthCall/EstimateGas with nonce 0
ctorArgs, err := types.ERC20Contract.ABI.Pack("", address, supply)
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
args, err := json.Marshal(&types.TransactionArgs{
From: &address,
Data: (*hexutil.Bytes)(&data),
})
suite.Require().NoError(err)
proposerAddress := suite.ctx.BlockHeader().ProposerAddress
_, err = suite.queryClient.EstimateGas(sdk.WrapSDKContext(suite.ctx), &types.EthCallRequest{
Args: args,
GasCap: uint64(config.DefaultGasCap),
Args: args,
GasCap: uint64(config.DefaultGasCap),
ProposerAddress: proposerAddress,
})
suite.Require().NoError(err)
_, err = suite.queryClient.EthCall(sdk.WrapSDKContext(suite.ctx), &types.EthCallRequest{
Args: args,
GasCap: uint64(config.DefaultGasCap),
Args: args,
GasCap: uint64(config.DefaultGasCap),
ProposerAddress: proposerAddress,
})
suite.Require().NoError(err)
}
@@ -981,3 +1259,158 @@ func (suite *KeeperTestSuite) TestQueryBaseFee() {
suite.enableFeemarket = false
suite.enableLondonHF = true
}
func (suite *KeeperTestSuite) TestEthCall() {
var (
req *types.EthCallRequest
)
address := tests.GenerateAddress()
suite.Require().Equal(uint64(0), suite.app.EvmKeeper.GetNonce(suite.ctx, address))
supply := sdkmath.NewIntWithDecimal(1000, 18).BigInt()
hexBigInt := hexutil.Big(*big.NewInt(1))
ctorArgs, err := types.ERC20Contract.ABI.Pack("", address, supply)
suite.Require().NoError(err)
data := append(types.ERC20Contract.Bin, ctorArgs...)
testCases := []struct {
name string
malleate func()
expPass bool
}{
{
"invalid args",
func() {
req = &types.EthCallRequest{Args: []byte("invalid args"), GasCap: uint64(config.DefaultGasCap)}
},
false,
},
{
"invalid args - specified both gasPrice and maxFeePerGas",
func() {
args, err := json.Marshal(&types.TransactionArgs{
From: &address,
Data: (*hexutil.Bytes)(&data),
GasPrice: &hexBigInt,
MaxFeePerGas: &hexBigInt,
})
suite.Require().NoError(err)
req = &types.EthCallRequest{Args: args, GasCap: uint64(config.DefaultGasCap)}
},
false,
},
{
"set param EnableCreate = false",
func() {
args, err := json.Marshal(&types.TransactionArgs{
From: &address,
Data: (*hexutil.Bytes)(&data),
})
suite.Require().NoError(err)
req = &types.EthCallRequest{Args: args, GasCap: uint64(config.DefaultGasCap)}
params := suite.app.EvmKeeper.GetParams(suite.ctx)
params.EnableCreate = false
suite.app.EvmKeeper.SetParams(suite.ctx, params)
},
false,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
tc.malleate()
res, err := suite.queryClient.EthCall(suite.ctx, req)
if tc.expPass {
suite.Require().NotNil(res)
suite.Require().NoError(err)
} else {
suite.Require().Error(err)
}
})
}
}
func (suite *KeeperTestSuite) TestEmptyRequest() {
k := suite.app.EvmKeeper
testCases := []struct {
name string
queryFunc func() (interface{}, error)
}{
{
"Account method",
func() (interface{}, error) {
return k.Account(suite.ctx, nil)
},
},
{
"CosmosAccount method",
func() (interface{}, error) {
return k.CosmosAccount(suite.ctx, nil)
},
},
{
"ValidatorAccount method",
func() (interface{}, error) {
return k.ValidatorAccount(suite.ctx, nil)
},
},
{
"Balance method",
func() (interface{}, error) {
return k.Balance(suite.ctx, nil)
},
},
{
"Storage method",
func() (interface{}, error) {
return k.Storage(suite.ctx, nil)
},
},
{
"Code method",
func() (interface{}, error) {
return k.Code(suite.ctx, nil)
},
},
{
"EthCall method",
func() (interface{}, error) {
return k.EthCall(suite.ctx, nil)
},
},
{
"EstimateGas method",
func() (interface{}, error) {
return k.EstimateGas(suite.ctx, nil)
},
},
{
"TraceTx method",
func() (interface{}, error) {
return k.TraceTx(suite.ctx, nil)
},
},
{
"TraceBlock method",
func() (interface{}, error) {
return k.TraceBlock(suite.ctx, nil)
},
},
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
suite.SetupTest()
_, err := tc.queryFunc()
suite.Require().Error(err)
})
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
package keeper
import (
errorsmod "cosmossdk.io/errors"
"github.com/cerc-io/laconicd/x/evm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
)
@@ -22,7 +22,7 @@ func NewMultiEvmHooks(hooks ...types.EvmHooks) MultiEvmHooks {
func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error {
for i := range mh {
if err := mh[i].PostTxProcessing(ctx, msg, receipt); err != nil {
return sdkerrors.Wrapf(err, "EVM hook %T failed", mh[i])
return errorsmod.Wrapf(err, "EVM hook %T failed", mh[i])
}
}
return nil
+3 -3
View File
@@ -3,11 +3,11 @@ package keeper
import (
"math/big"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -237,7 +237,7 @@ func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper {
// PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error
func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error {
if k.hooks == types.EvmHooks(nil) {
if k.hooks == nil {
return nil
}
return k.hooks.PostTxProcessing(ctx, msg, receipt)
@@ -364,7 +364,7 @@ func (k Keeper) SetTransientGasUsed(ctx sdk.Context, gasUsed uint64) {
func (k Keeper) AddTransientGasUsed(ctx sdk.Context, gasUsed uint64) (uint64, error) {
result := k.GetTransientGasUsed(ctx) + gasUsed
if result < gasUsed {
return 0, sdkerrors.Wrap(types.ErrGasOverflow, "transient gas used")
return 0, errorsmod.Wrap(types.ErrGasOverflow, "transient gas used")
}
k.SetTransientGasUsed(ctx, result)
return result, nil
+97 -7
View File
@@ -126,6 +126,8 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) {
evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt
evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt
evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt
evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt
evmGenesis.Params.ChainConfig.CancunBlock = &maxInt
genesis[types.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis)
}
return genesis
@@ -200,6 +202,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) {
valAddr := sdk.ValAddress(suite.address.Bytes())
validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{})
require.NoError(t, err)
err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator)
require.NoError(t, err)
err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator)
@@ -256,10 +259,10 @@ func (suite *KeeperTestSuite) DeployTestContract(t require.TestingT, owner commo
Data: (*hexutil.Bytes)(&data),
})
require.NoError(t, err)
res, err := suite.queryClient.EstimateGas(ctx, &types.EthCallRequest{
Args: args,
GasCap: uint64(config.DefaultGasCap),
Args: args,
GasCap: uint64(config.DefaultGasCap),
ProposerAddress: suite.ctx.BlockHeader().ProposerAddress,
})
require.NoError(t, err)
@@ -307,8 +310,9 @@ func (suite *KeeperTestSuite) TransferERC20Token(t require.TestingT, contractAdd
args, err := json.Marshal(&types.TransactionArgs{To: &contractAddr, From: &from, Data: (*hexutil.Bytes)(&transferData)})
require.NoError(t, err)
res, err := suite.queryClient.EstimateGas(ctx, &types.EthCallRequest{
Args: args,
GasCap: 25_000_000,
Args: args,
GasCap: 25_000_000,
ProposerAddress: suite.ctx.BlockHeader().ProposerAddress,
})
require.NoError(t, err)
@@ -364,8 +368,9 @@ func (suite *KeeperTestSuite) DeployTestMessageCall(t require.TestingT) common.A
require.NoError(t, err)
res, err := suite.queryClient.EstimateGas(ctx, &types.EthCallRequest{
Args: args,
GasCap: uint64(config.DefaultGasCap),
Args: args,
GasCap: uint64(config.DefaultGasCap),
ProposerAddress: suite.ctx.BlockHeader().ProposerAddress,
})
require.NoError(t, err)
@@ -434,3 +439,88 @@ func (suite *KeeperTestSuite) TestBaseFee() {
suite.enableFeemarket = false
suite.enableLondonHF = true
}
func (suite *KeeperTestSuite) TestGetAccountStorage() {
testCases := []struct {
name string
malleate func()
expRes []int
}{
{
"Only one account that's not a contract (no storage)",
func() {},
[]int{0},
},
{
"Two accounts - one contract (with storage), one wallet",
func() {
supply := big.NewInt(100)
suite.DeployTestContract(suite.T(), suite.address, supply)
},
[]int{2, 0},
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
tc.malleate()
i := 0
suite.app.AccountKeeper.IterateAccounts(suite.ctx, func(account authtypes.AccountI) bool {
ethAccount, ok := account.(ethermint.EthAccountI)
if !ok {
// ignore non EthAccounts
return false
}
addr := ethAccount.EthAddress()
storage := suite.app.EvmKeeper.GetAccountStorage(suite.ctx, addr)
suite.Require().Equal(tc.expRes[i], len(storage))
i++
return false
})
})
}
}
func (suite *KeeperTestSuite) TestGetAccountOrEmpty() {
empty := statedb.Account{
Balance: new(big.Int),
CodeHash: types.EmptyCodeHash,
}
supply := big.NewInt(100)
contractAddr := suite.DeployTestContract(suite.T(), suite.address, supply)
testCases := []struct {
name string
addr common.Address
expEmpty bool
}{
{
"unexisting account - get empty",
common.Address{},
true,
},
{
"existing contract account",
contractAddr,
false,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
res := suite.app.EvmKeeper.GetAccountOrEmpty(suite.ctx, tc.addr)
if tc.expEmpty {
suite.Require().Equal(empty, res)
} else {
suite.Require().NotEqual(empty, res)
}
})
}
}
+5 -9
View File
@@ -9,10 +9,10 @@ import (
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types"
errorsmod "cosmossdk.io/errors"
"github.com/armon/go-metrics"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cerc-io/laconicd/x/evm/types"
)
@@ -32,20 +32,16 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
labels := []metrics.Label{
telemetry.NewLabel("tx_type", fmt.Sprintf("%d", tx.Type())),
telemetry.NewLabel("from", sender),
}
if tx.To() == nil {
labels = []metrics.Label{telemetry.NewLabel("execution", "create")}
labels = append(labels, telemetry.NewLabel("execution", "create"))
} else {
labels = []metrics.Label{
telemetry.NewLabel("execution", "call"),
telemetry.NewLabel("to", tx.To().Hex()), // recipient address (contract or account)
}
labels = append(labels, telemetry.NewLabel("execution", "call"))
}
response, err := k.ApplyTransaction(ctx, tx)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to apply transaction")
return nil, errorsmod.Wrap(err, "failed to apply transaction")
}
defer func() {
@@ -104,7 +100,7 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
for i, log := range response.Logs {
value, err := json.Marshal(log)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to encode log")
return nil, errorsmod.Wrap(err, "failed to encode log")
}
txLogAttrs[i] = sdk.NewAttribute(types.AttributeKeyTxLog, string(value))
}
+80
View File
@@ -0,0 +1,80 @@
package keeper_test
import (
"math/big"
"github.com/cerc-io/laconicd/x/evm/statedb"
"github.com/cerc-io/laconicd/x/evm/types"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
)
func (suite *KeeperTestSuite) TestEthereumTx() {
var (
err error
msg *types.MsgEthereumTx
signer ethtypes.Signer
vmdb *statedb.StateDB
chainCfg *params.ChainConfig
expectedGasUsed uint64
)
testCases := []struct {
name string
malleate func()
expErr bool
}{
{
"Deploy contract tx - insufficient gas",
func() {
msg, err = suite.createContractMsgTx(
vmdb.GetNonce(suite.address),
signer,
chainCfg,
big.NewInt(1),
)
suite.Require().NoError(err)
},
true,
},
{
"Transfer funds tx",
func() {
msg, _, err = newEthMsgTx(
vmdb.GetNonce(suite.address),
suite.ctx.BlockHeight(),
suite.address,
chainCfg,
suite.signer,
signer,
ethtypes.AccessListTxType,
nil,
nil,
)
suite.Require().NoError(err)
expectedGasUsed = params.TxGas
},
false,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
keeperParams := suite.app.EvmKeeper.GetParams(suite.ctx)
chainCfg = keeperParams.ChainConfig.EthereumConfig(suite.app.EvmKeeper.ChainID())
signer = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID())
vmdb = suite.StateDB()
tc.malleate()
res, err := suite.app.EvmKeeper.EthereumTx(suite.ctx, msg)
if tc.expErr {
suite.Require().Error(err)
return
}
suite.Require().NoError(err)
suite.Require().Equal(expectedGasUsed, res.GasUsed)
suite.Require().False(res.Failed())
})
}
}
+35
View File
@@ -21,3 +21,38 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}
// GetChainConfig returns the chain configuration parameter.
func (k Keeper) GetChainConfig(ctx sdk.Context) types.ChainConfig {
var chainCfg types.ChainConfig
k.paramSpace.GetIfExists(ctx, types.ParamStoreKeyChainConfig, &chainCfg)
return chainCfg
}
// GetEVMDenom returns the EVM denom.
func (k Keeper) GetEVMDenom(ctx sdk.Context) string {
var evmDenom string
k.paramSpace.GetIfExists(ctx, types.ParamStoreKeyEVMDenom, &evmDenom)
return evmDenom
}
// GetEnableCall returns true if the EVM Call operation is enabled.
func (k Keeper) GetEnableCall(ctx sdk.Context) bool {
var enableCall bool
k.paramSpace.GetIfExists(ctx, types.ParamStoreKeyEnableCall, &enableCall)
return enableCall
}
// GetEnableCreate returns true if the EVM Create contract operation is enabled.
func (k Keeper) GetEnableCreate(ctx sdk.Context) bool {
var enableCreate bool
k.paramSpace.GetIfExists(ctx, types.ParamStoreKeyEnableCreate, &enableCreate)
return enableCreate
}
// GetAllowUnprotectedTxs returns true if unprotected txs (i.e non-replay protected as per EIP-155) are supported by the chain.
func (k Keeper) GetAllowUnprotectedTxs(ctx sdk.Context) bool {
var allowUnprotectedTx bool
k.paramSpace.GetIfExists(ctx, types.ParamStoreKeyAllowUnprotectedTxs, &allowUnprotectedTx)
return allowUnprotectedTx
}
+86 -4
View File
@@ -1,14 +1,96 @@
package keeper_test
import (
"reflect"
"github.com/cerc-io/laconicd/x/evm/types"
)
func (suite *KeeperTestSuite) TestParams() {
params := suite.app.EvmKeeper.GetParams(suite.ctx)
suite.Require().Equal(types.DefaultParams(), params)
params.EvmDenom = "inj"
suite.app.EvmKeeper.SetParams(suite.ctx, params)
newParams := suite.app.EvmKeeper.GetParams(suite.ctx)
suite.Require().Equal(newParams, params)
testCases := []struct {
name string
paramsFun func() interface{}
getFun func() interface{}
expected bool
}{
{
"success - Checks if the default params are set correctly",
func() interface{} {
return types.DefaultParams()
},
func() interface{} {
return suite.app.EvmKeeper.GetParams(suite.ctx)
},
true,
},
{
"success - EvmDenom param is set to \"inj\" and can be retrieved correctly",
func() interface{} {
params.EvmDenom = "inj"
suite.app.EvmKeeper.SetParams(suite.ctx, params)
return params.EvmDenom
},
func() interface{} {
return suite.app.EvmKeeper.GetEVMDenom(suite.ctx)
},
true,
},
{
"success - Check EnableCreate param is set to false and can be retrieved correctly",
func() interface{} {
params.EnableCreate = false
suite.app.EvmKeeper.SetParams(suite.ctx, params)
return params.EnableCreate
},
func() interface{} {
return suite.app.EvmKeeper.GetEnableCreate(suite.ctx)
},
true,
},
{
"success - Check EnableCall param is set to false and can be retrieved correctly",
func() interface{} {
params.EnableCall = false
suite.app.EvmKeeper.SetParams(suite.ctx, params)
return params.EnableCall
},
func() interface{} {
return suite.app.EvmKeeper.GetEnableCall(suite.ctx)
},
true,
},
{
"success - Check AllowUnprotectedTxs param is set to false and can be retrieved correctly",
func() interface{} {
params.AllowUnprotectedTxs = false
suite.app.EvmKeeper.SetParams(suite.ctx, params)
return params.AllowUnprotectedTxs
},
func() interface{} {
return suite.app.EvmKeeper.GetAllowUnprotectedTxs(suite.ctx)
},
true,
},
{
"success - Check ChainConfig param is set to the default value and can be retrieved correctly",
func() interface{} {
params.ChainConfig = types.DefaultChainConfig()
suite.app.EvmKeeper.SetParams(suite.ctx, params)
return params.ChainConfig
},
func() interface{} {
return suite.app.EvmKeeper.GetChainConfig(suite.ctx)
},
true,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
outcome := reflect.DeepEqual(tc.paramsFun(), tc.getFun())
suite.Require().Equal(tc.expected, outcome)
})
}
}
+49 -33
View File
@@ -1,15 +1,15 @@
package keeper
import (
"math"
"math/big"
sdkmath "cosmossdk.io/math"
tmtypes "github.com/tendermint/tendermint/types"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
@@ -39,14 +39,14 @@ func GasToRefund(availableRefund, gasConsumed, refundQuotient uint64) uint64 {
}
// EVMConfig creates the EVMConfig based on current state
func (k *Keeper) EVMConfig(ctx sdk.Context) (*types.EVMConfig, error) {
func (k *Keeper) EVMConfig(ctx sdk.Context, proposerAddress sdk.ConsAddress, chainID *big.Int) (*types.EVMConfig, error) {
params := k.GetParams(ctx)
ethCfg := params.ChainConfig.EthereumConfig(k.eip155ChainID)
ethCfg := params.ChainConfig.EthereumConfig(chainID)
// get the coinbase address from the block proposer
coinbase, err := k.GetCoinbaseAddress(ctx)
coinbase, err := k.GetCoinbaseAddress(ctx, proposerAddress)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to obtain coinbase address")
return nil, errorsmod.Wrap(err, "failed to obtain coinbase address")
}
baseFee := k.GetBaseFee(ctx, ethCfg)
@@ -72,6 +72,11 @@ func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig
// (ChainConfig and module Params). It additionally sets the validator operator address as the
// coinbase address to make it available for the COINBASE opcode, even though there is no
// beneficiary of the coinbase transaction (since we're not mining).
//
// NOTE: the RANDOM opcode is currently not supported since it requires
// RANDAO implementation. See https://github.com/cerc-io/laconicd/pull/1520#pullrequestreview-1200504697
// for more information.
func (k *Keeper) NewEVM(
ctx sdk.Context,
msg core.Message,
@@ -89,6 +94,7 @@ func (k *Keeper) NewEVM(
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
Difficulty: big.NewInt(0), // unused. Only required in PoW context
BaseFee: cfg.BaseFee,
Random: nil, // not supported
}
txCtx := core.NewEVMTxContext(msg)
@@ -199,9 +205,9 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
bloomReceipt ethtypes.Bloom
)
cfg, err := k.EVMConfig(ctx)
cfg, err := k.EVMConfig(ctx, sdk.ConsAddress(ctx.BlockHeader().ProposerAddress), k.eip155ChainID)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to load evm config")
return nil, errorsmod.Wrap(err, "failed to load evm config")
}
txConfig := k.TxConfig(ctx, tx.Hash())
@@ -209,7 +215,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight()))
msg, err := tx.AsMessage(signer, cfg.BaseFee)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to return ethereum transaction as core message")
return nil, errorsmod.Wrap(err, "failed to return ethereum transaction as core message")
}
// snapshot to contain the tx processing and post processing in same scope
@@ -226,7 +232,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
// pass true to commit the StateDB
res, err := k.ApplyMessageWithConfig(tmpCtx, msg, nil, true, cfg, txConfig)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to apply ethereum core message")
return nil, errorsmod.Wrap(err, "failed to apply ethereum core message")
}
logs := types.LogsToEthereum(res.Logs)
@@ -241,8 +247,10 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
cumulativeGasUsed := res.GasUsed
if ctx.BlockGasMeter() != nil {
limit := ctx.BlockGasMeter().Limit()
consumed := ctx.BlockGasMeter().GasConsumed()
cumulativeGasUsed = uint64(math.Min(float64(cumulativeGasUsed+consumed), float64(limit)))
cumulativeGasUsed += ctx.BlockGasMeter().GasConsumed()
if cumulativeGasUsed > limit {
cumulativeGasUsed = limit
}
}
var contractAddr common.Address
@@ -285,7 +293,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
// refund gas in order to match the Ethereum gas consumption instead of the default SDK one.
if err = k.RefundGas(ctx, msg, msg.Gas()-res.GasUsed, cfg.Params.EvmDenom); err != nil {
return nil, sdkerrors.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From())
return nil, errorsmod.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From())
}
if len(receipt.Logs) > 0 {
@@ -298,7 +306,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
totalGasUsed, err := k.AddTransientGasUsed(ctx, res.GasUsed)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to add transient gas used")
return nil, errorsmod.Wrap(err, "failed to add transient gas used")
}
// reset the gas meter for current cosmos transaction
@@ -358,9 +366,9 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
// return error if contract creation or call are disabled through governance
if !cfg.Params.EnableCreate && msg.To() == nil {
return nil, sdkerrors.Wrap(types.ErrCreateDisabled, "failed to create new contract")
return nil, errorsmod.Wrap(types.ErrCreateDisabled, "failed to create new contract")
} else if !cfg.Params.EnableCall && msg.To() != nil {
return nil, sdkerrors.Wrap(types.ErrCallDisabled, "failed to call contract")
return nil, errorsmod.Wrap(types.ErrCallDisabled, "failed to call contract")
}
stateDB := statedb.New(ctx, k, txConfig)
@@ -384,13 +392,13 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
intrinsicGas, err := k.GetEthIntrinsicGas(ctx, msg, cfg.ChainConfig, contractCreation)
if err != nil {
// should have already been checked on Ante Handler
return nil, sdkerrors.Wrap(err, "intrinsic gas failed")
return nil, errorsmod.Wrap(err, "intrinsic gas failed")
}
// Should check again even if it is checked on Ante Handler, because eth_call don't go through Ante Handler.
if leftoverGas < intrinsicGas {
// eth_estimateGas will check for this exact error
return nil, sdkerrors.Wrap(core.ErrIntrinsicGas, "apply message")
return nil, errorsmod.Wrap(core.ErrIntrinsicGas, "apply message")
}
leftoverGas -= intrinsicGas
@@ -420,10 +428,11 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
// calculate gas refund
if msg.Gas() < leftoverGas {
return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message")
return nil, errorsmod.Wrap(types.ErrGasOverflow, "apply message")
}
// refund gas
leftoverGas += GasToRefund(stateDB.GetRefund(), msg.Gas()-leftoverGas, refundQuotient)
temporaryGasUsed := msg.Gas() - leftoverGas
leftoverGas += GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient)
// EVM execution error needs to be available for the JSON-RPC client
var vmError string
@@ -434,7 +443,7 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
// The dirty states in `StateDB` is either committed or discarded after return
if commit {
if err := stateDB.Commit(); err != nil {
return nil, sdkerrors.Wrap(err, "failed to commit stateDB")
return nil, errorsmod.Wrap(err, "failed to commit stateDB")
}
}
@@ -446,9 +455,9 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
minimumGasUsed := gasLimit.Mul(minGasMultiplier)
if msg.Gas() < leftoverGas {
return nil, sdkerrors.Wrapf(types.ErrGasOverflow, "message gas limit < leftover gas (%d < %d)", msg.Gas(), leftoverGas)
return nil, errorsmod.Wrapf(types.ErrGasOverflow, "message gas limit < leftover gas (%d < %d)", msg.Gas(), leftoverGas)
}
temporaryGasUsed := msg.Gas() - leftoverGas
gasUsed := sdk.MaxDec(minimumGasUsed, sdk.NewDec(int64(temporaryGasUsed))).TruncateInt().Uint64()
// reset leftoverGas, to be used by the tracer
leftoverGas = msg.Gas() - gasUsed
@@ -464,9 +473,9 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
// ApplyMessage calls ApplyMessageWithConfig with default EVMConfig
func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*types.MsgEthereumTxResponse, error) {
cfg, err := k.EVMConfig(ctx)
cfg, err := k.EVMConfig(ctx, sdk.ConsAddress(ctx.BlockHeader().ProposerAddress), k.eip155ChainID)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to load evm config")
return nil, errorsmod.Wrap(err, "failed to load evm config")
}
txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash()))
return k.ApplyMessageWithConfig(ctx, msg, tracer, commit, cfg, txConfig)
@@ -492,7 +501,7 @@ func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64
switch remaining.Sign() {
case -1:
// negative refund errors
return sdkerrors.Wrapf(types.ErrInvalidRefund, "refunded amount value cannot be negative %d", remaining.Int64())
return errorsmod.Wrapf(types.ErrInvalidRefund, "refunded amount value cannot be negative %d", remaining.Int64())
case 1:
// positive amount refund
refundedCoins := sdk.Coins{sdk.NewCoin(denom, sdkmath.NewIntFromBigInt(remaining))}
@@ -501,8 +510,8 @@ func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64
err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, msg.From().Bytes(), refundedCoins)
if err != nil {
err = sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "fee collector account failed to refund fees: %s", err.Error())
return sdkerrors.Wrapf(err, "failed to refund %d leftover gas (%s)", leftoverGas, refundedCoins.String())
err = errorsmod.Wrapf(errortypes.ErrInsufficientFunds, "fee collector account failed to refund fees: %s", err.Error())
return errorsmod.Wrapf(err, "failed to refund %d leftover gas (%s)", leftoverGas, refundedCoins.String())
}
default:
// no refund, consume gas and update the tx gas meter
@@ -519,15 +528,22 @@ func (k *Keeper) ResetGasMeterAndConsumeGas(ctx sdk.Context, gasUsed uint64) {
ctx.GasMeter().ConsumeGas(gasUsed, "apply evm transaction")
}
// GetProposerAddress returns current block proposer's address when provided proposer address is empty.
func GetProposerAddress(ctx sdk.Context, proposerAddress sdk.ConsAddress) sdk.ConsAddress {
if len(proposerAddress) == 0 {
proposerAddress = ctx.BlockHeader().ProposerAddress
}
return proposerAddress
}
// GetCoinbaseAddress returns the block proposer's validator operator address.
func (k Keeper) GetCoinbaseAddress(ctx sdk.Context) (common.Address, error) {
consAddr := sdk.ConsAddress(ctx.BlockHeader().ProposerAddress)
validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
func (k Keeper) GetCoinbaseAddress(ctx sdk.Context, proposerAddress sdk.ConsAddress) (common.Address, error) {
validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, GetProposerAddress(ctx, proposerAddress))
if !found {
return common.Address{}, sdkerrors.Wrapf(
return common.Address{}, errorsmod.Wrapf(
stakingtypes.ErrNoValidatorFound,
"failed to retrieve validator from block proposer address %s",
consAddr.String(),
proposerAddress.String(),
)
}
@@ -75,7 +75,7 @@ func newSignedEthTx(
return ethTx, nil
}
func newNativeMessage(
func newEthMsgTx(
nonce uint64,
blockHeight int64,
address common.Address,
@@ -85,14 +85,11 @@ func newNativeMessage(
txType byte,
data []byte,
accessList ethtypes.AccessList,
) (core.Message, error) {
msgSigner := ethtypes.MakeSigner(cfg, big.NewInt(blockHeight))
) (*evmtypes.MsgEthereumTx, *big.Int, error) {
var (
ethTx *ethtypes.Transaction
baseFee *big.Int
)
switch txType {
case ethtypes.LegacyTxType:
templateLegacyTx.Nonce = nonce
@@ -122,14 +119,32 @@ func newNativeMessage(
ethTx = ethtypes.NewTx(templateDynamicFeeTx)
baseFee = big.NewInt(3)
default:
return nil, errors.New("unsupport tx type")
return nil, baseFee, errors.New("unsupport tx type")
}
msg := &evmtypes.MsgEthereumTx{}
msg.FromEthereumTx(ethTx)
msg.From = address.Hex()
if err := msg.Sign(ethSigner, krSigner); err != nil {
return msg, baseFee, msg.Sign(ethSigner, krSigner)
}
func newNativeMessage(
nonce uint64,
blockHeight int64,
address common.Address,
cfg *params.ChainConfig,
krSigner keyring.Signer,
ethSigner ethtypes.Signer,
txType byte,
data []byte,
accessList ethtypes.AccessList,
) (core.Message, error) {
msgSigner := ethtypes.MakeSigner(cfg, big.NewInt(blockHeight))
msg, baseFee, err := newEthMsgTx(nonce, blockHeight, address, cfg, krSigner, ethSigner, txType, data, accessList)
if err != nil {
return nil, err
}
+247 -26
View File
@@ -7,11 +7,13 @@ import (
"github.com/cerc-io/laconicd/tests"
"github.com/cerc-io/laconicd/x/evm/keeper"
"github.com/cerc-io/laconicd/x/evm/statedb"
"github.com/cerc-io/laconicd/x/evm/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/tendermint/tendermint/crypto/tmhash"
@@ -157,8 +159,8 @@ func (suite *KeeperTestSuite) TestGetCoinbaseAddress() {
suite.SetupTest() // reset
tc.malleate()
coinbase, err := suite.app.EvmKeeper.GetCoinbaseAddress(suite.ctx)
proposerAddress := suite.ctx.BlockHeader().ProposerAddress
coinbase, err := suite.app.EvmKeeper.GetCoinbaseAddress(suite.ctx, sdk.ConsAddress(proposerAddress))
if tc.expPass {
suite.Require().NoError(err)
suite.Require().Equal(valOpAddr, coinbase)
@@ -346,40 +348,63 @@ func (suite *KeeperTestSuite) TestGasToRefund() {
}
func (suite *KeeperTestSuite) TestRefundGas() {
var (
m core.Message
err error
)
testCases := []struct {
name string
leftoverGas uint64
refundQuotient uint64
noError bool
expGasRefund uint64
malleate func()
}{
{
"leftoverGas more than tx gas limit",
params.TxGas + 1,
params.RefundQuotient,
false,
params.TxGas + 1,
name: "leftoverGas more than tx gas limit",
leftoverGas: params.TxGas + 1,
refundQuotient: params.RefundQuotient,
noError: false,
expGasRefund: params.TxGas + 1,
},
{
"leftoverGas equal to tx gas limit, insufficient fee collector account",
params.TxGas,
params.RefundQuotient,
true,
0,
name: "leftoverGas equal to tx gas limit, insufficient fee collector account",
leftoverGas: params.TxGas,
refundQuotient: params.RefundQuotient,
noError: true,
expGasRefund: 0,
},
{
"leftoverGas less than to tx gas limit",
params.TxGas - 1,
params.RefundQuotient,
true,
0,
name: "leftoverGas less than to tx gas limit",
leftoverGas: params.TxGas - 1,
refundQuotient: params.RefundQuotient,
noError: true,
expGasRefund: 0,
},
{
"no leftoverGas, refund half used gas ",
0,
params.RefundQuotient,
true,
params.TxGas / params.RefundQuotient,
name: "no leftoverGas, refund half used gas ",
leftoverGas: 0,
refundQuotient: params.RefundQuotient,
noError: true,
expGasRefund: params.TxGas / params.RefundQuotient,
},
{
name: "invalid Gas value in msg",
leftoverGas: 0,
refundQuotient: params.RefundQuotient,
noError: false,
expGasRefund: params.TxGas,
malleate: func() {
keeperParams := suite.app.EvmKeeper.GetParams(suite.ctx)
m, err = suite.createContractGethMsg(
suite.StateDB().GetNonce(suite.address),
ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()),
keeperParams.ChainConfig.EthereumConfig(suite.app.EvmKeeper.ChainID()),
big.NewInt(-100),
)
suite.Require().NoError(err)
},
},
}
@@ -393,7 +418,7 @@ func (suite *KeeperTestSuite) TestRefundGas() {
signer := ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID())
vmdb := suite.StateDB()
m, err := newNativeMessage(
m, err = newNativeMessage(
vmdb.GetNonce(suite.address),
suite.ctx.BlockHeight(),
suite.address,
@@ -411,6 +436,11 @@ func (suite *KeeperTestSuite) TestRefundGas() {
if tc.leftoverGas > m.Gas() {
return
}
if tc.malleate != nil {
tc.malleate()
}
gasUsed := m.Gas() - tc.leftoverGas
refund := keeper.GasToRefund(vmdb.GetRefund(), gasUsed, tc.refundQuotient)
suite.Require().Equal(tc.expGasRefund, refund)
@@ -486,8 +516,8 @@ func (suite *KeeperTestSuite) TestResetGasMeterAndConsumeGas() {
}
func (suite *KeeperTestSuite) TestEVMConfig() {
suite.SetupTest()
cfg, err := suite.app.EvmKeeper.EVMConfig(suite.ctx)
proposerAddress := suite.ctx.BlockHeader().ProposerAddress
cfg, err := suite.app.EvmKeeper.EVMConfig(suite.ctx, proposerAddress, big.NewInt(9000))
suite.Require().NoError(err)
suite.Require().Equal(types.DefaultParams(), cfg.Params)
// london hardfork is enabled by default
@@ -497,8 +527,199 @@ func (suite *KeeperTestSuite) TestEVMConfig() {
}
func (suite *KeeperTestSuite) TestContractDeployment() {
suite.SetupTest()
contractAddress := suite.DeployTestContract(suite.T(), suite.address, big.NewInt(10000000000000))
db := suite.StateDB()
suite.Require().Greater(db.GetCodeSize(contractAddress), 0)
}
func (suite *KeeperTestSuite) TestApplyMessage() {
expectedGasUsed := params.TxGas
var msg core.Message
proposerAddress := suite.ctx.BlockHeader().ProposerAddress
config, err := suite.app.EvmKeeper.EVMConfig(suite.ctx, proposerAddress, big.NewInt(9000))
suite.Require().NoError(err)
keeperParams := suite.app.EvmKeeper.GetParams(suite.ctx)
chainCfg := keeperParams.ChainConfig.EthereumConfig(suite.app.EvmKeeper.ChainID())
signer := ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID())
tracer := suite.app.EvmKeeper.Tracer(suite.ctx, msg, config.ChainConfig)
vmdb := suite.StateDB()
msg, err = newNativeMessage(
vmdb.GetNonce(suite.address),
suite.ctx.BlockHeight(),
suite.address,
chainCfg,
suite.signer,
signer,
ethtypes.AccessListTxType,
nil,
nil,
)
suite.Require().NoError(err)
res, err := suite.app.EvmKeeper.ApplyMessage(suite.ctx, msg, tracer, true)
suite.Require().NoError(err)
suite.Require().Equal(expectedGasUsed, res.GasUsed)
suite.Require().False(res.Failed())
}
func (suite *KeeperTestSuite) TestApplyMessageWithConfig() {
var (
msg core.Message
err error
expectedGasUsed uint64
config *types.EVMConfig
keeperParams types.Params
signer ethtypes.Signer
vmdb *statedb.StateDB
txConfig statedb.TxConfig
chainCfg *params.ChainConfig
)
testCases := []struct {
name string
malleate func()
expErr bool
}{
{
"messsage applied ok",
func() {
msg, err = newNativeMessage(
vmdb.GetNonce(suite.address),
suite.ctx.BlockHeight(),
suite.address,
chainCfg,
suite.signer,
signer,
ethtypes.AccessListTxType,
nil,
nil,
)
suite.Require().NoError(err)
},
false,
},
{
"call contract tx with config param EnableCall = false",
func() {
config.Params.EnableCall = false
msg, err = newNativeMessage(
vmdb.GetNonce(suite.address),
suite.ctx.BlockHeight(),
suite.address,
chainCfg,
suite.signer,
signer,
ethtypes.AccessListTxType,
nil,
nil,
)
suite.Require().NoError(err)
},
true,
},
{
"create contract tx with config param EnableCreate = false",
func() {
msg, err = suite.createContractGethMsg(vmdb.GetNonce(suite.address), signer, chainCfg, big.NewInt(1))
suite.Require().NoError(err)
config.Params.EnableCreate = false
},
true,
},
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
suite.SetupTest()
expectedGasUsed = params.TxGas
proposerAddress := suite.ctx.BlockHeader().ProposerAddress
config, err = suite.app.EvmKeeper.EVMConfig(suite.ctx, proposerAddress, big.NewInt(9000))
suite.Require().NoError(err)
keeperParams = suite.app.EvmKeeper.GetParams(suite.ctx)
chainCfg = keeperParams.ChainConfig.EthereumConfig(suite.app.EvmKeeper.ChainID())
signer = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID())
vmdb = suite.StateDB()
txConfig = suite.app.EvmKeeper.TxConfig(suite.ctx, common.Hash{})
tc.malleate()
res, err := suite.app.EvmKeeper.ApplyMessageWithConfig(suite.ctx, msg, nil, true, config, txConfig)
if tc.expErr {
suite.Require().Error(err)
return
}
suite.Require().NoError(err)
suite.Require().False(res.Failed())
suite.Require().Equal(expectedGasUsed, res.GasUsed)
})
}
}
func (suite *KeeperTestSuite) createContractGethMsg(nonce uint64, signer ethtypes.Signer, cfg *params.ChainConfig, gasPrice *big.Int) (core.Message, error) {
ethMsg, err := suite.createContractMsgTx(nonce, signer, cfg, gasPrice)
if err != nil {
return nil, err
}
msgSigner := ethtypes.MakeSigner(cfg, big.NewInt(suite.ctx.BlockHeight()))
return ethMsg.AsMessage(msgSigner, nil)
}
func (suite *KeeperTestSuite) createContractMsgTx(nonce uint64, signer ethtypes.Signer, cfg *params.ChainConfig, gasPrice *big.Int) (*types.MsgEthereumTx, error) {
contractCreateTx := &ethtypes.AccessListTx{
GasPrice: gasPrice,
Gas: params.TxGasContractCreation,
To: nil,
Data: []byte("contract_data"),
Nonce: nonce,
}
ethTx := ethtypes.NewTx(contractCreateTx)
ethMsg := &types.MsgEthereumTx{}
ethMsg.FromEthereumTx(ethTx)
ethMsg.From = suite.address.Hex()
return ethMsg, ethMsg.Sign(signer, suite.signer)
}
func (suite *KeeperTestSuite) TestGetProposerAddress() {
var a sdk.ConsAddress
address := sdk.ConsAddress(suite.address.Bytes())
proposerAddress := sdk.ConsAddress(suite.ctx.BlockHeader().ProposerAddress)
testCases := []struct {
msg string
adr sdk.ConsAddress
expAdr sdk.ConsAddress
}{
{
"proposer address provided",
address,
address,
},
{
"nil proposer address provided",
nil,
proposerAddress,
},
{
"typed nil proposer address provided",
a,
proposerAddress,
},
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
suite.Require().Equal(tc.expAdr, keeper.GetProposerAddress(suite.ctx, tc.adr))
})
}
}
+2 -2
View File
@@ -6,12 +6,12 @@ import (
sdkmath "cosmossdk.io/math"
errorsmod "cosmossdk.io/errors"
ethermint "github.com/cerc-io/laconicd/types"
"github.com/cerc-io/laconicd/x/evm/statedb"
"github.com/cerc-io/laconicd/x/evm/types"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
)
@@ -189,7 +189,7 @@ func (k *Keeper) DeleteAccount(ctx sdk.Context, addr common.Address) error {
// NOTE: only Ethereum accounts (contracts) can be selfdestructed
_, ok := acct.(ethermint.EthAccountI)
if !ok {
return sdkerrors.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr)
return errorsmod.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr)
}
// clear balance
+135 -4
View File
@@ -6,6 +6,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
@@ -317,6 +318,40 @@ func (suite *KeeperTestSuite) TestSetCode() {
}
}
func (suite *KeeperTestSuite) TestKeeperSetCode() {
addr := tests.GenerateAddress()
baseAcc := &authtypes.BaseAccount{Address: sdk.AccAddress(addr.Bytes()).String()}
suite.app.AccountKeeper.SetAccount(suite.ctx, baseAcc)
testCases := []struct {
name string
codeHash []byte
code []byte
}{
{
"set code",
[]byte("codeHash"),
[]byte("this is the code"),
},
{
"delete code",
[]byte("codeHash"),
nil,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.app.EvmKeeper.SetCode(suite.ctx, tc.codeHash, tc.code)
key := suite.app.GetKey(types.StoreKey)
store := prefix.NewStore(suite.ctx.KVStore(key), types.KeyPrefixCode)
code := store.Get(tc.codeHash)
suite.Require().Equal(tc.code, code)
})
}
}
func (suite *KeeperTestSuite) TestRefund() {
testCases := []struct {
name string
@@ -384,8 +419,6 @@ func (suite *KeeperTestSuite) TestState() {
}
func (suite *KeeperTestSuite) TestCommittedState() {
suite.SetupTest()
key := common.BytesToHash([]byte("key"))
value1 := common.BytesToHash([]byte("value1"))
value2 := common.BytesToHash([]byte("value2"))
@@ -487,8 +520,6 @@ func (suite *KeeperTestSuite) TestExist() {
}
func (suite *KeeperTestSuite) TestEmpty() {
suite.SetupTest()
testCases := []struct {
name string
address common.Address
@@ -507,6 +538,7 @@ func (suite *KeeperTestSuite) TestEmpty() {
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
vmdb := suite.StateDB()
tc.malleate(vmdb)
@@ -811,3 +843,102 @@ func (suite *KeeperTestSuite) _TestForEachStorage() {
storage = types.Storage{}
}
}
func (suite *KeeperTestSuite) TestSetBalance() {
amount := big.NewInt(-10)
testCases := []struct {
name string
addr common.Address
malleate func()
expErr bool
}{
{
"address without funds - invalid amount",
suite.address,
func() {},
true,
},
{
"mint to address",
suite.address,
func() {
amount = big.NewInt(100)
},
false,
},
{
"burn from address",
suite.address,
func() {
amount = big.NewInt(60)
},
false,
},
{
"address with funds - invalid amount",
suite.address,
func() {
amount = big.NewInt(-10)
},
true,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
tc.malleate()
err := suite.app.EvmKeeper.SetBalance(suite.ctx, tc.addr, amount)
if tc.expErr {
suite.Require().Error(err)
} else {
balance := suite.app.EvmKeeper.GetBalance(suite.ctx, tc.addr)
suite.Require().NoError(err)
suite.Require().Equal(amount, balance)
}
})
}
}
func (suite *KeeperTestSuite) TestDeleteAccount() {
supply := big.NewInt(100)
contractAddr := suite.DeployTestContract(suite.T(), suite.address, supply)
testCases := []struct {
name string
addr common.Address
expErr bool
}{
{
"remove address",
suite.address,
false,
},
{
"remove unexistent address - returns nil error",
common.HexToAddress("unexistent_address"),
false,
},
{
"remove deployed contract",
contractAddr,
false,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
err := suite.app.EvmKeeper.DeleteAccount(suite.ctx, tc.addr)
if tc.expErr {
suite.Require().Error(err)
} else {
suite.Require().NoError(err)
balance := suite.app.EvmKeeper.GetBalance(suite.ctx, tc.addr)
suite.Require().Equal(new(big.Int), balance)
}
})
}
}
+42 -53
View File
@@ -1,37 +1,53 @@
package keeper
import (
"math"
"math/big"
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
)
// DeductTxCostsFromUserBalance it calculates the tx costs and deducts the fees
// returns (effectiveFee, priority, error)
func (k Keeper) DeductTxCostsFromUserBalance(
// DeductTxCostsFromUserBalance deducts the fees from the user balance. Returns an
// error if the specified sender address does not exist or the account balance is not sufficient.
func (k *Keeper) DeductTxCostsFromUserBalance(
ctx sdk.Context,
msgEthTx evmtypes.MsgEthereumTx,
fees sdk.Coins,
from common.Address,
) error {
// fetch sender account
signerAcc, err := authante.GetSignerAcc(ctx, k.accountKeeper, from.Bytes())
if err != nil {
return errorsmod.Wrapf(err, "account not found for sender %s", from)
}
// deduct the full gas cost from the user balance
if err := authante.DeductFees(k.bankKeeper, ctx, signerAcc, fees); err != nil {
return errorsmod.Wrapf(err, "failed to deduct full gas cost %s from the user %s balance", fees, from)
}
return nil
}
// VerifyFee is used to return the fee for the given transaction data in sdk.Coins. It checks that the
// gas limit is not reached, the gas limit is higher than the intrinsic gas and that the
// base fee is higher than the gas fee cap.
func VerifyFee(
txData evmtypes.TxData,
denom string,
homestead, istanbul, london bool,
) (fees sdk.Coins, priority int64, err error) {
baseFee *big.Int,
homestead, istanbul, isCheckTx bool,
) (sdk.Coins, error) {
isContractCreation := txData.GetTo() == nil
// fetch sender account from signature
signerAcc, err := authante.GetSignerAcc(ctx, k.accountKeeper, msgEthTx.GetFrom())
if err != nil {
return nil, 0, sdkerrors.Wrapf(err, "account not found for sender %s", msgEthTx.From)
}
gasLimit := txData.GetGas()
var accessList ethtypes.AccessList
@@ -41,7 +57,7 @@ func (k Keeper) DeductTxCostsFromUserBalance(
intrinsicGas, err := core.IntrinsicGas(txData.GetData(), accessList, isContractCreation, homestead, istanbul)
if err != nil {
return nil, 0, sdkerrors.Wrapf(
return nil, errorsmod.Wrapf(
err,
"failed to retrieve intrinsic gas, contract creation = %t; homestead = %t, istanbul = %t",
isContractCreation, homestead, istanbul,
@@ -49,54 +65,27 @@ func (k Keeper) DeductTxCostsFromUserBalance(
}
// intrinsic gas verification during CheckTx
if ctx.IsCheckTx() && gasLimit < intrinsicGas {
return nil, 0, sdkerrors.Wrapf(
sdkerrors.ErrOutOfGas,
if isCheckTx && gasLimit < intrinsicGas {
return nil, errorsmod.Wrapf(
errortypes.ErrOutOfGas,
"gas limit too low: %d (gas limit) < %d (intrinsic gas)", gasLimit, intrinsicGas,
)
}
var feeAmt *big.Int
baseFee := k.getBaseFee(ctx, london)
if baseFee != nil && txData.GetGasFeeCap().Cmp(baseFee) < 0 {
return nil, 0, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee,
return nil, errorsmod.Wrapf(errortypes.ErrInsufficientFee,
"the tx gasfeecap is lower than the tx baseFee: %s (gasfeecap), %s (basefee) ",
txData.GetGasFeeCap(),
baseFee)
}
feeAmt = txData.EffectiveFee(baseFee)
feeAmt := txData.EffectiveFee(baseFee)
if feeAmt.Sign() == 0 {
// zero fee, no need to deduct
return sdk.Coins{}, 0, nil
return sdk.Coins{}, nil
}
fees = sdk.Coins{sdk.NewCoin(denom, sdkmath.NewIntFromBigInt(feeAmt))}
// deduct the full gas cost from the user balance
if err := authante.DeductFees(k.bankKeeper, ctx, signerAcc, fees); err != nil {
return nil, 0, sdkerrors.Wrapf(
err,
"failed to deduct full gas cost %s from the user %s balance",
fees, msgEthTx.From,
)
}
// calculate priority based on effective gas price
tipPrice := txData.EffectiveGasPrice(baseFee)
// if london hardfork is not enabled, tipPrice is the gasPrice
if baseFee != nil {
tipPrice = new(big.Int).Sub(tipPrice, baseFee)
}
priorityBig := new(big.Int).Quo(tipPrice, evmtypes.DefaultPriorityReduction.BigInt())
if !priorityBig.IsInt64() {
priority = math.MaxInt64
} else {
priority = priorityBig.Int64()
}
return fees, priority, nil
return sdk.Coins{{Denom: denom, Amount: sdkmath.NewIntFromBigInt(feeAmt)}}, nil
}
// CheckSenderBalance validates that the tx cost value is positive and that the
@@ -108,15 +97,15 @@ func CheckSenderBalance(
cost := txData.Cost()
if cost.Sign() < 0 {
return sdkerrors.Wrapf(
sdkerrors.ErrInvalidCoins,
return errorsmod.Wrapf(
errortypes.ErrInvalidCoins,
"tx cost (%s) is negative and invalid", cost,
)
}
if balance.IsNegative() || balance.BigInt().Cmp(cost) < 0 {
return sdkerrors.Wrapf(
sdkerrors.ErrInsufficientFunds,
return errorsmod.Wrapf(
errortypes.ErrInsufficientFunds,
"sender balance < tx cost (%s < %s)", balance, txData.Cost(),
)
}
+171 -97
View File
@@ -4,7 +4,7 @@ import (
"math/big"
sdkmath "cosmossdk.io/math"
evmkeeper "github.com/cerc-io/laconicd/x/evm/keeper"
"github.com/cerc-io/laconicd/x/evm/keeper"
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
@@ -207,7 +207,8 @@ func (suite *KeeperTestSuite) TestCheckSenderBalance() {
vmdb.AddBalance(suite.address, hundredInt.BigInt())
balance := vmdb.GetBalance(suite.address)
suite.Require().Equal(balance, hundredInt.BigInt())
vmdb.Commit()
err := vmdb.Commit()
suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err)
for i, tc := range testCases {
suite.Run(tc.name, func() {
@@ -237,7 +238,7 @@ func (suite *KeeperTestSuite) TestCheckSenderBalance() {
txData, _ := evmtypes.UnpackTxData(tx.Data)
acct := suite.app.EvmKeeper.GetAccountOrEmpty(suite.ctx, suite.address)
err := evmkeeper.CheckSenderBalance(
err := keeper.CheckSenderBalance(
sdkmath.NewIntFromBigInt(acct.Balance),
txData,
)
@@ -251,7 +252,13 @@ func (suite *KeeperTestSuite) TestCheckSenderBalance() {
}
}
func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
// TestVerifyFeeAndDeductTxCostsFromUserBalance is a test method for both the VerifyFee
// function and the DeductTxCostsFromUserBalance method.
//
// NOTE: This method combines testing for both functions, because these used to be
// in one function and share a lot of the same setup.
// In practice, the two tested functions will also be sequentially executed.
func (suite *KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance() {
hundredInt := sdkmath.NewInt(100)
zeroInt := sdk.ZeroInt()
oneInt := sdkmath.NewInt(1)
@@ -262,105 +269,166 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
initBalance := sdkmath.NewInt((ethparams.InitialBaseFee + 10) * 105)
testCases := []struct {
name string
gasLimit uint64
gasPrice *sdkmath.Int
gasFeeCap *big.Int
gasTipCap *big.Int
cost *sdkmath.Int
accessList *ethtypes.AccessList
expectPass bool
enableFeemarket bool
name string
gasLimit uint64
gasPrice *sdkmath.Int
gasFeeCap *big.Int
gasTipCap *big.Int
cost *sdkmath.Int
accessList *ethtypes.AccessList
expectPassVerify bool
expectPassDeduct bool
enableFeemarket bool
from string
malleate func()
}{
{
name: "Enough balance",
gasLimit: 10,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
name: "Enough balance",
gasLimit: 10,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
from: suite.address.String(),
},
{
name: "Equal balance",
gasLimit: 100,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
name: "Equal balance",
gasLimit: 100,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
from: suite.address.String(),
},
{
name: "Higher gas limit, not enough balance",
gasLimit: 105,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: false,
name: "Higher gas limit, not enough balance",
gasLimit: 105,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: false,
from: suite.address.String(),
},
{
name: "Higher gas price, enough balance",
gasLimit: 20,
gasPrice: &fiveInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
name: "Higher gas price, enough balance",
gasLimit: 20,
gasPrice: &fiveInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
from: suite.address.String(),
},
{
name: "Higher gas price, not enough balance",
gasLimit: 20,
gasPrice: &fiftyInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: false,
name: "Higher gas price, not enough balance",
gasLimit: 20,
gasPrice: &fiftyInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: false,
from: suite.address.String(),
},
// This case is expected to be true because the fees can be deducted, but the tx
// execution is going to fail because there is no more balance to pay the cost
{
name: "Higher cost, enough balance",
gasLimit: 100,
gasPrice: &oneInt,
cost: &fiftyInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
name: "Higher cost, enough balance",
gasLimit: 100,
gasPrice: &oneInt,
cost: &fiftyInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
from: suite.address.String(),
},
// testcases with enableFeemarket enabled.
{
name: "Invalid gasFeeCap w/ enableFeemarket",
gasLimit: 10,
gasFeeCap: big.NewInt(1),
gasTipCap: big.NewInt(1),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: false,
enableFeemarket: true,
name: "Invalid gasFeeCap w/ enableFeemarket",
gasLimit: 10,
gasFeeCap: big.NewInt(1),
gasTipCap: big.NewInt(1),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: false,
expectPassDeduct: true,
enableFeemarket: true,
from: suite.address.String(),
},
{
name: "empty tip fee is valid to deduct",
gasLimit: 10,
gasFeeCap: big.NewInt(ethparams.InitialBaseFee),
gasTipCap: big.NewInt(1),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
enableFeemarket: true,
name: "empty tip fee is valid to deduct",
gasLimit: 10,
gasFeeCap: big.NewInt(ethparams.InitialBaseFee),
gasTipCap: big.NewInt(1),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
enableFeemarket: true,
from: suite.address.String(),
},
{
name: "effectiveTip equal to gasTipCap",
gasLimit: 100,
gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 2),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
enableFeemarket: true,
name: "effectiveTip equal to gasTipCap",
gasLimit: 100,
gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 2),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
enableFeemarket: true,
from: suite.address.String(),
},
{
name: "effectiveTip equal to (gasFeeCap - baseFee)",
gasLimit: 105,
gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 1),
gasTipCap: big.NewInt(2),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPass: true,
enableFeemarket: true,
name: "effectiveTip equal to (gasFeeCap - baseFee)",
gasLimit: 105,
gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 1),
gasTipCap: big.NewInt(2),
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: true,
enableFeemarket: true,
from: suite.address.String(),
},
{
name: "Invalid from address",
gasLimit: 10,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: true,
expectPassDeduct: false,
from: "abcdef",
},
{
name: "Enough balance - with access list",
gasLimit: 10,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{
ethtypes.AccessTuple{
Address: suite.address,
StorageKeys: []common.Hash{},
},
},
expectPassVerify: true,
expectPassDeduct: true,
from: suite.address.String(),
},
{
name: "gasLimit < intrinsicGas during IsCheckTx",
gasLimit: 1,
gasPrice: &oneInt,
cost: &oneInt,
accessList: &ethtypes.AccessList{},
expectPassVerify: false,
expectPassDeduct: true,
from: suite.address.String(),
malleate: func() {
suite.ctx = suite.ctx.WithIsCheckTx(true)
},
},
}
@@ -370,6 +438,9 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
suite.SetupTest()
vmdb := suite.StateDB()
if tc.malleate != nil {
tc.malleate()
}
var amount, gasPrice, gasFeeCap, gasTipCap *big.Int
if tc.cost != nil {
amount = tc.cost.BigInt()
@@ -396,25 +467,21 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
balance := vmdb.GetBalance(suite.address)
suite.Require().Equal(balance, hundredInt.BigInt())
}
vmdb.Commit()
err := vmdb.Commit()
suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err)
tx := evmtypes.NewTx(zeroInt.BigInt(), 1, &suite.address, amount, tc.gasLimit, gasPrice, gasFeeCap, gasTipCap, nil, tc.accessList)
tx.From = suite.address.String()
tx.From = tc.from
txData, _ := evmtypes.UnpackTxData(tx.Data)
fees, priority, err := suite.app.EvmKeeper.DeductTxCostsFromUserBalance(
suite.ctx,
*tx,
txData,
evmtypes.DefaultEVMDenom,
false,
false,
suite.enableFeemarket, // london
)
ethCfg := suite.app.EvmKeeper.GetChainConfig(suite.ctx).EthereumConfig(nil)
baseFee := suite.app.EvmKeeper.GetBaseFee(suite.ctx, ethCfg)
priority := evmtypes.GetTxPriority(txData, baseFee)
if tc.expectPass {
suite.Require().NoError(err, "valid test %d failed", i)
fees, err := keeper.VerifyFee(txData, evmtypes.DefaultEVMDenom, baseFee, false, false, suite.ctx.IsCheckTx())
if tc.expectPassVerify {
suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name)
if tc.enableFeemarket {
baseFee := suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx)
suite.Require().Equal(
@@ -422,7 +489,7 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
sdk.NewCoins(
sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewIntFromBigInt(txData.EffectiveFee(baseFee))),
),
"valid test %d failed, fee value is wrong ", i,
"valid test %d failed, fee value is wrong - '%s'", i, tc.name,
)
suite.Require().Equal(int64(0), priority)
} else {
@@ -431,12 +498,19 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
sdk.NewCoins(
sdk.NewCoin(evmtypes.DefaultEVMDenom, tc.gasPrice.Mul(sdkmath.NewIntFromUint64(tc.gasLimit))),
),
"valid test %d failed, fee value is wrong ", i,
"valid test %d failed, fee value is wrong - '%s'", i, tc.name,
)
}
} else {
suite.Require().Error(err, "invalid test %d passed", i)
suite.Require().Nil(fees, "invalid test %d passed. fees value must be nil", i)
suite.Require().Error(err, "invalid test %d passed - '%s'", i, tc.name)
suite.Require().Nil(fees, "invalid test %d passed. fees value must be nil - '%s'", i, tc.name)
}
err = suite.app.EvmKeeper.DeductTxCostsFromUserBalance(suite.ctx, fees, common.HexToAddress(tx.From))
if tc.expectPassDeduct {
suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name)
} else {
suite.Require().Error(err, "invalid test %d passed - '%s'", i, tc.name)
}
})
}
+22 -7
View File
@@ -21,7 +21,6 @@ import (
"github.com/cerc-io/laconicd/x/evm/client/cli"
"github.com/cerc-io/laconicd/x/evm/keeper"
"github.com/cerc-io/laconicd/x/evm/simulation"
"github.com/cerc-io/laconicd/x/evm/types"
)
@@ -65,7 +64,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo
// RegisterRESTRoutes performs a no-op as the EVM module doesn't expose REST
// endpoints
func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}
func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) {
@@ -114,7 +113,7 @@ func (AppModule) Name() string {
// RegisterInvariants interface for registering invariants. Performs a no-op
// as the evm module doesn't expose invariants.
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {
}
// RegisterServices registers a GRPC query service to respond to the
@@ -122,6 +121,7 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
<<<<<<< HEAD
m := keeper.NewMigrator(*am.keeper)
err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2)
@@ -132,6 +132,8 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
if err != nil {
panic(err)
}
=======
>>>>>>> v0.20.0
}
// Route returns the message routing key for the evm module.
@@ -144,7 +146,7 @@ func (AppModule) QuerierRoute() string { return types.RouterKey }
// LegacyQuerierHandler returns nil as the evm module doesn't expose a legacy
// Querier.
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}
@@ -177,6 +179,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}
// RandomizedParams creates randomized evm param changes for the simulator.
<<<<<<< HEAD
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
return simulation.ParamChanges(r)
}
@@ -184,21 +187,33 @@ func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
// RegisterStoreDecoder registers a decoder for evm module's types
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
sdr[types.StoreKey] = simulation.NewDecodeStore()
=======
func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
return nil
}
// RegisterStoreDecoder registers a decoder for evm module's types
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {
>>>>>>> v0.20.0
}
// ProposalContents doesn't return any content functions for governance proposals.
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent {
return nil
}
// GenerateGenesisState creates a randomized GenState of the evm module.
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
simulation.RandomizedGenState(simState)
func (AppModule) GenerateGenesisState(_ *module.SimulationState) {
}
// WeightedOperations returns the all the evm module operations with their respective weights.
<<<<<<< HEAD
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return simulation.WeightedOperations(
simState.AppParams, simState.Cdc, am.ak, am.keeper,
)
=======
func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
return nil
>>>>>>> v0.20.0
}
+3 -3
View File
@@ -19,7 +19,7 @@ The `query` commands allow users to query `evm` state.
Allows users to query the smart contract code at a given address.
```go
ethermintd query evm code [address] [flags]
ethermintd query evm code ADDRESS [flags]
```
```bash
@@ -35,7 +35,7 @@ code: "0xef616c92f3cfc9e92dc270d6acff9cea213cecc7020a76ee4395af09bdceb4837a1ebdb
Allows users to query storage for an account with a given key and height.
```bash
ethermintd query evm storage [address] [key] [flags]
ethermintd query evm storage ADDRESS KEY [flags]
```
```bash
@@ -55,7 +55,7 @@ The `tx` commands allow users to interact with the `evm` module.
Allows users to build cosmos transactions from raw ethereum transaction.
```bash
ethermintd tx evm raw [tx-hex] [flags]
ethermintd tx evm raw TX_HEX [flags]
```
```bash
+3 -3
View File
@@ -5,8 +5,8 @@ import (
"math/big"
"sort"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
@@ -440,14 +440,14 @@ func (s *StateDB) Commit() error {
obj := s.stateObjects[addr]
if obj.suicided {
if err := s.keeper.DeleteAccount(s.ctx, obj.Address()); err != nil {
return sdkerrors.Wrap(err, "failed to delete account")
return errorsmod.Wrap(err, "failed to delete account")
}
} else {
if obj.code != nil && obj.dirtyCode {
s.keeper.SetCode(s.ctx, obj.CodeHash(), obj.code)
}
if err := s.keeper.SetAccount(s.ctx, obj.Address(), obj.account); err != nil {
return sdkerrors.Wrap(err, "failed to set account")
return errorsmod.Wrap(err, "failed to set account")
}
for _, key := range obj.dirtyStorage.SortedKeys() {
value := obj.dirtyStorage[key]
+11 -10
View File
@@ -3,8 +3,9 @@ package types
import (
"math/big"
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
@@ -183,38 +184,38 @@ func (tx *AccessListTx) SetSignatureValues(chainID, v, r, s *big.Int) {
func (tx AccessListTx) Validate() error {
gasPrice := tx.GetGasPrice()
if gasPrice == nil {
return sdkerrors.Wrap(ErrInvalidGasPrice, "cannot be nil")
return errorsmod.Wrap(ErrInvalidGasPrice, "cannot be nil")
}
if !types.IsValidInt256(gasPrice) {
return sdkerrors.Wrap(ErrInvalidGasPrice, "out of bound")
return errorsmod.Wrap(ErrInvalidGasPrice, "out of bound")
}
if gasPrice.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
return errorsmod.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
}
amount := tx.GetValue()
// Amount can be 0
if amount != nil && amount.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
}
if !types.IsValidInt256(amount) {
return sdkerrors.Wrap(ErrInvalidAmount, "out of bound")
return errorsmod.Wrap(ErrInvalidAmount, "out of bound")
}
if !types.IsValidInt256(tx.Fee()) {
return sdkerrors.Wrap(ErrInvalidGasFee, "out of bound")
return errorsmod.Wrap(ErrInvalidGasFee, "out of bound")
}
if tx.To != "" {
if err := types.ValidateAddress(tx.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
return errorsmod.Wrap(err, "invalid to address")
}
}
if tx.GetChainID() == nil {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidChainID,
return errorsmod.Wrap(
errortypes.ErrInvalidChainID,
"chain ID must be present on AccessList txs",
)
}
+31 -20
View File
@@ -6,8 +6,8 @@ import (
sdkmath "cosmossdk.io/math"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/params"
@@ -35,6 +35,8 @@ func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig {
ArrowGlacierBlock: getBlockValue(cc.ArrowGlacierBlock),
GrayGlacierBlock: getBlockValue(cc.GrayGlacierBlock),
MergeNetsplitBlock: getBlockValue(cc.MergeNetsplitBlock),
ShanghaiBlock: getBlockValue(cc.ShanghaiBlock),
CancunBlock: getBlockValue(cc.CancunBlock),
TerminalTotalDifficulty: nil,
Ethash: nil,
Clique: nil,
@@ -58,6 +60,8 @@ func DefaultChainConfig() ChainConfig {
arrowGlacierBlock := sdk.ZeroInt()
grayGlacierBlock := sdk.ZeroInt()
mergeNetsplitBlock := sdk.ZeroInt()
shanghaiBlock := sdk.ZeroInt()
cancunBlock := sdk.ZeroInt()
return ChainConfig{
HomesteadBlock: &homesteadBlock,
@@ -77,6 +81,8 @@ func DefaultChainConfig() ChainConfig {
ArrowGlacierBlock: &arrowGlacierBlock,
GrayGlacierBlock: &grayGlacierBlock,
MergeNetsplitBlock: &mergeNetsplitBlock,
ShanghaiBlock: &shanghaiBlock,
CancunBlock: &cancunBlock,
}
}
@@ -92,64 +98,69 @@ func getBlockValue(block *sdkmath.Int) *big.Int {
// if any of the block values is uninitialized (i.e nil) or if the EIP150Hash is an invalid hash.
func (cc ChainConfig) Validate() error {
if err := validateBlock(cc.HomesteadBlock); err != nil {
return sdkerrors.Wrap(err, "homesteadBlock")
return errorsmod.Wrap(err, "homesteadBlock")
}
if err := validateBlock(cc.DAOForkBlock); err != nil {
return sdkerrors.Wrap(err, "daoForkBlock")
return errorsmod.Wrap(err, "daoForkBlock")
}
if err := validateBlock(cc.EIP150Block); err != nil {
return sdkerrors.Wrap(err, "eip150Block")
return errorsmod.Wrap(err, "eip150Block")
}
if err := validateHash(cc.EIP150Hash); err != nil {
return err
}
if err := validateBlock(cc.EIP155Block); err != nil {
return sdkerrors.Wrap(err, "eip155Block")
return errorsmod.Wrap(err, "eip155Block")
}
if err := validateBlock(cc.EIP158Block); err != nil {
return sdkerrors.Wrap(err, "eip158Block")
return errorsmod.Wrap(err, "eip158Block")
}
if err := validateBlock(cc.ByzantiumBlock); err != nil {
return sdkerrors.Wrap(err, "byzantiumBlock")
return errorsmod.Wrap(err, "byzantiumBlock")
}
if err := validateBlock(cc.ConstantinopleBlock); err != nil {
return sdkerrors.Wrap(err, "constantinopleBlock")
return errorsmod.Wrap(err, "constantinopleBlock")
}
if err := validateBlock(cc.PetersburgBlock); err != nil {
return sdkerrors.Wrap(err, "petersburgBlock")
return errorsmod.Wrap(err, "petersburgBlock")
}
if err := validateBlock(cc.IstanbulBlock); err != nil {
return sdkerrors.Wrap(err, "istanbulBlock")
return errorsmod.Wrap(err, "istanbulBlock")
}
if err := validateBlock(cc.MuirGlacierBlock); err != nil {
return sdkerrors.Wrap(err, "muirGlacierBlock")
return errorsmod.Wrap(err, "muirGlacierBlock")
}
if err := validateBlock(cc.BerlinBlock); err != nil {
return sdkerrors.Wrap(err, "berlinBlock")
return errorsmod.Wrap(err, "berlinBlock")
}
if err := validateBlock(cc.LondonBlock); err != nil {
return sdkerrors.Wrap(err, "londonBlock")
return errorsmod.Wrap(err, "londonBlock")
}
if err := validateBlock(cc.ArrowGlacierBlock); err != nil {
return sdkerrors.Wrap(err, "arrowGlacierBlock")
return errorsmod.Wrap(err, "arrowGlacierBlock")
}
if err := validateBlock(cc.GrayGlacierBlock); err != nil {
return sdkerrors.Wrap(err, "GrayGlacierBlock")
return errorsmod.Wrap(err, "GrayGlacierBlock")
}
if err := validateBlock(cc.MergeNetsplitBlock); err != nil {
return sdkerrors.Wrap(err, "MergeNetsplitBlock")
return errorsmod.Wrap(err, "MergeNetsplitBlock")
}
if err := validateBlock(cc.ShanghaiBlock); err != nil {
return errorsmod.Wrap(err, "ShanghaiBlock")
}
if err := validateBlock(cc.CancunBlock); err != nil {
return errorsmod.Wrap(err, "CancunBlock")
}
// NOTE: chain ID is not needed to check config order
if err := cc.EthereumConfig(nil).CheckConfigForkOrder(); err != nil {
return sdkerrors.Wrap(err, "invalid config fork order")
return errorsmod.Wrap(err, "invalid config fork order")
}
return nil
}
func validateHash(hex string) error {
if hex != "" && strings.TrimSpace(hex) == "" {
return sdkerrors.Wrap(ErrInvalidChainConfig, "hash cannot be blank")
return errorsmod.Wrap(ErrInvalidChainConfig, "hash cannot be blank")
}
return nil
@@ -162,7 +173,7 @@ func validateBlock(block *sdkmath.Int) error {
}
if block.IsNegative() {
return sdkerrors.Wrapf(
return errorsmod.Wrapf(
ErrInvalidChainConfig, "block value cannot be negative: %s", block,
)
}
+51
View File
@@ -39,6 +39,8 @@ func TestChainConfigValidate(t *testing.T) {
MuirGlacierBlock: newIntPtr(0),
BerlinBlock: newIntPtr(0),
LondonBlock: newIntPtr(0),
CancunBlock: newIntPtr(0),
ShanghaiBlock: newIntPtr(0),
},
false,
},
@@ -58,6 +60,8 @@ func TestChainConfigValidate(t *testing.T) {
MuirGlacierBlock: nil,
BerlinBlock: nil,
LondonBlock: nil,
CancunBlock: nil,
ShanghaiBlock: nil,
},
false,
},
@@ -316,6 +320,53 @@ func TestChainConfigValidate(t *testing.T) {
},
true,
},
{
"invalid ShanghaiBlock",
ChainConfig{
HomesteadBlock: newIntPtr(0),
DAOForkBlock: newIntPtr(0),
EIP150Block: newIntPtr(0),
EIP150Hash: defaultEIP150Hash,
EIP155Block: newIntPtr(0),
EIP158Block: newIntPtr(0),
ByzantiumBlock: newIntPtr(0),
ConstantinopleBlock: newIntPtr(0),
PetersburgBlock: newIntPtr(0),
IstanbulBlock: newIntPtr(0),
MuirGlacierBlock: newIntPtr(0),
BerlinBlock: newIntPtr(0),
LondonBlock: newIntPtr(0),
ArrowGlacierBlock: newIntPtr(0),
GrayGlacierBlock: newIntPtr(0),
MergeNetsplitBlock: newIntPtr(0),
ShanghaiBlock: newIntPtr(-1),
},
true,
},
{
"invalid CancunBlock",
ChainConfig{
HomesteadBlock: newIntPtr(0),
DAOForkBlock: newIntPtr(0),
EIP150Block: newIntPtr(0),
EIP150Hash: defaultEIP150Hash,
EIP155Block: newIntPtr(0),
EIP158Block: newIntPtr(0),
ByzantiumBlock: newIntPtr(0),
ConstantinopleBlock: newIntPtr(0),
PetersburgBlock: newIntPtr(0),
IstanbulBlock: newIntPtr(0),
MuirGlacierBlock: newIntPtr(0),
BerlinBlock: newIntPtr(0),
LondonBlock: newIntPtr(0),
ArrowGlacierBlock: newIntPtr(0),
GrayGlacierBlock: newIntPtr(0),
MergeNetsplitBlock: newIntPtr(0),
ShanghaiBlock: newIntPtr(0),
CancunBlock: newIntPtr(-1),
},
true,
},
}
for _, tc := range testCases {
+6 -5
View File
@@ -1,10 +1,11 @@
package types
import (
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/msgservice"
"github.com/cosmos/cosmos-sdk/types/tx"
proto "github.com/gogo/protobuf/proto"
@@ -39,12 +40,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
func PackTxData(txData TxData) (*codectypes.Any, error) {
msg, ok := txData.(proto.Message)
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", txData)
return nil, errorsmod.Wrapf(errortypes.ErrPackAny, "cannot proto marshal %T", txData)
}
anyTxData, err := codectypes.NewAnyWithValue(msg)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error())
return nil, errorsmod.Wrap(errortypes.ErrPackAny, err.Error())
}
return anyTxData, nil
@@ -54,12 +55,12 @@ func PackTxData(txData TxData) (*codectypes.Any, error) {
// client state can't be unpacked into a TxData.
func UnpackTxData(any *codectypes.Any) (TxData, error) {
if any == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnpackAny, "protobuf Any message cannot be nil")
return nil, errorsmod.Wrap(errortypes.ErrUnpackAny, "protobuf Any message cannot be nil")
}
txData, ok := any.GetCachedValue().(TxData)
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnpackAny, "cannot unpack Any into TxData %T", any)
return nil, errorsmod.Wrapf(errortypes.ErrUnpackAny, "cannot unpack Any into TxData %T", any)
}
return txData, nil
+15 -14
View File
@@ -3,8 +3,9 @@ package types
import (
"math/big"
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
@@ -195,58 +196,58 @@ func (tx *DynamicFeeTx) SetSignatureValues(chainID, v, r, s *big.Int) {
// Validate performs a stateless validation of the tx fields.
func (tx DynamicFeeTx) Validate() error {
if tx.GasTipCap == nil {
return sdkerrors.Wrap(ErrInvalidGasCap, "gas tip cap cannot nil")
return errorsmod.Wrap(ErrInvalidGasCap, "gas tip cap cannot nil")
}
if tx.GasFeeCap == nil {
return sdkerrors.Wrap(ErrInvalidGasCap, "gas fee cap cannot nil")
return errorsmod.Wrap(ErrInvalidGasCap, "gas fee cap cannot nil")
}
if tx.GasTipCap.IsNegative() {
return sdkerrors.Wrapf(ErrInvalidGasCap, "gas tip cap cannot be negative %s", tx.GasTipCap)
return errorsmod.Wrapf(ErrInvalidGasCap, "gas tip cap cannot be negative %s", tx.GasTipCap)
}
if tx.GasFeeCap.IsNegative() {
return sdkerrors.Wrapf(ErrInvalidGasCap, "gas fee cap cannot be negative %s", tx.GasFeeCap)
return errorsmod.Wrapf(ErrInvalidGasCap, "gas fee cap cannot be negative %s", tx.GasFeeCap)
}
if !types.IsValidInt256(tx.GetGasTipCap()) {
return sdkerrors.Wrap(ErrInvalidGasCap, "out of bound")
return errorsmod.Wrap(ErrInvalidGasCap, "out of bound")
}
if !types.IsValidInt256(tx.GetGasFeeCap()) {
return sdkerrors.Wrap(ErrInvalidGasCap, "out of bound")
return errorsmod.Wrap(ErrInvalidGasCap, "out of bound")
}
if tx.GasFeeCap.LT(*tx.GasTipCap) {
return sdkerrors.Wrapf(
return errorsmod.Wrapf(
ErrInvalidGasCap, "max priority fee per gas higher than max fee per gas (%s > %s)",
tx.GasTipCap, tx.GasFeeCap,
)
}
if !types.IsValidInt256(tx.Fee()) {
return sdkerrors.Wrap(ErrInvalidGasFee, "out of bound")
return errorsmod.Wrap(ErrInvalidGasFee, "out of bound")
}
amount := tx.GetValue()
// Amount can be 0
if amount != nil && amount.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
}
if !types.IsValidInt256(amount) {
return sdkerrors.Wrap(ErrInvalidAmount, "out of bound")
return errorsmod.Wrap(ErrInvalidAmount, "out of bound")
}
if tx.To != "" {
if err := types.ValidateAddress(tx.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
return errorsmod.Wrap(err, "invalid to address")
}
}
if tx.GetChainID() == nil {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidChainID,
return errorsmod.Wrap(
errortypes.ErrInvalidChainID,
"chain ID must be present on AccessList txs",
)
}
+22 -22
View File
@@ -4,7 +4,7 @@ import (
"errors"
"fmt"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errorsmod "cosmossdk.io/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/accounts/abi"
@@ -40,67 +40,67 @@ var ErrPostTxProcessing = errors.New("failed to execute post processing")
var (
// ErrInvalidState returns an error resulting from an invalid Storage State.
ErrInvalidState = sdkerrors.Register(ModuleName, codeErrInvalidState, "invalid storage state")
ErrInvalidState = errorsmod.Register(ModuleName, codeErrInvalidState, "invalid storage state")
// ErrExecutionReverted returns an error resulting from an error in EVM execution.
ErrExecutionReverted = sdkerrors.Register(ModuleName, codeErrExecutionReverted, vm.ErrExecutionReverted.Error())
ErrExecutionReverted = errorsmod.Register(ModuleName, codeErrExecutionReverted, vm.ErrExecutionReverted.Error())
// ErrChainConfigNotFound returns an error if the chain config cannot be found on the store.
ErrChainConfigNotFound = sdkerrors.Register(ModuleName, codeErrChainConfigNotFound, "chain configuration not found")
ErrChainConfigNotFound = errorsmod.Register(ModuleName, codeErrChainConfigNotFound, "chain configuration not found")
// ErrInvalidChainConfig returns an error resulting from an invalid ChainConfig.
ErrInvalidChainConfig = sdkerrors.Register(ModuleName, codeErrInvalidChainConfig, "invalid chain configuration")
ErrInvalidChainConfig = errorsmod.Register(ModuleName, codeErrInvalidChainConfig, "invalid chain configuration")
// ErrZeroAddress returns an error resulting from an zero (empty) ethereum Address.
ErrZeroAddress = sdkerrors.Register(ModuleName, codeErrZeroAddress, "invalid zero address")
ErrZeroAddress = errorsmod.Register(ModuleName, codeErrZeroAddress, "invalid zero address")
// ErrEmptyHash returns an error resulting from an empty ethereum Hash.
ErrEmptyHash = sdkerrors.Register(ModuleName, codeErrEmptyHash, "empty hash")
ErrEmptyHash = errorsmod.Register(ModuleName, codeErrEmptyHash, "empty hash")
// ErrBloomNotFound returns an error if the block bloom cannot be found on the store.
ErrBloomNotFound = sdkerrors.Register(ModuleName, codeErrBloomNotFound, "block bloom not found")
ErrBloomNotFound = errorsmod.Register(ModuleName, codeErrBloomNotFound, "block bloom not found")
// ErrTxReceiptNotFound returns an error if the transaction receipt could not be found
ErrTxReceiptNotFound = sdkerrors.Register(ModuleName, codeErrTxReceiptNotFound, "transaction receipt not found")
ErrTxReceiptNotFound = errorsmod.Register(ModuleName, codeErrTxReceiptNotFound, "transaction receipt not found")
// ErrCreateDisabled returns an error if the EnableCreate parameter is false.
ErrCreateDisabled = sdkerrors.Register(ModuleName, codeErrCreateDisabled, "EVM Create operation is disabled")
ErrCreateDisabled = errorsmod.Register(ModuleName, codeErrCreateDisabled, "EVM Create operation is disabled")
// ErrCallDisabled returns an error if the EnableCall parameter is false.
ErrCallDisabled = sdkerrors.Register(ModuleName, codeErrCallDisabled, "EVM Call operation is disabled")
ErrCallDisabled = errorsmod.Register(ModuleName, codeErrCallDisabled, "EVM Call operation is disabled")
// ErrInvalidAmount returns an error if a tx contains an invalid amount.
ErrInvalidAmount = sdkerrors.Register(ModuleName, codeErrInvalidAmount, "invalid transaction amount")
ErrInvalidAmount = errorsmod.Register(ModuleName, codeErrInvalidAmount, "invalid transaction amount")
// ErrInvalidGasPrice returns an error if an invalid gas price is provided to the tx.
ErrInvalidGasPrice = sdkerrors.Register(ModuleName, codeErrInvalidGasPrice, "invalid gas price")
ErrInvalidGasPrice = errorsmod.Register(ModuleName, codeErrInvalidGasPrice, "invalid gas price")
// ErrInvalidGasFee returns an error if the tx gas fee is out of bound.
ErrInvalidGasFee = sdkerrors.Register(ModuleName, codeErrInvalidGasFee, "invalid gas fee")
ErrInvalidGasFee = errorsmod.Register(ModuleName, codeErrInvalidGasFee, "invalid gas fee")
// ErrVMExecution returns an error resulting from an error in EVM execution.
ErrVMExecution = sdkerrors.Register(ModuleName, codeErrVMExecution, "evm transaction execution failed")
ErrVMExecution = errorsmod.Register(ModuleName, codeErrVMExecution, "evm transaction execution failed")
// ErrInvalidRefund returns an error if a the gas refund value is invalid.
ErrInvalidRefund = sdkerrors.Register(ModuleName, codeErrInvalidRefund, "invalid gas refund amount")
ErrInvalidRefund = errorsmod.Register(ModuleName, codeErrInvalidRefund, "invalid gas refund amount")
// ErrInconsistentGas returns an error if a the gas differs from the expected one.
ErrInconsistentGas = sdkerrors.Register(ModuleName, codeErrInconsistentGas, "inconsistent gas")
ErrInconsistentGas = errorsmod.Register(ModuleName, codeErrInconsistentGas, "inconsistent gas")
// ErrInvalidGasCap returns an error if a the gas cap value is negative or invalid
ErrInvalidGasCap = sdkerrors.Register(ModuleName, codeErrInvalidGasCap, "invalid gas cap")
ErrInvalidGasCap = errorsmod.Register(ModuleName, codeErrInvalidGasCap, "invalid gas cap")
// ErrInvalidBaseFee returns an error if a the base fee cap value is invalid
ErrInvalidBaseFee = sdkerrors.Register(ModuleName, codeErrInvalidBaseFee, "invalid base fee")
ErrInvalidBaseFee = errorsmod.Register(ModuleName, codeErrInvalidBaseFee, "invalid base fee")
// ErrGasOverflow returns an error if gas computation overlow/underflow
ErrGasOverflow = sdkerrors.Register(ModuleName, codeErrGasOverflow, "gas computation overflow/underflow")
ErrGasOverflow = errorsmod.Register(ModuleName, codeErrGasOverflow, "gas computation overflow/underflow")
// ErrInvalidAccount returns an error if the account is not an EVM compatible account
ErrInvalidAccount = sdkerrors.Register(ModuleName, codeErrInvalidAccount, "account type is not a valid ethereum account")
ErrInvalidAccount = errorsmod.Register(ModuleName, codeErrInvalidAccount, "account type is not a valid ethereum account")
// ErrInvalidGasLimit returns an error if gas limit value is invalid
ErrInvalidGasLimit = sdkerrors.Register(ModuleName, codeErrInvalidGasLimit, "invalid gas limit")
ErrInvalidGasLimit = errorsmod.Register(ModuleName, codeErrInvalidGasLimit, "invalid gas limit")
)
// NewExecErrorWithReason unpacks the revert return bytes and returns a wrapped error
+345 -41
View File
@@ -6,7 +6,7 @@ package types
import (
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
@@ -26,18 +26,22 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the EVM module parameters
type Params struct {
// evm denom represents the token denomination used to run the EVM state
// evm_denom represents the token denomination used to run the EVM state
// transitions.
EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty" yaml:"evm_denom"`
// enable create toggles state transitions that use the vm.Create function
// enable_create toggles state transitions that use the vm.Create function
EnableCreate bool `protobuf:"varint,2,opt,name=enable_create,json=enableCreate,proto3" json:"enable_create,omitempty" yaml:"enable_create"`
// enable call toggles state transitions that use the vm.Call function
// enable_call toggles state transitions that use the vm.Call function
EnableCall bool `protobuf:"varint,3,opt,name=enable_call,json=enableCall,proto3" json:"enable_call,omitempty" yaml:"enable_call"`
// extra eips defines the additional EIPs for the vm.Config
// extra_eips defines the additional EIPs for the vm.Config
ExtraEIPs []int64 `protobuf:"varint,4,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"`
// chain config defines the EVM chain configuration parameters
// chain_config defines the EVM chain configuration parameters
ChainConfig ChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config" yaml:"chain_config"`
<<<<<<< HEAD
// Allow unprotected transactions defines if replay-protected (i.e non EIP155
=======
// allow_unprotected_txs defines if replay-protected (i.e non EIP155
>>>>>>> v0.20.0
// signed) transactions can be executed on the state machine.
AllowUnprotectedTxs bool `protobuf:"varint,6,opt,name=allow_unprotected_txs,json=allowUnprotectedTxs,proto3" json:"allow_unprotected_txs,omitempty"`
}
@@ -120,41 +124,52 @@ func (m *Params) GetAllowUnprotectedTxs() bool {
// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values
// instead of *big.Int.
type ChainConfig struct {
// Homestead switch block (nil no fork, 0 = already homestead)
// homestead_block switch (nil no fork, 0 = already homestead)
HomesteadBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=homestead_block,json=homesteadBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"homestead_block,omitempty" yaml:"homestead_block"`
// TheDAO hard-fork switch block (nil no fork)
// dao_fork_block corresponds to TheDAO hard-fork switch block (nil no fork)
DAOForkBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=dao_fork_block,json=daoForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"dao_fork_block,omitempty" yaml:"dao_fork_block"`
// Whether the nodes supports or opposes the DAO hard-fork
// dao_fork_support defines whether the nodes supports or opposes the DAO hard-fork
DAOForkSupport bool `protobuf:"varint,3,opt,name=dao_fork_support,json=daoForkSupport,proto3" json:"dao_fork_support,omitempty" yaml:"dao_fork_support"`
// EIP150 implements the Gas price changes
// eip150_block: EIP150 implements the Gas price changes
// (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork)
EIP150Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=eip150_block,json=eip150Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip150_block,omitempty" yaml:"eip150_block"`
// EIP150 HF hash (needed for header only clients as only gas pricing changed)
// eip150_hash: EIP150 HF hash (needed for header only clients as only gas pricing changed)
EIP150Hash string `protobuf:"bytes,5,opt,name=eip150_hash,json=eip150Hash,proto3" json:"eip150_hash,omitempty" yaml:"byzantium_block"`
// EIP155Block HF block
// eip155_block: EIP155Block HF block
EIP155Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=eip155_block,json=eip155Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip155_block,omitempty" yaml:"eip155_block"`
// EIP158 HF block
// eip158_block: EIP158 HF block
EIP158Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=eip158_block,json=eip158Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip158_block,omitempty" yaml:"eip158_block"`
// Byzantium switch block (nil no fork, 0 = already on byzantium)
// byzantium_block: Byzantium switch block (nil no fork, 0 = already on byzantium)
ByzantiumBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=byzantium_block,json=byzantiumBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"byzantium_block,omitempty" yaml:"byzantium_block"`
// Constantinople switch block (nil no fork, 0 = already activated)
// constantinople_block: Constantinople switch block (nil no fork, 0 = already activated)
ConstantinopleBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=constantinople_block,json=constantinopleBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"constantinople_block,omitempty" yaml:"constantinople_block"`
// Petersburg switch block (nil same as Constantinople)
// petersburg_block: Petersburg switch block (nil same as Constantinople)
PetersburgBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=petersburg_block,json=petersburgBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"petersburg_block,omitempty" yaml:"petersburg_block"`
// Istanbul switch block (nil no fork, 0 = already on istanbul)
// istanbul_block: Istanbul switch block (nil no fork, 0 = already on istanbul)
IstanbulBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=istanbul_block,json=istanbulBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"istanbul_block,omitempty" yaml:"istanbul_block"`
// Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated)
// muir_glacier_block: Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated)
MuirGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=muir_glacier_block,json=muirGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"muir_glacier_block,omitempty" yaml:"muir_glacier_block"`
// Berlin switch block (nil = no fork, 0 = already on berlin)
// berlin_block: Berlin switch block (nil = no fork, 0 = already on berlin)
BerlinBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,13,opt,name=berlin_block,json=berlinBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"berlin_block,omitempty" yaml:"berlin_block"`
// London switch block (nil = no fork, 0 = already on london)
// london_block: London switch block (nil = no fork, 0 = already on london)
LondonBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,17,opt,name=london_block,json=londonBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"london_block,omitempty" yaml:"london_block"`
// Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
// arrow_glacier_block: Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
ArrowGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,18,opt,name=arrow_glacier_block,json=arrowGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"arrow_glacier_block,omitempty" yaml:"arrow_glacier_block"`
<<<<<<< HEAD
// EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated)
GrayGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,20,opt,name=gray_glacier_block,json=grayGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gray_glacier_block,omitempty" yaml:"gray_glacier_block"`
// Virtual fork after The Merge to use as a network splitter
MergeNetsplitBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,21,opt,name=merge_netsplit_block,json=mergeNetsplitBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"merge_netsplit_block,omitempty" yaml:"merge_netsplit_block"`
=======
// gray_glacier_block: EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated)
GrayGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,20,opt,name=gray_glacier_block,json=grayGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gray_glacier_block,omitempty" yaml:"gray_glacier_block"`
// merge_netsplit_block: Virtual fork after The Merge to use as a network splitter
MergeNetsplitBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,21,opt,name=merge_netsplit_block,json=mergeNetsplitBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"merge_netsplit_block,omitempty" yaml:"merge_netsplit_block"`
// Shanghai switch block (nil = no fork, 0 = already on shanghai)
ShanghaiBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,22,opt,name=shanghai_block,json=shanghaiBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shanghai_block,omitempty" yaml:"shanghai_block"`
// Cancun switch block (nil = no fork, 0 = already on cancun)
CancunBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,23,opt,name=cancun_block,json=cancunBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"cancun_block,omitempty" yaml:"cancun_block"`
>>>>>>> v0.20.0
}
func (m *ChainConfig) Reset() { *m = ChainConfig{} }
@@ -206,7 +221,9 @@ func (m *ChainConfig) GetEIP150Hash() string {
// State represents a single Storage key value pair item.
type State struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// key is the stored key
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// value is the stored value for the given key
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
@@ -261,7 +278,9 @@ func (m *State) GetValue() string {
// with a given hash. It it used for import/export data as transactions are not
// persisted on blockchain state after an upgrade.
type TransactionLogs struct {
// hash of the transaction
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
// logs is an array of Logs for the given transaction hash
Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"`
}
@@ -315,24 +334,27 @@ func (m *TransactionLogs) GetLogs() []*Log {
// Log represents an protobuf compatible Ethereum Log that defines a contract
// log event. These events are generated by the LOG opcode and stored/indexed by
// the node.
//
// NOTE: address, topics and data are consensus fields. The rest of the fields
// are derived, i.e. filled in by the nodes, but not secured by consensus.
type Log struct {
// address of the contract that generated the event
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
// list of topics provided by the contract.
// topics is a list of topics provided by the contract.
Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"`
// supplied by the contract, usually ABI-encoded
// data which is supplied by the contract, usually ABI-encoded
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
// block in which the transaction was included
// block_number of the block in which the transaction was included
BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"`
// hash of the transaction
// tx_hash is the transaction hash
TxHash string `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"transactionHash"`
// index of the transaction in the block
// tx_index of the transaction in the block
TxIndex uint64 `protobuf:"varint,6,opt,name=tx_index,json=txIndex,proto3" json:"transactionIndex"`
// hash of the block in which the transaction was included
// block_hash of the block in which the transaction was included
BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"`
// index of the log in the block
Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"logIndex"`
// The Removed field is true if this log was reverted due to a chain
// removed is true if this log was reverted due to a chain
// reorganisation. You must pay attention to this field if you receive logs
// through a filter query.
Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"`
@@ -488,9 +510,9 @@ var xxx_messageInfo_TxResult proto.InternalMessageInfo
// AccessTuple is the element type of an access list.
type AccessTuple struct {
// hex formatted ethereum address
// address is a hex formatted ethereum address
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
// hex formatted hashes of the storage keys
// storage_keys are hex formatted hashes of the storage keys
StorageKeys []string `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storageKeys"`
}
@@ -529,27 +551,29 @@ var xxx_messageInfo_AccessTuple proto.InternalMessageInfo
// TraceConfig holds extra parameters to trace functions.
type TraceConfig struct {
// custom javascript tracer
// tracer is a custom javascript tracer
Tracer string `protobuf:"bytes,1,opt,name=tracer,proto3" json:"tracer,omitempty"`
// overrides the default timeout of 5 seconds for JavaScript-based tracing
// timeout overrides the default timeout of 5 seconds for JavaScript-based tracing
// calls
Timeout string `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
// number of blocks the tracer is willing to go back
// reexec defines the number of blocks the tracer is willing to go back
Reexec uint64 `protobuf:"varint,3,opt,name=reexec,proto3" json:"reexec,omitempty"`
// disable stack capture
// disable_stack switches stack capture
DisableStack bool `protobuf:"varint,5,opt,name=disable_stack,json=disableStack,proto3" json:"disableStack"`
// disable storage capture
// disable_storage switches storage capture
DisableStorage bool `protobuf:"varint,6,opt,name=disable_storage,json=disableStorage,proto3" json:"disableStorage"`
// print output during capture end
// debug can be used to print output during capture end
Debug bool `protobuf:"varint,8,opt,name=debug,proto3" json:"debug,omitempty"`
// maximum length of output, but zero means unlimited
// limit defines the maximum length of output, but zero means unlimited
Limit int32 `protobuf:"varint,9,opt,name=limit,proto3" json:"limit,omitempty"`
// Chain overrides, can be used to execute a trace using future fork rules
// overrides can be used to execute a trace using future fork rules
Overrides *ChainConfig `protobuf:"bytes,10,opt,name=overrides,proto3" json:"overrides,omitempty"`
// enable memory capture
// enable_memory switches memory capture
EnableMemory bool `protobuf:"varint,11,opt,name=enable_memory,json=enableMemory,proto3" json:"enableMemory"`
// enable return data capture
// enable_return_data switches the capture of return data
EnableReturnData bool `protobuf:"varint,12,opt,name=enable_return_data,json=enableReturnData,proto3" json:"enableReturnData"`
// tracer_json_config configures the tracer using a JSON string
TracerJsonConfig string `protobuf:"bytes,13,opt,name=tracer_json_config,json=tracerJsonConfig,proto3" json:"tracerConfig"`
}
func (m *TraceConfig) Reset() { *m = TraceConfig{} }
@@ -655,6 +679,13 @@ func (m *TraceConfig) GetEnableReturnData() bool {
return false
}
func (m *TraceConfig) GetTracerJsonConfig() string {
if m != nil {
return m.TracerJsonConfig
}
return ""
}
func init() {
proto.RegisterType((*Params)(nil), "ethermint.evm.v1.Params")
proto.RegisterType((*ChainConfig)(nil), "ethermint.evm.v1.ChainConfig")
@@ -669,6 +700,7 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) }
var fileDescriptor_d21ecc92c8c8583e = []byte{
<<<<<<< HEAD
// 1543 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4d, 0x4f, 0xdc, 0xc6,
0x1b, 0x07, 0x76, 0x01, 0xef, 0xec, 0xb2, 0x6b, 0x86, 0x85, 0xff, 0x86, 0xe8, 0x8f, 0xa9, 0x0f,
@@ -767,6 +799,110 @@ var fileDescriptor_d21ecc92c8c8583e = []byte{
0xe7, 0x9e, 0x30, 0xf7, 0x7e, 0x40, 0xeb, 0x21, 0x76, 0x69, 0x1c, 0xb8, 0x5e, 0xbd, 0x23, 0x7f,
0x78, 0xe5, 0x37, 0xbf, 0x39, 0x27, 0x7f, 0x64, 0x1f, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x33,
0x1c, 0x76, 0xa8, 0x0e, 0x0f, 0x00, 0x00,
=======
// 1608 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xdd, 0x6e, 0xe3, 0xc6,
0x15, 0xb6, 0x2d, 0xda, 0xa6, 0x46, 0xb2, 0x44, 0x8f, 0xb5, 0x8e, 0xb2, 0x8b, 0x9a, 0x2e, 0x2f,
0x0a, 0x17, 0x48, 0xec, 0xd8, 0x81, 0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 0x96, 0x1f, 0x8b, 0xba, 0xb5, 0x50, 0xfa, 0xda, 0x6b, 0xd6, 0xec, 0x68, 0x74, 0xc9,
0xa9, 0xd9, 0xc5, 0xa5, 0x65, 0x5b, 0xce, 0xfa, 0xa5, 0x65, 0x6f, 0x3a, 0x76, 0x99, 0x3f, 0xb3,
0x0b, 0xb4, 0x33, 0xc1, 0x33, 0xcb, 0xeb, 0xfc, 0xf2, 0x87, 0xbb, 0xbd, 0xd5, 0x77, 0x77, 0x7b,
0xab, 0xff, 0xbe, 0xdb, 0x5b, 0xfd, 0xdb, 0xfb, 0xbd, 0x95, 0x77, 0xef, 0xf7, 0x56, 0xfe, 0xf9,
0x7e, 0x6f, 0xe5, 0x77, 0xb3, 0xef, 0x03, 0x19, 0xc8, 0xe7, 0x61, 0xfa, 0xfd, 0x3f, 0x54, 0xff,
0x01, 0x50, 0x6f, 0x44, 0x77, 0x43, 0x7d, 0xd9, 0x7f, 0xfa, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff,
0xe2, 0xe1, 0x18, 0x7a, 0x1f, 0x10, 0x00, 0x00,
>>>>>>> v0.20.0
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -878,6 +1014,44 @@ func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
<<<<<<< HEAD
if m.MergeNetsplitBlock != nil {
{
size := m.MergeNetsplitBlock.Size()
i -= size
if _, err := m.MergeNetsplitBlock.MarshalTo(dAtA[i:]); err != nil {
=======
if m.CancunBlock != nil {
{
size := m.CancunBlock.Size()
i -= size
if _, err := m.CancunBlock.MarshalTo(dAtA[i:]); err != nil {
>>>>>>> v0.20.0
return 0, err
}
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1
i--
<<<<<<< HEAD
=======
dAtA[i] = 0xba
}
if m.ShanghaiBlock != nil {
{
size := m.ShanghaiBlock.Size()
i -= size
if _, err := m.ShanghaiBlock.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0xb2
}
if m.MergeNetsplitBlock != nil {
{
size := m.MergeNetsplitBlock.Size()
@@ -890,6 +1064,7 @@ func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x1
i--
>>>>>>> v0.20.0
dAtA[i] = 0xaa
}
if m.GrayGlacierBlock != nil {
@@ -1380,6 +1555,13 @@ func (m *TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.TracerJsonConfig) > 0 {
i -= len(m.TracerJsonConfig)
copy(dAtA[i:], m.TracerJsonConfig)
i = encodeVarintEvm(dAtA, i, uint64(len(m.TracerJsonConfig)))
i--
dAtA[i] = 0x6a
}
if m.EnableReturnData {
i--
if m.EnableReturnData {
@@ -1582,6 +1764,17 @@ func (m *ChainConfig) Size() (n int) {
}
if m.MergeNetsplitBlock != nil {
l = m.MergeNetsplitBlock.Size()
<<<<<<< HEAD
=======
n += 2 + l + sovEvm(uint64(l))
}
if m.ShanghaiBlock != nil {
l = m.ShanghaiBlock.Size()
n += 2 + l + sovEvm(uint64(l))
}
if m.CancunBlock != nil {
l = m.CancunBlock.Size()
>>>>>>> v0.20.0
n += 2 + l + sovEvm(uint64(l))
}
return n
@@ -1753,6 +1946,10 @@ func (m *TraceConfig) Size() (n int) {
if m.EnableReturnData {
n += 2
}
l = len(m.TracerJsonConfig)
if l > 0 {
n += 1 + l + sovEvm(uint64(l))
}
return n
}
@@ -2631,6 +2828,81 @@ func (m *ChainConfig) Unmarshal(dAtA []byte) error {
var v github_com_cosmos_cosmos_sdk_types.Int
m.MergeNetsplitBlock = &v
if err := m.MergeNetsplitBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
<<<<<<< HEAD
=======
return err
}
iNdEx = postIndex
case 22:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ShanghaiBlock", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var v github_com_cosmos_cosmos_sdk_types.Int
m.ShanghaiBlock = &v
if err := m.ShanghaiBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 23:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CancunBlock", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var v github_com_cosmos_cosmos_sdk_types.Int
m.CancunBlock = &v
if err := m.CancunBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
>>>>>>> v0.20.0
return err
}
iNdEx = postIndex
@@ -3777,6 +4049,38 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error {
}
}
m.EnableReturnData = bool(v != 0)
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TracerJsonConfig", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TracerJsonConfig = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvm(dAtA[iNdEx:])
+24 -1
View File
@@ -5,7 +5,7 @@ package types
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
@@ -152,6 +152,7 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/genesis.proto", fileDescriptor_9bcdec50cc9d156d) }
var fileDescriptor_9bcdec50cc9d156d = []byte{
<<<<<<< HEAD
// 308 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xb1, 0x4e, 0xf3, 0x30,
0x14, 0x85, 0xe3, 0xbf, 0x55, 0xfb, 0xd7, 0x45, 0x80, 0x2c, 0x24, 0xa2, 0x0e, 0x6e, 0xd5, 0x85,
@@ -173,6 +174,28 @@ var fileDescriptor_9bcdec50cc9d156d = []byte{
0xb4, 0xbc, 0x4e, 0x14, 0x7f, 0x14, 0x52, 0x65, 0x89, 0x8c, 0xf8, 0x93, 0xbb, 0xad, 0x7d, 0x5e,
0x83, 0x59, 0x76, 0xdc, 0x6d, 0x6f, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x50, 0xbd, 0xc3, 0x62,
0xc1, 0x01, 0x00, 0x00,
=======
// 297 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbf, 0x4e, 0x83, 0x40,
0x1c, 0xe6, 0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, 0x50, 0x44, 0xa0, 0x2b, 0xc6, 0x81,
0xc6, 0xc4, 0xc7, 0xa6, 0x54, 0xa2, 0xe0, 0x31, 0x58, 0x03, 0x7d, 0xfb, 0x65, 0xbf, 0x59, 0x3f,
0xd3, 0x3f, 0x6b, 0x8a, 0xdf, 0xbf, 0xa6, 0xe6, 0xb2, 0xd5, 0x07, 0x7b, 0xa3, 0x7f, 0xbb, 0xad,
0x28, 0xda, 0x55, 0x14, 0x7d, 0x57, 0x14, 0xbd, 0xd5, 0xd4, 0xd8, 0xd5, 0xd4, 0xf8, 0xa8, 0xa9,
0xf1, 0x78, 0x15, 0x27, 0x6a, 0xbd, 0x59, 0xb1, 0x50, 0xa4, 0xcd, 0xae, 0x42, 0x7a, 0xbf, 0x73,
0x3f, 0xe9, 0xc1, 0xd5, 0x73, 0x0e, 0x72, 0x35, 0xd2, 0xd3, 0x5e, 0xff, 0x04, 0x00, 0x00, 0xff,
0xff, 0xe3, 0x61, 0xf0, 0x9f, 0xc0, 0x01, 0x00, 0x00,
>>>>>>> v0.20.0
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
+8 -8
View File
@@ -3,8 +3,8 @@ package types
import (
"math/big"
errorsmod "cosmossdk.io/errors"
"github.com/cerc-io/laconicd/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
)
@@ -160,31 +160,31 @@ func (tx *LegacyTx) SetSignatureValues(_, v, r, s *big.Int) {
func (tx LegacyTx) Validate() error {
gasPrice := tx.GetGasPrice()
if gasPrice == nil {
return sdkerrors.Wrap(ErrInvalidGasPrice, "gas price cannot be nil")
return errorsmod.Wrap(ErrInvalidGasPrice, "gas price cannot be nil")
}
if gasPrice.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
return errorsmod.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
}
if !types.IsValidInt256(gasPrice) {
return sdkerrors.Wrap(ErrInvalidGasPrice, "out of bound")
return errorsmod.Wrap(ErrInvalidGasPrice, "out of bound")
}
if !types.IsValidInt256(tx.Fee()) {
return sdkerrors.Wrap(ErrInvalidGasFee, "out of bound")
return errorsmod.Wrap(ErrInvalidGasFee, "out of bound")
}
amount := tx.GetValue()
// Amount can be 0
if amount != nil && amount.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
}
if !types.IsValidInt256(amount) {
return sdkerrors.Wrap(ErrInvalidAmount, "out of bound")
return errorsmod.Wrap(ErrInvalidAmount, "out of bound")
}
if tx.To != "" {
if err := types.ValidateAddress(tx.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
return errorsmod.Wrap(err, "invalid to address")
}
}
+7 -6
View File
@@ -7,11 +7,12 @@ import (
sdkmath "cosmossdk.io/math"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
@@ -165,23 +166,23 @@ func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx }
func (msg MsgEthereumTx) ValidateBasic() error {
if msg.From != "" {
if err := types.ValidateAddress(msg.From); err != nil {
return sdkerrors.Wrap(err, "invalid from address")
return errorsmod.Wrap(err, "invalid from address")
}
}
// Validate Size_ field, should be kept empty
if msg.Size_ != 0 {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "tx size is deprecated")
return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "tx size is deprecated")
}
txData, err := UnpackTxData(msg.Data)
if err != nil {
return sdkerrors.Wrap(err, "failed to unpack tx data")
return errorsmod.Wrap(err, "failed to unpack tx data")
}
// prevent txs with 0 gas to fill up the mempool
if txData.GetGas() == 0 {
return sdkerrors.Wrap(ErrInvalidGasLimit, "gas limit must not be zero")
return errorsmod.Wrap(ErrInvalidGasLimit, "gas limit must not be zero")
}
if err := txData.Validate(); err != nil {
@@ -191,7 +192,7 @@ func (msg MsgEthereumTx) ValidateBasic() error {
// Validate Hash field after validated txData to avoid panic
txHash := msg.AsTransaction().Hash().Hex()
if msg.Hash != txHash {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid tx hash %s, expected: %s", msg.Hash, txHash)
return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "invalid tx hash %s, expected: %s", msg.Hash, txHash)
}
return nil
+396 -21
View File
@@ -8,15 +8,15 @@ import (
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io"
math "math"
math_bits "math/bits"
@@ -78,7 +78,7 @@ var xxx_messageInfo_QueryAccountRequest proto.InternalMessageInfo
type QueryAccountResponse struct {
// balance is the balance of the EVM denomination.
Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
// code hash is the hex-formatted code bytes from the EOA.
// code_hash is the hex-formatted code bytes from the EOA.
CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"`
// nonce is the account's sequence number.
Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
@@ -185,7 +185,7 @@ type QueryCosmosAccountResponse struct {
CosmosAddress string `protobuf:"bytes,1,opt,name=cosmos_address,json=cosmosAddress,proto3" json:"cosmos_address,omitempty"`
// sequence is the account's sequence number.
Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"`
// account_number is the account numbert
// account_number is the account number
AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"`
}
@@ -435,7 +435,7 @@ func (m *QueryBalanceResponse) GetBalance() string {
// QueryStorageRequest is the request type for the Query/Storage RPC method.
type QueryStorageRequest struct {
/// address is the ethereum hex address to query the storage state for.
// address is the ethereum hex address to query the storage state for.
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
// key defines the key of the storage state
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
@@ -477,7 +477,7 @@ var xxx_messageInfo_QueryStorageRequest proto.InternalMessageInfo
// QueryStorageResponse is the response type for the Query/Storage RPC
// method.
type QueryStorageResponse struct {
// key defines the storage state value hash associated with the given key.
// value defines the storage state value hash associated with the given key.
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
}
@@ -648,7 +648,7 @@ func (m *QueryTxLogsRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryTxLogsRequest proto.InternalMessageInfo
// QueryTxLogs is the response type for the Query/TxLogs RPC method.
// QueryTxLogsResponse is the response type for the Query/TxLogs RPC method.
type QueryTxLogsResponse struct {
// logs represents the ethereum logs generated from the given transaction.
Logs []*Log `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"`
@@ -788,10 +788,14 @@ func (m *QueryParamsResponse) GetParams() Params {
// EthCallRequest defines EthCall request
type EthCallRequest struct {
// same json format as the json rpc api.
// args uses the same json format as the json rpc api.
Args []byte `protobuf:"bytes,1,opt,name=args,proto3" json:"args,omitempty"`
// the default gas cap to be used
// gas_cap defines the default gas cap to be used
GasCap uint64 `protobuf:"varint,2,opt,name=gas_cap,json=gasCap,proto3" json:"gas_cap,omitempty"`
// proposer_address of the requested block in hex format
ProposerAddress github_com_cosmos_cosmos_sdk_types.ConsAddress `protobuf:"bytes,3,opt,name=proposer_address,json=proposerAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ConsAddress" json:"proposer_address,omitempty"`
// chain_id is the eip155 chain id parsed from the requested block header
ChainId int64 `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *EthCallRequest) Reset() { *m = EthCallRequest{} }
@@ -841,9 +845,23 @@ func (m *EthCallRequest) GetGasCap() uint64 {
return 0
}
func (m *EthCallRequest) GetProposerAddress() github_com_cosmos_cosmos_sdk_types.ConsAddress {
if m != nil {
return m.ProposerAddress
}
return nil
}
func (m *EthCallRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
// EstimateGasResponse defines EstimateGas response
type EstimateGasResponse struct {
// the estimated gas
// gas returns the estimated gas
Gas uint64 `protobuf:"varint,1,opt,name=gas,proto3" json:"gas,omitempty"`
}
@@ -889,19 +907,27 @@ func (m *EstimateGasResponse) GetGas() uint64 {
// QueryTraceTxRequest defines TraceTx request
type QueryTraceTxRequest struct {
// msgEthereumTx for the requested transaction
// msg is the MsgEthereumTx for the requested transaction
Msg *MsgEthereumTx `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
<<<<<<< HEAD
// TraceConfig holds extra parameters to trace functions.
=======
// trace_config holds extra parameters to trace functions.
>>>>>>> v0.20.0
TraceConfig *TraceConfig `protobuf:"bytes,3,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"`
// the predecessor transactions included in the same block
// predecessors is an array of transactions included in the same block
// need to be replayed first to get correct context for tracing.
Predecessors []*MsgEthereumTx `protobuf:"bytes,4,rep,name=predecessors,proto3" json:"predecessors,omitempty"`
// block number of requested transaction
// block_number of requested transaction
BlockNumber int64 `protobuf:"varint,5,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
// block hex hash of requested transaction
// block_hash of requested transaction
BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
// block time of requested transaction
// block_time of requested transaction
BlockTime time.Time `protobuf:"bytes,7,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time"`
// proposer_address is the proposer of the requested block
ProposerAddress github_com_cosmos_cosmos_sdk_types.ConsAddress `protobuf:"bytes,8,opt,name=proposer_address,json=proposerAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ConsAddress" json:"proposer_address,omitempty"`
// chain_id is the the eip155 chain id parsed from the requested block header
ChainId int64 `protobuf:"varint,9,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *QueryTraceTxRequest) Reset() { *m = QueryTraceTxRequest{} }
@@ -979,9 +1005,23 @@ func (m *QueryTraceTxRequest) GetBlockTime() time.Time {
return time.Time{}
}
func (m *QueryTraceTxRequest) GetProposerAddress() github_com_cosmos_cosmos_sdk_types.ConsAddress {
if m != nil {
return m.ProposerAddress
}
return nil
}
func (m *QueryTraceTxRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
// QueryTraceTxResponse defines TraceTx response
type QueryTraceTxResponse struct {
// response serialized in bytes
// data is the response serialized in bytes
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}
@@ -1027,16 +1067,20 @@ func (m *QueryTraceTxResponse) GetData() []byte {
// QueryTraceBlockRequest defines TraceTx request
type QueryTraceBlockRequest struct {
// txs messages in the block
// txs is an array of messages in the block
Txs []*MsgEthereumTx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"`
// TraceConfig holds extra parameters to trace functions.
// trace_config holds extra parameters to trace functions.
TraceConfig *TraceConfig `protobuf:"bytes,3,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"`
// block number
// block_number of the traced block
BlockNumber int64 `protobuf:"varint,5,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
// block hex hash
// block_hash (hex) of the traced block
BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
// block time
// block_time of the traced block
BlockTime time.Time `protobuf:"bytes,7,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time"`
// proposer_address is the address of the requested block
ProposerAddress github_com_cosmos_cosmos_sdk_types.ConsAddress `protobuf:"bytes,8,opt,name=proposer_address,json=proposerAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ConsAddress" json:"proposer_address,omitempty"`
// chain_id is the eip155 chain id parsed from the requested block header
ChainId int64 `protobuf:"varint,9,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *QueryTraceBlockRequest) Reset() { *m = QueryTraceBlockRequest{} }
@@ -1107,8 +1151,23 @@ func (m *QueryTraceBlockRequest) GetBlockTime() time.Time {
return time.Time{}
}
func (m *QueryTraceBlockRequest) GetProposerAddress() github_com_cosmos_cosmos_sdk_types.ConsAddress {
if m != nil {
return m.ProposerAddress
}
return nil
}
func (m *QueryTraceBlockRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
// QueryTraceBlockResponse defines TraceBlock response
type QueryTraceBlockResponse struct {
// data is the response serialized in bytes
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}
@@ -1190,8 +1249,14 @@ func (m *QueryBaseFeeRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryBaseFeeRequest proto.InternalMessageInfo
<<<<<<< HEAD
// BaseFeeResponse returns the EIP1559 base fee.
type QueryBaseFeeResponse struct {
=======
// QueryBaseFeeResponse returns the EIP1559 base fee.
type QueryBaseFeeResponse struct {
// base_fee is the EIP1559 base fee
>>>>>>> v0.20.0
BaseFee *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=base_fee,json=baseFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"base_fee,omitempty"`
}
@@ -1258,6 +1323,7 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/query.proto", fileDescriptor_e15a877459347994) }
var fileDescriptor_e15a877459347994 = []byte{
<<<<<<< HEAD
// 1377 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
0x14, 0xcf, 0x26, 0x4e, 0xec, 0x3e, 0xa7, 0x25, 0x4c, 0x53, 0xea, 0x2e, 0x89, 0x9d, 0x6e, 0x9b,
@@ -1346,6 +1412,99 @@ var fileDescriptor_e15a877459347994 = []byte{
0x2a, 0x75, 0x6a, 0xd8, 0xa5, 0x7e, 0xd5, 0x2d, 0x3b, 0x1d, 0xe9, 0x48, 0x2a, 0x58, 0x69, 0x46,
0x4a, 0xf0, 0xdb, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x45, 0x2a, 0xac, 0x59, 0x10, 0x00,
0x00,
=======
// 1434 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcd, 0x6f, 0x13, 0x47,
0x14, 0xcf, 0xc6, 0x4e, 0xec, 0x3c, 0x07, 0x70, 0x87, 0x50, 0xcc, 0x36, 0xb1, 0xc3, 0x42, 0x3e,
0x09, 0xbb, 0x8d, 0x5b, 0x21, 0x95, 0x4b, 0xc1, 0x56, 0xa0, 0x14, 0xa8, 0xa8, 0x1b, 0xf5, 0x50,
0x09, 0x59, 0xe3, 0xf5, 0xb0, 0xb6, 0x62, 0xef, 0x9a, 0x9d, 0xb1, 0xeb, 0x40, 0xe9, 0xa1, 0x52,
0x11, 0x15, 0x52,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0xa9, 0x33, 0xb6, 0x05, 0x90, 0x73, 0x68, 0x23, 0x0c, 0x84, 0x06,
0xa2, 0x5d, 0x1c, 0xd6, 0xfd, 0x3d, 0xb2, 0xff, 0x00, 0xdd, 0x83, 0x28, 0x27, 0x6d, 0xc8, 0x18,
0x59, 0x32, 0x1d, 0x26, 0xa8, 0x9f, 0x19, 0x2b, 0x23, 0x31, 0x6c, 0x08, 0x0c, 0x67, 0xd0, 0xe9,
0x61, 0xd5, 0x54, 0xee, 0x8b, 0xc4, 0x97, 0x30, 0x1b, 0xf0, 0x16, 0x74, 0x76, 0x84, 0xe6, 0x3e,
0x7a, 0xa4, 0xaf, 0x4c, 0x90, 0x92, 0x08, 0x96, 0x05, 0x02, 0x1d, 0xa5, 0xc2, 0x08, 0x02, 0x62,
0x84, 0xda, 0x10, 0x93, 0xbc, 0x08, 0x2d, 0x87, 0x75, 0xf6, 0x53, 0x26, 0x7d, 0x6d, 0xd2, 0xac,
0x50, 0x76, 0x0d, 0x61, 0x77, 0x11, 0xe9, 0x61, 0xbb, 0x84, 0x55, 0x8a, 0x36, 0x37, 0xf7, 0x35,
0x24, 0x7a, 0x88, 0xcd, 0x21, 0xac, 0x0f, 0xf1, 0x79, 0x08, 0x33, 0x32, 0x56, 0x85, 0xed, 0x65,
0x94, 0x1e, 0x62, 0x5b, 0x8a, 0x17, 0x1d, 0x4c, 0xd1, 0x57, 0x10, 0x93, 0x73, 0x74, 0x64, 0xed,
0xf5, 0x33, 0xa9, 0x91, 0xb5, 0x37, 0x30, 0x8e, 0xc7, 0x79, 0x1f, 0x0c, 0x51, 0xd6, 0x46, 0x8f,
0x34, 0x80, 0xee, 0x24, 0x40, 0xeb, 0xe3, 0x54, 0xf7, 0x0e, 0x6f, 0x7d, 0xe3, 0x10, 0x92, 0x12,
0xc7, 0x8a, 0xc0, 0x91, 0x41, 0x4b, 0xa3, 0x70, 0x88, 0xb1, 0xc8, 0x03, 0x21, 0xa7, 0xc9, 0x98,
0x6e, 0xd0, 0x3b, 0x84, 0xc6, 0x74, 0x83, 0xbe, 0xa1, 0x34, 0x2e, 0x10, 0x6a, 0x58, 0xe5, 0x2e,
0x3d, 0x7b, 0x95, 0xd6, 0x9e, 0xbf, 0x4a, 0x6b, 0x2f, 0x5f, 0xa5, 0xb5, 0x27, 0x07, 0xe9, 0xa9,
0xe7, 0x07, 0xe9, 0xa9, 0x5f, 0x0f, 0xd2, 0x53, 0x5f, 0xf4, 0x0e, 0x2f, 0xd2, 0xe2, 0xb3, 0xab,
0xab, 0xa5, 0x2d, 0xf4, 0x88, 0x01, 0x56, 0x9a, 0x15, 0xb3, 0xff, 0xbd, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xa4, 0xba, 0x06, 0x5b, 0xc7, 0x11, 0x00, 0x00,
>>>>>>> v0.20.0
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -2420,6 +2579,18 @@ func (m *EthCallRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x20
}
if len(m.ProposerAddress) > 0 {
i -= len(m.ProposerAddress)
copy(dAtA[i:], m.ProposerAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposerAddress)))
i--
dAtA[i] = 0x1a
}
if m.GasCap != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.GasCap))
i--
@@ -2483,6 +2654,18 @@ func (m *QueryTraceTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x48
}
if len(m.ProposerAddress) > 0 {
i -= len(m.ProposerAddress)
copy(dAtA[i:], m.ProposerAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposerAddress)))
i--
dAtA[i] = 0x42
}
n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime):])
if err4 != nil {
return 0, err4
@@ -2594,6 +2777,18 @@ func (m *QueryTraceBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x48
}
if len(m.ProposerAddress) > 0 {
i -= len(m.ProposerAddress)
copy(dAtA[i:], m.ProposerAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposerAddress)))
i--
dAtA[i] = 0x42
}
n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime):])
if err7 != nil {
return 0, err7
@@ -2990,6 +3185,13 @@ func (m *EthCallRequest) Size() (n int) {
if m.GasCap != 0 {
n += 1 + sovQuery(uint64(m.GasCap))
}
l = len(m.ProposerAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
return n
}
@@ -3034,6 +3236,13 @@ func (m *QueryTraceTxRequest) Size() (n int) {
}
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime)
n += 1 + l + sovQuery(uint64(l))
l = len(m.ProposerAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
return n
}
@@ -3075,6 +3284,13 @@ func (m *QueryTraceBlockRequest) Size() (n int) {
}
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime)
n += 1 + l + sovQuery(uint64(l))
l = len(m.ProposerAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
return n
}
@@ -4717,6 +4933,59 @@ func (m *EthCallRequest) Unmarshal(dAtA []byte) error {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProposerAddress = append(m.ProposerAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ProposerAddress == nil {
m.ProposerAddress = []byte{}
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -5026,6 +5295,59 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProposerAddress = append(m.ProposerAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ProposerAddress == nil {
m.ProposerAddress = []byte{}
}
iNdEx = postIndex
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -5314,6 +5636,59 @@ func (m *QueryTraceBlockRequest) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProposerAddress = append(m.ProposerAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ProposerAddress == nil {
m.ProposerAddress = []byte{}
}
iNdEx = postIndex
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
+61 -11
View File
@@ -20,6 +20,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
@@ -30,6 +31,7 @@ var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAccountRequest
@@ -560,12 +562,14 @@ func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marsha
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Account_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -573,6 +577,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_Account_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -586,6 +591,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_CosmosAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -593,6 +600,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_CosmosAccount_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -606,6 +614,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_ValidatorAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -613,6 +623,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_ValidatorAccount_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -626,6 +637,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -633,6 +646,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_Balance_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -646,6 +660,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_Storage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -653,6 +669,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_Storage_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -666,6 +683,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -673,6 +692,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -686,6 +706,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -693,6 +715,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -706,6 +729,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_EthCall_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -713,6 +738,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_EthCall_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -726,6 +752,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_EstimateGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -733,6 +761,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_EstimateGas_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -746,6 +775,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_TraceTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -753,6 +784,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_TraceTx_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -766,6 +798,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_TraceBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -773,6 +807,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_TraceBlock_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -786,6 +821,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
<<<<<<< HEAD
=======
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
>>>>>>> v0.20.0
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -793,6 +833,10 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_BaseFee_0(rctx, inboundMarshaler, server, req, pathParams)
<<<<<<< HEAD
=======
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
>>>>>>> v0.20.0
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -1088,29 +1132,35 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}
var (
pattern_Query_Account_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "account", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Account_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "account", "address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_CosmosAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "cosmos_account", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_CosmosAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "cosmos_account", "address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ValidatorAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "validator_account", "cons_address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ValidatorAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "validator_account", "cons_address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Balance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "balances", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Balance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "balances", "address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Storage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"ethermint", "evm", "v1", "storage", "address", "key"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Storage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"ethermint", "evm", "v1", "storage", "address", "key"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "codes", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "codes", "address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_EthCall_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "eth_call"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_EthCall_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "eth_call"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_EstimateGas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "estimate_gas"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_EstimateGas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "estimate_gas"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_TraceTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "trace_tx"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_TraceTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "trace_tx"}, "", runtime.AssumeColonVerbOpt(false)))
<<<<<<< HEAD
pattern_Query_TraceBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "trace_block"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_BaseFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "base_fee"}, "", runtime.AssumeColonVerbOpt(true)))
=======
pattern_Query_TraceBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "trace_block"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_BaseFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "base_fee"}, "", runtime.AssumeColonVerbOpt(false)))
>>>>>>> v0.20.0
)
var (
+3 -3
View File
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
errorsmod "cosmossdk.io/errors"
"github.com/ethereum/go-ethereum/common"
)
@@ -17,7 +17,7 @@ func (s Storage) Validate() error {
seenStorage := make(map[string]bool)
for i, state := range s {
if seenStorage[state.Key] {
return sdkerrors.Wrapf(ErrInvalidState, "duplicate state key %d: %s", i, state.Key)
return errorsmod.Wrapf(ErrInvalidState, "duplicate state key %d: %s", i, state.Key)
}
if err := state.Validate(); err != nil {
@@ -51,7 +51,7 @@ func (s Storage) Copy() Storage {
// NOTE: state value can be empty
func (s State) Validate() error {
if strings.TrimSpace(s.Key) == "" {
return sdkerrors.Wrap(ErrInvalidState, "state key hash cannot be blank")
return errorsmod.Wrap(ErrInvalidState, "state key hash cannot be blank")
}
return nil
+27
View File
@@ -1,10 +1,37 @@
package types
import (
"math"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
)
// GetTxPriority returns the priority of a given Ethereum tx. It relies of the
// priority reduction global variable to calculate the tx priority given the tx
// tip price:
//
// tx_priority = tip_price / priority_reduction
func GetTxPriority(txData TxData, baseFee *big.Int) (priority int64) {
// calculate priority based on effective gas price
tipPrice := txData.EffectiveGasPrice(baseFee)
// if london hardfork is not enabled, tipPrice is the gasPrice
if baseFee != nil {
tipPrice = new(big.Int).Sub(tipPrice, baseFee)
}
priority = math.MaxInt64
priorityBig := new(big.Int).Quo(tipPrice, DefaultPriorityReduction.BigInt())
// safety check
if priorityBig.IsInt64() {
priority = priorityBig.Int64()
}
return priority
}
// Failed returns if the contract execution failed in vm errors
func (m *MsgEthereumTxResponse) Failed() bool {
return len(m.VmError) > 0
+88 -23
View File
@@ -7,12 +7,12 @@ import (
context "context"
encoding_binary "encoding/binary"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
types "github.com/cosmos/cosmos-sdk/codec/types"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "github.com/regen-network/cosmos-proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
@@ -35,13 +35,17 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.
type MsgEthereumTx struct {
// inner transaction data
// data is inner transaction data of the Ethereum transaction
Data *types.Any `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
<<<<<<< HEAD
// DEPRECATED: encoded storage size of the transaction
=======
// size is the encoded storage size of the transaction (DEPRECATED)
>>>>>>> v0.20.0
Size_ float64 `protobuf:"fixed64,2,opt,name=size,proto3" json:"-"`
// transaction hash in hex format
// hash of the transaction in hex format
Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty" rlp:"-"`
// ethereum signer address in hex format. This address value is checked
// from is the ethereum signer address in hex format. This address value is checked
// against the address derived from the signature (V, R, S) using the
// secp256k1 elliptic curve
From string `protobuf:"bytes,4,opt,name=from,proto3" json:"from,omitempty"`
@@ -86,15 +90,15 @@ var xxx_messageInfo_MsgEthereumTx proto.InternalMessageInfo
type LegacyTx struct {
// nonce corresponds to the account nonce (transaction sequence).
Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
// gas price defines the value for each gas unit
// gas_price defines the value for each gas unit
GasPrice *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price,omitempty"`
// gas defines the gas limit defined for the transaction.
GasLimit uint64 `protobuf:"varint,3,opt,name=gas,proto3" json:"gas,omitempty"`
// hex formatted address of the recipient
// to is the hex formatted address of the recipient
To string `protobuf:"bytes,4,opt,name=to,proto3" json:"to,omitempty"`
// value defines the unsigned integer value of the transaction amount.
Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"`
// input defines the data payload bytes of the transaction.
// data is the data payload bytes of the transaction.
Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
// v defines the signature value
V []byte `protobuf:"bytes,7,opt,name=v,proto3" json:"v,omitempty"`
@@ -139,20 +143,21 @@ var xxx_messageInfo_LegacyTx proto.InternalMessageInfo
// AccessListTx is the data of EIP-2930 access list transactions.
type AccessListTx struct {
// destination EVM chain ID
// chain_id of the destination EVM chain
ChainID *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"chainID"`
// nonce corresponds to the account nonce (transaction sequence).
Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
// gas price defines the value for each gas unit
// gas_price defines the value for each gas unit
GasPrice *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price,omitempty"`
// gas defines the gas limit defined for the transaction.
GasLimit uint64 `protobuf:"varint,4,opt,name=gas,proto3" json:"gas,omitempty"`
// hex formatted address of the recipient
// to is the recipient address in hex format
To string `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"`
// value defines the unsigned integer value of the transaction amount.
Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"`
// input defines the data payload bytes of the transaction.
Data []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
// data is the data payload bytes of the transaction.
Data []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
// accesses is an array of access tuples
Accesses AccessList `protobuf:"bytes,8,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"`
// v defines the signature value
V []byte `protobuf:"bytes,9,opt,name=v,proto3" json:"v,omitempty"`
@@ -197,22 +202,23 @@ var xxx_messageInfo_AccessListTx proto.InternalMessageInfo
// DynamicFeeTx is the data of EIP-1559 dinamic fee transactions.
type DynamicFeeTx struct {
// destination EVM chain ID
// chain_id of the destination EVM chain
ChainID *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"chainID"`
// nonce corresponds to the account nonce (transaction sequence).
Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
// gas tip cap defines the max value for the gas tip
// gas_tip_cap defines the max value for the gas tip
GasTipCap *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=gas_tip_cap,json=gasTipCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_tip_cap,omitempty"`
// gas fee cap defines the max value for the gas fee
// gas_fee_cap defines the max value for the gas fee
GasFeeCap *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=gas_fee_cap,json=gasFeeCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_fee_cap,omitempty"`
// gas defines the gas limit defined for the transaction.
GasLimit uint64 `protobuf:"varint,5,opt,name=gas,proto3" json:"gas,omitempty"`
// hex formatted address of the recipient
// to is the hex formatted address of the recipient
To string `protobuf:"bytes,6,opt,name=to,proto3" json:"to,omitempty"`
// value defines the the transaction amount.
Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"`
// input defines the data payload bytes of the transaction.
Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"`
// data is the data payload bytes of the transaction.
Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"`
// accesses is an array of access tuples
Accesses AccessList `protobuf:"bytes,9,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"`
// v defines the signature value
V []byte `protobuf:"bytes,10,opt,name=v,proto3" json:"v,omitempty"`
@@ -255,6 +261,7 @@ func (m *DynamicFeeTx) XXX_DiscardUnknown() {
var xxx_messageInfo_DynamicFeeTx proto.InternalMessageInfo
// ExtensionOptionsEthereumTx is an extension option for ethereum transactions
type ExtensionOptionsEthereumTx struct {
}
@@ -293,19 +300,19 @@ var xxx_messageInfo_ExtensionOptionsEthereumTx proto.InternalMessageInfo
// MsgEthereumTxResponse defines the Msg/EthereumTx response type.
type MsgEthereumTxResponse struct {
// ethereum transaction hash in hex format. This hash differs from the
// hash of the ethereum transaction in hex format. This hash differs from the
// Tendermint sha256 hash of the transaction bytes. See
// https://github.com/tendermint/tendermint/issues/6539 for reference
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
// logs contains the transaction hash and the proto-compatible ethereum
// logs.
Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"`
// returned data from evm function (result or data supplied with revert
// ret is the returned data from evm function (result or data supplied with revert
// opcode)
Ret []byte `protobuf:"bytes,3,opt,name=ret,proto3" json:"ret,omitempty"`
// vm error is the error returned by vm execution
// vm_error is the error returned by vm execution
VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"`
// gas consumed by the transaction
// gas_used specifies how much gas was consumed by the transaction
GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
}
@@ -354,6 +361,7 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) }
var fileDescriptor_f75ac0a12d075f21 = []byte{
<<<<<<< HEAD
// 859 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x8f, 0xdb, 0x44,
0x14, 0xce, 0x24, 0x4e, 0xec, 0x4c, 0x42, 0x55, 0x59, 0x5b, 0xc9, 0x1b, 0xd1, 0x38, 0xb2, 0x04,
@@ -409,6 +417,63 @@ var fileDescriptor_f75ac0a12d075f21 = []byte{
0xce, 0xba, 0x95, 0x0f, 0xee, 0x5c, 0xd5, 0x13, 0x4e, 0x82, 0x01, 0x61, 0xde, 0x0c, 0x05, 0x8c,
0x92, 0x60, 0xe2, 0x65, 0x2a, 0x96, 0x12, 0xd5, 0x49, 0x43, 0xed, 0xda, 0xb7, 0xfe, 0x0c, 0x00,
0x00, 0xff, 0xff, 0x91, 0xe5, 0xb2, 0x95, 0x4f, 0x08, 0x00, 0x00,
=======
// 853 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x31, 0x8f, 0xe3, 0x44,
0x14, 0xce, 0x24, 0x4e, 0xec, 0x4c, 0xc2, 0xe9, 0x64, 0xed, 0x49, 0x4e, 0xc4, 0xc5, 0x91, 0x25,
0x20, 0x20, 0xc5, 0x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d, 0xbf, 0x09, 0x58, 0x3d, 0xd6, 0x7a, 0xed, 0x93, 0x1f, 0x7f, 0xfb,
0xb2, 0x6c, 0x5a, 0x77, 0x9d, 0xed, 0xed, 0x5c, 0x44, 0x8f, 0x59, 0x36, 0xb8, 0xff, 0x7c, 0xd9,
0x01, 0x2f, 0x96, 0x1d, 0xf0, 0xeb, 0xb2, 0x03, 0xbe, 0x38, 0xeb, 0x94, 0x5e, 0x9c, 0x75, 0x4a,
0x3f, 0x9d, 0x75, 0x4a, 0x1f, 0x5c, 0xd6, 0x13, 0x4e, 0xb9, 0x9c, 0xd6, 0x40, 0x99, 0x80, 0x12,
0x9a, 0x3a, 0xa9, 0x89, 0x55, 0xfb, 0xf6, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdd, 0xce, 0x14,
0xcb, 0x4e, 0x08, 0x00, 0x00,
>>>>>>> v0.20.0
}
// Reference imports to suppress errors if they are not otherwise used.
+7 -2
View File
@@ -20,6 +20,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
@@ -30,6 +31,7 @@ var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
var (
filter_Msg_EthereumTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
@@ -70,12 +72,14 @@ func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marsh
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
// UnaryRPC :call MsgServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
mux.Handle("POST", pattern_Msg_EthereumTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -83,6 +87,7 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
return
}
resp, md, err := local_request_Msg_EthereumTx_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@@ -158,7 +163,7 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
}
var (
pattern_Msg_EthereumTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "ethereum_tx"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Msg_EthereumTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "ethereum_tx"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"github.com/gogo/protobuf/proto"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
@@ -34,7 +34,7 @@ func DecodeTxResponse(in []byte) (*MsgEthereumTxResponse, error) {
var res MsgEthereumTxResponse
if err := proto.Unmarshal(txMsgData.MsgResponses[0].Value, &res); err != nil {
return nil, sdkerrors.Wrap(err, "failed to unmarshal tx response message data")
return nil, errorsmod.Wrap(err, "failed to unmarshal tx response message data")
}
return &res, nil