From bd29fdfd78095491cf601fcfa02be56bf695db15 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 4 Oct 2024 17:00:51 +0800 Subject: [PATCH] Problem: fix of broken opBlockhash and tx validation are not included (#1621) --- CHANGELOG.md | 1 + app/upgrades.go | 6 ++++++ client/docs/swagger-ui/swagger.yaml | 12 ++++++++++++ go.mod | 2 +- go.sum | 4 ++-- gomod2nix.toml | 4 ++-- integration_tests/test_upgrade.py | 12 ++++++++++-- third_party/proto/ethermint/evm/v1/params.proto | 2 ++ 8 files changed, 36 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9711340795..0c8b732ffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * [#1609](https://github.com/crypto-org-chain/cronos/pull/1609) Fix query address-by-acc-num by account_id instead of id. * [#1611](https://github.com/crypto-org-chain/cronos/pull/1611) Fix multisig account failed on threshold encode after send tx. * [#1617](https://github.com/crypto-org-chain/cronos/pull/1617) Fix unsuppored sign mode SIGN_MODE_TEXTUAL for bank transfer. +* [#1621](https://github.com/crypto-org-chain/cronos/pull/1621) Update ethermint to the fix of broken opBlockhash and tx validation. *Sep 13, 2024* diff --git a/app/upgrades.go b/app/upgrades.go index 5c8df4f765..677951d3e4 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper" + evmtypes "github.com/evmos/ethermint/x/evm/types" ) func (app *App) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper) { @@ -26,6 +27,11 @@ func (app *App) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKeeper clie params := app.ICAHostKeeper.GetParams(sdkCtx) params.HostEnabled = false app.ICAHostKeeper.SetParams(sdkCtx, params) + evmParams := app.EvmKeeper.GetParams(sdkCtx) + evmParams.HeaderHashNum = evmtypes.DefaultHeaderHashNum + if err := app.EvmKeeper.SetParams(sdkCtx, evmParams); err != nil { + return m, err + } } return m, nil }) diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 69b5101109..6969e77e22 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -3044,6 +3044,10 @@ paths: EIP155 signed) transactions can be executed on the state machine. + header_hash_num: + type: string + format: uint64 + description: header_hash_num is the number of header hash to persist. title: Params defines the EVM module parameters description: >- QueryParamsResponse defines the response type for querying x/evm @@ -48880,6 +48884,10 @@ definitions: description: |- allow_unprotected_txs defines if replay-protected (i.e non EIP155 signed) transactions can be executed on the state machine. + header_hash_num: + type: string + format: uint64 + description: header_hash_num is the number of header hash to persist. title: Params defines the EVM module parameters ethermint.evm.v1.QueryAccountResponse: type: object @@ -49076,6 +49084,10 @@ definitions: description: |- allow_unprotected_txs defines if replay-protected (i.e non EIP155 signed) transactions can be executed on the state machine. + header_hash_num: + type: string + format: uint64 + description: header_hash_num is the number of header hash to persist. title: Params defines the EVM module parameters description: >- QueryParamsResponse defines the response type for querying x/evm diff --git a/go.mod b/go.mod index f6df722b27..6d0f9ff42a 100644 --- a/go.mod +++ b/go.mod @@ -275,7 +275,7 @@ replace ( github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a // develop - github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240927061036-33e3cc6ed365 + github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20241004074623-853e1e5b3475 // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0 diff --git a/go.sum b/go.sum index 6e06b481a1..5d4d6bb8fb 100644 --- a/go.sum +++ b/go.sum @@ -428,8 +428,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240930015419-f4ea363b3fdf github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240930015419-f4ea363b3fdf/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20240930015419-f4ea363b3fdf h1:u6BY+dtlmhuQYfPDnpGhDBF2uiCA0HvrIk22L67nB6Q= github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20240930015419-f4ea363b3fdf/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= -github.com/crypto-org-chain/ethermint v0.6.1-0.20240927061036-33e3cc6ed365 h1:/oVOLrFnYrKotmHfLQrh5oKK8PT/ETLAVBdXn+fWPvc= -github.com/crypto-org-chain/ethermint v0.6.1-0.20240927061036-33e3cc6ed365/go.mod h1:ZAHySxm1OEGIWruUEoCAZaqV6eTCgQ43+mSZ9hZsLCU= +github.com/crypto-org-chain/ethermint v0.6.1-0.20241004074623-853e1e5b3475 h1:NazTUTxkx8/C7HNzhsXJ7x/lR4dHlmKaVbqtdW4i8Vw= +github.com/crypto-org-chain/ethermint v0.6.1-0.20241004074623-853e1e5b3475/go.mod h1:LUv3b8+dRjqAI9UTml5XzjExT2ANyvjtkFssi7lIRb0= github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI= github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40= diff --git a/gomod2nix.toml b/gomod2nix.toml index a4c1099e99..d4784cd231 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -263,8 +263,8 @@ schema = 3 hash = "sha256-ozwVS2BhAoz+OOisAyMhgg+lq8FdQjf90xoOq9cxtGw=" replaced = "github.com/crypto-org-chain/go-ethereum" [mod."github.com/evmos/ethermint"] - version = "v0.6.1-0.20240927061036-33e3cc6ed365" - hash = "sha256-BFiTOil1KNMz8z6l2E/7BL+w9x/psEHhHiKf2wenceQ=" + version = "v0.6.1-0.20241004074623-853e1e5b3475" + hash = "sha256-ThAVz/yMndPH0fd0Nn8dYdnhaRC0uTf1PEd3KlEonLw=" replaced = "github.com/crypto-org-chain/ethermint" [mod."github.com/fatih/color"] version = "v1.16.0" diff --git a/integration_tests/test_upgrade.py b/integration_tests/test_upgrade.py index e34c1e73c4..2aed548e3d 100644 --- a/integration_tests/test_upgrade.py +++ b/integration_tests/test_upgrade.py @@ -283,10 +283,18 @@ def do_upgrade(plan_name, target, mode=None): do_upgrade("v1.4", target_height3) cli = c.cosmos_cli() - assert e0 == cli.query_params("evm", height=target_height0 - 1)["params"] - assert e1 == cli.query_params("evm", height=target_height1 - 1)["params"] + + def assert_evm_params(cli, expected, height): + params = cli.query_params("evm", height=height)["params"] + del params["header_hash_num"] + assert expected == params + + assert_evm_params(cli, e0, target_height0 - 1) + assert_evm_params(cli, e1, target_height1 - 1) + assert f0 == cli.query_params("feemarket", height=target_height0 - 1)["params"] assert f1 == cli.query_params("feemarket", height=target_height1 - 1)["params"] + assert cli.query_params("evm")["params"]["header_hash_num"] == "10000", p with pytest.raises(AssertionError): cli.query_params("icaauth") diff --git a/third_party/proto/ethermint/evm/v1/params.proto b/third_party/proto/ethermint/evm/v1/params.proto index c4c64323aa..48c0c944ce 100644 --- a/third_party/proto/ethermint/evm/v1/params.proto +++ b/third_party/proto/ethermint/evm/v1/params.proto @@ -22,4 +22,6 @@ message Params { // allow_unprotected_txs defines if replay-protected (i.e non EIP155 // signed) transactions can be executed on the state machine. bool allow_unprotected_txs = 6; + // header_hash_num is the number of header hash to persist. + uint64 header_hash_num = 7; } \ No newline at end of file