@@ -40,10 +40,8 @@ func NewEthSigVerificationDecorator(ek EVMKeeper) EthSigVerificationDecorator {
40
40
// won't see the error message.
41
41
func (esvd EthSigVerificationDecorator ) AnteHandle (ctx sdk.Context , tx sdk.Tx , simulate bool , next sdk.AnteHandler ) (newCtx sdk.Context , err error ) {
42
42
chainID := esvd .evmKeeper .ChainID ()
43
-
44
- params := esvd .evmKeeper .GetParams (ctx )
45
-
46
- ethCfg := params .ChainConfig .EthereumConfig (chainID )
43
+ chainCfg := esvd .evmKeeper .GetChainConfig (ctx )
44
+ ethCfg := chainCfg .EthereumConfig (chainID )
47
45
blockNum := big .NewInt (ctx .BlockHeight ())
48
46
signer := ethtypes .MakeSigner (ethCfg , blockNum )
49
47
@@ -53,8 +51,9 @@ func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, s
53
51
return ctx , sdkerrors .Wrapf (sdkerrors .ErrUnknownRequest , "invalid message type %T, expected %T" , msg , (* evmtypes .MsgEthereumTx )(nil ))
54
52
}
55
53
54
+ allowUnprotectedTxs := esvd .evmKeeper .GetAllowUnprotectedTxs (ctx )
56
55
ethTx := msgEthTx .AsTransaction ()
57
- if ! params . AllowUnprotectedTxs && ! ethTx .Protected () {
56
+ if ! allowUnprotectedTxs && ! ethTx .Protected () {
58
57
return ctx , sdkerrors .Wrapf (
59
58
sdkerrors .ErrNotSupported ,
60
59
"rejected unprotected Ethereum txs. Please EIP155 sign your transaction to protect it against replay-attacks" )
@@ -176,15 +175,13 @@ func NewEthGasConsumeDecorator(
176
175
// - transaction or block gas meter runs out of gas
177
176
// - sets the gas meter limit
178
177
func (egcd EthGasConsumeDecorator ) AnteHandle (ctx sdk.Context , tx sdk.Tx , simulate bool , next sdk.AnteHandler ) (sdk.Context , error ) {
179
- params := egcd .evmKeeper .GetParams (ctx )
180
-
181
- ethCfg := params .ChainConfig .EthereumConfig (egcd .evmKeeper .ChainID ())
178
+ chainCfg := egcd .evmKeeper .GetChainConfig (ctx )
179
+ ethCfg := chainCfg .EthereumConfig (egcd .evmKeeper .ChainID ())
182
180
183
181
blockHeight := big .NewInt (ctx .BlockHeight ())
184
182
homestead := ethCfg .IsHomestead (blockHeight )
185
183
istanbul := ethCfg .IsIstanbul (blockHeight )
186
184
london := ethCfg .IsLondon (blockHeight )
187
- evmDenom := params .EvmDenom
188
185
gasWanted := uint64 (0 )
189
186
var events sdk.Events
190
187
@@ -213,6 +210,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
213
210
gasWanted += txData .GetGas ()
214
211
}
215
212
213
+ evmDenom := egcd .evmKeeper .GetEVMDenom (ctx )
216
214
fees , priority , err := egcd .evmKeeper .DeductTxCostsFromUserBalance (
217
215
ctx ,
218
216
* msgEthTx ,
@@ -436,9 +434,9 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
436
434
txFee := sdk.Coins {}
437
435
txGasLimit := uint64 (0 )
438
436
439
- params := vbd .evmKeeper .GetParams (ctx )
437
+ chainCfg := vbd .evmKeeper .GetChainConfig (ctx )
440
438
chainID := vbd .evmKeeper .ChainID ()
441
- ethCfg := params . ChainConfig .EthereumConfig (chainID )
439
+ ethCfg := chainCfg .EthereumConfig (chainID )
442
440
baseFee := vbd .evmKeeper .GetBaseFee (ctx , ethCfg )
443
441
444
442
for _ , msg := range protoTx .GetMsgs () {
@@ -460,17 +458,21 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
460
458
}
461
459
462
460
// return error if contract creation or call are disabled through governance
463
- if ! params .EnableCreate && txData .GetTo () == nil {
461
+ enableCreate := vbd .evmKeeper .GetEnableCreate (ctx )
462
+ enableCall := vbd .evmKeeper .GetEnableCall (ctx )
463
+
464
+ if ! enableCreate && txData .GetTo () == nil {
464
465
return ctx , sdkerrors .Wrap (evmtypes .ErrCreateDisabled , "failed to create new contract" )
465
- } else if ! params . EnableCall && txData .GetTo () != nil {
466
+ } else if ! enableCall && txData .GetTo () != nil {
466
467
return ctx , sdkerrors .Wrap (evmtypes .ErrCallDisabled , "failed to call contract" )
467
468
}
468
469
469
470
if baseFee == nil && txData .TxType () == ethtypes .DynamicFeeTxType {
470
471
return ctx , sdkerrors .Wrap (ethtypes .ErrTxTypeNotSupported , "dynamic fee tx not supported" )
471
472
}
472
473
473
- txFee = txFee .Add (sdk .NewCoin (params .EvmDenom , sdkmath .NewIntFromBigInt (txData .Fee ())))
474
+ evmDenom := vbd .evmKeeper .GetEVMDenom (ctx )
475
+ txFee = txFee .Add (sdk .NewCoin (evmDenom , sdkmath .NewIntFromBigInt (txData .Fee ())))
474
476
}
475
477
476
478
authInfo := protoTx .AuthInfo
@@ -546,8 +548,8 @@ func NewEthMempoolFeeDecorator(ek EVMKeeper) EthMempoolFeeDecorator {
546
548
// It only do the check if london hardfork not enabled or feemarket not enabled, because in that case feemarket will take over the task.
547
549
func (mfd EthMempoolFeeDecorator ) AnteHandle (ctx sdk.Context , tx sdk.Tx , simulate bool , next sdk.AnteHandler ) (newCtx sdk.Context , err error ) {
548
550
if ctx .IsCheckTx () && ! simulate {
549
- params := mfd .evmKeeper .GetParams (ctx )
550
- ethCfg := params . ChainConfig .EthereumConfig (mfd .evmKeeper .ChainID ())
551
+ chainCfg := mfd .evmKeeper .GetChainConfig (ctx )
552
+ ethCfg := chainCfg .EthereumConfig (mfd .evmKeeper .ChainID ())
551
553
baseFee := mfd .evmKeeper .GetBaseFee (ctx , ethCfg )
552
554
if baseFee == nil {
553
555
for _ , msg := range tx .GetMsgs () {
@@ -556,7 +558,7 @@ func (mfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat
556
558
return ctx , sdkerrors .Wrapf (sdkerrors .ErrUnknownRequest , "invalid message type %T, expected %T" , msg , (* evmtypes .MsgEthereumTx )(nil ))
557
559
}
558
560
559
- evmDenom := params . EvmDenom
561
+ evmDenom := mfd . evmKeeper . GetEVMDenom ( ctx )
560
562
feeAmt := ethMsg .GetFee ()
561
563
glDec := sdk .NewDec (int64 (ethMsg .GetGas ()))
562
564
requiredFee := ctx .MinGasPrices ().AmountOf (evmDenom ).Mul (glDec )
0 commit comments