Skip to content

Commit

Permalink
Add migration in UPGRADING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jul 29, 2024
1 parent 837d111 commit 0c2b427
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
27 changes: 27 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Upgrading Replicated Security

## ...

### Provider

Upgrading a provider from X to Y requires state migrations. The following migrators should be added to the upgrade handler of the provider chain:

```go
// InitializeMaxValidatorsForExistingConsumers initializes the max validators
// parameter for existing consumers to the MaxProviderConsensusValidators parameter.
// This is necessary to avoid those consumer chains having an excessive amount of validators.
func InitializeMaxValidatorsForExistingConsumers(ctx sdk.Context, providerKeeper providerkeeper.Keeper) {
maxVals := providerKeeper.GetParams(ctx).MaxProviderConsensusValidators
for _, chainID := range providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) {
providerKeeper.SetValidatorSetCap(ctx, chainID, uint32(maxVals))
}
}

// InitializeMaxProviderConsensusParam initializes the MaxProviderConsensusValidators parameter.
func InitializeMaxProviderConsensusParam(ctx sdk.Context, providerKeeper providerkeeper.Keeper) {
params := providerKeeper.GetParams(ctx)
if params.MaxProviderConsensusValidators == 0 {
params.MaxProviderConsensusValidators = 180
providerKeeper.SetParams(ctx, params)
}
}
```

## [v5.1.x](https://github.com/cosmos/interchain-security/releases/tag/v5.1.0)

### Provider
Expand Down
25 changes: 0 additions & 25 deletions x/ccv/provider/migrations/vX/migrations.go

This file was deleted.

0 comments on commit 0c2b427

Please sign in to comment.