chore: cosmos-sdk upgrade 0.54 and evm upgrade 0.7.0 - #295
Open
AryaLanjewar3005 wants to merge 1 commit into
Open
chore: cosmos-sdk upgrade 0.54 and evm upgrade 0.7.0#295AryaLanjewar3005 wants to merge 1 commit into
AryaLanjewar3005 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chore: upgrade cosmos-sdk v0.53.7 → v0.54.3, ibc-go v10 → v11.2.0, cosmos-evm v0.6.0 → v0.7.0
Target chain: donut testnet (
push_42101-1).Summary
cosmos-evm v0.7.0 requires cosmos-sdk v0.54, which in turn requires ibc-go v11 and
cometbft v0.39. There is no way to split this — it is one atomic, coordinated,
state-affecting upgrade.
pushchain/evmrc2)../push-chain-evm)cosmossdk.io/storev1.1.2cosmos-sdk/store/v2v2.0.0cosmossdk.io/logv1.6.1cosmossdk.io/log/v2v2.1.071 files changed on
feat/cosmos-sdk-0.54-evm-0.7.0.Companion PR: the
push-chain-evmv0.7.0 upgrade (seePR-evm.md). This PR pointsgithub.com/cosmos/evmat that fork via a local replace.Critical decisions
Each of these was a fork in the road. Rationale recorded so reviewers can challenge
the reasoning, not just the diff.
D1. Target ibc-go v11.2.0, not the v11.0.0 that cosmos-evm pins
Decision. Pin ibc-go to v11.2.0 even though cosmos-evm v0.7.0 requires only
v11.0.0.
Why.
packet-forward-middlewareandrate-limitinghave noibc-appsv11release — the latest are v10.6.0 and v10.7.0, both pinning ibc-go v10 and
cosmos-sdk v0.53.4, and
cosmos/ibc-appsmainis still on v10 for both. It wouldbe easy to conclude from that alone that these modules are unavailable and must be
dropped.
That conclusion is wrong. Both middlewares were upstreamed into ibc-go core. On
v11 they are imported from ibc-go itself:
The patch release matters:
Pinning v11.0.0 or v11.1.0 forces dropping rate-limiting. v11.2.0 keeps both.
Verified by resolving the module and compiling a probe against
pfm.NewIBCMiddleware,pfmkeeper.NewKeeper,rl.NewIBCMiddlewareandrlkeeper.NewKeeper.Consequence. Zero IBC middleware functionality is lost. An earlier in-house
attempt (
task/sdk-upgrade) targeted v11.1.0 and consequently deleted therate-limiting middleware and its store; that sacrifice is unnecessary.
D2. Drop tokenfactory and group — and nothing else
Decision. Unwire exactly two modules and delete their stores.
Why. Neither has a cosmos-sdk v0.54 compatible release, verified by compiling:
cosmossdk.io/x/grouponly shipsv0.2.0-rc.1, which requirescosmossdk.io/core/registry,core/transaction,core/appmodule/v2,cosmos-sdk/simsxandclient/v2/autocli/prompt— all from the abandoned SDKv2 line, none present in the 0.54 constellation (
core v1.1.0,client/v2 v2.11.0).v0.50.7-wasmvm2, targetingSDK v0.50. Its own
apppackage importsgithub.com/cosmos/cosmos-sdk/x/group,a path that no longer exists in 0.54.
Why nothing else. It is tempting to conclude that
x/crisis,x/circuit,x/nft,x/evidence,x/feegrantandx/upgradewere also removed, because theirold import paths all break. They were relocated, not removed:
cosmossdk.io/x/circuitcosmos-sdk/contrib/x/circuitcosmos-sdk/x/crisiscosmos-sdk/contrib/x/crisiscosmossdk.io/x/nftcosmos-sdk/contrib/x/nftcosmossdk.io/x/evidencecosmos-sdk/x/evidence(main module)cosmossdk.io/x/feegrantcosmos-sdk/x/feegrant(main module)cosmossdk.io/x/upgradecosmos-sdk/x/upgrade(main module)All six are retained. The casualty list is two, not eight.
D3. Deleting those two stores is safe — verified against live chain state
Decision. Delete the
tokenfactoryandgroupstores in the upgrade handlerwith no pre-upgrade asset migration.
Why. Store deletion is irreversible and can strand funds, so this was verified
against donut rather than assumed. Queried at height ~20,158,578:
q bank total-supplyupc. Nofactory/...denoms.q bank denoms-metadataupcq tokenfactory paramsdenoms-from-creatoremptyq group group-info 1..5group: not foundfor every idGroup ids are sequential from 1, so the absence of group 1 means no group was ever
created — therefore no group policies, therefore no policy accounts holding funds.
This distinction matters because the two modules carry different risk:
x/bank, not in the tokenfactory store. Deletingits store would not delete balances; it would freeze denom administration (no more
mint/burn/admin changes). Recoverable-ish.
can hold funds, and the only way to spend from it is a proposal executed through
the group module. Delete the module with a funded policy and those funds become
permanently unreachable.
Both are empty, so neither risk materialises.
D4. Sequential default tx runner — not BlockSTM
Decision.
vmrunner.SetRunner(app.BaseApp, txnrunner.NewDefaultRunner(txConfig.TxDecoder())).Why. Registering a runner is mandatory in v0.7.0 regardless of execution
strategy. The reference
evmdapp usesNewSTMRunner(BlockSTM parallel execution),but BlockSTM is an optional, state-breaking feature bundled with virtual fee
collection. Adopting it is a separate decision with its own risk profile and its own
coordinated upgrade; folding it into an already-large dependency upgrade would
conflate two independent sources of consensus risk.
Virtual fee collection is likewise not enabled (no
EnableVirtualFeeCollection, nobanktypes.ObjectStoreKey).BlockSTM can be adopted later, but note it requires another coordinated upgrade —
it is baked in at build time.
D5. Krakatoa mempool — not applicable
Decision. No mempool migration performed.
Why. The v0.7.0 guide's Krakatoa section is required only if the fork wired
ExperimentalEVMMempool. push-chain does not —app.gohas only a commented-outSetMempool(nonceMempool)and otherwise uses the default SDK mempool. Nothing tomigrate.
mempool.type = "app"is not set inconfig.toml.D6. Retain the
compat/orm-apishim, re-pointed at api v1.0.0Decision. Keep the nested shim module and bump its
cosmossdk.io/apirequirement from v0.9.2 to v1.0.0.
Why.
cosmossdk.io/apidropped thecosmos/orm/*packages at v0.9.0 and stilldoes not ship them at v1.0.0, but
cosmossdk.io/orm— and therefore push-chain'sown ORM-backed
x/uregistryandx/uvalidatorgenerated state files, which carry_ "cosmossdk.io/orm"— still import them. The shim re-provides them viareplace cosmossdk.io/api/cosmos/orm => ./compat/orm-api.Worth flagging for reviewers of the reference attempt:
task/sdk-upgradehas nocompat/dir and no ORM state files, because its base commit predates them. It is agood template for pins but does not cover this.
D7. Purge the SDK-v2-line modules — the root cause of the resolution failure
Decision. Remove
cosmossdk.io/x/group,x/bank,x/gov, the RCcosmossdk.io/storeand
core/testingfromgo.modentirely.Why. These pull
cometbft >= v1.0.0transitively. With them present, MVSresolved cometbft to v1.0.1 regardless of the
requireon v0.39.3, and thebuild failed with a wall of
does not contain package github.com/cometbft/cometbft/proto/tendermint/*errors that look like a cometbftproblem but are not.
They had been re-added automatically by
go build -mod=modwhile the source stillimported
x/group. Once group was unwired and these purged, cometbft holds atv0.39.3 with no
replaceneeded — for cometbft or the SDK.This is the single highest-value debugging note in this PR: if cometbft ever drifts
to v1.x again, look for a v2-line module, not for a cometbft pin.
D8. Remove the
GasWantedDecoratorfrom the cosmos ante chainDecision. Delete it, add nothing in its place.
Why. It was removed upstream along with the transient stores. Its job was to
accumulate block gas-wanted into a feemarket transient store; in v0.7.0
x/feemarketreadsctx.BlockGasWanted()directly from the SDK's own block gasmeter in
EndBlock. Ante-side accumulation is redundant. No behaviour is lost —this is not a feature drop.
D9. Remove the capability module
Decision. Delete
capabilitykeeperusage entirely.Why. ibc-go v11 drops capabilities. In push-chain it was already vestigial: two
fields (
ChainApp.ScopedWasmKeeper,Upgrade.CapabilityKeeper) with zeroconsumers anywhere in the repo. Its keeper also fails to compile against store/v2
(
cosmossdk.io/store/typesvscosmos-sdk/store/v2/typesmismatch).D10. Rate-limiting placed at the top of the transfer stack
Decision. Rebuild the transfer stack on ibc-go v11's
porttypes.NewIBCStackBuilder,ordered bottom-to-top:
Why.
Build()wires the ICS4Wrappers so the transfer keeper'sSendPacketflowsup through every middleware before reaching the channel keeper — this replaces the
manual
app.TransferKeeper.WithICS4Wrapper(cbStack)call the v10 code needed.Rate-limiting sits outermost so it observes every packet after forwarding decisions
are made, which is where quota enforcement belongs.
Reviewers should sanity-check this ordering against the v10 behaviour, since the
old code expressed the stack by nesting constructors and passing
app.RatelimitKeeperas the transfer keeper's ICS4Wrapper — a different shape, andthe ordering equivalence is a judgement call rather than a mechanical translation.
D11.
iavlpinned to v1.2.8Why. v1.3.4 references
corestore.KVStoreWithBatchandcorestore.Batch, whichdo not exist in the
cosmossdk.io/corev1.1.0 that SDK 0.54.3 uses. v1.2.8 is theversion the working reference builds against.
Other notable changes
Store layer.
SetCommitMultiStoreTracerremoved (gone with store/v2). The evmand feemarket transient keys replaced by
storetypes.NewObjectStoreKeys(evmtypes.ObjectKey)+MountObjectStores. The EVMkeeper now takes the object key and a deterministically sorted
[]storetypes.StoreKeyinstead of the key map — sorting matters, the slice order isconsensus-visible.
Keeper signature changes. ibc (drops params subspace; upgrade keeper is now an
02-client/types.UpgradeKeeper), gov (reordered, plusgovkeeper.NewDefaultCalculateVoteResultsAndVotingPower(app.StakingKeeper)),transfer (pointer return, address codec inline, no ICS4Wrapper arg), rate-limiting,
packet-forward (
SetTransferKeepergone — transfer keeper passed directly), ICAhost/controller (pointer returns), wasm (gains
ChannelKeeperV2),nodeservice.RegisterNodeService(gains an earliest-version getter).AppCreator. The
traceStore io.Writerparameter was dropped fromservertypes.AppCreator;newApp,appExportand thesdkAppCreatorwrapper wereupdated and now pass
niltoNewChainApp.HydrateGlobals. Added afterLoadLatestVersion:This populates the global EVM coin info from the KV store before any JSON-RPC handler
can run. Unit tests do not catch its absence — the app builds and the entire
suite passes without it — but RPC requests served before the first
PreBlockwouldread an uninitialised
evmCoinInfo. Caught by diffing againstevmd, not by tests.banktypes.ModuleNameadded toSetOrderEndBlockers. SDK 0.54 panics if anyregistered module is missing from the ordering.
precompiles/usigverifier. Two changes: added theName()method that geth 1.17added to
vm.PrecompiledContract; and replaced the removedcmn.LoadABI. Notefor anyone porting another precompile: this
abi.jsonis a Hardhat artifact(
hh-sol-artifact-1— an object with an"abi"key), not a bare ABI array like theupstream precompiles use.
cmn.LoadABIunwrapped it;abi.JSONdoes not. Passingthe raw artifact panics at package init and takes down every app-constructing test in
the repo.
app/ante/fee.go.errorsmod.Wrapf(err, err.Error())→Wrap; Go 1.24+vetrejects a non-constant format string.
Upgrade handler
app/upgrades/sdk-v0-54, registered inapp/upgrades.go:The handler also deletes both from the consensus version map before
RunMigrations,so it does not attempt to init-genesis or migrate modules that no longer exist.
UpgradeName = "sdk-v0.54"— must match theplan.namein theMsgSoftwareUpgradeproposal.Testing
All passing:
x/uexecutor,x/uregistry(incl. migrations/v3),x/utss,x/uvalidator(keeper + types each),app,app/ante,app/decorators,app/upgrades/purge-expired-outbounds,utils.*
cmd/puniversaldfails at the link step withld: library 'godkls' not foundbecause
../dkls23-rs/target/releasedoes not exist in this workspace. Pre-existingenvironment gap, not a regression —
go vet ./cmd/puniversald/...compiles clean.Build the Rust dkls23 library and it links.
Dependency link — to be repointed before merge
go.modcurrently carries a local path replace:This is intentional for development and will be swapped for a published version.
Everything in this PR was built and tested against
push-chain-evmat commita5cdd297("feat: cosmos evm upgrade 0.7.0", branchevm-upgrade-0.7.0), treeclean.
When repointing, the published tag must contain that exact tree. If the fork is
re-tagged from a different commit, none of the test results in this PR transfer —
the local replace bypasses
go.sum, so a content mismatch will not be caught bychecksum verification. Re-run
go test -tags=test ./x/... ./app/... ./utils/...after the swap.
Review checklist
allStoreKeysslice passed to the EVM keeper is deterministic across nodesHydrateGlobalscontext (LastBlockHeight/ChainID) is correct for a fresh-genesis start as well as a restartpuniversaldlinksReferences
Changes
Testing
go test ./...Checklist