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

fix: set 0 min gas prices #1411

Merged
merged 10 commits into from
Sep 19, 2022
Merged

fix: set 0 min gas prices #1411

merged 10 commits into from
Sep 19, 2022

Conversation

adamewozniak
Copy link
Collaborator

@adamewozniak adamewozniak commented Sep 18, 2022

Description

This is necessary for testing since keplr's suggestchain feature only allows default gas prices computations. We should add this in another prop after v3

This is initially opened for discussion

Update: Let's use this to build a network to test keplr against for the frontend team.


Author Checklist

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.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@adamewozniak adamewozniak requested a review from a team as a code owner September 18, 2022 20:36
@adamewozniak
Copy link
Collaborator Author

cc: @robert-zaremba / @brandoncomer

@robert-zaremba
Copy link
Member

how about the following:

  1. for firedrill we leave the gas prices update
  2. for beta testing we create a new chain, based on this branch (so instead of merging this branch, we will create a new binary from this branch).

@adamewozniak
Copy link
Collaborator Author

how about the following:

  1. for firedrill we leave the gas prices update
  2. for beta testing we create a new chain, based on this branch (so instead of merging this branch, we will create a new binary from this branch).

Works for me, I'll convert to draft. Will bother infra about creating a new net for @brandoncomer on mon.

@adamewozniak adamewozniak marked this pull request as draft September 18, 2022 21:43
@adamewozniak
Copy link
Collaborator Author

adamewozniak commented Sep 18, 2022

On second thought, I don't think keplr will do this before we hit mainnet. @robert-zaremba @toteki can we please do this after v3?

e: we've got to put this in, @toteki please check out tests while I work on the integrations 🙏

@adamewozniak adamewozniak marked this pull request as ready for review September 18, 2022 22:08
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2022

Codecov Report

Merging #1411 (9a62413) into main (d83990a) will increase coverage by 0.31%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1411      +/-   ##
==========================================
+ Coverage   52.52%   52.83%   +0.31%     
==========================================
  Files          70       70              
  Lines        6692     6751      +59     
==========================================
+ Hits         3515     3567      +52     
- Misses       2909     2914       +5     
- Partials      268      270       +2     
Impacted Files Coverage Δ
x/leverage/types/params.go 21.92% <ø> (ø)
x/oracle/types/params.go 100.00% <ø> (ø)
ante/fee.go 80.41% <42.85%> (-9.28%) ⬇️
x/leverage/client/tests/suite.go 95.38% <100.00%> (+0.07%) ⬆️
x/leverage/types/genesis.go 10.34% <100.00%> (+1.14%) ⬆️
x/leverage/types/token.go 83.22% <100.00%> (+10.69%) ⬆️
x/leverage/keeper/genesis.go 4.00% <0.00%> (+1.00%) ⬆️

@toteki toteki requested a review from a team as a code owner September 18, 2022 23:32
@adamewozniak
Copy link
Collaborator Author

lgtm except for the upgrade test failure (just can't approve my own PRs 😅)

@@ -63,7 +63,10 @@ func checkFees(minGasPrices sdk.DecCoins, fees sdk.Coins, gasLimit uint64) error
requiredFees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt())
}

if !fees.IsAnyGTE(requiredFees) {
// Clear any zero coins from requiredFees in the case of zero min gas price
requiredFees = sdk.NewCoins(requiredFees...)
Copy link
Member

Choose a reason for hiding this comment

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

this line is not needed - let's update the loop above:

	requiredFees := make(sdk.Coins, len(minGasPrices), 0)

	// Determine the required fees by multiplying each required minimum gas
	// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
	glDec := sdk.NewDec(int64(gasLimit))
	for _, gp := range minGasPrices {
        if gp.IsZero() || gasLimit == 0 {
           continue
        }
		fee := gp.Amount.Mul(glDec)
		requiredFees = append(requiredFees, sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt()))
	}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cc: @toteki

@toteki toteki merged commit fd05708 into main Sep 19, 2022
@toteki toteki deleted the woz/set-zero-min-gas-prices branch September 19, 2022 01:10
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