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

Ensure gauges can only be created for assets that exist on-chain #855

Merged
merged 4 commits into from
Feb 18, 2022

Conversation

AlpinYukseloglu
Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu commented Feb 12, 2022

Closes: #530

Description

Adds a check in the gauge creation process that prevents gauges from being created for denoms that do not exist on-chain.


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@mattverse
Copy link
Member

Awesome! Can you fix the tests for this as well? @AlpinYukseloglu

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2022

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 20.61%. Comparing base (efe2853) to head (f292078).
Report is 3373 commits behind head on main.

Files with missing lines Patch % Lines
x/incentives/keeper/gauge.go 0.00% 1 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #855      +/-   ##
==========================================
+ Coverage   20.00%   20.61%   +0.61%     
==========================================
  Files         189      191       +2     
  Lines       24549    25792    +1243     
==========================================
+ Hits         4910     5318     +408     
- Misses      18783    19567     +784     
- Partials      856      907      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AlpinYukseloglu
Copy link
Contributor Author

Awesome! Can you fix the tests for this as well? @AlpinYukseloglu

Should be good to go!

@@ -39,8 +39,10 @@ enum LockQueryType {
}

message QueryCondition {
LockQueryType lock_query_type = 1; // type of lock query, ByLockDuration | ByLockTime
string denom = 2; // What token denomination are we looking for lockups of
// type of lock query, ByLockDuration | ByLockTime
Copy link
Member

Choose a reason for hiding this comment

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

Nice change, as we found out these don't get into the go docs. Can you also make an issue in this repo to update all of our proto files for this? (Moving comments above the line they affect, rather than in the same line, to the side?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created one here: #863

Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

LGTM!

@mattverse can you review & merge as well

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

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

Just the general question on the tests, otherwise looks LGTM!

Comment on lines +87 to 91
mintLPtokens := sdk.Coins{sdk.NewInt64Coin(distrTo.Denom, 200)}
err = simapp.FundAccount(suite.app.BankKeeper, suite.ctx, gaugeCreator, mintLPtokens)
suite.Require().NoError(err)

gaugeId, err := suite.app.IncentivesKeeper.CreateGauge(suite.ctx, true, gaugeCreator, coins, distrTo, time.Now(), 1)
Copy link
Member

Choose a reason for hiding this comment

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

Why are we minting / funding account here? I understand why it should be happening in setupGaugeForLPIncentives but I dont understand why we're minting LP Tokens here(Don't have opinions btw, really just curous)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +35 to +38
mintLPtokens := sdk.Coins{sdk.NewInt64Coin(distrTo.Denom, 200)}
err = simapp.FundAccount(app.BankKeeper, ctx, addr, mintLPtokens)
require.NoError(t, err)

Copy link
Member

Choose a reason for hiding this comment

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

Why are we minting / funding account here? I understand why it should be happening in setupGaugeForLPIncentives but I dont understand why we're minting LP Tokens here(Don't have opinions btw, really just curious)

Copy link
Contributor Author

@AlpinYukseloglu AlpinYukseloglu Feb 17, 2022

Choose a reason for hiding this comment

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

I think maybe the denom lptoken might be a bit misleading - I didn't pick apart what the entire test is doing and whether or not it is necessary for it to create a gauge that distributes to the denom lptoken, but since it does, we have to make sure the denom has supply on-chain since otherwise, CreateGauge fails due to the new check we've added. It shouldn't affect the test's direct functionality - it just makes sure that the test is compliant with the new constraint that we've added to CreateGauge.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see, makes sense!

@ValarDragon ValarDragon merged commit 9eafd1a into main Feb 18, 2022
@ValarDragon ValarDragon deleted the 530-gauge-assets branch February 18, 2022 06:19
@github-actions github-actions bot mentioned this pull request Apr 1, 2024
@github-actions github-actions bot mentioned this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Ensure gauges can only be created for assets that exist on-chain
4 participants