fix: evm-0.6.1 hotfix - #19
Conversation
* align gas calculation * changelog * lint * fix tests * fix test * Revert "fix test" This reverts commit 11147e5a609e8e88906922bfa5f1520990b24abc. * solhint * lint * make systemtest time 3s instead of 5s to hit blocktime
…187) (#1190) * 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) * fix conflicts * bump sol --------- Co-authored-by: mattac21 <matt@cosmoslabs.io> Co-authored-by: Vlad <vladjdk@gmail.com>
WalkthroughThe change adds locked-balance snapshots and locked-aware EVM balance updates, including bank-keeper interfaces, implementations, mocks, and integration tests. Native precompile execution now propagates out-of-gas errors directly, with bank precompile coverage measuring consumed gas. Integration tests update gas limits and add vesting, revert, and account-state scenarios. EVM mempool, ERC20 test deployment, consensus defaults, fee-market overflow handling, and test tooling are also updated. Estimated code review effort: 4 (Complex) | ~60 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
x/vm/statedb/state_object.go (1)
45-48: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueStale doc comment on
HasCodeHash.The comment still reads "IsContract returns..." though the method is
HasCodeHash. Minor naming/comment drift, likely predates this diff but is now touched by the line shift.✏️ Suggested fix
-// IsContract returns if the account contains contract code. +// HasCodeHash returns if the account contains contract code. func (acct Account) HasCodeHash() bool {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@x/vm/statedb/state_object.go` around lines 45 - 48, Update the doc comment directly above Account.HasCodeHash to describe HasCodeHash and its boolean result, replacing the stale IsContract reference while leaving the method implementation unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@x/precisebank/keeper/keeper.go`:
- Around line 51-54: Update Keeper.LockedCoins to convert the integer-denom
locked coins returned by k.bk.LockedCoins into the extended denomination before
returning them. Preserve the coin amounts while using the denomination
conversion utilities and match the VM BankKeeper contract expected by
lockedCoin() and SetBalance().
In `@x/vm/keeper/statedb.go`:
- Around line 140-147: Update SetBalanceWithLocked to defensively validate
locked before using it in big.Int arithmetic, returning a clear error when it is
nil; preserve the existing amount validation and normal balance-setting behavior
for valid inputs.
---
Nitpick comments:
In `@x/vm/statedb/state_object.go`:
- Around line 45-48: Update the doc comment directly above Account.HasCodeHash
to describe HasCodeHash and its boolean result, replacing the stale IsContract
reference while leaving the method implementation unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 95aecc77-fc27-432e-9bae-62269ed4c6b8
⛔ Files ignored due to path filters (1)
tests/solidity/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (33)
CHANGELOG.mdcontracts/solidity/ContractCreationTester.solcontracts/solidity/precompiles/bank/testdata/BankCaller.solevmd/mempool.goevmd/tests/ibc/helper.goevmd/testutil/eth_setup.goprecompiles/bank/testdata/BankCaller.jsonprecompiles/bank/testdata/BankCaller.solprecompiles/common/precompile.gotests/integration/precompiles/bank/test_integration.gotests/integration/precompiles/gov/test_integration.gotests/integration/precompiles/staking/test_integration.gotests/integration/precompiles/staking/test_staking.gotests/integration/precompiles/werc20/test_integration.gotests/integration/precompiles/werc20/test_utils.gotests/integration/x/vm/test_call_evm.gotests/integration/x/vm/test_state_transition.gotests/integration/x/vm/test_statedb.gotests/solidity/package.jsontests/systemtests/Makefiletestutil/integration/params.gox/erc20/keeper/dynamic_precompiles.gox/feemarket/keeper/abci.gox/precisebank/keeper/keeper.gox/precisebank/types/interfaces.gox/precisebank/types/mocks/MockBankKeeper.gox/vm/keeper/keeper.gox/vm/keeper/statedb.gox/vm/statedb/state_object.gox/vm/statedb/statedb.gox/vm/types/interfaces.gox/vm/types/mocks/BankKeeper.gox/vm/wrappers/testutil/mock.go
Description
Ports the July 2026 Cosmos EVM hotfix into the public fork, now that upstream has published it as cosmos/evm v0.6.1.
These changes were carried privately during the coordinated disclosure window and are already running in production:
kiichaind v7.3.0was built from this exact tree and Oro testnet upgraded to it at height33659735.Commits, applied directly on top of
main:chore: align gas usage with EVM semantics (#1049)— precompile gas accountingfix(statedb): snapshot locked balance on statedb account (backport #1187) (#1190)— StateDB locked-balance snapshottingMerge of changes— accompanying feemarket/StateDB fixes and integration testsThe resulting tree matches the private mirror at
v0.6.0-fork.3exactly, so no source change is introduced relative to the auditedv7.3.0binary.These are state-machine-breaking and must be adopted at a coordinated upgrade height.
Follow-up once merged: tag
v0.6.1-fork.1and flip thereplaceinKiiChain/kiichainfromKiiChain/evm-private v0.6.0-fork.3to the public tag, then remove the private-repo CI auth.Author Checklist
I have...
mainbranch