Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@


### Improvements

* [#1841](https://github.com/crypto-org-chain/cronos/pull/1841) Ci: use `golangci-lint run --fix`.
* [#1779](https://github.com/crypto-org-chain/cronos/pull/1779) Upgrade rocksdb to `v9.11.2`.
* [#1824](https://github.com/crypto-org-chain/cronos/pull/1824) Rework on github actions.
* [#1826](https://github.com/crypto-org-chain/cronos/pull/1826) Update linter and tidy up code.
* [#1807](https://github.com/crypto-org-chain/cronos/pull/1807) Update go-ethereum version to [v1.15.11](https://github.com/ethereum/go-ethereum/releases/tag/v1.15.11).
* [#1840](https://github.com/crypto-org-chain/cronos/pull/1840) Tx replacement support.
* [#1851](https://github.com/crypto-org-chain/cronos/pull/1850) Add default value of CancunTime and PragueTime in chain config.

*Jun 20, 2025*

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ replace (
// release/v1.15
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20250815065500-a4fbafcae0dd
// develop
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250819081101-9a03795ec96b
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250820110050-d940a537fb81
// 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 @@ -910,8 +910,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254 h1:JzLOFRiKsDtLJt5h0M0jkEIPDKvFFyja7VEp7gG6O9U=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250819081101-9a03795ec96b h1:Tm6Hm2id0PRMc8LNQduNY3bA6nvEz/qXoAyTpnEHCHA=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250819081101-9a03795ec96b/go.mod h1:pilxRzYqGqlhVBDXcBYfDbFy6vkiqxwc8zHDPYXLnOQ=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250820110050-d940a537fb81 h1:WCfAxy31LBHVwcAlJfU4XEGlUppoeJSn+fRcdIQfiuA=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250820110050-d940a537fb81/go.mod h1:pilxRzYqGqlhVBDXcBYfDbFy6vkiqxwc8zHDPYXLnOQ=
github.com/crypto-org-chain/go-block-stm v0.0.0-20241213061541-7afe924fb4a6 h1:6KPEi8dWkDSBddQb4NAvEXmNnTXymF3yVeTaT4Hz1iU=
github.com/crypto-org-chain/go-block-stm v0.0.0-20241213061541-7afe924fb4a6/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20250815065500-a4fbafcae0dd h1:ebSnzvM9yKVGFjvoGly7LFQQCS2HuOWMCvQyByJ52Gs=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ schema = 3
version = "v0.2.2"
hash = "sha256-0MLfSJKdeK3Z7tWAXTdzwB4091dmyxIX38S5SKH5QAw="
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20250819081101-9a03795ec96b"
hash = "sha256-AbomdzYu7acbuQooMZwqe8vh08Q2jBYtRAMaZF3Yg+4="
version = "v0.6.1-0.20250820110050-d940a537fb81"
hash = "sha256-IiOutLdexw9kqigNKbQYqRvIuMj9V7HD2LLDubJ7XJQ="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/fatih/color"]
version = "v1.17.0"
Expand Down
4 changes: 4 additions & 0 deletions integration_tests/contracts/contracts/TestSuicide.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ contract Destroyee {
function destroy() public {
selfdestruct(payable(msg.sender));
}

receive() external payable {}
}

contract Destroyer {
Expand All @@ -17,4 +19,6 @@ contract Destroyer {
}
require(_size > 0);
}

receive() external payable {}
}
43 changes: 41 additions & 2 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
contract_path,
deploy_contract,
derive_new_account,
fund_acc,
get_account_nonce,
get_expedited_params,
get_receipts_by_block,
get_sync_info,
modify_command_in_supervisor_config,
remove_cancun_prague_params,
replace_transaction,
send_transaction,
send_txs,
Expand Down Expand Up @@ -669,13 +671,14 @@
assert len(receipt.logs) == iterations


def test_suicide(cluster):
def test_suicide_pre_cancun(cronos):
"""
test compliance of contract suicide
- within the tx, after contract suicide, the code is still available.
- after the tx, the code is not available.
"""
w3 = cluster.w3
remove_cancun_prague_params(cronos)

Check failure on line 680 in integration_tests/test_basic.py

View workflow job for this annotation

GitHub Actions / integration_tests (unmarked)

test_suicide_pre_cancun[True] AssertionError: (cronosd tx gov submit-proposal /tmp/tmp1g_nn72r -y --from community --home /tmp/pytest-of-runner/pytest-0/indexer0/cronos_777-1/node0 --node tcp://127.0.0.1:27007 --keyring-backend test --chain-id cronos_777-1 --gas-prices 100000000000basetcro --gas auto --gas-adjustment 1.5 --broadcast-mode sync)
w3 = cronos.w3
destroyee = deploy_contract(
w3,
contract_path("Destroyee", "TestSuicide.sol"),
Expand All @@ -696,6 +699,42 @@
assert len(w3.eth.get_code(destroyee.address)) == 0


def test_suicide_post_cancun(cluster):
"""
after EIP-6780, SELFDESTRUCT will recover all funds to the target
but not delete the account, except when called in the same transaction as creation
"""
w3 = cluster.w3
destroyee = deploy_contract(
w3,
contract_path("Destroyee", "TestSuicide.sol"),
)
destroyer = deploy_contract(
w3,
contract_path("Destroyer", "TestSuicide.sol"),
)

balance_wanted = 1000000000000000000
fund_acc(w3, destroyee, balance_wanted)
assert w3.eth.get_balance(destroyee.address) == balance_wanted
assert w3.eth.get_balance(destroyer.address) == 0

old_code_destroyee = w3.eth.get_code(destroyee.address)
old_code_destroyer = w3.eth.get_code(destroyer.address)
assert len(old_code_destroyee) > 0
assert len(old_code_destroyer) > 0

tx = destroyer.functions.check_codesize_after_suicide(
destroyee.address
).build_transaction()
receipt = send_transaction(w3, tx)
assert receipt.status == 1

assert w3.eth.get_code(destroyee.address) == old_code_destroyee
assert w3.eth.get_balance(destroyee.address) == 0
assert w3.eth.get_balance(destroyer.address) == balance_wanted


def test_batch_tx(cronos):
"send multiple eth txs in single cosmos tx"
w3 = cronos.w3
Expand Down
4 changes: 4 additions & 0 deletions integration_tests/test_gov_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def test_evm_update_param(cronos, tmp_path):
p = cli.query_params("evm")
del p["chain_config"]["merge_netsplit_block"]
del p["chain_config"]["shanghai_time"]
del p["chain_config"]["cancun_time"]
del p["chain_config"]["prague_time"]
authority = module_address("gov")
msg = "/ethermint.evm.v1.MsgUpdateParams"
submit_gov_proposal(
Expand All @@ -33,6 +35,8 @@ def test_evm_update_param(cronos, tmp_path):
p = cli.query_params("evm")
assert not p["chain_config"]["merge_netsplit_block"]
assert not p["chain_config"]["shanghai_time"]
assert not p["chain_config"]["cancun_time"]
assert not p["chain_config"]["prague_time"]
invalid_msg = "invalid opcode: PUSH0"
with pytest.raises(ValueError) as e_info:
contract.caller.randomTokenId()
Expand Down
31 changes: 31 additions & 0 deletions integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,3 +846,34 @@ def assert_gov_params(cli, old_param):
expedited_param = get_expedited_params(old_param)
for key, value in expedited_param.items():
assert param[key] == value, param


def fund_acc(w3, acc, fund=3000000000000000000):
addr = acc.address
if w3.eth.get_balance(addr, "latest") == 0:
tx = {"to": addr, "value": fund, "gasPrice": w3.eth.gas_price}
send_transaction(w3, tx)
assert w3.eth.get_balance(addr, "latest") == fund


def remove_cancun_prague_params(cronos):
cli = cronos.cosmos_cli()
p = cli.query_params("evm")
del p["chain_config"]["cancun_time"]
del p["chain_config"]["prague_time"]
authority = module_address("gov")
msg = "/ethermint.evm.v1.MsgUpdateParams"
submit_gov_proposal(
cronos,
msg,
messages=[
{
"@type": msg,
"authority": authority,
"params": p,
}
],
)
p = cli.query_params("evm")
assert not p["chain_config"]["cancun_time"]
assert not p["chain_config"]["prague_time"]
16 changes: 14 additions & 2 deletions scripts/geth-genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@
"yoloV3Block": 0,
"londonBlock": 0,
"shanghaiTime": 0,
"cancunTime": null,
"pragueTime": null,
"cancunTime": 0,
"pragueTime": 0,
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": 3338477
}
},
"terminalTotalDifficulty": 0,
"clique": {
"period": 2,
Expand Down
Loading