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

Codecov Report

Merging #855 (f292078) into main (efe2853) will increase coverage by 0.61%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
x/incentives/keeper/gauge.go 58.33% <0.00%> (+0.64%) ⬆️
x/superfluid/keeper/grpc_query.go 23.25% <0.00%> (-76.75%) ⬇️
x/lockup/keeper/msg_server.go 20.68% <0.00%> (-4.67%) ⬇️
x/lockup/module.go 52.72% <0.00%> (-3.09%) ⬇️
x/lockup/keeper/iterator.go 83.48% <0.00%> (-2.96%) ⬇️
x/superfluid/keeper/twap_price.go 84.61% <0.00%> (-1.35%) ⬇️
x/lockup/keeper/store.go 85.71% <0.00%> (-0.96%) ⬇️
x/superfluid/keeper/gov.go 100.00% <0.00%> (ø)
x/gamm/types/query.pb.gw.go 0.00% <0.00%> (ø)
x/superfluid/client/cli/tx.go 0.00% <0.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efe2853...f292078. Read the comment docs.

@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