Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
## UNRELEASED

* [#1869](https://github.com/crypto-org-chain/cronos/pull/1869) Add missing tx context during vm initialisation
* [#1872](https://github.com/crypto-org-chain/cronos/pull/1872) fix(evm): support 4byteTracer for tracer
* [#1875](https://github.com/crypto-org-chain/cronos/pull/1875) Add integration tests for preinstalls
* [#1872](https://github.com/crypto-org-chain/cronos/pull/1872) Support 4byteTracer for tracer
* [#1875](https://github.com/crypto-org-chain/cronos/pull/1875) Support for preinstalls
* [#1882](https://github.com/crypto-org-chain/cronos/pull/1882) Support for eip2935

*Sep 4, 2025*

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
golang.org/x/crypto v0.41.0
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7
google.golang.org/grpc v1.75.1
google.golang.org/protobuf v1.36.9
google.golang.org/protobuf v1.36.10
gopkg.in/yaml.v2 v2.4.0
)

Expand Down Expand Up @@ -234,7 +234,7 @@ require (
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/tidwall/tinylru v1.1.0 // indirect
github.com/tidwall/wal v1.1.7 // indirect
Expand Down Expand Up @@ -306,7 +306,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.22.1-0.20251002045626-63f3de0a10b2
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.22.1-0.20251007011737-164da0caf703
// 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
17 changes: 10 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,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.22.1-0.20251002045626-63f3de0a10b2 h1://0sA+PCGB9hyaX22kI7CaVcBJ+b4uV7rqo/BhTHi58=
github.com/crypto-org-chain/ethermint v0.22.1-0.20251002045626-63f3de0a10b2/go.mod h1:CsJ9yDOjuoVWNOxSIiTJhiYziDyCx3pk2hlnj97eGJU=
github.com/crypto-org-chain/ethermint v0.22.1-0.20251007011737-164da0caf703 h1:O0DF++IbEl5TAknuXtAcxFTocZ8zO8DlZRUMIo9HnLA=
github.com/crypto-org-chain/ethermint v0.22.1-0.20251007011737-164da0caf703/go.mod h1:GVopiVE4ftDRfAm3e6qj7URhNTa3Tv3JrCbfO/s8P/I=
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 Expand Up @@ -1507,8 +1507,8 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo/v2 v2.25.3 h1:Ty8+Yi/ayDAGtk4XxmmfUy4GabvM+MegeB4cDLRi6nw=
github.com/onsi/ginkgo/v2 v2.25.3/go.mod h1:43uiyQC4Ed2tkOzLsEYm7hnrb7UJTWHYNsuy3bG/snE=
github.com/onsi/ginkgo/v2 v2.26.0 h1:1J4Wut1IlYZNEAWIV3ALrT9NfiaGW2cDCJQSFQMs/gE=
github.com/onsi/ginkgo/v2 v2.26.0/go.mod h1:qhEywmzWTBUY88kfO0BRvX4py7scov9yR+Az2oavUzw=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
Expand Down Expand Up @@ -1723,8 +1723,9 @@ github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/tidwall/tinylru v1.1.0 h1:XY6IUfzVTU9rpwdhKUF6nQdChgCdGjkMfLzbWyiau6I=
Expand Down Expand Up @@ -1917,6 +1918,8 @@ golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -2587,8 +2590,8 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
12 changes: 6 additions & 6 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ schema = 3
version = "v0.2.2"
hash = "sha256-0MLfSJKdeK3Z7tWAXTdzwB4091dmyxIX38S5SKH5QAw="
[mod."github.com/evmos/ethermint"]
version = "v0.22.1-0.20251002045626-63f3de0a10b2"
hash = "sha256-lpXYx7Q2NZnhmnT4Z9V7EMxovVZrV1cLjj5hLhtl5/w="
version = "v0.22.1-0.20251007011737-164da0caf703"
hash = "sha256-lWvRrVuhssOIMCv07iXwJLfN2gFRgsbK8HBiqMBTMew="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/fatih/color"]
version = "v1.17.0"
Expand Down Expand Up @@ -669,8 +669,8 @@ schema = 3
version = "v1.1.1"
hash = "sha256-M2klhPId3Q3T3VGkSbOkYl/2nLHnsG+yMbXkPkyrRdg="
[mod."github.com/tidwall/pretty"]
version = "v1.2.0"
hash = "sha256-esRQGsn2Ee/CiySlwyuOICSLdqUkH4P7u8qXszos8Yc="
version = "v1.2.1"
hash = "sha256-S0uTDDGD8qr415Ut7QinyXljCp0TkL4zOIrlJ+9OMl8="
[mod."github.com/tidwall/sjson"]
version = "v1.2.5"
hash = "sha256-OYGNolkmL7E1Qs2qrQ3IVpQp5gkcHNU/AB/z2O+Myps="
Expand Down Expand Up @@ -792,8 +792,8 @@ schema = 3
version = "v1.75.1"
hash = "sha256-t5w9BLW8P3SuxHRSAqsVBn8kddzCDKVijh4oxatLIps="
[mod."google.golang.org/protobuf"]
version = "v1.36.9"
hash = "sha256-i4zQhGFR6KprA5elLw33bA1VdMLAnL+Du3gBmrea+3Y="
version = "v1.36.10"
hash = "sha256-gUrj1qSpjcpRKCBnrYlKMm+P0OSh7B/8EBREstwhD1w="
[mod."gopkg.in/yaml.v2"]
version = "v2.4.0"
hash = "sha256-uVEGglIedjOIGZzHW4YwN1VoRSTK8o0eGZqzd+TNdd0="
Expand Down
153 changes: 153 additions & 0 deletions integration_tests/configs/eip2935.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
dotenv: '../../scripts/.env',
'cronos_777-1': {
cmd: 'cronosd',
'start-flags': '--trace',
config: {
db_backend: 'rocksdb',
mempool: {
version: 'v1',
},
},
'app-config': {
chain_id: 'cronos_777-1',
'app-db-backend': 'rocksdb',
'minimum-gas-prices': '0basetcro',
'index-events': ['ethereum_tx.ethereumTxHash'],
'iavl-lazy-loading': true,
'json-rpc': {
address: '127.0.0.1:{EVMRPC_PORT}',
'ws-address': '127.0.0.1:{EVMRPC_PORT_WS}',
api: 'eth,net,web3,debug,cronos',
'feehistory-cap': 100,
'block-range-cap': 10000,
'logs-cap': 10000,
},
evm: {
'block-executor': 'sequential',
},
mempool: {
'max-txs': 1000,
},
},
validators: [{
coins: '1000000000000000000stake,10000000000000000000000basetcro',
staked: '1000000000000000000stake',
mnemonic: '${VALIDATOR1_MNEMONIC}',
client_config: {
'broadcast-mode': 'sync',
},
'app-config': {
memiavl: {
enable: true,
'zero-copy': true,
'snapshot-interval': 5,
'cache-size': 0,
'async-commit-buffer': 5,
},
versiondb: {
enable: true,
},
evm: {
'block-executor': 'block-stm',
'block-stm-workers': 32,
},
},
}, {
coins: '1000000000000000000stake,10000000000000000000000basetcro',
staked: '1000000000000000000stake',
mnemonic: '${VALIDATOR2_MNEMONIC}',
client_config: {
'broadcast-mode': 'sync',
},
config: {
db_backend: 'pebbledb',
},
'app-config': {
'app-db-backend': 'pebbledb',
},
}, {
coins: '1000000000000000000stake,10000000000000000000000basetcro',
staked: '1000000000000000000stake',
mnemonic: '${VALIDATOR3_MNEMONIC}',
client_config: {
'broadcast-mode': 'sync',
},
config: {
db_backend: 'goleveldb',
},
'app-config': {
'app-db-backend': 'goleveldb',
},
}],
accounts: [{
name: 'community',
coins: '10000000000000000000000basetcro',
mnemonic: '${COMMUNITY_MNEMONIC}',
}, {
name: 'signer1',
coins: '20000000000000000000000basetcro',
mnemonic: '${SIGNER1_MNEMONIC}',
}, {
name: 'signer2',
coins: '30000000000000000000000basetcro',
mnemonic: '${SIGNER2_MNEMONIC}',
}],
genesis: {
consensus: {
params: {
block: {
max_bytes: '1048576',
max_gas: '81500000',
},
},
},
app_state: {
evm: {
params: {
evm_denom: 'basetcro',
header_hash_num: '5',
},
},
cronos: {
params: {
cronos_admin: '${CRONOS_ADMIN}',
enable_auto_deployment: true,
ibc_cro_denom: '${IBC_CRO_DENOM}',
},
},
e2ee: {
keys: [{
address: 'crc16z0herz998946wr659lr84c8c556da55dc34hh',
key: 'age1k3mpspxytgvx6e0jja0xgrtzz7vw2p00c2a3xmq5ygfzhwh4wg0s35z4c8',
}],
},
gov: {
params: {
expedited_voting_period: '1s',
voting_period: '10s',
max_deposit_period: '10s',
min_deposit: [
{
denom: 'basetcro',
amount: '1',
},
],
},
},
transfer: {
params: {
receive_enabled: true,
send_enabled: true,
},
},
feemarket: {
params: {
no_base_fee: false,
base_fee: '100000000000',
},
},
},
},
},
}
9 changes: 9 additions & 0 deletions integration_tests/contracts/contracts/TestEip2935.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;

contract TestEip2935 {
// helper that returns blockhash opcode result (to demonstrate opcode unchanged)
function blockhashOpcode(uint256 blk) public view returns (bytes32) {
return blockhash(blk);
}
}
81 changes: 81 additions & 0 deletions integration_tests/test_eip2935.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from pathlib import Path

import pytest
from hexbytes import HexBytes

from .cosmoscli import module_address
from .network import Cronos, setup_custom_cronos
from .utils import CONTRACTS, deploy_contract, submit_gov_proposal, w3_wait_for_block


@pytest.fixture(scope="module")
def cronos_eip2935(tmp_path_factory):
"""start-cronos
set evm's param header_hash_num to 5
"""
yield from setup_custom_cronos(
tmp_path_factory.mktemp("eip2935"),
28000,
Path(__file__).parent / "configs/eip2935.jsonnet",
)


def test_eip2935(cronos_eip2935: Cronos):
"""
check eip2935
"""
w3 = cronos_eip2935.w3

# Set header_hash_num to 5 in genesis, e.g we persist only the latest 5 block hashes
# Check that there is no history if query < current_block_number - 5
contract = deploy_contract(
w3,
CONTRACTS["TestEip2935"],
)
start = w3.eth.block_number
w3_wait_for_block(w3, start + 10, timeout=30)
for i in range(0, 4):
stored = contract.caller.blockhashOpcode(start + i)
assert HexBytes(stored) == HexBytes(b"\x00" * 32)

# Deploy history storage contract
history_storage_address = "0x0000F90827F1C53a10cb7A02335B175320002935"
history_storage_code = w3.eth.get_code(history_storage_address)
assert history_storage_code == HexBytes("0x")

expected_history_storage_code = (
"0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f356001"
"43038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611f"
"ff60014303065500"
)
history_storage_preinstall = {
"name": "HistoryStorage",
"address": history_storage_address,
"code": expected_history_storage_code,
}

msg = "/ethermint.evm.v1.MsgRegisterPreinstalls"
authority = module_address("gov")
submit_gov_proposal(
cronos_eip2935,
msg,
messages=[
{
"@type": msg,
"authority": authority,
"preinstalls": [history_storage_preinstall],
}
],
)

history_storage_code = w3.eth.get_code(history_storage_address)
assert history_storage_code == HexBytes(expected_history_storage_code)

# Check that history < current_block_number - 5 is available
w3_wait_for_block(w3, w3.eth.block_number + 10, timeout=30)
start = w3.eth.block_number
w3_wait_for_block(w3, start + 10, timeout=30)
for i in range(0, 9):
block = w3.eth.get_block(start + i)
stored = contract.caller.blockhashOpcode(start + i)
assert stored == block.hash
1 change: 1 addition & 0 deletions integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Simple7702Counter": "Simple7702Counter.sol",
"Utils": "Utils.sol",
"Counter": "Counter.sol",
"TestEip2935": "TestEip2935.sol",
}


Expand Down
2 changes: 2 additions & 0 deletions third_party/proto/ethermint/evm/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ message Params {
bool allow_unprotected_txs = 6;
// header_hash_num is the number of header hash to persist.
uint64 header_hash_num = 7;
// historyServeWindow for EIP 2935
uint64 history_serve_window = 8;
}
Loading