Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed Jan 30, 2025
1 parent f4ffba6 commit f86c3bd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.
1 change: 0 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ func (app *App) RegisterUpgradeHandler() error {
app.Configurator(),
app.Logger(),
app.CapabilityKeeper,
app.ConsensusKeeper,
),
)

Expand Down
2 changes: 1 addition & 1 deletion e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestChainUpgrade(t *testing.T) {
// After successfully creating and querying the ICA account we need to update the test suite value for later usage.
icaTs.IcaAddress = icaAddr

// Assert inital balance of the ICA is correct.
// Assert initial balance of the ICA is correct.
initBal, err := noble.BankQueryBalance(ctx, icaAddr, noble.Config().Denom)
require.NoError(t, err, "failed to query bank balance")
require.True(t, initBal.Equal(icaTs.InitBal), "invalid balance expected(%s), got(%s)", icaTs.InitBal, initBal)
Expand Down
2 changes: 2 additions & 0 deletions upgrade/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ import (

dollartypes "dollar.noble.xyz/types"
wormholetypes "github.com/noble-assets/wormhole/types"
swaptypes "swap.noble.xyz/types"
)

func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
// Noble Modules
dollartypes.ModuleName,
swaptypes.ModuleName,
wormholetypes.ModuleName,
},
}
Expand Down
40 changes: 2 additions & 38 deletions upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@ package upgrade

import (
"context"
"fmt"

"cosmossdk.io/errors"
"cosmossdk.io/log"
upgradetypes "cosmossdk.io/x/upgrade/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/proto/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
Expand All @@ -37,22 +32,16 @@ func CreateUpgradeHandler(
cfg module.Configurator,
logger log.Logger,
capabilityKeeper *capabilitykeeper.Keeper,
consensusKeeper consensuskeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
vm, err := mm.RunMigrations(ctx, cfg, vm)
if err != nil {
return nil, err
return vm, err
}

sdkCtx := sdk.UnwrapSDKContext(ctx)
FixICS27ChannelCapabilities(sdkCtx, capabilityKeeper)

err = EnableVoteExtensions(ctx, logger, plan, consensusKeeper)
if err != nil {
return nil, err
}

logger.Info("Welcome to a new generation of Noble!" + UpgradeASCII)

return vm, nil
Expand Down Expand Up @@ -87,28 +76,3 @@ func FixICS27ChannelCapabilities(ctx sdk.Context, capabilityKeeper *capabilityke

capabilityKeeper.InitMemStore(ctx)
}

// EnableVoteExtensions updates the consensus parameters of Noble to enable
// vote extensions one block after the Argentum upgrade is performed.
func EnableVoteExtensions(ctx context.Context, logger log.Logger, plan upgradetypes.Plan, consensusKeeper consensuskeeper.Keeper) error {
var params cmtproto.ConsensusParams
var err error

params, err = consensusKeeper.ParamsStore.Get(ctx)
if err != nil {
return errors.Wrap(err, "unable to get consensus params from state")
}

params.Abci = &tmtypes.ABCIParams{
VoteExtensionsEnableHeight: plan.Height + 1,
}

err = consensusKeeper.ParamsStore.Set(ctx, params)
if err != nil {
return errors.Wrap(err, "unable to set consensus params to state")
}

logger.Info(fmt.Sprintf("enabling vote extensions at block %d", params.Abci.VoteExtensionsEnableHeight))

return nil
}

0 comments on commit f86c3bd

Please sign in to comment.