diff --git a/CHANGELOG.md b/CHANGELOG.md index faa9d8a830..e97378ad43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ ### Bug Fixes * [#1520](https://github.com/crypto-org-chain/cronos/pull/1520) Avoid invalid chain id for signer error when rpc call before chain id set in BeginBlock. +* [#1539](https://github.com/crypto-org-chain/cronos/pull/1539) Fix go-block-stm bug that causes app hash mismatch. *Jun 18, 2024* diff --git a/go.mod b/go.mod index e847e005e0..edf01b867d 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/99designs/keyring v1.2.2 github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44 github.com/cosmos/cosmos-db v1.0.3-0.20240408151834-e75f6e4b28d8 - github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.7 github.com/cosmos/gogoproto v1.4.12 github.com/cosmos/ibc-go/modules/apps/callbacks v0.0.0-20240410121711-d89cb0895b1e @@ -88,6 +87,7 @@ require ( github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.1.2 // indirect @@ -97,7 +97,7 @@ require ( github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect github.com/crypto-org-chain/cronos/memiavl v0.0.4 // indirect - github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde // indirect + github.com/crypto-org-chain/go-block-stm v0.0.0-20240806075927-09a64748f883 // indirect github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect diff --git a/go.sum b/go.sum index 589e9830fd..85b4a64e14 100644 --- a/go.sum +++ b/go.sum @@ -432,8 +432,8 @@ github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20240722033504-50f1fa0c49d1 h github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20240722033504-50f1fa0c49d1/go.mod h1:RTiTs4hkXG6IvYGknvB8p79YgjYJdcbzLUOGJChsPnY= github.com/crypto-org-chain/ethermint v0.6.1-0.20240729070824-350955227f14 h1:ZVIlVCtx5X6sckKyMhc8nPBjXvr+/CzmXYqh7e/287I= github.com/crypto-org-chain/ethermint v0.6.1-0.20240729070824-350955227f14/go.mod h1:Xap56y3WoiP7DyNammmB6N7P+Y83QQd6363RHGuaYV0= -github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde h1:sQIHTJfVt5VTrF7po9eZiFkZiPjlHbFvnXtGCOoBjNM= -github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= +github.com/crypto-org-chain/go-block-stm v0.0.0-20240806075927-09a64748f883 h1:Oj7VvlK8iXRaugnpGA8CBXGrgkyigji+Ae5weSRD85I= +github.com/crypto-org-chain/go-block-stm v0.0.0-20240806075927-09a64748f883/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240425065928-ebb09502e7a7 h1:V43F3JFcqG4MUThf9W/DytnPblpR6CcaLBw2Wx6zTgE= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240425065928-ebb09502e7a7/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= diff --git a/gomod2nix.toml b/gomod2nix.toml index e2582f85be..f2e83c291a 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -213,8 +213,8 @@ schema = 3 version = "v0.0.24" hash = "sha256-4vUukHONOjNn0qfQr4esK6TWfPWsIp+rbdz65og84lw=" [mod."github.com/crypto-org-chain/go-block-stm"] - version = "v0.0.0-20240408011717-9f11af197bde" - hash = "sha256-+UTSUoh4DxkWPQEc/j0atak1Oxq3tdP8r6ZMmB0k5KE=" + version = "v0.0.0-20240806075927-09a64748f883" + hash = "sha256-DuqcnTqpUVRxV+I+CaBuDg/1CLmMeXdw4VEFeuCsUbU=" [mod."github.com/danieljoos/wincred"] version = "v1.2.0" hash = "sha256-LHcvTJCc8++bFndbd8ZgMSTe4L5h2C4rN+cSWHCz54Y=" diff --git a/integration_tests/configs/default.jsonnet b/integration_tests/configs/default.jsonnet index 07c62ae363..ad7c1c3c40 100644 --- a/integration_tests/configs/default.jsonnet +++ b/integration_tests/configs/default.jsonnet @@ -48,7 +48,7 @@ }, evm: { 'block-executor': 'block-stm', - 'block-stm-workers': 16, + 'block-stm-workers': 32, }, }, }, { diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index 140c9192be..d10cf89b93 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -25,13 +25,16 @@ contract_address, contract_path, deploy_contract, + derive_new_account, eth_to_bech32, get_receipts_by_block, get_sync_info, modify_command_in_supervisor_config, send_transaction, send_txs, + sign_transaction, submit_any_proposal, + w3_wait_for_block, wait_for_block, wait_for_new_blocks, wait_for_port, @@ -934,3 +937,40 @@ def test_submit_send_enabled(cronos, tmp_path): approve_proposal(cronos, rsp["events"]) print("check params have been updated now") assert cli.query_bank_send(*denoms) == send_enable + + +def test_block_stm_delete(cronos): + """ + this test case revealed a bug in block-stm, + see: https://github.com/crypto-org-chain/go-block-stm/pull/11 + """ + w3 = cronos.w3 + cli = cronos.cosmos_cli() + acc = derive_new_account(3) + sender = acc.address + + # fund new sender + fund = 3000000000000000000 + tx = {"to": sender, "value": fund, "gasPrice": w3.eth.gas_price} + send_transaction(w3, tx) + assert w3.eth.get_balance(sender, "latest") == fund + nonce = w3.eth.get_transaction_count(sender) + wait_for_new_blocks(cli, 1) + txhashes = [] + total = 3 + for n in range(total): + tx = { + "to": "0x2956c404227Cc544Ea6c3f4a36702D0FD73d20A2", + "value": fund // total, + "gas": 21000, + "maxFeePerGas": 6556868066901, + "maxPriorityFeePerGas": 1500000000, + "nonce": nonce + n, + } + signed = sign_transaction(w3, tx, acc.key) + txhash = w3.eth.send_raw_transaction(signed.rawTransaction) + txhashes.append(txhash) + for txhash in txhashes[0 : total - 1]: + res = w3.eth.wait_for_transaction_receipt(txhash) + assert res.status == 1 + w3_wait_for_block(w3, w3.eth.block_number + 3, timeout=30)