Skip to content

Commit 5099247

Browse files
committed
Merge remote-tracking branch 'origin/main' into set_fee_payee
2 parents 1d2b397 + 1ae61b4 commit 5099247

File tree

8 files changed

+52
-7
lines changed

8 files changed

+52
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* (cli)[#1647](https://github.com/crypto-org-chain/cronos/pull/1647) Fix node can't shutdown by signal.
99
* (testground)[#1652](https://github.com/crypto-org-chain/cronos/pull/1652) Remove unexpected conflicts in benchmark transactions.
1010
* [#1654](https://github.com/crypto-org-chain/cronos/pull/1654) Set relayer as payee for relayer caller when enabled incentivized packet.
11+
* [#1655](https://github.com/crypto-org-chain/cronos/pull/1655) Fix state overwrite in debug trace APIs.
1112

1213
### Improvements
1314

@@ -16,6 +17,8 @@
1617
* [#1648](https://github.com/crypto-org-chain/cronos/pull/1648) Add abort OE in PrepareProposal.
1718
* (testground)[#1651](https://github.com/crypto-org-chain/cronos/pull/1651) Benchmark use cosmos broadcast rpc.
1819
* (testground)[#1650](https://github.com/crypto-org-chain/cronos/pull/1650) Benchmark support batch mode.
20+
* [#1658](https://github.com/crypto-org-chain/cronos/pull/1658) Optimize when block-list is empty.
21+
* (testground)[#1659](https://github.com/crypto-org-chain/cronos/pull/1659) Support skip check-tx in benchmark.
1922

2023
*Oct 14, 2024*
2124

app/app.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const (
189189

190190
FlagBlockedAddresses = "blocked-addresses"
191191
FlagUnsafeIgnoreBlockListFailure = "unsafe-ignore-block-list-failure"
192+
FlagUnsafeDummyCheckTx = "unsafe-dummy-check-tx"
192193
)
193194

194195
var Forks = []Fork{}
@@ -318,6 +319,7 @@ type App struct {
318319
// encoding
319320
cdc *codec.LegacyAmino
320321
txConfig client.TxConfig
322+
txDecoder sdk.TxDecoder
321323
appCodec codec.Codec
322324
interfaceRegistry types.InterfaceRegistry
323325

@@ -381,6 +383,9 @@ type App struct {
381383
qms storetypes.RootMultiStore
382384

383385
blockProposalHandler *ProposalHandler
386+
387+
// unsafe to set for validator, used for testing
388+
dummyCheckTx bool
384389
}
385390

386391
// New returns a reference to an initialized chain.
@@ -485,6 +490,7 @@ func New(
485490
BaseApp: bApp,
486491
cdc: cdc,
487492
txConfig: txConfig,
493+
txDecoder: txDecoder,
488494
appCodec: appCodec,
489495
interfaceRegistry: interfaceRegistry,
490496
invCheckPeriod: invCheckPeriod,
@@ -493,6 +499,7 @@ func New(
493499
okeys: okeys,
494500
memKeys: memKeys,
495501
blockProposalHandler: blockProposalHandler,
502+
dummyCheckTx: cast.ToBool(appOpts.Get(FlagUnsafeDummyCheckTx)),
496503
}
497504

498505
app.SetDisableBlockGasMeter(true)
@@ -1495,3 +1502,21 @@ func (app *App) Close() error {
14951502
func maxParallelism() int {
14961503
return min(stdruntime.GOMAXPROCS(0), stdruntime.NumCPU())
14971504
}
1505+
1506+
func (app *App) CheckTx(req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) {
1507+
if app.dummyCheckTx {
1508+
tx, err := app.txDecoder(req.Tx)
1509+
if err != nil {
1510+
return nil, err
1511+
}
1512+
1513+
feeTx, ok := tx.(sdk.FeeTx)
1514+
if !ok {
1515+
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "tx must be FeeTx")
1516+
}
1517+
1518+
return &abci.ResponseCheckTx{Code: abci.CodeTypeOK, GasWanted: int64(feeTx.GetGas())}, nil
1519+
}
1520+
1521+
return app.BaseApp.CheckTx(req)
1522+
}

app/proposal.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ func (h *ProposalHandler) SetBlockList(blob []byte) error {
124124
}
125125

126126
func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error {
127+
if len(h.blocklist) == 0 {
128+
// fast path, accept all txs
129+
return nil
130+
}
131+
127132
sigTx, ok := tx.(signing.SigVerifiableTx)
128133
if !ok {
129134
return fmt.Errorf("tx of type %T does not implement SigVerifiableTx", tx)
@@ -147,6 +152,11 @@ func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error {
147152

148153
func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler {
149154
return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
155+
if len(h.blocklist) == 0 {
156+
// fast path, accept all txs
157+
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil
158+
}
159+
150160
for _, txBz := range req.Txs {
151161
memTx, err := h.TxDecoder(txBz)
152162
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ replace (
273273
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
274274
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a
275275
// develop
276-
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20241017130935-816389c76eac
276+
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20241022025636-430068294727
277277
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
278278
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
279279
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241018012743-d78d66e74712
428428
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241018012743-d78d66e74712/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
429429
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241018012743-d78d66e74712 h1:vvN3FqhFTakKy4jgVC1GoEtHW52zQg49uNE/e16Scu8=
430430
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241018012743-d78d66e74712/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
431-
github.com/crypto-org-chain/ethermint v0.6.1-0.20241017130935-816389c76eac h1:tSgcMmugbp5h5Xi2rRZBCwP37EfqxM6jmNv9qO/aNrI=
432-
github.com/crypto-org-chain/ethermint v0.6.1-0.20241017130935-816389c76eac/go.mod h1:LUv3b8+dRjqAI9UTml5XzjExT2ANyvjtkFssi7lIRb0=
431+
github.com/crypto-org-chain/ethermint v0.6.1-0.20241022025636-430068294727 h1:vMY/xLOa4kBZahv6JgIeJPLeaiNfKsgRirKRFzd+oeg=
432+
github.com/crypto-org-chain/ethermint v0.6.1-0.20241022025636-430068294727/go.mod h1:LUv3b8+dRjqAI9UTml5XzjExT2ANyvjtkFssi7lIRb0=
433433
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI=
434434
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
435435
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40=

gomod2nix.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ schema = 3
262262
hash = "sha256-ozwVS2BhAoz+OOisAyMhgg+lq8FdQjf90xoOq9cxtGw="
263263
replaced = "github.com/crypto-org-chain/go-ethereum"
264264
[mod."github.com/evmos/ethermint"]
265-
version = "v0.6.1-0.20241017130935-816389c76eac"
266-
hash = "sha256-DD2uiTxQKEwKP5tCETMZNX8it7G7e+MBFFMG3YpW6RA="
265+
version = "v0.6.1-0.20241022025636-430068294727"
266+
hash = "sha256-BLzVdTWu6We25O2DRCAyB5ShbBEnw4aKzWY9vDVSRok="
267267
replaced = "github.com/crypto-org-chain/ethermint"
268268
[mod."github.com/fatih/color"]
269269
version = "v1.16.0"

integration_tests/test_basic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,15 +866,19 @@ def fn(cmd):
866866
cronos.base_dir / "tasks.ini",
867867
lambda cmd: fn(cmd),
868868
)
869+
cli = cronos.cosmos_cli()
870+
# update right after a new block start
871+
wait_for_new_blocks(cli, 1, sleep=0.1)
869872
cronos.supervisorctl("update")
873+
# ensure nodes stop and start at the same time
874+
time.sleep(2)
870875
wait_for_port(ports.evmrpc_port(cronos.base_port(0)))
871876

872877
# reset to origin_cmd only
873878
if max_gas_wanted is None:
874879
return
875880

876881
w3 = cronos.w3
877-
cli = cronos.cosmos_cli()
878882
block_gas_limit = 81500000
879883
tx_gas_limit = 80000000
880884
max_tx_in_block = block_gas_limit // min(max_gas_wanted, tx_gas_limit)

integration_tests/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ def wait_for_block(cli, height, timeout=240):
122122
raise TimeoutError(f"wait for block {height} timeout")
123123

124124

125-
def wait_for_new_blocks(cli, n, sleep=0.5):
125+
def wait_for_new_blocks(cli, n, sleep=0.5, timeout=240):
126126
cur_height = begin_height = int(get_sync_info(cli.status())["latest_block_height"])
127+
start_time = time.time()
127128
while cur_height - begin_height < n:
128129
time.sleep(sleep)
129130
cur_height = int(get_sync_info(cli.status())["latest_block_height"])
131+
if time.time() - start_time > timeout:
132+
raise TimeoutError(f"wait for block {begin_height + n} timeout")
130133
return cur_height
131134

132135

0 commit comments

Comments
 (0)