-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Yarom Swisa <yarom@lavanet.xyz git config --global user.name Yarom>
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package v0_9_6 | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
"github.com/lavanet/lava/app/upgrades" | ||
) | ||
|
||
const UpgradeName = "v0.9.6" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, // upgrade name defined few lines above | ||
CreateUpgradeHandler: CreateUpgradeHandler, // create CreateUpgradeHandler in upgrades.go below | ||
StoreUpgrades: store.StoreUpgrades{}, // StoreUpgrades has 3 fields: Added/Renamed/Deleted any module that fits these description should be added in the way below | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package v0_9_6 | ||
|
||
import ( | ||
"log" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
"github.com/lavanet/lava/app/keepers" | ||
"github.com/lavanet/lava/app/upgrades" | ||
epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" | ||
) | ||
|
||
const ( | ||
// ClientPaymentStorageKeyPrefix is the prefix to retrieve all ClientPaymentStorage | ||
ClientPaymentStorageKeyPrefix = "ClientPaymentStorage/value/" | ||
// UniquePaymentStorageClientProviderKeyPrefix is the prefix to retrieve all UniquePaymentStorageClientProvider | ||
UniquePaymentStorageClientProviderKeyPrefix = "UniquePaymentStorageClientProvider/value/" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
bpm upgrades.BaseAppParamManager, | ||
keepers *keepers.LavaKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
log.Println("########################") | ||
log.Println("# STARTING UPGRADE #") | ||
log.Println("########################") | ||
|
||
chainIDs := keepers.SpecKeeper.GetAllChainIDs(ctx) | ||
for _, chainID := range chainIDs { | ||
storage, found := keepers.EpochstorageKeeper.GetStakeStorageCurrent(ctx, epochstoragetypes.ProviderKey, chainID) | ||
if !found { | ||
continue | ||
} | ||
|
||
for _, entry := range storage.StakeEntries { | ||
err := keepers.PairingKeeper.FreezeProvider(ctx, entry.Address, []string{chainID}, "") | ||
if err != nil { | ||
continue | ||
} | ||
} | ||
} | ||
|
||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |