Skip to content
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
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ import (
upgrade1 "github.com/sagaxyz/ssc/app/upgrades/1.0"
upgrade2 "github.com/sagaxyz/ssc/app/upgrades/2"
upgrade3 "github.com/sagaxyz/ssc/app/upgrades/3"
upgrade4 "github.com/sagaxyz/ssc/app/upgrades/v4"

// this line is used by starport scaffolding # stargate/app/moduleImport

Expand Down Expand Up @@ -1270,6 +1271,7 @@ func (app *App) RegisterUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(upgrade1.Name, upgrade1.UpgradeHandler(app.mm, app.configurator, app.AccountKeeper, app.BankKeeper, app.ProviderKeeper, app.DacKeeper, *app.ChainletKeeper, app.BillingKeeper))
app.UpgradeKeeper.SetUpgradeHandler(upgrade2.Name, upgrade2.UpgradeHandler(app.mm, app.configurator))
app.UpgradeKeeper.SetUpgradeHandler(upgrade3.Name, upgrade3.UpgradeHandler(app.mm, app.configurator, app.TransferKeeper, app.BankKeeper))
app.UpgradeKeeper.SetUpgradeHandler(upgrade4.Name, upgrade4.UpgradeHandler(app.mm, app.configurator, *app.StakingKeeper, app.LiquidKeeper))

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
Expand Down
50 changes: 50 additions & 0 deletions app/upgrades/v4/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package v4

import (
"context"
"fmt"

"cosmossdk.io/math"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/types/module"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
liquidmodulekeeper "github.com/cosmos/gaia/v25/x/liquid/keeper"
liquidtypes "github.com/cosmos/gaia/v25/x/liquid/types"
)

const Name = "3-to-4"

func UpgradeHandler(mm *module.Manager, configurator module.Configurator, stakingKeeper stakingkeeper.Keeper, liquidKeeper liquidmodulekeeper.Keeper) upgradetypes.UpgradeHandler {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
newVM, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return nil, err
}

// set params to the liquid module
params := liquidtypes.Params{
GlobalLiquidStakingCap: math.LegacyNewDecFromIntWithPrec(math.NewInt(25), 2), // 0.25
ValidatorLiquidStakingCap: math.LegacyNewDecFromIntWithPrec(math.NewInt(5), 1), // 0.5
}
err = liquidKeeper.SetParams(ctx, params)
if err != nil {
return vm, fmt.Errorf("error setting params: %w", err)
}

// add all validators to the liquid module
allVals, err := stakingKeeper.GetAllValidators(ctx)
if err != nil {
return vm, fmt.Errorf("unable to get all validators: %w", err)
}
for _, val := range allVals {
lVal := liquidtypes.NewLiquidValidator(val.OperatorAddress)
if err := liquidKeeper.SetLiquidValidator(ctx, lVal); err != nil {
return vm, fmt.Errorf("error migrating liquid validator: %w", err)
}
}
Comment thread
luckychess marked this conversation as resolved.

// because this is a new module, we don't need to migrate anything else

return newVM, nil
}
}
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
cosmossdk.io/x/feegrant v0.2.0
cosmossdk.io/x/tx v0.14.0
cosmossdk.io/x/upgrade v0.2.0
github.com/cometbft/cometbft v0.38.19
github.com/cometbft/cometbft v0.38.21
github.com/cosmos/cosmos-db v1.1.1
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.53.4
Expand Down Expand Up @@ -238,5 +238,3 @@ require (
replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

replace github.com/cosmos/gaia => github.com/cosmos/gaia/v25 v25.1.1

replace github.com/cometbft/cometbft => github.com/sagaxyz/cometbft-sec-tachyon v0.38.21-0.20260113214209-9ac677707f85
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ github.com/cockroachdb/redact v1.1.6/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb h1:3bCgBvB8PbJVMX1ouCcSIxvsqKPYM7gs72o0zC76n9g=
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/cometbft/cometbft v0.38.21 h1:qcIJSH9LiwU5s6ZgKR5eRbsLNucbubfraDs5bzgjtOI=
github.com/cometbft/cometbft v0.38.21/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo=
github.com/cometbft/cometbft-db v1.0.4 h1:cezb8yx/ZWcF124wqUtAFjAuDksS1y1yXedvtprUFxs=
github.com/cometbft/cometbft-db v1.0.4/go.mod h1:M+BtHAGU2XLrpUxo3Nn1nOCcnVCiLM9yx5OuT0u5SCA=
github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4=
Expand Down Expand Up @@ -1482,8 +1484,6 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagaxyz/cometbft-sec-tachyon v0.38.21-0.20260113214209-9ac677707f85 h1:Vb5rpOYaAjEEtME+tIaPd5LtARljB9cCDLnoYNn6ocU=
github.com/sagaxyz/cometbft-sec-tachyon v0.38.21-0.20260113214209-9ac677707f85/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo=
github.com/sagaxyz/saga-sdk v0.11.1 h1:NNVAL3QHEaMiEpVIvvCKzbMj9kWE02QmQeU9kPWP1l4=
github.com/sagaxyz/saga-sdk v0.11.1/go.mod h1:XQEnR9jgvV9fYQeTRg/wPYCGMUyR5z2eKGuCoO+CYqc=
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
Expand Down
Loading