Skip to content

Commit 20bed3a

Browse files
authored
Merge pull request #354 from pushchain/chore/evm-v0-6-2-handler
chore: add evm-v0.6.2 upgrade handler (donut)
2 parents ff021b6 + 8cd3404 commit 20bed3a

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

app/upgrades.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
evmv040 "github.com/pushchain/push-chain-node/app/upgrades/evm-v0-4-0"
2424
evmv050 "github.com/pushchain/push-chain-node/app/upgrades/evm-v0-5-0"
2525
evmv060 "github.com/pushchain/push-chain-node/app/upgrades/evm-v0-6-0"
26+
evmv062 "github.com/pushchain/push-chain-node/app/upgrades/evm-v0-6-2"
2627
feeabs "github.com/pushchain/push-chain-node/app/upgrades/fee-abs"
2728
gasoracle "github.com/pushchain/push-chain-node/app/upgrades/gas-oracle"
2829
"github.com/pushchain/push-chain-node/app/upgrades/noop"
@@ -88,6 +89,7 @@ var Upgrades = []upgrades.Upgrade{
8889
securityauditfixes.NewUpgrade(),
8990
// cosmos/evm v0.6.0 — runs the standard transfer module v5->v6 migration
9091
evmv060.NewUpgrade(),
92+
evmv062.NewUpgrade(),
9193
// pc20 — no-op binary swap; VAULT_PC/VAULT_PC20 deployed separately from EVM side
9294
pc20.NewUpgrade(),
9395
// sdk-v0.53 — Cosmos SDK v0.50.10 -> v0.53.7; no-op (no module ConsensusVersion changes)

app/upgrades/evm-v0-6-2/upgrade.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package evmv062
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
storetypes "cosmossdk.io/store/types"
8+
upgradetypes "cosmossdk.io/x/upgrade/types"
9+
sdk "github.com/cosmos/cosmos-sdk/types"
10+
"github.com/cosmos/cosmos-sdk/types/module"
11+
"github.com/pushchain/push-chain-node/app/upgrades"
12+
)
13+
14+
const UpgradeName = "evm-v0.6.2"
15+
16+
// NewUpgrade registers the cosmos/evm v0.6.0 -> v0.6.2 upgrade.
17+
//
18+
// Unlike the v0.6.0 upgrade, this release carries NO state migration: across
19+
// v0.6.0..v0.6.2 upstream changed no .proto file, added or removed no store key,
20+
// and bumped no module's ConsensusVersion. StoreUpgrades is therefore empty and
21+
// RunMigrations is expected to be a no-op — the handler exists so the plan has a
22+
// name for cosmovisor to switch the binary on.
23+
//
24+
// The behavioural changes that DO land with this binary, for the record:
25+
// - statedb SubBalance now panics on balance underflow instead of wrapping
26+
// silently (upstream's equivalent of F-2026-18201).
27+
// - Module accounts may no longer have their EVM balance written
28+
// ("<addr> is not allowed to receive funds"). Push is unaffected: every
29+
// module-sender EVM call passes value=0, and the fee/burn and universal
30+
// validator reward paths run through the SDK bank keeper, which never
31+
// reaches the EVM statedb.
32+
// - Precompile out-of-gas now propagates as vm.ErrOutOfGas. No repricing:
33+
// succeeding transactions consume identical gas.
34+
// - Extended-denom accounting and the erc20 IBC v2 ack changes are no-ops on
35+
// this chain (ExtendedDenom == Denom == upc; no IBC v2 stack is wired).
36+
func NewUpgrade() upgrades.Upgrade {
37+
return upgrades.Upgrade{
38+
UpgradeName: UpgradeName,
39+
CreateUpgradeHandler: CreateUpgradeHandler,
40+
StoreUpgrades: storetypes.StoreUpgrades{
41+
Added: []string{},
42+
Deleted: []string{},
43+
},
44+
}
45+
}
46+
47+
// CreateUpgradeHandler runs the standard module migrations. No module migration
48+
// is expected to fire for this release; RunMigrations is called anyway so the
49+
// stored version map stays consistent and any migration bundled by a dependency
50+
// is still executed rather than silently skipped.
51+
func CreateUpgradeHandler(
52+
mm upgrades.ModuleManager,
53+
configurator module.Configurator,
54+
_ *upgrades.AppKeepers,
55+
) upgradetypes.UpgradeHandler {
56+
return func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
57+
logger := sdk.UnwrapSDKContext(ctx).Logger().With("upgrade", UpgradeName)
58+
logger.Info("starting cosmos/evm v0.6.2 upgrade: no state migration expected")
59+
60+
versionMap, err := mm.RunMigrations(ctx, configurator, fromVM)
61+
if err != nil {
62+
return nil, fmt.Errorf("run migrations: %w", err)
63+
}
64+
65+
logger.Info("cosmos/evm v0.6.2 upgrade complete")
66+
return versionMap, nil
67+
}
68+
}

0 commit comments

Comments
 (0)