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: make global min gas price gov modifiable #3094

Merged

Conversation

ninabarbakadze
Copy link
Member

@ninabarbakadze ninabarbakadze commented Feb 8, 2024

Overview

Makes GlobalMinGasPrice hard-coded constant gov modifiable

Fixes - #3092

@ninabarbakadze ninabarbakadze changed the title Nina/gov modifiable gmgp feat: make GlobalMinGasPrice gov modifiable Feb 8, 2024
@ninabarbakadze ninabarbakadze changed the title feat: make GlobalMinGasPrice gov modifiable feat: make global min gas price gov modifiable Feb 8, 2024
@ninabarbakadze ninabarbakadze force-pushed the nina/gov-modifiable-gmgp branch 4 times, most recently from d471c49 to 0cfa5bb Compare February 13, 2024 22:45
@ninabarbakadze ninabarbakadze force-pushed the nina/gov-modifiable-gmgp branch 2 times, most recently from 79c9be2 to 90742ce Compare March 13, 2024 19:34
@ninabarbakadze ninabarbakadze force-pushed the nina/gov-modifiable-gmgp branch 2 times, most recently from 1b47b3e to efcdbb2 Compare March 14, 2024 22:04
Co-authored-by: Callum Waters <[email protected]>
@celestia-bot celestia-bot requested a review from a team March 18, 2024 18:54
@ninabarbakadze ninabarbakadze marked this pull request as draft March 18, 2024 19:29
@ninabarbakadze
Copy link
Member Author

Do you want to update the specs in this PR or a follow-up PR? We have to update CIP-13 in a follow-up PR because separate repo. Do you mind creating an issue or PR in the cips repo to track?

Ref: #3092 (comment)

[question] did we use the Cosmos Hub globalfee module as inspiration for this?

  1. I updated the params.md to include this new param. we still need to update state_machine_modules.md with link to our new modules + minfee module once it's merged. I will create an issue for it.
  2. I tried to follow the pattern in our existing modules.

@ninabarbakadze ninabarbakadze marked this pull request as ready for review March 19, 2024 00:00
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

Great work!

Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

+1 great work!

// unit of gas is fixed and set globally, and the tx priority is computed from the gas price.
func CheckTxFeeWithGlobalMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
// CheckTxFeeWithMinGasPrices implements default fee validation logic for transactions.
// It ensures that the provided transaction fee meets a minimum threshold for the validator
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahh now I remember that. I think that means we can close #3034 as won't do.

[optional] we could update the comment here to say that the config minimum only applies for CheckTx and the global minimum applies for Prepare/ProcessProposal.

Update: it's described in the body of this function so definitely optional / not blocking.

Comment on lines +122 to +129
{
name: "bad tx; fee below node's required minimum",
fee: sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, feeAmount-1)),
gasLimit: uint64(float64(feeAmount) / validatorMinGasPrice),
appVersion: uint64(1),
isCheckTx: true,
expErr: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@@ -64,5 +64,6 @@ are blocked by the `x/paramfilter` module.
| staking.MaxValidators | 100 | Maximum number of validators. | True |
| staking.MinCommissionRate | 0.05 (5%) | Minimum commission rate used by all validators. | True |
| staking.UnbondingTime | 1814400 (21 days) | Duration of time for unbonding in seconds. | False |
| minfee.GlobalMinGasPrice | 0.002 | All transactions must have a gas price greater than or equal to this value | True |
Copy link
Collaborator

Choose a reason for hiding this comment

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

[nit] this param table is alphabetically sorted. Can you please move minfee up?

Copy link
Collaborator

Choose a reason for hiding this comment

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

[tangent] we don't have to figure this out in this PR but I wonder if it would make sense to include the app version that a constant is applicable for in this table. For example, I think some of these params could be modified to be different in different app versions and at that point it's not immediately obvious if this table should reflect the original or updated value. Perhaps both with a new column for app version?

Copy link
Member Author

@ninabarbakadze ninabarbakadze Mar 19, 2024

Choose a reason for hiding this comment

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

yes, i can move it in a follow up pr. thanks @rootulp

to you second point i think that's a good call. I'll export your comment as an issue and we can discuss it during our grooming session.


// The purpose of this wrapper is to enable the passing of an additional paramKeeper parameter
// whilst still satisfying the ante.TxFeeChecker type.
func CheckTxFeeWithGlobalMinGasPricesWrapper(paramKeeper paramkeeper.Keeper) ante.TxFeeChecker {
Copy link
Member

Choose a reason for hiding this comment

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

[optional]

the name CheckTx could be confusing

if ctx.IsCheckTx() {
minGasPrice := ctx.MinGasPrices().AmountOf(appconsts.BondDenom)
if !minGasPrice.IsZero() {
err := verifyMinFee(fee, gas, minGasPrice, "insufficient minimum gas price for this validator")
Copy link
Member

Choose a reason for hiding this comment

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

[optoinal]

since all nodes will run this, validator might be confusing to users

@evan-forbes
Copy link
Member

evan-forbes commented Mar 20, 2024

thanks for testing rigorously!

only had optional naming related things left!

@ninabarbakadze
Copy link
Member Author

thanks for testing rigorously!

only had optional naming related things left!

thanks evan! I'll update in a follow up pr.

@ninabarbakadze ninabarbakadze merged commit 8bacf9b into celestiaorg:main Mar 20, 2024
34 checks passed
@ninabarbakadze ninabarbakadze deleted the nina/gov-modifiable-gmgp branch March 20, 2024 18:42
@cmwaters cmwaters mentioned this pull request Mar 21, 2024
ninabarbakadze added a commit that referenced this pull request Mar 21, 2024
## Overview

follow-up pr addressing some of the comments on
[minfee-module](#3094)

---------
ninabarbakadze added a commit to ninabarbakadze/celestia-app that referenced this pull request Apr 2, 2024
Makes GlobalMinGasPrice hard-coded constant gov modifiable

Fixes - celestiaorg#3092

---------
ninabarbakadze added a commit to ninabarbakadze/celestia-app that referenced this pull request Apr 2, 2024
## Overview

follow-up pr addressing some of the comments on
[minfee-module](celestiaorg#3094)

---------
0xchainlover pushed a commit to celestia-org/celestia-app that referenced this pull request Aug 1, 2024
## Overview

follow-up pr addressing some of the comments on
[minfee-module](celestiaorg/celestia-app#3094)

---------
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.

4 participants