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

feat(incentives): added fees for adding to gauge and gauge creation #1188

Merged
merged 9 commits into from
Sep 16, 2024

Conversation

keruch
Copy link
Contributor

@keruch keruch commented Sep 4, 2024

Description

This PR adds extra gas fees for gauge depositing and gauge creation.


Closes #1171

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

PR review checkboxes:

I have...

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Targeted PR against the correct branch
  • included the correct type prefix in the PR title
  • Linked to the GitHub issue with discussion and accepted design
  • Targets only one GitHub issue
  • Wrote unit and integration tests
  • Wrote relevant migration scripts if necessary
  • All CI checks have passed
  • Added relevant godoc comments
  • Updated the scripts for local run, e.g genesis_config_commands.sh if the PR changes parameters
  • Add an issue in the e2e-tests repo if necessary

SDK Checklist

  • Import/Export Genesis
  • Registered Invariants
  • Registered Events
  • Updated openapi.yaml
  • No usage of go map
  • No usage of time.Now()
  • Used fixed point arithmetic and not float arithmetic
  • Avoid panicking in Begin/End block as much as possible
  • No unexpected math Overflow
  • Used sendCoin and not SendCoins
  • Out-of-block compute is bounded
  • No serialized ID at the end of store keys
  • UInt to byte conversion should use BigEndian

Full security checklist here


For Reviewer:

  • Confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • Confirmed all author checklist items have been addressed

After reviewer approval:

  • In case the PR targets the main branch, PR should not be squash merge in order to keep meaningful git history.
  • In case the PR targets a release branch, PR must be rebased.

@keruch keruch self-assigned this Sep 4, 2024
@keruch keruch requested a review from a team as a code owner September 4, 2024 19:39
if !incentivestypes.CreateGaugeFee.Equal(expectCreateGaugeFee) || !incentivestypes.AddToGaugeFee.Equal(expectAddToGaugeFee) {
return fmt.Errorf("incentives parameters not set correctly")
}
//if !incentivestypes.CreateGaugeFee.Equal(expectCreateGaugeFee) || !incentivestypes.AddToGaugeFee.Equal(expectAddToGaugeFee) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not a fan of commented code! :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's an old state migration (v3 while current is v4), and i didn't want to modify old migration scripts, so i intentionally left this code commented here to have a historical reference. added an explanation comment for that.

params := ik.GetParams(ctx)
defaultParams := incentivestypes.DefaultParams()
params.CreateGaugeFee = defaultParams.CreateGaugeFee
params.AddToGaugeFee = defaultParams.AddToGaugeFee
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont we include the defaults for base_gas_fee_for_create_gauge and base_gas_fee_for_add_reward_to_gauge ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it, thanks for the catch!

@faultytolly
Copy link
Contributor

I only saw that issue with the DefaultParams

faultytolly
faultytolly previously approved these changes Sep 10, 2024
@mtsitrin
Copy link
Contributor

@keruch can u elaborte why we need both explicit creation/adding Fee AND implicit gas modifications?

isn't the goal is to charge the user for action? why we need both types of fee charge?

@keruch
Copy link
Contributor Author

keruch commented Sep 12, 2024

@keruch can u elaborte why we need both explicit creation/adding Fee AND implicit gas modifications?

isn't the goal is to charge the user for action? why we need both types of fee charge?

re gas first. as you know, there are rewards in each gauge. when we send tokens to lockup holders, we iterate through all denoms for every gauge, so adding more than one denom while creating/adding to gauge is a big overhead. eg if the gauge has Osmo + Dym + Atom rewards, then the num of iterations is 3x implying O(denoms * lockups). that's why we decided to consume gas depending on the number of denoms added. this is actually a solution from osmosis: osmosis-labs/osmosis#4830.

fee is a one-time charge independent of the number of denom. just a maker fee. it was added before, we just decided to make it a module parameter and set the default value for adding rewards to 1 DYM (prev was 0).

@mtsitrin
Copy link
Contributor

mtsitrin commented Sep 12, 2024

fee is a one-time charge independent of the number of denom

well, it doesn't have to be.
The fee can be: BaseFee + PerDenomFee * num_of_denoms

not sure why osmosis did it this way,
but as discussed, IMO it makes more sense to charge fees by the "application layer" and not through gas.

it also harder to manage (e.g if I want the fee to be burned rather than distributed to validators)

}

// Charge fess based on the number of coins to add
// Fee = AddToGaugeBaseFee + AddDenomFee * (NumAddedDenoms + NumGaugeDenoms)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to pay for existing denoms as well? Isn't it already paid for when added initially?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to prevent spam where somebody keeps excessively adding funds to some already overloaded gauge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so this fee makes it pricey to add more and more new denoms to the gauge

@omritoptix omritoptix merged commit 7e83549 into main Sep 16, 2024
60 of 130 checks passed
@omritoptix omritoptix deleted the kirill/1171-add-gauge-fee branch September 16, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add extra gas for deposit to gauges
5 participants