Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adds missing migration for LS validator fields in the testnet. #195

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,28 @@ func (app *Application) BeginBlocker(ctx sdk.Context, req abcitypes.RequestBegin
}

func (app *Application) EndBlocker(ctx sdk.Context, req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock {
// FIXME(max): remove this block after state migration is final
if ctx.BlockHeight() > 11060956 {
validators := app.StakingKeeper.GetLastValidators(ctx)
for _, val := range validators {
var valNeedsUpdate bool

if val.TotalLiquidShares.IsNil() {
val.TotalLiquidShares = sdk.ZeroDec()
valNeedsUpdate = true
}
if val.TotalValidatorBondShares.IsNil() {
val.TotalValidatorBondShares = sdk.ZeroDec()
valNeedsUpdate = true
}

if valNeedsUpdate {
app.StakingKeeper.SetValidator(ctx, val)
app.Logger().Info("migrated validator fields for liquid shares", "val", val.OperatorAddress)
}
}
}

return app.moduleManager.EndBlock(ctx, req)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/cosmos/ibc-go/v6 v6.1.0
github.com/gogo/protobuf v1.3.3
github.com/gorilla/mux v1.8.0
github.com/persistenceOne/persistence-sdk/v2 v2.1.0-rc1
github.com/persistenceOne/persistence-sdk/v2 v2.1.0-rc2
github.com/persistenceOne/pstake-native/v2 v2.1.0-rc0
github.com/prometheus/client_golang v1.14.0
github.com/rakyll/statik v0.1.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,8 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/persistenceOne/persistence-sdk/v2 v2.1.0-rc1 h1:cMDBFVi5mldbzEND4Ve5ZrsqR4Mp4Abpb+HuD2EOqyk=
github.com/persistenceOne/persistence-sdk/v2 v2.1.0-rc1/go.mod h1:17uPaWchEBtSa5pQ6EdHZDbFh3ppiZNZjMHg+kiJtcE=
github.com/persistenceOne/persistence-sdk/v2 v2.1.0-rc2 h1:5Erv5ECMoaBHA0YmcXD7My/fRzYzqRcoPCSZNdHjDoA=
github.com/persistenceOne/persistence-sdk/v2 v2.1.0-rc2/go.mod h1:17uPaWchEBtSa5pQ6EdHZDbFh3ppiZNZjMHg+kiJtcE=
github.com/persistenceOne/pstake-native/v2 v2.1.0-rc0 h1:eKH60IMLVEl39SWu6QEB7adBm0c/up808Y0w+tpJleg=
github.com/persistenceOne/pstake-native/v2 v2.1.0-rc0/go.mod h1:77iJIcyM5qb2D787OUKRNUfZzhj/T5c9674AWR+etxc=
github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
Expand Down