Skip to content

Commit

Permalink
Merge branch 'crypto-org-chain:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
alienc0der authored Aug 7, 2024
2 parents ed9e829 + 867d53c commit 8bdec03
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 31 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [#1458](https://github.com/crypto-org-chain/cronos/pull/1458) Adjust require gas for recvPacket when ReceiverChainIsSource.
* [#1519](https://github.com/crypto-org-chain/cronos/pull/1519) Upgrade ibc-go to 8.3 and remove icaauth module.
* [#1518](https://github.com/crypto-org-chain/cronos/pull/1518) Keep versiondb/memiavl compatible with upstream sdk, stop supporting other streaming service.
* [#1541](https://github.com/crypto-org-chain/cronos/pull/1541) Disable MsgCreatePermanentLockedAccount and MsgCreatePeriodicVestingAccount messages.

### Improvements

Expand All @@ -32,6 +33,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*

Expand Down
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,31 @@ test-sim-random-genesis-fast:
@go test -tags=objstore -mod=readonly $(SIMAPP) -run TestFullAppSimulation \
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h

test-sim-import-export: export GOFLAGS=-tags=objstore
test-sim-import-export: runsim
@echo "Running application import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Tags=objstore -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport

test-sim-after-import: export GOFLAGS=-tags=objstore
test-sim-after-import: runsim
@echo "Running application simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Tags=objstore -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport

test-sim-custom-genesis-multi-seed: export GOFLAGS=-tags=objstore
test-sim-custom-genesis-multi-seed: runsim
@echo "Running multi-seed custom genesis simulation..."
@echo "By default, ${HOME}/.cronosd/config/genesis.json will be used."
@$(BINDIR)/runsim -Tags=objstore -Genesis=${HOME}/.cronosd/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation
@$(BINDIR)/runsim -Genesis=${HOME}/.cronosd/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation

test-sim-multi-seed-long: export GOFLAGS=-tags=objstore
test-sim-multi-seed-long: runsim
@echo "Running long multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Tags=objstore -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestFullAppSimulation
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestFullAppSimulation

test-sim-multi-seed-short: export GOFLAGS=-tags=objstore
test-sim-multi-seed-short: runsim
@echo "Running short multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Tags=objstore -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation

test-sim-benchmark-invariants:
@echo "Running simulation invariant benchmarks..."
Expand Down
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,8 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64, bl
DisabledAuthzMsgs: []string{
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreateVestingAccount{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreatePermanentLockedAccount{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreatePeriodicVestingAccount{}),
},
ExtraDecorators: []sdk.AnteDecorator{blockAddressDecorator},
PendingTxListener: app.onPendingTx,
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ require (
cosmossdk.io/x/upgrade v0.1.1
filippo.io/age v1.1.1
github.com/99designs/keyring v1.2.2
github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44
github.com/cometbft/cometbft v0.38.10
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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -276,7 +276,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.20240425065928-ebb09502e7a7
// block-stm branch
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240729070824-350955227f14
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240802052216-0e0baa4ea540
// 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
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA=
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44 h1:Tm6SG54Tj/bGVEZUyFPs2UyG0BYvCO3oqvWNyw99bi4=
github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc=
github.com/cometbft/cometbft v0.38.10 h1:2ePuglchT+j0Iao+cfmt/nw5U7K2lnGDzXSUPGVdXaU=
github.com/cometbft/cometbft v0.38.10/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down Expand Up @@ -430,10 +430,10 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240722033504-50f1fa0c49d1
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240722033504-50f1fa0c49d1/go.mod h1:gjE3DZe4t/+VeIk6CmrouyqiuDbZ7QOVDDq3nLqBTpg=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20240722033504-50f1fa0c49d1 h1:r0ALP31Wnw19FqEmqzsK2SFNqdMetHshnM/X/FeJRIo=
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/ethermint v0.6.1-0.20240802052216-0e0baa4ea540 h1:werx5A5sAiqxHy95ARhXGSRRVkedS5y6s0m7oQTASes=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240802052216-0e0baa4ea540/go.mod h1:soxGcxnn/3k0LO9r0IY5CyfKqBK0rRO/HrYcQLFEg3s=
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=
Expand Down
12 changes: 6 additions & 6 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ schema = 3
version = "v1.0.0"
hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0="
[mod."github.com/cometbft/cometbft"]
version = "v0.38.10-0.20240709120009-0792c8bdda44"
hash = "sha256-ZKAAgJ78Z1Mgww2D8BZz9Qug/m3CXWa9MKM8W4CTbGI="
version = "v0.38.10"
hash = "sha256-zd/vD0uUgawzuuzuNweRK4HctzWmCb3tnLUFmaOT4OE="
[mod."github.com/cometbft/cometbft-db"]
version = "v0.0.0-20231011055109-57922ac52a63"
hash = "sha256-iLs/FN1be3AcoyhKj2+b5Msqeat9j2ja4acyOs+w+Uk="
Expand Down Expand Up @@ -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="
Expand Down Expand Up @@ -262,8 +262,8 @@ schema = 3
hash = "sha256-lE4G5FaRb3MVi9FFVn+WlwsSTOB4SbjmVboKyQ5yB0A="
replaced = "github.com/crypto-org-chain/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20240729070824-350955227f14"
hash = "sha256-aZ9Kq7PujK4alMXp1kk7LF7PTap8UdJbt+gK2ljvwyw="
version = "v0.6.1-0.20240802052216-0e0baa4ea540"
hash = "sha256-qGQPxKz2nWEj8saqR5lU38j0ToV2oIRR7Bhhin5iIfg="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/fatih/color"]
version = "v1.16.0"
Expand Down
10 changes: 7 additions & 3 deletions integration_tests/configs/default.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
'block-range-cap': 10000,
'logs-cap': 10000,
},
evm: {
'block-executor': 'sequential',
},
mempool: {
'max-txs': 1000,
},
evm: {
'block-executor': 'block-stm',
},
},
validators: [{
coins: '1000000000000000000stake,10000000000000000000000basetcro',
Expand All @@ -46,6 +46,10 @@
versiondb: {
enable: true,
},
evm: {
'block-executor': 'block-stm',
'block-stm-workers': 32,
},
},
}, {
coins: '1000000000000000000stake,10000000000000000000000basetcro',
Expand Down
40 changes: 40 additions & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
5 changes: 3 additions & 2 deletions testground/benchmark/benchmark/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def bootstrap(ctx: Context, cli) -> PeerPacket:
cli("genesis", "validate", home=home)

p2p_peers = connect_all(peer, peers)
patch_configs(home, ctx.params.test_group_id, p2p_peers)
patch_configs(home, ctx.params.test_group_id, p2p_peers, "block-stm")
return peer


Expand Down Expand Up @@ -116,7 +116,7 @@ def gen_genesis(cli: ChainCommand, leader_home: Path, peers: List[PeerPacket]):
)


def patch_configs(home: Path, group: str, peers: str):
def patch_configs(home: Path, group: str, peers: str, block_executor: str):
# update persistent_peers and other configs in config.toml
config_patch = {
"p2p.persistent_peers": peers,
Expand All @@ -133,6 +133,7 @@ def patch_configs(home: Path, group: str, peers: str):
"index-events": ["ethereum_tx.ethereumTxHash"],
"memiavl.enable": True,
"mempool.max-txs": MEMPOOL_SIZE,
"evm.block-executor": block_executor,
}

patch_toml(home / "config" / "config.toml", config_patch)
Expand Down
23 changes: 18 additions & 5 deletions testground/benchmark/benchmark/stateless.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def gen(
hostname_template=HOSTNAME_TEMPLATE,
num_accounts=10,
num_txs=1000,
block_executor="block-stm", # or "sequential"
):
outdir = Path(outdir)
cli = ChainCommand(LOCAL_CRONOSD_PATH)
Expand All @@ -67,10 +68,18 @@ def gen(
print("patch genesis")
# write genesis file and patch config files
for i in range(validators):
patch_configs_local(peers, genesis, outdir, VALIDATOR_GROUP, i, i)
patch_configs_local(
peers, genesis, outdir, VALIDATOR_GROUP, i, i, block_executor
)
for i in range(fullnodes):
patch_configs_local(
peers, genesis, outdir, FULLNODE_GROUP, i, i + validators
peers,
genesis,
outdir,
FULLNODE_GROUP,
i,
i + validators,
block_executor,
)

print("write config")
Expand Down Expand Up @@ -146,12 +155,15 @@ def run(
proc.wait()

# collect outputs
output = Path("/data.tar.bz2")
with tarfile.open(output, "x:bz2") as tar:
tar.add(home, arcname="data")
outdir = Path(outdir)
if outdir.exists():
assert outdir.is_dir()
filename = outdir / f"{group}_{group_seq}.tar.bz2"
filename.unlink(missing_ok=True)
with tarfile.open(filename, "x:bz2") as tar:
tar.add(home, arcname="data")
shutil.copy(output, filename)


def detect_idle(idle_blocks: int, interval: int):
Expand Down Expand Up @@ -205,11 +217,12 @@ def patch_configs_local(
group: str,
i: int,
group_seq: int,
block_executor: str,
):
home = outdir / group / str(i)
(home / "config" / "genesis.json").write_text(json.dumps(genesis))
p2p_peers = connect_all(peers[i], peers)
patch_configs(home, group, p2p_peers)
patch_configs(home, group, p2p_peers, block_executor)


def node_index() -> int:
Expand Down

0 comments on commit 8bdec03

Please sign in to comment.