Skip to content

feat: base the fork on cosmos/evm v0.7.3 - #22

Closed
mattkii wants to merge 202 commits into
mainfrom
feat/fork-v0.7.3
Closed

mattkii wants to merge 202 commits into
mainfrom
feat/fork-v0.7.3

Conversation

@mattkii

@mattkii mattkii commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

Move main from the v0.6 fork onto cosmos/evm v0.7.3, and carry the five Kii-only behaviors that v0.7.3 does not have. The rest of the v0.6 fork (StateDB overflow and underflow guards, commit atomicity, locked-balance snapshot, gasCap, precompile gas, ERC20 and ICS-20 acks, Ledger coin type) is already in v0.7.3.

Brought from the v0.6 fork:

  • Refund unused EVM gas in the denom that was actually paid (ContextPaidFeesKey, capped by the amount paid).
  • Reject contract creation unless the account is empty or a plain BaseAccount (IsBaseAccountOrEmpty).
  • Skip non-20-byte accounts when mirroring balances, and reject a non-20-byte distribution withdraw address.
  • Use the sign-doc chain id for EIP-712 when it parses as a uint64.
  • Treat an already-known EVM tx as CheckTx success, and return ErrAlreadyKnown from SendRawTransaction.

Review the five commits on top of v0.7.3 (6cd2d513 through 700c8297). The large diff under that is the upstream v0.7.3 upgrade.

Kiichain will follow the v0.6.x → v0.7.0 migration guide on feat/evm-v0.7.3: bump Go 1.25, cosmos-sdk v0.54, cometbft v0.39, ibc-go v11, and geth 1.17; replace ExperimentalEVMMempool with Krakatoa; recopy the fee-abstraction EVM ante so it still sets ContextPaidFeesKey; drop x/precisebank; leave BlockSTM off for the first cut.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

mattac21 and others added 30 commits October 21, 2025 15:59
* support rocksdb build options in localnode script compilation

* echo provided build flags before building
* fix(rpc): apply state overrides to eth_estimateGas api

* fix(rpc): use blockNumberOrHash instead of blockNumber for eth_estimateGas api

* fix(v/xm): state overrides for EstimateGas

* test(jsonrpc): enhance eth_estimateGas api

* chore: fix codeQL warning

* chore: update CHANGELOG.md
* Bump golang to 1.25.0

* Also bump systemtests

* Also bump jsontestsimulator

* Fix typo

* Fix lint
* move relevant hardcoded configs back to evmd as an example

* undo makefile

* lints
* address docs gaps

* fix duplicate 3) entry

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* Problem: precompile abi json is not pure abi

Closes: #757

Solution:
- cleanup the non-abi stuff from abi.json.
- cleanup the abi parsing function.

* Update CHANGELOG.md

* fix lint

* lint: ignore

---------

Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Co-authored-by: srdtrk <srdtrk@hotmail.com>
Co-authored-by: Abdul Malek <me@almk.dev>
* Bump to latest deps

* Fix lints

* Update

* Tidy systemtests

* Fix tests

* Bump to latest ibc-go

* Point to latest SDK deps

* Bump systemtest versions

* Remove replace in systemtests

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* refactor(systemtests): change CheckTxsQueuedSync to CheckTxsQueuedAsync

* refactor(systemtests): remove calling AfterEachAction from TestTxsOrdering

* refactor(systemtests): refactor account type

* refactor(systemtests): apply mutex for accounts

* refactor(systemtests): apply account pool to test cases

* refactor(systemtests): apply account pool to eip7702 test

* refactor(systemtests): fix CheckTxsQueuedAsync

* refactor(systemtests): apply global chain

* refactor(systemtests): fix eip7702 test

* refactor(systemtests): fix test suite

* chore(systemtests): refactor test suite

* refactor(systemtests): fix eip712 test

* refactor(systemtests): fix validation method

* refactor(systemtests): refactor suite

* WIP: refactor test suite

* chore: modify makefile

* refactor: change upgrade test file name and apply --mempool.max-txs=0 flag

* refactor test suite

* refactor(systemtest): add test cases

* refactor(systemtest): enable chainupgrade test

* refactor(systemtest): refactor suite

* fix system tests

* fix system tests

* fix system tests

* refactor test cases

* chore: change test name

* fix upgrade test

* fix upgrade test

* resolve merge conflic

* test(systemtests): remove additional test accounts setting

* test(systemtests): fix helper function for pending txs

* test(systemtests): fix test case

* tet(systemtests): refactor test execution

* test(systemtests): remove account pool

* test(systemtests): fix pending cosmos tx verification

* chore: update CHANGELOG.md

* chore: update comments

* test(systemtests): increase block time of replacement test cases

* fix: rollback block time increase for test

* test(systemtests): apply 6s blocktime only for specific test case

* test(systemtests): apply 9s blocktime only for specific test case

* chore: modify Makefile

* test(systemtest): disable non-deterministic test case

* resolve merge conflict

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* attempt

* increase timeout

* try faster runner

* test(systemtests): ignore err from getting baseFee

* test(systemtests): disable unstable test cases

---------

Co-authored-by: Abdul Malek <me@almk.dev>
Co-authored-by: Haber <bluejet1104@gmail.com>
* Problem: ibc middleware verify sender address incorrectly

* Update CHANGELOG.md

Signed-off-by: yihuang <yi.huang@mantrachain.io>

* remove sendToSelf check

* fix test build

* fix test

* Fix test

* fix test

---------

Signed-off-by: yihuang <yi.huang@mantrachain.io>
Co-authored-by: Vlad J <vladjdk@gmail.com>
Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* create new context

* add teardown

* add multistore to test setup so that cachecontext can be used

* add explicit subpool resets

* add longer timeout

* add mutex control

* lint

* update changelog

* update comments

* add separated builds

* rename attr

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* WIP: add estimateGas test file

* fix: align gas estimation binary search with geth

* fix(x/vm): fix EstimateGasInternal

- let EstimateGasInternal call ApplyMessageWithConfig with internal = true
- fix lowest possible gas

* apply EIP-7623: Data-heavy transactions pay the floor gas

* fix: state overrides handling

* fix test code for gas estimation

* chore: update CHANGELOG.md

* test(x/vm): fix test code

* chore: resolve codeQL warnings

* fix(x/vm): StateDB.Commit

* test(jsonrpc): enhance eth_estimateGas test case

* chore: remove temporary file for test

* chore: apply code review

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* fix: allow ledger flag work with coin type 60

aligned ledger firmware with go-ethereum

* lint

* allow to generate both

* cleanup

* fix test

* fix build

* fix resolve

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
* feat: added ICS02 interface

* style: rename

* imp: added abi

* imp: add interface

* imp: added precompile boilerplate

* feat: added tx.go

* imp: added query

* imp: use new abi

* fix

* imp: update default precompiles

* imp: wire

* docs: updated changelog

* lint

* test: boilerplate

* fix: added missing adress

* fix: wrong address

* test: first test passing

* test: bad case

* feat: update client tested and working

* lint: golanci-lint

* test: verify membership

* test: verify non-membership

* lint

* style: self review items

* test: fix

* chore: fix attempt

* imp: change addr to 0x...807 instead of 0x...808

* imp: update required gas

* docs: added README

* imp: removed unused constants

* test: added update_client misbehavior

* test: added more update_client error cases

* test: added more failure cases to get_client_state

* test: added invalid header test

* test: add failure cases for verify membership

* test: added more failure cases to non-membership

* imp: removed noop

* imp: removed bankKeeper

* lint

* docs: added migration docs

* docs: alex review items

* docs: removed noop

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
Co-authored-by: Vlad J <vladjdk@gmail.com>
x/vm Keeper
TransientGas used has been refactored to write gas used per transaction to an object store key which is unique based on the txn index. This avoid each transaction reading/writing the same key/value. It is reset during EndBlock via deletion of all transient gas values.
Block bloom has been refactored to write each transactions' log bloom to a separate key in object storage. An EndBlocker has been added to accumulate all of these into a final bloom, and Reset is called to delete all of the keys.
x/feemarket Keeper
TransientBlockGasWanted was fully removed. BlockGasWanted was added to the SDK's context and is now updated in baseapp during FinalizeBlock. The base fee calculation of the feemarket module has been updated to use the context's gas wanted for base fee calculation.
Antehandlers
As mentioned above, we no longer use gas wanted via the antehandlers so that has been removed.
The event emission has been changed to use the context's tx index instead of transient storage.
* bump gogoproto

* bump system tests mod
* Problem: evmCoinInfo not exists in historical state (#16)

* support default evmCoinInfo

* changelog

* Update CHANGELOG.md

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
… (#794)

* add explicit override for viper config default

* add changelog

* check error and panic
* Fix denom exponent checks

* Add changelog
Eric-Warehime and others added 27 commits May 1, 2026 16:16
* defer reap of replacement evm txs until they are verified via rechecker

* add test

* fix double hash calc

* add comment about not clearing toReap when cancelling demote early

* clear toReap on legacypool.Clear()
…gured reaplist on startup (#1158)

* add reaplist bounds and tests

* remove wedge test

* greptile fixes

* lints
…and cosmos tx (#1160)

* chore(mempool): add systemtests demonstrating a same-nonce authoriztion and cosmos tx race

* Update tests/systemtests/accountabstraction/test_eip7702_same_block.go

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix suggestion

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* bump sdk to main

* bump comet to main
* remove errors log; add notes

* streamline recheck mempool creation

* wip

* make reserver.Hold and .Release atomic for multiple addresses

* refactor cosmos reserver calls

* implement reserve handler WithRefCounter()

* log errors
…rong sequence (#1163)

* fix removal of multisigner txs bug and fix bug invalding valid txs after nonce bump, add tests

* update existing tests with recheck pool removal behavior

* lint

* fix comment wording

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* remove intergration test for cosmos removals

* remove cosmos remove test

* flip drop to keep

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
(cherry picked from commit 64e859b6c26e1954a8f819e7bd8495af7d31777b)

Co-authored-by: mattac21 <matt@cosmoslabs.io>
* remove incorrect note about NoCheckProposalTxVerifier replacing EthSignerExtractor

* change note about NoCheckProposalTxVerifier to make it not required and an optional performance optimization

* update app mempool configuration in comet note

* Update docs/migrations/v0.6.x_to_v0.7.0.md



* update

---------


(cherry picked from commit 6edbe09ccc957b6f32bd2d14918ad06ec255af29)

Co-authored-by: mattac21 <matt@cosmoslabs.io>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix ics02 gas

* lints

* fix greptile comments

* Revert "fix greptile comments"

This reverts commit beb4078676e1e60e1a0629714772d04c0f1d29d1.

* fix greptile 02

* revert viewonly

* fix tests

* changelog

(cherry picked from commit 727f3b9ddd8c568c6ec8ef891044d7d7b55326c7)

Co-authored-by: Vlad J <vladjdk@gmail.com>
(cherry picked from commit e118daef885f4a43f456cf881fa9fe6806778c6d)

Co-authored-by: Eric Warehime <eric.warehime@gmail.com>
…187) (#1189)

* fix(statedb): snapshot locked balance on statedb account  (#1187)

* snapshot locked balance on statedb account creation to calculate spendable + locked bank balance after locked balance changes via precompile

* lint formatting

* modify x/erc20 registering code hash to not silently drop existing accounts locked balacne

* update comments

* Update x/vm/keeper/statedb.go

Co-authored-by: Vlad J <vladjdk@gmail.com>

---------

Co-authored-by: Vlad J <vladjdk@gmail.com>
(cherry picked from commit 008c171178abc8456399e4fc31fe6994ab969da0)

# Conflicts:
#	x/vm/statedb/state_object.go

* conflicts

---------

Co-authored-by: mattac21 <matt@cosmoslabs.io>
* fix: reject EVM txs below base fee at mempool (#1223)

to avoid underpriced evm tx pass pool's default 0 min-tip gate, silently queued but never included

Co-authored-by: mattac21 <matt@cosmoslabs.io>
(cherry picked from commit 61cce3e60e2483c62e6e708d8697b759a7e11f2b)

* changelog

---------

Co-authored-by: mmsqe <tqd0800210105@gmail.com>
Co-authored-by: mattac21 <matt@cosmoslabs.io>
* chore(erc20/v2): align ack validation with ibc-go. (#1232)

* After code review

* Apply suggestion from @dianab-cl

* After code review

* Apply suggestion from @dianab-cl

* Apply suggestion from @dianab-cl

* Apply suggestion from @dianab-cl
* fix

* respect blocked accounts

* make strict equality

* tests

---------

Co-authored-by: mattac21 <matt@cosmoslabs.io>
…43) (#1255)

* fix: Move tests to use eoa instead of module account as deployer

* Lint

* Apply suggestion from @dianab-cl

Co-authored-by: dianab-cl <diana@cosmoslabs.io>
(cherry picked from commit 430eaed9a32168eface3959bed79f0fe8fe92e0b)

Co-authored-by: Eric Warehime <eric.warehime@gmail.com>
…) (#1254)

* fix: harden statedb balance and event amount handling (#1176)

* fix: harden statedb balance and event amount handling

Guard StateDB balance subtraction against underflow and make precompile balance-event parsing denom-aware for base vs extended denom paths. Also add regression tests and document that only 18-decimal EVM gas-token chains are supported.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(vm): enforce 18-decimal coin configuration

Reject non-18 decimal EVM coin configs in both runtime and test configurators, align affected tests, and temporarily exclude precisebank packages from root unit-test targets until precisebank removal lands.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: remove obsolete precisebank test package filters

Now that contrib/x/precisebank is removed on main, package selection no longer needs explicit exclusions and can rely on the standard simulation/e2e filters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: fix formatter ordering in scaling tests

Apply golangci formatter output for scaling tests so gci/gofumpt checks pass in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test: align integration suites with 18-decimal-only config

Remove non-18-decimal integration cases and fee checks that now fail by design under enforced 18-decimal EVM coin configuration.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 264aa70f18f4217b0354855a0c056e19c2f51b51)

# Conflicts:
#	x/vm/statedb/state_object.go

* Fix merge conflict

* Fix lints

* remove the requirement that the EVM coin be configured with 18 decimals

* sum the base and extended denom amounts when parsing balance change events

---------

Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
Co-authored-by: Eric Warehime <eric.warehime@gmail.com>
Co-authored-by: Matt Acciai <matt@cosmoslabs.io>
* fix(vm): make StateDB.Commit atomic to prevent partial writes on failure

* chore: trim newTestCtx comment

* Merge pull request #12 from cosmos/eric/backport-0.7

chore: Merge pull request #10 from cosmos/eric/overflow

---------

Co-authored-by: Dennis Fang <dhsfang@gmail.com>
Co-authored-by: Eric Warehime <eric.warehime@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 425b1f4f-595a-41c9-8a99-70b87cb21720
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mattkii

mattkii commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing this. The base is the v0.6 fork, so the diff is the whole v0.7 upgrade and the merge conflicts.

The review is #23, which targets base/v0.7.3 and contains only the five Kii patches.

@mattkii mattkii closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.