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

[Uptime Incentives]: Incorporate gov param in distribution logic #7419

Merged
merged 12 commits into from
Feb 7, 2024

Conversation

AlpinYukseloglu
Copy link
Contributor

Closes: #7371

What is the purpose of the change

This PR adds the gov param from #7418 into distribution logic as described in #7370 and #7371. In short, it sets the incentive record's uptime to the gov param if the gauge is an internal gauge.

The fallback logic for unauthorized uptimes is applied to internal gauges as well, meaning that if an unauthorized uptime is set as the internal uptime (or a previously set uptime is now unauthorized), distributions will proceed with the default uptime of 1ns. The reasons for this are explained in PR comments, but the short version is we want to be able to immediately stop distributions to problematic uptimes if a problem is discovered with a non-default one in the future.

Testing and Verifying

Tests can be found in distribute_test.go

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

s.Require().Error(err)
}
}
} else {
Copy link
Contributor Author

@AlpinYukseloglu AlpinYukseloglu Feb 6, 2024

Choose a reason for hiding this comment

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

After a couple cleanup attempts, it seems a messed up diff is unavoidable here. The core changes are:

  1. Removed error branch, as the logic covered by these cases should never be erroring (also there were no error cases)
  2. Moved the passing logic out of the else block, which caused the indentation-related diff below
  3. Updated uptime checks to be against tc.expectedUptime instead of a static default value

Note: i made the changes for 1 in a separate commit in case we want to revert. I find this version of the tests to be much less verbose & more readable, but on the fence on this.

Copy link
Member

Choose a reason for hiding this comment

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

This is fine to me imo

//
// Note that this fallback happens even if the gauge is an internal gauge. This is because
// we want to be able to unauthorize internal gauges as well in the event that there is an
// issue found with a previously authorized uptime.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A secondary reason is that allowing "supported but unauthorized uptimes" to be valid for internal gauges would require hackily bypassing CL incentive record checks, which currently validate against authorized uptimes. I started with trying this and ended up walking back my impl to this version.

}{
"valid case: one poolId and gaugeId": {
Copy link
Contributor Author

@AlpinYukseloglu AlpinYukseloglu Feb 6, 2024

Choose a reason for hiding this comment

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

Note: diff is a bit messy due to driveby test case renaming/removal of expectErr: falses. Happy to undo either of these if anyone has strong qualms.

Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

👍

Base automatically changed from alpo/use-uptime-duration to main February 7, 2024 04:52
@AlpinYukseloglu AlpinYukseloglu merged commit bf0adc4 into main Feb 7, 2024
1 check passed
@AlpinYukseloglu AlpinYukseloglu deleted the alpo/internal-uptime-logic branch February 7, 2024 05:09
@github-actions github-actions bot mentioned this pull request Mar 15, 2024
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/incentives V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Uptime Incentives]: Incorporate gov param in distribution logic
3 participants