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

LSM Migration for v14 #910

Merged
merged 16 commits into from
Aug 27, 2023
Merged

LSM Migration for v14 #910

merged 16 commits into from
Aug 27, 2023

Conversation

sampocs
Copy link
Collaborator

@sampocs sampocs commented Aug 25, 2023

  • Migrated stakeibc host zone and validator types
  • Migrated stakeibc params
  • Cleared out pending queries
  • Enabled LSM gaia

ValidatorSlashQueryThreshold uint64 = 1
// The exchange rate here does not matter since it will be updated after the slash query
// Setting it to this value makes it easier to verify that we've submitted the query
DefaultExchangeRate = sdk.MustNewDecFromStr("1.000000000000001")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this rate be used in the RR if we hit an epoch before a first slash query to this validator?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Separate) nit: I think exchRate g.t. 1 is impossible so might make sense to make the default (even if unused) something like 0.999 instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only used in the redemption rate when summing up LSMTokenDeposits, but we should run the query on all validators before LSM is even live on the hub

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, agreed, 0.9999 probably makes more sense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool this makes sense

@riley-stride
Copy link
Contributor

Quick review on the convert functions. Added some comments. Going to review the rest of the PR now.

// - Added SlashQueryInProgress field
// - InternalExchangeRate is now a decimal named SharesToTokensRate
// - DelegationAmt renamed to Delegation
func convertToNewValidator(oldValidator oldstakeibctypes.Validator, totalDelegations sdkmath.Int) newstakeibctypes.Validator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once the questions re DefaultExchangeRate are addressed.
Confirming that you haven't missed any proto fields on Validator.

x/stakeibc/migrations/v3/convert.go Show resolved Hide resolved
x/stakeibc/migrations/v3/convert.go Outdated Show resolved Hide resolved
TransferChannelId: oldHostZone.TransferChannelId,
IbcDenom: oldHostZone.IbcDenom,
HostDenom: oldHostZone.HostDenom,
UnbondingPeriod: (oldHostZone.UnbondingFrequency - 1) * 7,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This arithmetic seems right, but given how sensitive it is and the fact that we've debated the formula in the past (though I think we're all aligned on it now) let's make sure we are all in sync on this before merging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified with all the existing host zones that this formula lines up

x/stakeibc/migrations/v3/convert.go Show resolved Hide resolved
ValidatorSlashQueryThreshold uint64 = 1
// The exchange rate here does not matter since it will be updated after the slash query
// Setting it to this value makes it easier to verify that we've submitted the query
DefaultExchangeRate = sdk.MustNewDecFromStr("1.000000000000001")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool this makes sense

// TODO: Revert after upgrade v14
// return errorsmod.Wrapf(types.ErrInvalidValidatorDelegationUpdates,
// "cannot decrement the number of delegation updates if the validator has 0 updates in progress")
return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it this is the 0 floor. In theory this line should not be reachable, so imo we should emit an event here and log before returning nil, so that we can trace any issues. Then in v14 we revert.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, added a log

@sampocs sampocs merged commit 92f38d0 into v14-upgrade-handler Aug 27, 2023
1 check passed
@asalzmann asalzmann mentioned this pull request Aug 28, 2023
@sampocs sampocs mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants