Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove STAKE supply correction in v8 upgrade #428

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/monerium/module-noble/v2 v2.0.0 h1:VZJnM+9yEKaGkvyfgeeQx2QIQusZkxOsL8mZiUHEiaQ=
github.com/monerium/module-noble/v2 v2.0.0/go.mod h1:Zdc3bwH628QVNcyNu6F6C3znA+Uxk+EnuSUUNYJJKlY=
github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI=
github.com/moricho/tparallel v0.3.2/go.mod h1:OQ+K3b4Ln3l2TZveGCywybl68glfLEwFGqvnjok8b+U=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
cosmossdk.io/depinject v1.0.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.4.1
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.1.1
cosmossdk.io/tools/confix v0.1.2
cosmossdk.io/x/evidence v0.1.1
Expand Down Expand Up @@ -46,6 +45,7 @@ require (
cloud.google.com/go/storage v1.43.0 // indirect
cosmossdk.io/api v0.7.5 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/math v1.3.0 // indirect
cosmossdk.io/x/tx v0.13.5 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/4meepo/tagalign v1.3.4 // indirect
Expand Down
31 changes: 0 additions & 31 deletions upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"cosmossdk.io/errors"
"cosmossdk.io/log"
"cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -184,12 +183,6 @@ func CreateUpgradeHandler(
// Migrate validator accounts to permanently locked vesting.
MigrateValidatorAccounts(ctx, accountKeeper, stakingKeeper)

// Safely burn surplus staking token supply.
err = BurnSurplusSupply(ctx, authority, accountKeeper, bankKeeper)
if err != nil {
return vm, err
}

logger.Info(UpgradeASCII)
return vm, nil
}
Expand Down Expand Up @@ -231,30 +224,6 @@ func MigrateValidatorAccounts(ctx context.Context, accountKeeper authkeeper.Acco
}
}

// BurnSurplusSupply performs a burn of the surplus $STAKE supply.
func BurnSurplusSupply(ctx context.Context, authority string, accountKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper) error {
supply := bankKeeper.GetSupply(ctx, "ustake")
surplus, err := supply.SafeSub(sdk.NewCoin(
"ustake", math.NewInt(1_000_000_000_000_000),
))

if err != nil || !surplus.IsPositive() {
return nil
}

address, err := accountKeeper.AddressCodec().StringToBytes(authority)
if err != nil {
return err
}
err = bankKeeper.SendCoinsFromAccountToModule(ctx, address, upgradetypes.ModuleName, sdk.NewCoins(surplus))
if err != nil {
return err
}

err = bankKeeper.BurnCoins(ctx, upgradetypes.ModuleName, sdk.NewCoins(surplus))
return err
}

// GetModuleMessages is a utility that returns all messages registered by a module.
func GetModuleMessages(registry codectypes.InterfaceRegistry, name string) (messages []string) {
for _, message := range registry.ListImplementations(sdk.MsgInterfaceProtoName) {
Expand Down