Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into set_fee_payee
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 23, 2024
2 parents 1d2b397 + 1ae61b4 commit 5099247
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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*

Expand Down
25 changes: 25 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const (

FlagBlockedAddresses = "blocked-addresses"
FlagUnsafeIgnoreBlockListFailure = "unsafe-ignore-block-list-failure"
FlagUnsafeDummyCheckTx = "unsafe-dummy-check-tx"
)

var Forks = []Fork{}
Expand Down Expand Up @@ -318,6 +319,7 @@ type App struct {
// encoding
cdc *codec.LegacyAmino
txConfig client.TxConfig
txDecoder sdk.TxDecoder
appCodec codec.Codec
interfaceRegistry types.InterfaceRegistry

Expand Down Expand Up @@ -381,6 +383,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.
Expand Down Expand Up @@ -485,6 +490,7 @@ func New(
BaseApp: bApp,
cdc: cdc,
txConfig: txConfig,
txDecoder: txDecoder,
appCodec: appCodec,
interfaceRegistry: interfaceRegistry,
invCheckPeriod: invCheckPeriod,
Expand All @@ -493,6 +499,7 @@ func New(
okeys: okeys,
memKeys: memKeys,
blockProposalHandler: blockProposalHandler,
dummyCheckTx: cast.ToBool(appOpts.Get(FlagUnsafeDummyCheckTx)),
}

app.SetDisableBlockGasMeter(true)
Expand Down Expand Up @@ -1495,3 +1502,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)
}
10 changes: 10 additions & 0 deletions app/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,15 +866,19 @@ 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
if max_gas_wanted is None:
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)
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 5099247

Please sign in to comment.