forked from cerc-io/laconicd-deprecated
* refactor(params): store all params under one key in evm module (#1617) * refactor(params): store all params under one key in evm module * refactor(params): add changelog entry * refactor(params): update based on review comments. Remove params getter functions * refactor(params): refactor params store key * refactor(params): remove unnecessary store keys * refactor(params): add paramSetPairs for backwards compatibility * Update CHANGELOG.md * refactor(params): add license to params_legacy file * Apply suggestions from code review * fix(evm): handle RC1 params during migration (#1624) * fix(evm): handle RC1 params during migration * migration * fix: test case updated for RC1 * v5 migration * tests * tests pt2 * comment * execute make proto-all Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> Co-authored-by: MalteHerrmann <malte@evmos.org> * Apply suggestions from code review * rm dup vars Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> Co-authored-by: MalteHerrmann <malte@evmos.org> (cherry picked from commit f07b14f1c409a6b738a0fadb50c9ba47d56cb821) # Conflicts: # CHANGELOG.md * update changelog Co-authored-by: Tomas Guerra <54514587+GAtom22@users.noreply.github.com> Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: MalteHerrmann <malte@evmos.org>
This commit is contained in:
co-authored by
Tomas Guerra
MalteHerrmann
MalteHerrmann
parent
00b0d4411f
commit
4f48176298
+3
-2
@@ -149,7 +149,8 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
|
||||
return next(newCtx, tx, simulate)
|
||||
}
|
||||
|
||||
chainCfg := egcd.evmKeeper.GetChainConfig(ctx)
|
||||
evmParams := egcd.evmKeeper.GetParams(ctx)
|
||||
chainCfg := evmParams.GetChainConfig()
|
||||
ethCfg := chainCfg.EthereumConfig(egcd.evmKeeper.ChainID())
|
||||
|
||||
blockHeight := big.NewInt(ctx.BlockHeight())
|
||||
@@ -183,7 +184,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
|
||||
gasWanted += txData.GetGas()
|
||||
}
|
||||
|
||||
evmDenom := egcd.evmKeeper.GetEVMDenom(ctx)
|
||||
evmDenom := evmParams.GetEvmDenom()
|
||||
|
||||
fees, err := keeper.VerifyFee(txData, evmDenom, baseFee, homestead, istanbul, ctx.IsCheckTx())
|
||||
if err != nil {
|
||||
|
||||
@@ -42,7 +42,8 @@ func NewGasWantedDecorator(
|
||||
}
|
||||
|
||||
func (gwd GasWantedDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
|
||||
chainCfg := gwd.evmKeeper.GetChainConfig(ctx)
|
||||
evmParams := gwd.evmKeeper.GetParams(ctx)
|
||||
chainCfg := evmParams.GetChainConfig()
|
||||
ethCfg := chainCfg.EthereumConfig(gwd.evmKeeper.ChainID())
|
||||
|
||||
blockHeight := big.NewInt(ctx.BlockHeight())
|
||||
|
||||
+7
-5
@@ -88,8 +88,8 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
|
||||
if minGasPrice.IsZero() || simulate {
|
||||
return next(ctx, tx, simulate)
|
||||
}
|
||||
|
||||
evmDenom := mpd.evmKeeper.GetEVMDenom(ctx)
|
||||
evmParams := mpd.evmKeeper.GetParams(ctx)
|
||||
evmDenom := evmParams.GetEvmDenom()
|
||||
minGasPrices := sdk.DecCoins{
|
||||
{
|
||||
Denom: evmDenom,
|
||||
@@ -133,7 +133,8 @@ func (empd EthMinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul
|
||||
return next(ctx, tx, simulate)
|
||||
}
|
||||
|
||||
chainCfg := empd.evmKeeper.GetChainConfig(ctx)
|
||||
evmParams := empd.evmKeeper.GetParams(ctx)
|
||||
chainCfg := evmParams.GetChainConfig()
|
||||
ethCfg := chainCfg.EthereumConfig(empd.evmKeeper.ChainID())
|
||||
baseFee := empd.evmKeeper.GetBaseFee(ctx, ethCfg)
|
||||
|
||||
@@ -191,7 +192,8 @@ func (mfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat
|
||||
if !ctx.IsCheckTx() || simulate {
|
||||
return next(ctx, tx, simulate)
|
||||
}
|
||||
chainCfg := mfd.evmKeeper.GetChainConfig(ctx)
|
||||
evmParams := mfd.evmKeeper.GetParams(ctx)
|
||||
chainCfg := evmParams.GetChainConfig()
|
||||
ethCfg := chainCfg.EthereumConfig(mfd.evmKeeper.ChainID())
|
||||
|
||||
baseFee := mfd.evmKeeper.GetBaseFee(ctx, ethCfg)
|
||||
@@ -200,7 +202,7 @@ func (mfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat
|
||||
return next(ctx, tx, simulate)
|
||||
}
|
||||
|
||||
evmDenom := mfd.evmKeeper.GetEVMDenom(ctx)
|
||||
evmDenom := evmParams.GetEvmDenom()
|
||||
minGasPrice := ctx.MinGasPrices().AmountOf(evmDenom)
|
||||
|
||||
for _, msg := range tx.GetMsgs() {
|
||||
|
||||
@@ -49,11 +49,7 @@ type EVMKeeper interface {
|
||||
GetBalance(ctx sdk.Context, addr common.Address) *big.Int
|
||||
ResetTransientGasUsed(ctx sdk.Context)
|
||||
GetTxIndexTransient(ctx sdk.Context) uint64
|
||||
GetChainConfig(ctx sdk.Context) evmtypes.ChainConfig
|
||||
GetAllowUnprotectedTxs(ctx sdk.Context) bool
|
||||
GetEVMDenom(ctx sdk.Context) string
|
||||
GetEnableCall(ctx sdk.Context) bool
|
||||
GetEnableCreate(ctx sdk.Context) bool
|
||||
GetParams(ctx sdk.Context) evmtypes.Params
|
||||
}
|
||||
|
||||
type protoTxProvider interface {
|
||||
|
||||
+5
-4
@@ -152,13 +152,14 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
|
||||
txFee := sdk.Coins{}
|
||||
txGasLimit := uint64(0)
|
||||
|
||||
chainCfg := vbd.evmKeeper.GetChainConfig(ctx)
|
||||
evmParams := vbd.evmKeeper.GetParams(ctx)
|
||||
chainCfg := evmParams.GetChainConfig()
|
||||
chainID := vbd.evmKeeper.ChainID()
|
||||
ethCfg := chainCfg.EthereumConfig(chainID)
|
||||
baseFee := vbd.evmKeeper.GetBaseFee(ctx, ethCfg)
|
||||
enableCreate := vbd.evmKeeper.GetEnableCreate(ctx)
|
||||
enableCall := vbd.evmKeeper.GetEnableCall(ctx)
|
||||
evmDenom := vbd.evmKeeper.GetEVMDenom(ctx)
|
||||
enableCreate := evmParams.GetEnableCreate()
|
||||
enableCall := evmParams.GetEnableCall()
|
||||
evmDenom := evmParams.GetEvmDenom()
|
||||
|
||||
for _, msg := range protoTx.GetMsgs() {
|
||||
msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx)
|
||||
|
||||
@@ -44,7 +44,8 @@ func NewEthSigVerificationDecorator(ek EVMKeeper) EthSigVerificationDecorator {
|
||||
// won't see the error message.
|
||||
func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
|
||||
chainID := esvd.evmKeeper.ChainID()
|
||||
chainCfg := esvd.evmKeeper.GetChainConfig(ctx)
|
||||
evmParams := esvd.evmKeeper.GetParams(ctx)
|
||||
chainCfg := evmParams.GetChainConfig()
|
||||
ethCfg := chainCfg.EthereumConfig(chainID)
|
||||
blockNum := big.NewInt(ctx.BlockHeight())
|
||||
signer := ethtypes.MakeSigner(ethCfg, blockNum)
|
||||
@@ -55,7 +56,7 @@ func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, s
|
||||
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil))
|
||||
}
|
||||
|
||||
allowUnprotectedTxs := esvd.evmKeeper.GetAllowUnprotectedTxs(ctx)
|
||||
allowUnprotectedTxs := evmParams.GetAllowUnprotectedTxs()
|
||||
ethTx := msgEthTx.AsTransaction()
|
||||
if !allowUnprotectedTxs && !ethTx.Protected() {
|
||||
return ctx, errorsmod.Wrapf(
|
||||
|
||||
+1
-1
@@ -863,7 +863,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
|
||||
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
||||
paramsKeeper.Subspace(ibchost.ModuleName)
|
||||
// ethermint subspaces
|
||||
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable())
|
||||
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint: staticcheck
|
||||
paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable())
|
||||
return paramsKeeper
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user