Skip to content

Commit

Permalink
add upgrade handler. fix lint errors. update changelog version
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Adams authored and dwedul-figure committed Jun 14, 2022
1 parent b4b3fbd commit 77cde58
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 68 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

---

## [v1.11.0](https://github.com/provenance-io/provenance/releases/tag/v1.11.0) - 2022-06-13
## [v1.11.1-rc1](https://github.com/provenance-io/provenance/releases/tag/v1.11.1-rc1) - 2022-06-14

### Features

Expand Down
65 changes: 2 additions & 63 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/cosmos/ibc-go/v2/modules/core/exported"
ibcctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types"

attributetypes "github.com/provenance-io/provenance/x/attribute/types"
markertypes "github.com/provenance-io/provenance/x/marker/types"
Expand All @@ -36,67 +34,8 @@ type appUpgrade struct {
}

var handlers = map[string]appUpgrade{
"green": {
Handler: func(app *App, ctx sdk.Context, plan upgradetypes.Plan) (module.VersionMap, error) {
// Ensure consensus params are correct and match mainnet/testnet. Max Block Sizes: 60M gas, 5MB
params := app.GetConsensusParams(ctx)
params.Block.MaxBytes = 1024 * 1024 * 5 // 5MB
params.Block.MaxGas = 60_000_000 // With ante tx gas limit this will yield 3M gas max per tx.
app.StoreConsensusParams(ctx, params)

app.IBCKeeper.ClientKeeper.IterateClients(ctx, func(clientId string, state exported.ClientState) bool {
tc, ok := (state).(*ibcctmtypes.ClientState)
if ok {
tc.AllowUpdateAfterExpiry = true
app.IBCKeeper.ClientKeeper.SetClientState(ctx, clientId, state)
}
return false
})

// set governance deposit requirement to 50,000HASH
govParams := app.GovKeeper.GetDepositParams(ctx)
beforeDeposit := govParams.MinDeposit
govParams.MinDeposit = sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, sdk.NewInt(50_000_000_000_000)))
app.GovKeeper.SetDepositParams(ctx, govParams)
ctx.Logger().Info(fmt.Sprintf("Updated governance module minimum deposit from %s to %s", beforeDeposit, govParams.MinDeposit))

// set attribute param length to 1,000 from 10,000
attrParams := app.AttributeKeeper.GetParams(ctx)
beforeLength := attrParams.MaxValueLength
attrParams.MaxValueLength = 1_000
app.AttributeKeeper.SetParams(ctx, attrParams)
ctx.Logger().Info(fmt.Sprintf("Updated attribute module max length value from %d to %d", beforeLength, attrParams.MaxValueLength))

// Note: retrieving current module versions from upgrade keeper
// metadata module will be at from version 2 going to version 3
// msgfees module will not be in version map this will cause runmigrations to create it and run InitGenesis
versionMap := app.UpgradeKeeper.GetModuleVersionMap(ctx)
ctx.Logger().Info("NOTICE: Starting migrations. This may take a significant amount of time to complete. Do not restart node.")
resultVM, err := app.mm.RunMigrations(ctx, app.configurator, versionMap)
if err != nil {
return resultVM, err
}

return resultVM, AddMsgBasedFees(app, ctx)

},
Added: []string{msgfeestypes.ModuleName},
},
"hazel": {},
"indigo": {}, // upgrade for pio-testnet-1 from v1.8.0-rc7 to v1.8.0-rc8
"jasmine": {
Handler: func(app *App, ctx sdk.Context, plan upgradetypes.Plan) (module.VersionMap, error) {
// Ensure consensus params are correct and match mainnet/testnet. Max Block Sizes: 60M gas, 5MB
params := app.GetConsensusParams(ctx)
params.Block.MaxBytes = 1024 * 1024 * 5 // 5MB
params.Block.MaxGas = 60_000_000 // With ante tx gas limit this will yield 3M gas max per tx.
app.StoreConsensusParams(ctx, params)
versionMap := app.UpgradeKeeper.GetModuleVersionMap(ctx)
return versionMap, nil
}, // upgrade for pio-testnet-1 from v1.8.0-rc8 to v1.8.0-rc9
},
"kahlua": {}, // upgrade for pio-testnet-1 from v1.8.0-rc9 to v1.8.0
"lava": {}, // upgrade for 1.10.0
"lava": {}, // upgrade for 1.10.0
"mango": {}, // upgrade for 1.11.1
// TODO - Add new upgrade definitions here.
}

Expand Down
1 change: 1 addition & 0 deletions internal/handlers/msg_fee_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

msgfeestypes "github.com/provenance-io/provenance/x/msgfees/types"
)

Expand Down
4 changes: 0 additions & 4 deletions internal/handlers/msg_fee_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func (afd MsgFeeInvoker) Invoke(ctx sdk.Context, simulate bool) (coins sdk.Coins
eventsToReturn := sdk.Events{}

if ctx.TxBytes() != nil && len(ctx.TxBytes()) != 0 {
originalGasMeter := ctx.GasMeter()

tx, err := afd.txDecoder(ctx.TxBytes())
if err != nil {
panic(fmt.Errorf("error in chargeFees() while getting txBytes: %w", err))
Expand Down Expand Up @@ -123,8 +121,6 @@ func (afd MsgFeeInvoker) Invoke(ctx sdk.Context, simulate bool) (coins sdk.Coins
eventsToReturn = append(eventsToReturn, msgFeesSummaryEvent)
}
}

ctx = ctx.WithGasMeter(originalGasMeter)
}

return chargedFees, eventsToReturn, nil
Expand Down

0 comments on commit 77cde58

Please sign in to comment.