From f740e132c812aa9550b883bc3b96b9faa060d417 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 19 Jul 2022 17:06:23 +0200 Subject: [PATCH] fix(rpc): fix panic on breaking EVM and feemarket params (backport #1188) (#1193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(rpc): fix panic on breaking EVM and feemarket params (#1188) * release: v0.17.0 changelog (#1153) * release: v0.17.0 changelog * rm newline * update link * fix(rpc): fix panic on breaking EVM and feemarket params * changelog * fix gosec (cherry picked from commit 73c9ea218e48c393b04957c83b25c019ad7a748b) # Conflicts: # .mergify.yml # CHANGELOG.md * Update .mergify.yml * fix Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> --- .mergify.yml | 15 +++++++++++++++ CHANGELOG.md | 6 ++++++ server/json_rpc.go | 11 ++++++----- x/evm/keeper/params.go | 7 ++++++- x/feemarket/keeper/params.go | 6 +++++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index 665ddc3de9..eb3ceeeef9 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -16,6 +16,21 @@ pull_request_rules: commit_message_template: | {{ title }} (#{{ number }}) {{ body }} + - name: backport patches to main branch + conditions: + - label=backport/main + actions: + backport: + branches: + - main + - name: backport patches to v0.17.x branch + conditions: + - base=main + - label=backport/0.17.x + actions: + backport: + branches: + - release/v0.17.x - name: backport patches to v0.16.x branch conditions: - base=main diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a913cddb3..c419b3d046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## Unreleased + +### Bug Fixes + +* (rpc) [\#1190](https://github.com/evmos/ethermint/issues/1190) Fix `UnmarshalJSON` panic of breaking EVM and fee market `Params`. + ## [v0.17.1] - 2022-07-13 ### Improvements diff --git a/server/json_rpc.go b/server/json_rpc.go index feefa12cb2..c27399b88c 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -61,11 +61,12 @@ func StartJSONRPC(ctx *server.Context, clientCtx client.Context, tmRPCAddr, tmEn } httpSrv := &http.Server{ - Addr: config.JSONRPC.Address, - Handler: handlerWithCors.Handler(r), - ReadTimeout: config.JSONRPC.HTTPTimeout, - WriteTimeout: config.JSONRPC.HTTPTimeout, - IdleTimeout: config.JSONRPC.HTTPIdleTimeout, + Addr: config.JSONRPC.Address, + Handler: handlerWithCors.Handler(r), + ReadHeaderTimeout: config.JSONRPC.HTTPTimeout, + ReadTimeout: config.JSONRPC.HTTPTimeout, + WriteTimeout: config.JSONRPC.HTTPTimeout, + IdleTimeout: config.JSONRPC.HTTPIdleTimeout, } httpSrvDone := make(chan struct{}, 1) diff --git a/x/evm/keeper/params.go b/x/evm/keeper/params.go index f9de24bfaf..c28198b489 100644 --- a/x/evm/keeper/params.go +++ b/x/evm/keeper/params.go @@ -8,7 +8,12 @@ import ( // GetParams returns the total set of evm parameters. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) + // TODO: update once https://github.com/cosmos/cosmos-sdk/pull/12615 is merged + // and released + for _, pair := range params.ParamSetPairs() { + k.paramSpace.GetIfExists(ctx, pair.Key, pair.Value) + } + return params } diff --git a/x/feemarket/keeper/params.go b/x/feemarket/keeper/params.go index 1fb9e28f96..1583716c15 100644 --- a/x/feemarket/keeper/params.go +++ b/x/feemarket/keeper/params.go @@ -9,7 +9,11 @@ import ( // GetParams returns the total set of fee market parameters. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) + // TODO: update once https://github.com/cosmos/cosmos-sdk/pull/12615 is merged + // and released + for _, pair := range params.ParamSetPairs() { + k.paramSpace.GetIfExists(ctx, pair.Key, pair.Value) + } return params }