From 11ab2b1f6420f4223de5af22ecaa6529e760552d Mon Sep 17 00:00:00 2001 From: zakir <80246097+zakir-code@users.noreply.github.com> Date: Tue, 31 Dec 2024 17:51:06 +0800 Subject: [PATCH] fix: base chain oracle status (#853) --- app/upgrades/v8/upgrade.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/upgrades/v8/upgrade.go b/app/upgrades/v8/upgrade.go index 74582113..801643b6 100644 --- a/app/upgrades/v8/upgrade.go +++ b/app/upgrades/v8/upgrade.go @@ -34,6 +34,7 @@ import ( fxevmkeeper "github.com/pundiai/fx-core/v8/x/evm/keeper" "github.com/pundiai/fx-core/v8/x/gov/keeper" fxgovv8 "github.com/pundiai/fx-core/v8/x/gov/migrations/v8" + layer2types "github.com/pundiai/fx-core/v8/x/layer2/types" fxstakingv8 "github.com/pundiai/fx-core/v8/x/staking/migrations/v8" ) @@ -94,6 +95,8 @@ func CreateUpgradeHandler(cdc codec.Codec, mm *module.Manager, configurator modu return fromVM, err } + fixBaseOracleStatus(cacheCtx, app.CrosschainKeepers.Layer2Keeper) + commit() cacheCtx.Logger().Info("upgrade complete", "module", "upgrade") return toVM, nil @@ -301,3 +304,17 @@ func deployAccessControlContract( getContractOwner(cacheCtx), ) } + +func fixBaseOracleStatus(ctx sdk.Context, crosschainKeeper crosschainkeeper.Keeper) { + if crosschainKeeper.ModuleName() != layer2types.ModuleName { + return + } + oracles := crosschainKeeper.GetAllOracles(ctx, false) + for _, oracle := range oracles { + oracle.Online = true + oracle.SlashTimes = 0 + oracle.StartHeight = ctx.BlockHeight() + crosschainKeeper.SetOracle(ctx, oracle) + } + crosschainKeeper.SetLastTotalPower(ctx) +}