Skip to content

Commit 302a15c

Browse files
committed
refactor(upgrade): make v1.3.0 a noop — authz grants are create-only gates (release/1.3.x)
Mirror of the #263 decision on release/1.3.x. The only authz grants moca's state machine reads are create-time gates (validator self-del -> gov MsgDelegate in MsgCreateValidator, SP funding -> gov MsgDeposit in MsgCreateStorageProvider); nothing consumes them after creation, and a new creator re-grants before creating, so the grants the moca-iavl bug dropped need no restoration. Restoring/deleting from a handler is also consensus-unsafe (enumeration via the store iterator reads the fastnode, not the tree, and forks on a node whose fastnode is missing a tree-backed key). Real fixes are not a handler: cosmos/iavl#1009 in the binary stops the prove=true panic, and an IAVL fastnode rebuild (state-sync / fastStorageVersionValue bump) clears the drift. Removes app/upgrades/v1_3_0_authz_recovery.go and its test.
1 parent e2dd822 commit 302a15c

4 files changed

Lines changed: 18 additions & 174 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4141

4242
- (proto) [#67](https://github.com/mocachain/moca/pull/67) Publish protos to BSR under moca org
4343
- (cli) [#243](https://github.com/mocachain/moca/pull/243) Add `mocad snapshots` command tree (list/delete/dump/export/load/restore) for managing local state-sync snapshots
44-
- (upgrade) [#266](https://github.com/mocachain/moca/pull/266) `v1.3.0` upgrade re-grants the validator self-del → gov (`MsgDelegate`, Generic) authz grant required by `MsgCreateValidator` that the moca-iavl commit-time bug dropped from the merkle tree, keyed off the canonical staking store so it is deterministic on every node. Scope is intentionally minimal (only this required grant); other dropped grants are not reconstructable from on-chain state and owners re-create them
44+
- (upgrade) [#266](https://github.com/mocachain/moca/pull/266) Add `v1.3.0` upgrade handler (noop `RunMigrations`). The moca-iavl commit-time bug left authz fastnode-vs-tree drift, but the only authz grants moca reads are create-time gates (validator→gov `MsgDelegate` in `MsgCreateValidator`, SP funding→gov `MsgDeposit` in `MsgCreateStorageProvider`) — nothing consumes them after creation, so the dropped grants need no restoration. The `prove=true` panic is fixed by `cosmos/iavl#1009` in the binary; the residual fastnode drift is cleared by an IAVL rebuild (state-sync / `fastStorageVersionValue` bump), not a consensus handler
4545

4646
### Improvements
4747

app/app.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,19 +1559,23 @@ func (app *Evmos) setupUpgradeHandlers() {
15591559
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
15601560
})
15611561

1562-
// v1.3.0: re-grant the validator SelfDelAddress -> gov (MsgDelegate) authz
1563-
// grant that moca's MsgCreateValidator handler requires but that the
1564-
// moca-iavl commit-time bug dropped from the merkle tree. Keyed off the
1565-
// canonical staking store so it is deterministic on every node regardless of
1566-
// per-node fastnode drift; restored as Generic to match the standard
1567-
// create-validator flow. Other dropped grants are not reconstructable from
1568-
// on-chain state and owners re-create them; the residual fastnode drift is
1569-
// fixed by an IAVL rebuild (state-sync / fastStorageVersionValue bump), not
1570-
// from a consensus handler. The v1.3.0 binary also carries cosmos/iavl#1009.
1571-
app.UpgradeKeeper.SetUpgradeHandler(
1572-
upgrades.V1_3_0UpgradeName,
1573-
upgrades.V1_3_0RestoreValidatorDelegateGrant(app.AuthzKeeper, app.StakingKeeper, app.mm, app.configurator),
1574-
)
1562+
// v1.3.0: no state-machine changes. The moca-iavl commit-time bug left authz
1563+
// fastnode-vs-tree drift, but the only authz grants moca's handlers read are
1564+
// create-time gates — validator self-del -> gov (MsgDelegate) in
1565+
// MsgCreateValidator, and SP funding -> gov (MsgDeposit) in
1566+
// MsgCreateStorageProvider. Nothing consumes them after creation (delegate,
1567+
// withdraw, unjail, redelegate, edit, deposit top-ups, slashing all skip the
1568+
// check), and a new creator re-grants right before creating, so the dropped
1569+
// grants need no restoration. Restoring them is also consensus-unsafe from a
1570+
// handler (a purge/regrant keyed off the store iterator, which reads the
1571+
// fastnode not the tree, forks on a node whose fastnode is missing a
1572+
// tree-backed key). The v1.3.0 binary carries cosmos/iavl#1009 (stops the
1573+
// prove=true panic on the phantom keys); the residual fastnode drift is
1574+
// cleared by an IAVL rebuild (state-sync / fastStorageVersionValue bump),
1575+
// not from this handler.
1576+
app.UpgradeKeeper.SetUpgradeHandler("v1.3.0", func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
1577+
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
1578+
})
15751579

15761580
// testnet only upgrade Handlers
15771581
app.UpgradeKeeper.SetUpgradeHandler(

app/upgrades/v1_3_0_authz_recovery.go

Lines changed: 0 additions & 85 deletions
This file was deleted.

app/upgrades/v1_3_0_authz_recovery_test.go

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)