upgrade to ethermint v0.21.0 #99
14
app/app.go
14
app/app.go
@ -412,16 +412,18 @@ func NewEthermintApp(
|
|||||||
tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer))
|
tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer))
|
||||||
|
|
||||||
// Create Ethermint keepers
|
// Create Ethermint keepers
|
||||||
|
feeMarketSs := app.GetSubspace(feemarkettypes.ModuleName)
|
||||||
app.FeeMarketKeeper = feemarketkeeper.NewKeeper(
|
app.FeeMarketKeeper = feemarketkeeper.NewKeeper(
|
||||||
appCodec, authtypes.NewModuleAddress(govtypes.ModuleName),
|
appCodec, authtypes.NewModuleAddress(govtypes.ModuleName),
|
||||||
keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey],
|
keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey], feeMarketSs,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set authority to x/gov module account to only expect the module account to update params
|
// Set authority to x/gov module account to only expect the module account to update params
|
||||||
|
evmSs := app.GetSubspace(evmtypes.ModuleName)
|
||||||
app.EvmKeeper = evmkeeper.NewKeeper(
|
app.EvmKeeper = evmkeeper.NewKeeper(
|
||||||
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName),
|
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName),
|
||||||
app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper,
|
app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper,
|
||||||
nil, geth.NewEVM, tracer,
|
nil, geth.NewEVM, tracer, evmSs,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create IBC Keeper
|
// Create IBC Keeper
|
||||||
@ -507,8 +509,8 @@ func NewEthermintApp(
|
|||||||
ibc.NewAppModule(app.IBCKeeper),
|
ibc.NewAppModule(app.IBCKeeper),
|
||||||
transferModule,
|
transferModule,
|
||||||
// Ethermint app modules
|
// Ethermint app modules
|
||||||
feemarket.NewAppModule(app.FeeMarketKeeper, app.GetSubspace(feemarkettypes.ModuleName)),
|
feemarket.NewAppModule(app.FeeMarketKeeper, feeMarketSs),
|
||||||
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.GetSubspace(evmtypes.ModuleName)),
|
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs),
|
||||||
)
|
)
|
||||||
|
|
||||||
// During begin block slashing happens after distr.BeginBlocker so that
|
// During begin block slashing happens after distr.BeginBlocker so that
|
||||||
@ -861,7 +863,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
|
|||||||
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
||||||
paramsKeeper.Subspace(ibchost.ModuleName)
|
paramsKeeper.Subspace(ibchost.ModuleName)
|
||||||
// ethermint subspaces
|
// ethermint subspaces
|
||||||
paramsKeeper.Subspace(evmtypes.ModuleName)
|
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable())
|
||||||
paramsKeeper.Subspace(feemarkettypes.ModuleName)
|
paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable())
|
||||||
return paramsKeeper
|
return paramsKeeper
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ schema = 3
|
|||||||
hash = "sha256-EmpRZ48pjPFq/fIHneut9Vyo5QJATfb3ZO7KzWnqs9g="
|
hash = "sha256-EmpRZ48pjPFq/fIHneut9Vyo5QJATfb3ZO7KzWnqs9g="
|
||||||
[mod."github.com/cosmos/ibc-go/v6"]
|
[mod."github.com/cosmos/ibc-go/v6"]
|
||||||
version = "v6.1.0"
|
version = "v6.1.0"
|
||||||
hash = "sha256-Gfqhdz9ZKEgb7LCkHiXCwYZYUYluQ+vMew/GkssfVj8="
|
hash = "sha256-mHYCqLedcveDjfm1EiO2EMMNJqLm9u4WHwQTy1muOoc="
|
||||||
[mod."github.com/cosmos/ledger-cosmos-go"]
|
[mod."github.com/cosmos/ledger-cosmos-go"]
|
||||||
version = "v0.12.1"
|
version = "v0.12.1"
|
||||||
hash = "sha256-9+nr+/r4MyiogddS0JcXOuriPqXP4nxln8ts+mYQRcg="
|
hash = "sha256-9+nr+/r4MyiogddS0JcXOuriPqXP4nxln8ts+mYQRcg="
|
||||||
@ -406,8 +406,8 @@ schema = 3
|
|||||||
version = "v0.9.1"
|
version = "v0.9.1"
|
||||||
hash = "sha256-YLGNrHHM+mN4ElW/XWuylOnFrA/VjSY+eBuC4LN//5c="
|
hash = "sha256-YLGNrHHM+mN4ElW/XWuylOnFrA/VjSY+eBuC4LN//5c="
|
||||||
[mod."github.com/rs/cors"]
|
[mod."github.com/rs/cors"]
|
||||||
version = "v1.8.2"
|
version = "v1.8.3"
|
||||||
hash = "sha256-FxBbQVb8zIoDGGaAJKfsYV0+POkh1tyX7P6A/Lk5Vsc="
|
hash = "sha256-VgVB4HKAhPSjNg96mIEUN1bt5ZQng8Fi3ZABy3CDWQE="
|
||||||
[mod."github.com/rs/zerolog"]
|
[mod."github.com/rs/zerolog"]
|
||||||
version = "v1.27.0"
|
version = "v1.27.0"
|
||||||
hash = "sha256-BxQtP2TROeSSpj9l1irocuSfxn55UL4ugzB/og7r8eE="
|
hash = "sha256-BxQtP2TROeSSpj9l1irocuSfxn55UL4ugzB/og7r8eE="
|
||||||
@ -523,11 +523,11 @@ schema = 3
|
|||||||
version = "v1.6.7"
|
version = "v1.6.7"
|
||||||
hash = "sha256-zIxGRHiq4QBvRqkrhMGMGCaVL4iM4TtlYpAi/hrivS4="
|
hash = "sha256-zIxGRHiq4QBvRqkrhMGMGCaVL4iM4TtlYpAi/hrivS4="
|
||||||
[mod."google.golang.org/genproto"]
|
[mod."google.golang.org/genproto"]
|
||||||
version = "v0.0.0-20221116193143-41c2ba794472"
|
version = "v0.0.0-20221118155620-16455021b5e6"
|
||||||
hash = "sha256-uQuxuOvWRsdMii5M5QresisVd1E+Ss8s2WfR2n7QSXk="
|
hash = "sha256-FFSliEzgr7AceO8B+ZoPAlZDFVPLeqAFg+25VQw6cFs="
|
||||||
[mod."google.golang.org/grpc"]
|
[mod."google.golang.org/grpc"]
|
||||||
version = "v1.51.0"
|
version = "v1.52.0"
|
||||||
hash = "sha256-RzH5DU13D/ulxxOouIKpdNt8eHdff7mrEnB+JUupbLU="
|
hash = "sha256-wYJ/ysugKxz1O9u6BxECTIGFJ3sv0XmxOfM+Y0jW3KQ="
|
||||||
[mod."google.golang.org/protobuf"]
|
[mod."google.golang.org/protobuf"]
|
||||||
version = "v1.28.2-0.20220831092852-f930b1dc76e8"
|
version = "v1.28.2-0.20220831092852-f930b1dc76e8"
|
||||||
hash = "sha256-li5hXlXwTJ5LIZ8bVki1AZ6UFI2gXHl33JwdX1dOrtM="
|
hash = "sha256-li5hXlXwTJ5LIZ8bVki1AZ6UFI2gXHl33JwdX1dOrtM="
|
||||||
|
@ -3,10 +3,9 @@ let
|
|||||||
fetchEthermint = rev: builtins.fetchTarball "https://github.com/evmos/ethermint/archive/${rev}.tar.gz";
|
fetchEthermint = rev: builtins.fetchTarball "https://github.com/evmos/ethermint/archive/${rev}.tar.gz";
|
||||||
released = pkgs.buildGo118Module rec {
|
released = pkgs.buildGo118Module rec {
|
||||||
name = "ethermintd";
|
name = "ethermintd";
|
||||||
# the commit before https://github.com/evmos/ethermint/pull/943
|
src = fetchEthermint "d29cdad6e667f6089dfecbedd36bb8d3a2a7d025";
|
||||||
src = fetchEthermint "8866ae0ffd67a104e9d1cf4e50fba8391dda6c45";
|
|
||||||
subPackages = [ "cmd/ethermintd" ];
|
subPackages = [ "cmd/ethermintd" ];
|
||||||
vendorSha256 = "sha256-oDtMamNlwe/393fZd+RNtRy6ipWpusbco8Xg1ZuKWYw=";
|
vendorSha256 = "sha256-cQAol54b6hNzsA4Q3MP9mTqFWM1MvR5uMPrYpaoj3SY=";
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
current = pkgs.callPackage ../../../. { };
|
current = pkgs.callPackage ../../../. { };
|
||||||
|
@ -637,9 +637,8 @@ class CosmosCLI:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def gov_propose(self, proposer, kind, proposal, **kwargs):
|
def gov_propose(self, proposer, kind, proposal, **kwargs):
|
||||||
method = "submit-legacy-proposal"
|
method = "submit-proposal"
|
||||||
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
|
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
|
||||||
kwargs.setdefault("gas", DEFAULT_GAS)
|
|
||||||
if kind == "software-upgrade":
|
if kind == "software-upgrade":
|
||||||
return json.loads(
|
return json.loads(
|
||||||
self.raw(
|
self.raw(
|
||||||
@ -649,7 +648,6 @@ class CosmosCLI:
|
|||||||
kind,
|
kind,
|
||||||
proposal["name"],
|
proposal["name"],
|
||||||
"-y",
|
"-y",
|
||||||
"--no-validate",
|
|
||||||
from_=proposer,
|
from_=proposer,
|
||||||
# content
|
# content
|
||||||
title=proposal.get("title"),
|
title=proposal.get("title"),
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||||
@ -75,6 +76,8 @@ type Keeper struct {
|
|||||||
|
|
||||||
// evm constructor function
|
// evm constructor function
|
||||||
evmConstructor evm.Constructor
|
evmConstructor evm.Constructor
|
||||||
|
// Legacy subspace
|
||||||
|
ss paramstypes.Subspace
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKeeper generates new evm module keeper
|
// NewKeeper generates new evm module keeper
|
||||||
@ -89,6 +92,7 @@ func NewKeeper(
|
|||||||
customPrecompiles evm.PrecompiledContracts,
|
customPrecompiles evm.PrecompiledContracts,
|
||||||
evmConstructor evm.Constructor,
|
evmConstructor evm.Constructor,
|
||||||
tracer string,
|
tracer string,
|
||||||
|
ss paramstypes.Subspace,
|
||||||
) *Keeper {
|
) *Keeper {
|
||||||
// ensure evm module account is set
|
// ensure evm module account is set
|
||||||
if addr := ak.GetModuleAddress(types.ModuleName); addr == nil {
|
if addr := ak.GetModuleAddress(types.ModuleName); addr == nil {
|
||||||
@ -113,6 +117,7 @@ func NewKeeper(
|
|||||||
customPrecompiles: customPrecompiles,
|
customPrecompiles: customPrecompiles,
|
||||||
evmConstructor: evmConstructor,
|
evmConstructor: evmConstructor,
|
||||||
tracer: tracer,
|
tracer: tracer,
|
||||||
|
ss: ss,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,24 +3,23 @@ package keeper_test
|
|||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
|
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
|
||||||
v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types"
|
|
||||||
"github.com/evmos/ethermint/x/evm/types"
|
"github.com/evmos/ethermint/x/evm/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockSubspace struct {
|
type mockSubspace struct {
|
||||||
ps v4types.V4Params
|
ps types.Params
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockSubspace(ps v4types.V4Params) mockSubspace {
|
func newMockSubspace(ps types.Params) mockSubspace {
|
||||||
return mockSubspace{ps: ps}
|
return mockSubspace{ps: ps}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) {
|
func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) {
|
||||||
*ps.(*v4types.V4Params) = ms.ps
|
*ps.(*types.Params) = ms.ps
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) TestMigrations() {
|
func (suite *KeeperTestSuite) TestMigrations() {
|
||||||
legacySubspace := newMockSubspace(v4types.DefaultParams())
|
legacySubspace := newMockSubspace(types.DefaultParams())
|
||||||
migrator := evmkeeper.NewMigrator(*suite.app.EvmKeeper, legacySubspace)
|
migrator := evmkeeper.NewMigrator(*suite.app.EvmKeeper, legacySubspace)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
@ -48,13 +48,20 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLegacyParams returns param set for version before migrate
|
||||||
|
func (k Keeper) GetLegacyParams(ctx sdk.Context) types.Params {
|
||||||
|
var params types.Params
|
||||||
|
k.ss.GetParamSetIfExists(ctx, ¶ms)
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
// GetExtraEIPs returns the extra EIPs enabled on the chain.
|
// GetExtraEIPs returns the extra EIPs enabled on the chain.
|
||||||
func (k Keeper) GetExtraEIPs(ctx sdk.Context) types.ExtraEIPs {
|
func (k Keeper) GetExtraEIPs(ctx sdk.Context) types.ExtraEIPs {
|
||||||
var extraEIPs types.ExtraEIPs
|
var extraEIPs types.ExtraEIPs
|
||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
bz := store.Get(types.ParamStoreKeyExtraEIPs)
|
bz := store.Get(types.ParamStoreKeyExtraEIPs)
|
||||||
if len(bz) == 0 {
|
if len(bz) == 0 {
|
||||||
return extraEIPs
|
return k.GetLegacyParams(ctx).ExtraEIPs
|
||||||
}
|
}
|
||||||
k.cdc.MustUnmarshal(bz, &extraEIPs)
|
k.cdc.MustUnmarshal(bz, &extraEIPs)
|
||||||
return extraEIPs
|
return extraEIPs
|
||||||
@ -66,7 +73,7 @@ func (k Keeper) GetChainConfig(ctx sdk.Context) types.ChainConfig {
|
|||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
bz := store.Get(types.ParamStoreKeyChainConfig)
|
bz := store.Get(types.ParamStoreKeyChainConfig)
|
||||||
if len(bz) == 0 {
|
if len(bz) == 0 {
|
||||||
return chainCfg
|
return k.GetLegacyParams(ctx).ChainConfig
|
||||||
}
|
}
|
||||||
k.cdc.MustUnmarshal(bz, &chainCfg)
|
k.cdc.MustUnmarshal(bz, &chainCfg)
|
||||||
return chainCfg
|
return chainCfg
|
||||||
@ -77,7 +84,7 @@ func (k Keeper) GetEVMDenom(ctx sdk.Context) string {
|
|||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
bz := store.Get(types.ParamStoreKeyEVMDenom)
|
bz := store.Get(types.ParamStoreKeyEVMDenom)
|
||||||
if len(bz) == 0 {
|
if len(bz) == 0 {
|
||||||
return ""
|
return k.GetLegacyParams(ctx).EvmDenom
|
||||||
}
|
}
|
||||||
return string(bz)
|
return string(bz)
|
||||||
}
|
}
|
||||||
@ -85,19 +92,31 @@ func (k Keeper) GetEVMDenom(ctx sdk.Context) string {
|
|||||||
// GetEnableCall returns true if the EVM Call operation is enabled.
|
// GetEnableCall returns true if the EVM Call operation is enabled.
|
||||||
func (k Keeper) GetEnableCall(ctx sdk.Context) bool {
|
func (k Keeper) GetEnableCall(ctx sdk.Context) bool {
|
||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
return store.Has(types.ParamStoreKeyEnableCall)
|
exist := store.Has(types.ParamStoreKeyEnableCall)
|
||||||
|
if !exist {
|
||||||
|
exist = k.GetLegacyParams(ctx).EnableCall
|
||||||
|
}
|
||||||
|
return exist
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEnableCreate returns true if the EVM Create contract operation is enabled.
|
// GetEnableCreate returns true if the EVM Create contract operation is enabled.
|
||||||
func (k Keeper) GetEnableCreate(ctx sdk.Context) bool {
|
func (k Keeper) GetEnableCreate(ctx sdk.Context) bool {
|
||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
return store.Has(types.ParamStoreKeyEnableCreate)
|
exist := store.Has(types.ParamStoreKeyEnableCreate)
|
||||||
|
if !exist {
|
||||||
|
exist = k.GetLegacyParams(ctx).EnableCreate
|
||||||
|
}
|
||||||
|
return exist
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAllowUnprotectedTxs returns true if unprotected txs (i.e non-replay protected as per EIP-155) are supported by the chain.
|
// 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 {
|
func (k Keeper) GetAllowUnprotectedTxs(ctx sdk.Context) bool {
|
||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
return store.Has(types.ParamStoreKeyAllowUnprotectedTxs)
|
exist := store.Has(types.ParamStoreKeyAllowUnprotectedTxs)
|
||||||
|
if !exist {
|
||||||
|
exist = k.GetLegacyParams(ctx).AllowUnprotectedTxs
|
||||||
|
}
|
||||||
|
return exist
|
||||||
}
|
}
|
||||||
|
|
||||||
// setChainConfig sets the ChainConfig in the store
|
// setChainConfig sets the ChainConfig in the store
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types"
|
|
||||||
"github.com/evmos/ethermint/x/evm/types"
|
"github.com/evmos/ethermint/x/evm/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ func MigrateStore(
|
|||||||
) error {
|
) error {
|
||||||
var (
|
var (
|
||||||
store = ctx.KVStore(storeKey)
|
store = ctx.KVStore(storeKey)
|
||||||
params v4types.V4Params
|
params types.Params
|
||||||
)
|
)
|
||||||
|
|
||||||
legacySubspace.GetParamSetIfExists(ctx, ¶ms)
|
legacySubspace.GetParamSetIfExists(ctx, ¶ms)
|
||||||
@ -29,22 +28,22 @@ func MigrateStore(
|
|||||||
}
|
}
|
||||||
|
|
||||||
chainCfgBz := cdc.MustMarshal(¶ms.ChainConfig)
|
chainCfgBz := cdc.MustMarshal(¶ms.ChainConfig)
|
||||||
extraEIPsBz := cdc.MustMarshal(&v4types.ExtraEIPs{EIPs: v4types.AvailableExtraEIPs})
|
extraEIPsBz := cdc.MustMarshal(&types.ExtraEIPs{EIPs: types.AvailableExtraEIPs})
|
||||||
|
|
||||||
store.Set(v4types.ParamStoreKeyEVMDenom, []byte(params.EvmDenom))
|
store.Set(types.ParamStoreKeyEVMDenom, []byte(params.EvmDenom))
|
||||||
store.Set(v4types.ParamStoreKeyExtraEIPs, extraEIPsBz)
|
store.Set(types.ParamStoreKeyExtraEIPs, extraEIPsBz)
|
||||||
store.Set(v4types.ParamStoreKeyChainConfig, chainCfgBz)
|
store.Set(types.ParamStoreKeyChainConfig, chainCfgBz)
|
||||||
|
|
||||||
if params.AllowUnprotectedTxs {
|
if params.AllowUnprotectedTxs {
|
||||||
store.Set(v4types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01})
|
store.Set(types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01})
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.EnableCall {
|
if params.EnableCall {
|
||||||
store.Set(v4types.ParamStoreKeyEnableCall, []byte{0x01})
|
store.Set(types.ParamStoreKeyEnableCall, []byte{0x01})
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.EnableCreate {
|
if params.EnableCreate {
|
||||||
store.Set(v4types.ParamStoreKeyEnableCreate, []byte{0x01})
|
store.Set(types.ParamStoreKeyEnableCreate, []byte{0x01})
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -11,20 +11,19 @@ import (
|
|||||||
"github.com/evmos/ethermint/app"
|
"github.com/evmos/ethermint/app"
|
||||||
"github.com/evmos/ethermint/encoding"
|
"github.com/evmos/ethermint/encoding"
|
||||||
v4 "github.com/evmos/ethermint/x/evm/migrations/v4"
|
v4 "github.com/evmos/ethermint/x/evm/migrations/v4"
|
||||||
v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockSubspace struct {
|
type mockSubspace struct {
|
||||||
ps v4types.V4Params
|
ps types.Params
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockSubspace(ps v4types.V4Params) mockSubspace {
|
func newMockSubspace(ps types.Params) mockSubspace {
|
||||||
return mockSubspace{ps: ps}
|
return mockSubspace{ps: ps}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) {
|
func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) {
|
||||||
*ps.(*v4types.V4Params) = ms.ps
|
*ps.(*types.Params) = ms.ps
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMigrate(t *testing.T) {
|
func TestMigrate(t *testing.T) {
|
||||||
@ -36,29 +35,30 @@ func TestMigrate(t *testing.T) {
|
|||||||
ctx := testutil.DefaultContext(storeKey, tKey)
|
ctx := testutil.DefaultContext(storeKey, tKey)
|
||||||
kvStore := ctx.KVStore(storeKey)
|
kvStore := ctx.KVStore(storeKey)
|
||||||
|
|
||||||
legacySubspace := newMockSubspace(v4types.DefaultParams())
|
legacySubspace := newMockSubspace(types.DefaultParams())
|
||||||
require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc))
|
require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc))
|
||||||
|
|
||||||
// Get all the new parameters from the kvStore
|
// Get all the new parameters from the kvStore
|
||||||
var evmDenom string
|
var evmDenom string
|
||||||
bz := kvStore.Get(v4types.ParamStoreKeyEVMDenom)
|
bz := kvStore.Get(types.ParamStoreKeyEVMDenom)
|
||||||
evmDenom = string(bz)
|
evmDenom = string(bz)
|
||||||
|
|
||||||
var allowUnprotectedTx gogotypes.BoolValue
|
var allowUnprotectedTx gogotypes.BoolValue
|
||||||
bz = kvStore.Get(v4types.ParamStoreKeyAllowUnprotectedTxs)
|
bz = kvStore.Get(types.ParamStoreKeyAllowUnprotectedTxs)
|
||||||
cdc.MustUnmarshal(bz, &allowUnprotectedTx)
|
cdc.MustUnmarshal(bz, &allowUnprotectedTx)
|
||||||
|
|
||||||
enableCreate := kvStore.Has(v4types.ParamStoreKeyEnableCreate)
|
enableCreate := kvStore.Has(types.ParamStoreKeyEnableCreate)
|
||||||
enableCall := kvStore.Has(v4types.ParamStoreKeyEnableCall)
|
enableCall := kvStore.Has(types.ParamStoreKeyEnableCall)
|
||||||
|
|
||||||
var chainCfg v4types.ChainConfig
|
var chainCfg types.ChainConfig
|
||||||
bz = kvStore.Get(v4types.ParamStoreKeyChainConfig)
|
bz = kvStore.Get(types.ParamStoreKeyChainConfig)
|
||||||
cdc.MustUnmarshal(bz, &chainCfg)
|
cdc.MustUnmarshal(bz, &chainCfg)
|
||||||
|
|
||||||
var extraEIPs v4types.ExtraEIPs
|
var extraEIPs types.ExtraEIPs
|
||||||
bz = kvStore.Get(v4types.ParamStoreKeyExtraEIPs)
|
bz = kvStore.Get(types.ParamStoreKeyExtraEIPs)
|
||||||
cdc.MustUnmarshal(bz, &extraEIPs)
|
cdc.MustUnmarshal(bz, &extraEIPs)
|
||||||
|
require.Equal(t, types.AvailableExtraEIPs, extraEIPs.EIPs)
|
||||||
|
|
||||||
params := v4types.NewParams(evmDenom, allowUnprotectedTx.Value, enableCreate, enableCall, chainCfg, extraEIPs)
|
params := types.NewParams(evmDenom, allowUnprotectedTx.Value, enableCreate, enableCall, chainCfg, extraEIPs)
|
||||||
require.Equal(t, legacySubspace.ps, params)
|
require.Equal(t, legacySubspace.ps, params)
|
||||||
}
|
}
|
||||||
|
1265
x/evm/types/events.pb.go
generated
Normal file
1265
x/evm/types/events.pb.go
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/evmos/ethermint/types"
|
"github.com/evmos/ethermint/types"
|
||||||
)
|
)
|
||||||
@ -56,6 +57,11 @@ var (
|
|||||||
AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529}
|
AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ParamKeyTable returns the parameter key table.
|
||||||
|
func ParamKeyTable() paramtypes.KeyTable {
|
||||||
|
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||||
|
}
|
||||||
|
|
||||||
// NewParams creates a new Params instance
|
// NewParams creates a new Params instance
|
||||||
func NewParams(evmDenom string, allowUnprotectedTxs, enableCreate, enableCall bool, config ChainConfig, extraEIPs ExtraEIPs) Params {
|
func NewParams(evmDenom string, allowUnprotectedTxs, enableCreate, enableCall bool, config ChainConfig, extraEIPs ExtraEIPs) Params {
|
||||||
return Params{
|
return Params{
|
||||||
@ -81,6 +87,18 @@ func DefaultParams() Params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParamSetPairs returns the parameter set pairs.
|
||||||
|
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||||
|
return paramtypes.ParamSetPairs{
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyEVMDenom, &p.EvmDenom, validateEVMDenom),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyEnableCreate, &p.EnableCreate, validateBool),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyEnableCall, &p.EnableCall, validateBool),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyExtraEIPs, &p.ExtraEIPs.EIPs, validateEIPs),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyAllowUnprotectedTxs, &p.AllowUnprotectedTxs, validateBool),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Validate performs basic validation on evm parameters.
|
// Validate performs basic validation on evm parameters.
|
||||||
func (p Params) Validate() error {
|
func (p Params) Validate() error {
|
||||||
if err := validateEVMDenom(p.EvmDenom); err != nil {
|
if err := validateEVMDenom(p.EvmDenom); err != nil {
|
||||||
|
125
x/evm/types/tx.pb.go
generated
125
x/evm/types/tx.pb.go
generated
@ -454,69 +454,68 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) }
|
func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) }
|
||||||
|
|
||||||
var fileDescriptor_f75ac0a12d075f21 = []byte{
|
var fileDescriptor_f75ac0a12d075f21 = []byte{
|
||||||
// 990 bytes of a gzipped FileDescriptorProto
|
// 975 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x8f, 0xdb, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x8f, 0xdb, 0xc4,
|
||||||
0x14, 0x5f, 0x27, 0xce, 0xbf, 0x49, 0x58, 0xaa, 0xd1, 0x56, 0x75, 0x22, 0x1a, 0xa7, 0x96, 0xa0,
|
0x17, 0x8f, 0x13, 0xe7, 0xd7, 0x24, 0xdf, 0xfd, 0x56, 0xa3, 0xad, 0xea, 0x44, 0x34, 0x0e, 0x96,
|
||||||
0x69, 0xa5, 0xd8, 0xea, 0x82, 0x7a, 0xd8, 0x53, 0x37, 0xdd, 0x6d, 0xd5, 0x6a, 0x57, 0x54, 0x26,
|
0x80, 0xb4, 0x52, 0x6c, 0x75, 0x41, 0x3d, 0xec, 0xa9, 0x9b, 0xee, 0xb6, 0x6a, 0xb5, 0x2b, 0x2a,
|
||||||
0xbd, 0xd0, 0x43, 0x34, 0xeb, 0xcc, 0x4e, 0x2c, 0x62, 0x8f, 0xe5, 0x19, 0x5b, 0x09, 0x12, 0x97,
|
0x93, 0x5e, 0x28, 0x52, 0x34, 0x6b, 0xcf, 0x4e, 0x2c, 0x62, 0x8f, 0xe5, 0x99, 0x58, 0x09, 0x12,
|
||||||
0x4a, 0x48, 0x1c, 0x90, 0x00, 0xf1, 0x05, 0x38, 0x70, 0xe2, 0x84, 0x44, 0x3f, 0x00, 0xc7, 0x8a,
|
0x97, 0x9e, 0xb8, 0x01, 0xe2, 0x1f, 0xe0, 0xc0, 0x89, 0x13, 0x12, 0xfd, 0x03, 0x38, 0x56, 0x9c,
|
||||||
0x53, 0x05, 0x17, 0xc4, 0x21, 0xa0, 0x2c, 0x12, 0xd2, 0xde, 0xe0, 0x13, 0xa0, 0x99, 0x71, 0x36,
|
0x2a, 0xb8, 0x20, 0x0e, 0x01, 0x65, 0x91, 0x90, 0xf6, 0x06, 0x7f, 0x01, 0x9a, 0x19, 0x67, 0xb3,
|
||||||
0x9b, 0x86, 0x6d, 0xa1, 0x14, 0x71, 0xf2, 0xbc, 0x79, 0x6f, 0xde, 0x7b, 0xf3, 0xfb, 0xfd, 0x66,
|
0x69, 0xd8, 0x16, 0x4a, 0x11, 0x27, 0xcf, 0x9b, 0xf7, 0xe6, 0xbd, 0x37, 0x9f, 0xcf, 0x67, 0x66,
|
||||||
0xc6, 0xa0, 0x8e, 0xf9, 0x10, 0xc7, 0x81, 0x1f, 0x72, 0x07, 0xa7, 0x81, 0x93, 0x5e, 0x73, 0xf8,
|
0x0c, 0x1a, 0x98, 0x0f, 0x71, 0x12, 0x06, 0x11, 0x77, 0x70, 0x1a, 0x3a, 0xe9, 0x35, 0x87, 0x4f,
|
||||||
0xd8, 0x8e, 0x62, 0xca, 0x29, 0x3c, 0x77, 0xe2, 0xb2, 0x71, 0x1a, 0xd8, 0xe9, 0xb5, 0xc6, 0x05,
|
0xec, 0x38, 0xa1, 0x9c, 0xc2, 0x0b, 0xa7, 0x2e, 0x1b, 0xa7, 0xa1, 0x9d, 0x5e, 0x6b, 0x5e, 0xf2,
|
||||||
0x8f, 0xb2, 0x80, 0x32, 0x27, 0x60, 0x44, 0x44, 0x06, 0x8c, 0xa8, 0xd0, 0x46, 0x5d, 0x39, 0xfa,
|
0x28, 0x0b, 0x29, 0x73, 0x42, 0x46, 0x44, 0x64, 0xc8, 0x88, 0x0a, 0x6d, 0x36, 0x94, 0x63, 0x20,
|
||||||
0xd2, 0x72, 0x94, 0x91, 0xb9, 0x1a, 0x2b, 0x05, 0x44, 0x32, 0xe5, 0xdb, 0x20, 0x94, 0x50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17, 0x1a, 0xb8, 0xb8, 0xf2, 0x44, 0xb8, 0x98, 0xc5, 0x34, 0x62, 0x72, 0xa3, 0xf2, 0x96,
|
||||||
0xbc, 0xa6, 0x2e, 0x71, 0x79, 0xb1, 0x5f, 0x01, 0xfa, 0x88, 0x12, 0x66, 0xe4, 0xe4, 0x26, 0xcf,
|
0xd7, 0xd4, 0x25, 0x2e, 0x2f, 0xf6, 0x2b, 0x40, 0x1f, 0x51, 0xc2, 0x8c, 0xbc, 0xdc, 0xe4, 0xc5,
|
||||||
0xaf, 0x6e, 0x72, 0x8f, 0x12, 0x57, 0x86, 0xc0, 0x73, 0x20, 0x1f, 0x63, 0x2e, 0x35, 0x53, 0x73,
|
0xf5, 0x4d, 0xee, 0x53, 0xe2, 0xca, 0x10, 0x78, 0x01, 0x14, 0x12, 0xcc, 0xa5, 0x66, 0xea, 0xae,
|
||||||
0xc5, 0x10, 0xd6, 0x41, 0x39, 0x0d, 0xfa, 0x38, 0x8e, 0x69, 0x9c, 0xdd, 0xba, 0xa5, 0x34, 0xd8,
|
0x18, 0xc2, 0x06, 0xa8, 0xa4, 0xe1, 0x00, 0x27, 0x09, 0x4d, 0xb2, 0x5b, 0xb7, 0x9c, 0x86, 0x7b,
|
||||||
0x15, 0xa6, 0x70, 0x09, 0x71, 0x24, 0x0c, 0x0f, 0x14, 0xab, 0x6e, 0x89, 0x20, 0x76, 0x9f, 0xe1,
|
0xc2, 0x14, 0x2e, 0x21, 0x8e, 0x31, 0xc3, 0xbe, 0x62, 0xd5, 0x2d, 0x13, 0xc4, 0xee, 0x33, 0xec,
|
||||||
0x41, 0xd6, 0xe6, 0x67, 0x1a, 0x78, 0x75, 0x9f, 0x91, 0xfb, 0xd1, 0x00, 0x71, 0x7c, 0x0f, 0xc5,
|
0x67, 0x6d, 0x7e, 0xaa, 0x81, 0xff, 0x1f, 0x30, 0x72, 0x3f, 0xf6, 0x11, 0xc7, 0xf7, 0x50, 0x82,
|
||||||
0x28, 0x60, 0xf0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 0x85, 0x8b, 0x54, 0x63, 0x99, 0x4c, 0x1e, 0xc5, 0x83, 0xa2, 0xfc, 0x43, 0x79, 0xf3,
|
0xe6, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xf3, 0xe0, 0xc6, 0x74, 0x09, 0x00, 0x00,
|
||||||
0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x20, 0xbe, 0xf3, 0x9e, 0x09, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
83
x/evm/types/tx.pb.gw.go
generated
83
x/evm/types/tx.pb.gw.go
generated
@ -69,42 +69,6 @@ func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marsh
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
)
|
|
||||||
|
|
||||||
func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq MsgUpdateParams
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_UpdateParams_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq MsgUpdateParams
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_UpdateParams_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.UpdateParams(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
|
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
|
||||||
// UnaryRPC :call MsgServer directly.
|
// UnaryRPC :call MsgServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
@ -134,29 +98,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle("POST", pattern_Msg_UpdateParams_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 {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_Msg_UpdateParams_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)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,37 +159,13 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_Msg_UpdateParams_0(rctx, inboundMarshaler, client, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
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(false)))
|
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)))
|
||||||
|
|
||||||
pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "update_params"}, "", runtime.AssumeColonVerbOpt(false)))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
forward_Msg_EthereumTx_0 = runtime.ForwardResponseMessage
|
forward_Msg_EthereumTx_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage
|
|
||||||
)
|
)
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
|
|
||||||
"github.com/evmos/ethermint/x/feemarket/types"
|
"github.com/evmos/ethermint/x/feemarket/types"
|
||||||
@ -38,11 +39,13 @@ type Keeper struct {
|
|||||||
transientKey storetypes.StoreKey
|
transientKey storetypes.StoreKey
|
||||||
// the address capable of executing a MsgUpdateParams message. Typically, this should be the x/gov module account.
|
// the address capable of executing a MsgUpdateParams message. Typically, this should be the x/gov module account.
|
||||||
authority sdk.AccAddress
|
authority sdk.AccAddress
|
||||||
|
// Legacy subspace
|
||||||
|
ss paramstypes.Subspace
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKeeper generates new fee market module keeper
|
// NewKeeper generates new fee market module keeper
|
||||||
func NewKeeper(
|
func NewKeeper(
|
||||||
cdc codec.BinaryCodec, authority sdk.AccAddress, storeKey, transientKey storetypes.StoreKey,
|
cdc codec.BinaryCodec, authority sdk.AccAddress, storeKey, transientKey storetypes.StoreKey, ss paramstypes.Subspace,
|
||||||
) Keeper {
|
) Keeper {
|
||||||
// ensure authority account is correctly formatted
|
// ensure authority account is correctly formatted
|
||||||
if err := sdk.VerifyAddressFormat(authority); err != nil {
|
if err := sdk.VerifyAddressFormat(authority); err != nil {
|
||||||
@ -54,6 +57,7 @@ func NewKeeper(
|
|||||||
storeKey: storeKey,
|
storeKey: storeKey,
|
||||||
authority: authority,
|
authority: authority,
|
||||||
transientKey: transientKey,
|
transientKey: transientKey,
|
||||||
|
ss: ss,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,24 +3,23 @@ package keeper_test
|
|||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
|
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
|
||||||
v4types "github.com/evmos/ethermint/x/feemarket/migrations/v4/types"
|
|
||||||
"github.com/evmos/ethermint/x/feemarket/types"
|
"github.com/evmos/ethermint/x/feemarket/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockSubspace struct {
|
type mockSubspace struct {
|
||||||
ps v4types.Params
|
ps types.Params
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockSubspace(ps v4types.Params) mockSubspace {
|
func newMockSubspace(ps types.Params) mockSubspace {
|
||||||
return mockSubspace{ps: ps}
|
return mockSubspace{ps: ps}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) {
|
func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) {
|
||||||
*ps.(*v4types.Params) = ms.ps
|
*ps.(*types.Params) = ms.ps
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) TestMigrations() {
|
func (suite *KeeperTestSuite) TestMigrations() {
|
||||||
legacySubspace := newMockSubspace(v4types.DefaultParams())
|
legacySubspace := newMockSubspace(types.DefaultParams())
|
||||||
migrator := feemarketkeeper.NewMigrator(suite.app.FeeMarketKeeper, legacySubspace)
|
migrator := feemarketkeeper.NewMigrator(suite.app.FeeMarketKeeper, legacySubspace)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
@ -28,7 +28,9 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
|||||||
store := ctx.KVStore(k.storeKey)
|
store := ctx.KVStore(k.storeKey)
|
||||||
bz := store.Get(types.ParamsKey)
|
bz := store.Get(types.ParamsKey)
|
||||||
if len(bz) == 0 {
|
if len(bz) == 0 {
|
||||||
return params
|
var p types.Params
|
||||||
|
k.ss.GetParamSetIfExists(ctx, &p)
|
||||||
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
k.cdc.MustUnmarshal(bz, ¶ms)
|
k.cdc.MustUnmarshal(bz, ¶ms)
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
v4types "github.com/evmos/ethermint/x/feemarket/migrations/v4/types"
|
|
||||||
"github.com/evmos/ethermint/x/feemarket/types"
|
"github.com/evmos/ethermint/x/feemarket/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ func MigrateStore(
|
|||||||
) error {
|
) error {
|
||||||
var (
|
var (
|
||||||
store = ctx.KVStore(storeKey)
|
store = ctx.KVStore(storeKey)
|
||||||
params v4types.Params
|
params types.Params
|
||||||
)
|
)
|
||||||
|
|
||||||
legacySubspace.GetParamSetIfExists(ctx, ¶ms)
|
legacySubspace.GetParamSetIfExists(ctx, ¶ms)
|
||||||
|
@ -8,25 +8,24 @@ import (
|
|||||||
"github.com/evmos/ethermint/app"
|
"github.com/evmos/ethermint/app"
|
||||||
"github.com/evmos/ethermint/encoding"
|
"github.com/evmos/ethermint/encoding"
|
||||||
v4 "github.com/evmos/ethermint/x/feemarket/migrations/v4"
|
v4 "github.com/evmos/ethermint/x/feemarket/migrations/v4"
|
||||||
v4types "github.com/evmos/ethermint/x/feemarket/migrations/v4/types"
|
|
||||||
"github.com/evmos/ethermint/x/feemarket/types"
|
"github.com/evmos/ethermint/x/feemarket/types"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockSubspace struct {
|
type mockSubspace struct {
|
||||||
ps v4types.Params
|
ps types.Params
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockSubspaceEmpty() mockSubspace {
|
func newMockSubspaceEmpty() mockSubspace {
|
||||||
return mockSubspace{}
|
return mockSubspace{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockSubspace(ps v4types.Params) mockSubspace {
|
func newMockSubspace(ps types.Params) mockSubspace {
|
||||||
return mockSubspace{ps: ps}
|
return mockSubspace{ps: ps}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) {
|
func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) {
|
||||||
*ps.(*v4types.Params) = ms.ps
|
*ps.(*types.Params) = ms.ps
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMigrate(t *testing.T) {
|
func TestMigrate(t *testing.T) {
|
||||||
@ -41,11 +40,11 @@ func TestMigrate(t *testing.T) {
|
|||||||
legacySubspaceEmpty := newMockSubspaceEmpty()
|
legacySubspaceEmpty := newMockSubspaceEmpty()
|
||||||
require.Error(t, v4.MigrateStore(ctx, storeKey, legacySubspaceEmpty, cdc))
|
require.Error(t, v4.MigrateStore(ctx, storeKey, legacySubspaceEmpty, cdc))
|
||||||
|
|
||||||
legacySubspace := newMockSubspace(v4types.DefaultParams())
|
legacySubspace := newMockSubspace(types.DefaultParams())
|
||||||
require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc))
|
require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc))
|
||||||
|
|
||||||
paramsBz := kvStore.Get(v4types.ParamsKey)
|
paramsBz := kvStore.Get(types.ParamsKey)
|
||||||
var params v4types.Params
|
var params types.Params
|
||||||
cdc.MustUnmarshal(paramsBz, ¶ms)
|
cdc.MustUnmarshal(paramsBz, ¶ms)
|
||||||
|
|
||||||
require.Equal(t, params, legacySubspace.ps)
|
require.Equal(t, params, legacySubspace.ps)
|
||||||
|
546
x/feemarket/types/events.pb.go
generated
Normal file
546
x/feemarket/types/events.pb.go
generated
Normal file
@ -0,0 +1,546 @@
|
|||||||
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
|
// source: ethermint/feemarket/v1/events.proto
|
||||||
|
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/gogo/protobuf/proto"
|
||||||
|
io "io"
|
||||||
|
math "math"
|
||||||
|
math_bits "math/bits"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
// EventFeeMarket is the event type for the fee market module
|
||||||
|
type EventFeeMarket struct {
|
||||||
|
// base_fee for EIP-1559 blocks
|
||||||
|
BaseFee string `protobuf:"bytes,1,opt,name=base_fee,json=baseFee,proto3" json:"base_fee,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventFeeMarket) Reset() { *m = EventFeeMarket{} }
|
||||||
|
func (m *EventFeeMarket) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EventFeeMarket) ProtoMessage() {}
|
||||||
|
func (*EventFeeMarket) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_c6edce8d670faff7, []int{0}
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_EventFeeMarket.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EventFeeMarket.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EventFeeMarket.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EventFeeMarket proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EventFeeMarket) GetBaseFee() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.BaseFee
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// EventBlockGas defines an Ethereum block gas event
|
||||||
|
type EventBlockGas struct {
|
||||||
|
// height of the block
|
||||||
|
Height string `protobuf:"bytes,1,opt,name=height,proto3" json:"height,omitempty"`
|
||||||
|
// amount of gas wanted by the block
|
||||||
|
Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventBlockGas) Reset() { *m = EventBlockGas{} }
|
||||||
|
func (m *EventBlockGas) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EventBlockGas) ProtoMessage() {}
|
||||||
|
func (*EventBlockGas) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_c6edce8d670faff7, []int{1}
|
||||||
|
}
|
||||||
|
func (m *EventBlockGas) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *EventBlockGas) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_EventBlockGas.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *EventBlockGas) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EventBlockGas.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EventBlockGas) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *EventBlockGas) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EventBlockGas.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EventBlockGas proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EventBlockGas) GetHeight() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Height
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventBlockGas) GetAmount() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Amount
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*EventFeeMarket)(nil), "ethermint.feemarket.v1.EventFeeMarket")
|
||||||
|
proto.RegisterType((*EventBlockGas)(nil), "ethermint.feemarket.v1.EventBlockGas")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("ethermint/feemarket/v1/events.proto", fileDescriptor_c6edce8d670faff7)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_c6edce8d670faff7 = []byte{
|
||||||
|
// 212 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x2d, 0xc9, 0x48,
|
||||||
|
0x2d, 0xca, 0xcd, 0xcc, 0x2b, 0xd1, 0x4f, 0x4b, 0x4d, 0xcd, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1,
|
||||||
|
0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
|
||||||
|
0x12, 0x83, 0x2b, 0xd2, 0x83, 0x2b, 0xd2, 0x2b, 0x33, 0x54, 0xd2, 0xe6, 0xe2, 0x73, 0x05, 0xa9,
|
||||||
|
0x73, 0x4b, 0x4d, 0xf5, 0x05, 0x0b, 0x0a, 0x49, 0x72, 0x71, 0x24, 0x25, 0x16, 0xa7, 0xc6, 0xa7,
|
||||||
|
0xa5, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xb1, 0x83, 0xf8, 0x6e, 0xa9, 0xa9, 0x4a,
|
||||||
|
0xf6, 0x5c, 0xbc, 0x60, 0xc5, 0x4e, 0x39, 0xf9, 0xc9, 0xd9, 0xee, 0x89, 0xc5, 0x42, 0x62, 0x5c,
|
||||||
|
0x6c, 0x19, 0xa9, 0x99, 0xe9, 0x19, 0x25, 0x50, 0x95, 0x50, 0x1e, 0x48, 0x3c, 0x31, 0x37, 0xbf,
|
||||||
|
0x34, 0xaf, 0x44, 0x82, 0x09, 0x22, 0x0e, 0xe1, 0x39, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1,
|
||||||
|
0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70,
|
||||||
|
0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae,
|
||||||
|
0x7e, 0x6a, 0x59, 0x6e, 0x7e, 0xb1, 0x3e, 0xc2, 0x57, 0x15, 0x48, 0xfe, 0x2a, 0xa9, 0x2c, 0x48,
|
||||||
|
0x2d, 0x4e, 0x62, 0x03, 0x7b, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x52, 0xc3, 0x38,
|
||||||
|
0xfb, 0x00, 0x00, 0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventFeeMarket) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventFeeMarket) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventFeeMarket) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.BaseFee) > 0 {
|
||||||
|
i -= len(m.BaseFee)
|
||||||
|
copy(dAtA[i:], m.BaseFee)
|
||||||
|
i = encodeVarintEvents(dAtA, i, uint64(len(m.BaseFee)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventBlockGas) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventBlockGas) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventBlockGas) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Amount) > 0 {
|
||||||
|
i -= len(m.Amount)
|
||||||
|
copy(dAtA[i:], m.Amount)
|
||||||
|
i = encodeVarintEvents(dAtA, i, uint64(len(m.Amount)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
if len(m.Height) > 0 {
|
||||||
|
i -= len(m.Height)
|
||||||
|
copy(dAtA[i:], m.Height)
|
||||||
|
i = encodeVarintEvents(dAtA, i, uint64(len(m.Height)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
|
||||||
|
offset -= sovEvents(v)
|
||||||
|
base := offset
|
||||||
|
for v >= 1<<7 {
|
||||||
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
v >>= 7
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
return base
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.BaseFee)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovEvents(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EventBlockGas) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Height)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovEvents(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Amount)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovEvents(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func sovEvents(x uint64) (n int) {
|
||||||
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
|
}
|
||||||
|
func sozEvents(x uint64) (n int) {
|
||||||
|
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
|
}
|
||||||
|
func (m *EventFeeMarket) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: EventFeeMarket: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: EventFeeMarket: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.BaseFee = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipEvents(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *EventBlockGas) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: EventBlockGas: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: EventBlockGas: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Height = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Amount = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipEvents(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func skipEvents(dAtA []byte) (n int, err error) {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
depth := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
switch wireType {
|
||||||
|
case 0:
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx++
|
||||||
|
if dAtA[iNdEx-1] < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
iNdEx += 8
|
||||||
|
case 2:
|
||||||
|
var length int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowEvents
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
length |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if length < 0 {
|
||||||
|
return 0, ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
iNdEx += length
|
||||||
|
case 3:
|
||||||
|
depth++
|
||||||
|
case 4:
|
||||||
|
if depth == 0 {
|
||||||
|
return 0, ErrUnexpectedEndOfGroupEvents
|
||||||
|
}
|
||||||
|
depth--
|
||||||
|
case 5:
|
||||||
|
iNdEx += 4
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||||
|
}
|
||||||
|
if iNdEx < 0 {
|
||||||
|
return 0, ErrInvalidLengthEvents
|
||||||
|
}
|
||||||
|
if depth == 0 {
|
||||||
|
return iNdEx, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||||
|
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
|
||||||
|
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
|
||||||
|
)
|
@ -20,11 +20,10 @@ import (
|
|||||||
|
|
||||||
sdkmath "cosmossdk.io/math"
|
sdkmath "cosmossdk.io/math"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ParamsKey = []byte("Params")
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// DefaultMinGasMultiplier is 0.5 or 50%
|
// DefaultMinGasMultiplier is 0.5 or 50%
|
||||||
DefaultMinGasMultiplier = sdk.NewDecWithPrec(50, 2)
|
DefaultMinGasMultiplier = sdk.NewDecWithPrec(50, 2)
|
||||||
@ -36,6 +35,36 @@ var (
|
|||||||
DefaultNoBaseFee = false
|
DefaultNoBaseFee = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Parameter keys
|
||||||
|
var (
|
||||||
|
ParamsKey = []byte("Params")
|
||||||
|
ParamStoreKeyNoBaseFee = []byte("NoBaseFee")
|
||||||
|
ParamStoreKeyBaseFeeChangeDenominator = []byte("BaseFeeChangeDenominator")
|
||||||
|
ParamStoreKeyElasticityMultiplier = []byte("ElasticityMultiplier")
|
||||||
|
ParamStoreKeyBaseFee = []byte("BaseFee")
|
||||||
|
ParamStoreKeyEnableHeight = []byte("EnableHeight")
|
||||||
|
ParamStoreKeyMinGasPrice = []byte("MinGasPrice")
|
||||||
|
ParamStoreKeyMinGasMultiplier = []byte("MinGasMultiplier")
|
||||||
|
)
|
||||||
|
|
||||||
|
// ParamKeyTable returns the parameter key table.
|
||||||
|
func ParamKeyTable() paramtypes.KeyTable {
|
||||||
|
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParamSetPairs returns the parameter set pairs.
|
||||||
|
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||||
|
return paramtypes.ParamSetPairs{
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyNoBaseFee, &p.NoBaseFee, validateBool),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyBaseFeeChangeDenominator, &p.BaseFeeChangeDenominator, validateBaseFeeChangeDenominator),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyElasticityMultiplier, &p.ElasticityMultiplier, validateElasticityMultiplier),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyBaseFee, &p.BaseFee, validateBaseFee),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyEnableHeight, &p.EnableHeight, validateEnableHeight),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyMinGasPrice, &p.MinGasPrice, validateMinGasPrice),
|
||||||
|
paramtypes.NewParamSetPair(ParamStoreKeyMinGasMultiplier, &p.MinGasMultiplier, validateMinGasPrice),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NewParams creates a new Params instance
|
// NewParams creates a new Params instance
|
||||||
func NewParams(
|
func NewParams(
|
||||||
noBaseFee bool,
|
noBaseFee bool,
|
||||||
@ -91,6 +120,14 @@ func (p Params) Validate() error {
|
|||||||
return validateMinGasPrice(p.MinGasPrice)
|
return validateMinGasPrice(p.MinGasPrice)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func validateBool(i interface{}) error {
|
||||||
|
_, ok := i.(bool)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("invalid parameter type: %T", i)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Params) IsBaseFeeEnabled(height int64) bool {
|
func (p *Params) IsBaseFeeEnabled(height int64) bool {
|
||||||
return !p.NoBaseFee && height >= p.EnableHeight
|
return !p.NoBaseFee && height >= p.EnableHeight
|
||||||
}
|
}
|
||||||
@ -113,6 +150,53 @@ func validateMinGasPrice(i interface{}) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func validateBaseFeeChangeDenominator(i interface{}) error {
|
||||||
|
value, ok := i.(uint32)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("invalid parameter type: %T", i)
|
||||||
|
}
|
||||||
|
|
||||||
|
if value == 0 {
|
||||||
|
return fmt.Errorf("base fee change denominator cannot be 0")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateElasticityMultiplier(i interface{}) error {
|
||||||
|
_, ok := i.(uint32)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("invalid parameter type: %T", i)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateBaseFee(i interface{}) error {
|
||||||
|
value, ok := i.(sdkmath.Int)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("invalid parameter type: %T", i)
|
||||||
|
}
|
||||||
|
|
||||||
|
if value.IsNegative() {
|
||||||
|
return fmt.Errorf("base fee cannot be negative")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateEnableHeight(i interface{}) error {
|
||||||
|
value, ok := i.(int64)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("invalid parameter type: %T", i)
|
||||||
|
}
|
||||||
|
|
||||||
|
if value < 0 {
|
||||||
|
return fmt.Errorf("enable height cannot be negative: %d", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func validateMinGasMultiplier(i interface{}) error {
|
func validateMinGasMultiplier(i interface{}) error {
|
||||||
v, ok := i.(sdk.Dec)
|
v, ok := i.(sdk.Dec)
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
sdkmath "cosmossdk.io/math"
|
sdkmath "cosmossdk.io/math"
|
||||||
@ -18,61 +17,6 @@ func TestParamsTestSuite(t *testing.T) {
|
|||||||
suite.Run(t, new(ParamsTestSuite))
|
suite.Run(t, new(ParamsTestSuite))
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateElasticityMultiplier(i interface{}) error {
|
|
||||||
_, ok := i.(uint32)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("invalid parameter type: %T", i)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateBaseFeeChangeDenominator(i interface{}) error {
|
|
||||||
value, ok := i.(uint32)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("invalid parameter type: %T", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
if value == 0 {
|
|
||||||
return fmt.Errorf("base fee change denominator cannot be 0")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateEnableHeight(i interface{}) error {
|
|
||||||
value, ok := i.(int64)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("invalid parameter type: %T", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
if value < 0 {
|
|
||||||
return fmt.Errorf("enable height cannot be negative: %d", value)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateBool(i interface{}) error {
|
|
||||||
_, ok := i.(bool)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("invalid parameter type: %T", i)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateBaseFee(i interface{}) error {
|
|
||||||
value, ok := i.(sdkmath.Int)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("invalid parameter type: %T", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
if value.IsNegative() {
|
|
||||||
return fmt.Errorf("base fee cannot be negative")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (suite *ParamsTestSuite) TestParamsValidate() {
|
func (suite *ParamsTestSuite) TestParamsValidate() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
|
Loading…
Reference in New Issue
Block a user