diff --git a/CHANGELOG.md b/CHANGELOG.md index 285b7b4331..e2b5382b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * (cli)[#1647](https://github.com/crypto-org-chain/cronos/pull/1647) Fix node can't shutdown by signal. * (testground)[#1652](https://github.com/crypto-org-chain/cronos/pull/1652) Remove unexpected conflicts in benchmark transactions. * [#1654](https://github.com/crypto-org-chain/cronos/pull/1654) Set relayer as payee for relayer caller when enabled incentivized packet. +* [#1655](https://github.com/crypto-org-chain/cronos/pull/1655) Fix state overwrite in debug trace APIs. ### Improvements @@ -16,6 +17,8 @@ * [#1648](https://github.com/crypto-org-chain/cronos/pull/1648) Add abort OE in PrepareProposal. * (testground)[#1651](https://github.com/crypto-org-chain/cronos/pull/1651) Benchmark use cosmos broadcast rpc. * (testground)[#1650](https://github.com/crypto-org-chain/cronos/pull/1650) Benchmark support batch mode. +* [#1658](https://github.com/crypto-org-chain/cronos/pull/1658) Optimize when block-list is empty. +* (testground)[#1659](https://github.com/crypto-org-chain/cronos/pull/1659) Support skip check-tx in benchmark. *Oct 14, 2024* diff --git a/app/app.go b/app/app.go index dfa97330d0..45ef35d8fc 100644 --- a/app/app.go +++ b/app/app.go @@ -190,6 +190,7 @@ const ( FlagBlockedAddresses = "blocked-addresses" FlagUnsafeIgnoreBlockListFailure = "unsafe-ignore-block-list-failure" + FlagUnsafeDummyCheckTx = "unsafe-dummy-check-tx" ) var Forks = []Fork{} @@ -332,6 +333,7 @@ type App struct { // encoding cdc *codec.LegacyAmino txConfig client.TxConfig + txDecoder sdk.TxDecoder appCodec codec.Codec interfaceRegistry types.InterfaceRegistry @@ -395,6 +397,9 @@ type App struct { qms storetypes.RootMultiStore blockProposalHandler *ProposalHandler + + // unsafe to set for validator, used for testing + dummyCheckTx bool } // New returns a reference to an initialized chain. @@ -499,6 +504,7 @@ func New( BaseApp: bApp, cdc: cdc, txConfig: txConfig, + txDecoder: txDecoder, appCodec: appCodec, interfaceRegistry: interfaceRegistry, invCheckPeriod: invCheckPeriod, @@ -507,6 +513,7 @@ func New( okeys: okeys, memKeys: memKeys, blockProposalHandler: blockProposalHandler, + dummyCheckTx: cast.ToBool(appOpts.Get(FlagUnsafeDummyCheckTx)), } app.SetDisableBlockGasMeter(true) @@ -1509,3 +1516,21 @@ func (app *App) Close() error { func maxParallelism() int { return min(stdruntime.GOMAXPROCS(0), stdruntime.NumCPU()) } + +func (app *App) CheckTx(req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) { + if app.dummyCheckTx { + tx, err := app.txDecoder(req.Tx) + if err != nil { + return nil, err + } + + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "tx must be FeeTx") + } + + return &abci.ResponseCheckTx{Code: abci.CodeTypeOK, GasWanted: int64(feeTx.GetGas())}, nil + } + + return app.BaseApp.CheckTx(req) +} diff --git a/app/proposal.go b/app/proposal.go index 8a755941c5..3e4465b084 100644 --- a/app/proposal.go +++ b/app/proposal.go @@ -124,6 +124,11 @@ func (h *ProposalHandler) SetBlockList(blob []byte) error { } func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error { + if len(h.blocklist) == 0 { + // fast path, accept all txs + return nil + } + sigTx, ok := tx.(signing.SigVerifiableTx) if !ok { return fmt.Errorf("tx of type %T does not implement SigVerifiableTx", tx) @@ -147,6 +152,11 @@ func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error { func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler { return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) { + if len(h.blocklist) == 0 { + // fast path, accept all txs + return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil + } + for _, txBz := range req.Txs { memTx, err := h.TxDecoder(txBz) if err != nil { diff --git a/go.mod b/go.mod index df2bb91564..525960b41d 100644 --- a/go.mod +++ b/go.mod @@ -273,7 +273,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.20241017130935-816389c76eac + github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20241022025636-430068294727 // 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 0da36aff13..03b1db312a 100644 --- a/go.sum +++ b/go.sum @@ -428,8 +428,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241018012743-d78d66e74712 github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241018012743-d78d66e74712/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241018012743-d78d66e74712 h1:vvN3FqhFTakKy4jgVC1GoEtHW52zQg49uNE/e16Scu8= github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241018012743-d78d66e74712/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= -github.com/crypto-org-chain/ethermint v0.6.1-0.20241017130935-816389c76eac h1:tSgcMmugbp5h5Xi2rRZBCwP37EfqxM6jmNv9qO/aNrI= -github.com/crypto-org-chain/ethermint v0.6.1-0.20241017130935-816389c76eac/go.mod h1:LUv3b8+dRjqAI9UTml5XzjExT2ANyvjtkFssi7lIRb0= +github.com/crypto-org-chain/ethermint v0.6.1-0.20241022025636-430068294727 h1:vMY/xLOa4kBZahv6JgIeJPLeaiNfKsgRirKRFzd+oeg= +github.com/crypto-org-chain/ethermint v0.6.1-0.20241022025636-430068294727/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 f1be8f6123..dec9b33381 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -262,8 +262,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.20241017130935-816389c76eac" - hash = "sha256-DD2uiTxQKEwKP5tCETMZNX8it7G7e+MBFFMG3YpW6RA=" + version = "v0.6.1-0.20241022025636-430068294727" + hash = "sha256-BLzVdTWu6We25O2DRCAyB5ShbBEnw4aKzWY9vDVSRok=" replaced = "github.com/crypto-org-chain/ethermint" [mod."github.com/fatih/color"] version = "v1.16.0" diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index 7089b6c9d1..b267746806 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -866,7 +866,12 @@ def fn(cmd): cronos.base_dir / "tasks.ini", lambda cmd: fn(cmd), ) + cli = cronos.cosmos_cli() + # update right after a new block start + wait_for_new_blocks(cli, 1, sleep=0.1) cronos.supervisorctl("update") + # ensure nodes stop and start at the same time + time.sleep(2) wait_for_port(ports.evmrpc_port(cronos.base_port(0))) # reset to origin_cmd only @@ -874,7 +879,6 @@ def fn(cmd): return w3 = cronos.w3 - cli = cronos.cosmos_cli() block_gas_limit = 81500000 tx_gas_limit = 80000000 max_tx_in_block = block_gas_limit // min(max_gas_wanted, tx_gas_limit) diff --git a/integration_tests/utils.py b/integration_tests/utils.py index adbdaa2bf9..c4474d8ce6 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -122,11 +122,14 @@ def wait_for_block(cli, height, timeout=240): raise TimeoutError(f"wait for block {height} timeout") -def wait_for_new_blocks(cli, n, sleep=0.5): +def wait_for_new_blocks(cli, n, sleep=0.5, timeout=240): cur_height = begin_height = int(get_sync_info(cli.status())["latest_block_height"]) + start_time = time.time() while cur_height - begin_height < n: time.sleep(sleep) cur_height = int(get_sync_info(cli.status())["latest_block_height"]) + if time.time() - start_time > timeout: + raise TimeoutError(f"wait for block {begin_height + n} timeout") return cur_height