Skip to content

Commit 9f9a0cf

Browse files
committed
remove GetParam fallback mechanism & always use GetParamsIfExists
1 parent 8666169 commit 9f9a0cf

File tree

4 files changed

+37
-495
lines changed

4 files changed

+37
-495
lines changed

proto/evm/params.proto

-45
Original file line numberDiff line numberDiff line change
@@ -32,51 +32,6 @@ string minimum_fee_per_gas = 4 [
3232
(gogoproto.nullable) = false,
3333
(gogoproto.jsontag) = "minimum_fee_per_gas"
3434
];
35-
uint64 deliver_tx_hook_wasm_gas_limit = 5;
36-
// ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
37-
// string chain_id = 6 [
38-
// (gogoproto.moretags) = "yaml:\"chain_id\"",
39-
// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
40-
// (gogoproto.nullable) = false,
41-
// (gogoproto.jsontag) = "chain_id"
42-
// ];
43-
// repeated string whitelisted_codehashes_bank_send = 7 [
44-
// (gogoproto.moretags) = "yaml:\"whitelisted_codehashes_bank_send\"",
45-
// (gogoproto.jsontag) = "whitelisted_codehashes_bank_send"
46-
// ];
47-
repeated bytes whitelisted_cw_code_hashes_for_delegate_call = 8 [
48-
(gogoproto.moretags) = "yaml:\"whitelisted_cw_code_hashes_for_delegate_call\"",
49-
(gogoproto.jsontag) = "whitelisted_cw_code_hashes_for_delegate_call"
50-
];
51-
}
52-
53-
// ParamsV590 is for pre V580 and post V590
54-
message ParamsV590 {
55-
option (gogoproto.goproto_stringer) = false;
56-
57-
// string base_denom = 1 [
58-
// (gogoproto.moretags) = "yaml:\"base_denom\"",
59-
// (gogoproto.jsontag) = "base_denom"
60-
// ];
61-
string priority_normalizer = 2 [
62-
(gogoproto.moretags) = "yaml:\"priority_normalizer\"",
63-
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
64-
(gogoproto.nullable) = false,
65-
(gogoproto.jsontag) = "priority_normalizer"
66-
];
67-
string base_fee_per_gas = 3 [
68-
(gogoproto.moretags) = "yaml:\"base_fee_per_gas\"",
69-
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
70-
(gogoproto.nullable) = false,
71-
(gogoproto.jsontag) = "base_fee_per_gas"
72-
];
73-
string minimum_fee_per_gas = 4 [
74-
(gogoproto.moretags) = "yaml:\"minimum_fee_per_gas\"",
75-
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
76-
(gogoproto.nullable) = false,
77-
(gogoproto.jsontag) = "minimum_fee_per_gas"
78-
];
79-
8035
// ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
8136
// string chain_id = 6 [
8237
// (gogoproto.moretags) = "yaml:\"chain_id\"",

x/evm/keeper/params.go

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package keeper
22

33
import (
4-
"fmt"
54
"math/big"
65

76
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -17,32 +16,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
1716
}
1817

1918
func (k *Keeper) GetParams(ctx sdk.Context) (params types.Params) {
20-
if ctx.IsCheckTx() {
21-
return k.GetParamsIfExists(ctx)
22-
}
23-
params = types.Params{}
24-
defer func() {
25-
if r := recover(); r != nil {
26-
// If panic occurs, try to get V590 params
27-
fmt.Printf("[Debug panic get paramset with height: %d\n", ctx.BlockHeight())
28-
params = k.GetV590Params(ctx)
29-
}
30-
}()
31-
k.Paramstore.GetParamSet(ctx, &params)
32-
return params
33-
}
34-
35-
func (k *Keeper) GetV590Params(ctx sdk.Context) types.Params {
36-
v590Params := types.ParamsV590{}
37-
k.Paramstore.GetParamSet(ctx, &v590Params)
38-
// Convert GetV590Params to types.Params
39-
return types.Params{
40-
PriorityNormalizer: v590Params.PriorityNormalizer,
41-
BaseFeePerGas: v590Params.BaseFeePerGas,
42-
MinimumFeePerGas: v590Params.MinimumFeePerGas,
43-
WhitelistedCwCodeHashesForDelegateCall: v590Params.WhitelistedCwCodeHashesForDelegateCall,
44-
DeliverTxHookWasmGasLimit: uint64(300000),
45-
}
19+
return k.GetParamsIfExists(ctx)
4620
}
4721

4822
func (k *Keeper) GetParamsIfExists(ctx sdk.Context) types.Params {

x/evm/types/params.go

-14
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
5555
}
5656
}
5757

58-
func (p *ParamsV590) ParamSetPairs() paramtypes.ParamSetPairs {
59-
return paramtypes.ParamSetPairs{
60-
paramtypes.NewParamSetPair(KeyPriorityNormalizer, &p.PriorityNormalizer, validatePriorityNormalizer),
61-
paramtypes.NewParamSetPair(KeyBaseFeePerGas, &p.BaseFeePerGas, validateBaseFeePerGas),
62-
paramtypes.NewParamSetPair(KeyMinFeePerGas, &p.MinimumFeePerGas, validateMinFeePerGas),
63-
paramtypes.NewParamSetPair(KeyWhitelistedCwCodeHashesForDelegateCall, &p.WhitelistedCwCodeHashesForDelegateCall, validateWhitelistedCwHashesForDelegateCall),
64-
paramtypes.NewParamSetPair(KeyDeliverTxHookWasmGasLimit, &p.DeliverTxHookWasmGasLimit, validateDeliverTxHookWasmGasLimit),
65-
}
66-
}
67-
func (p ParamsV590) String() string {
68-
out, _ := yaml.Marshal(p)
69-
return string(out)
70-
}
71-
7258
func (p Params) Validate() error {
7359
if err := validatePriorityNormalizer(p.PriorityNormalizer); err != nil {
7460
return err

0 commit comments

Comments
 (0)