|
| 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