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: nil pointer for gas_prices query #146

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

freeelancer
Copy link

@freeelancer freeelancer commented Sep 23, 2024

currently the gas_prices endpoint is giving nil pointer error if resolver is not set due to it always calling k.resolver.ExtraDenoms(ctx). This PR fixes it by returning only the params.FeeDenom if k.resolver == nil

@aljo242
Copy link
Collaborator

aljo242 commented Sep 23, 2024

@freeelancer thanks for opening this.

Could we get a test against this newly added logic?

@@ -114,6 +114,10 @@ func (k *Keeper) GetMinGasPrices(ctx sdk.Context) (sdk.DecCoins, error) {
minGasPrice := sdk.NewDecCoinFromDec(params.FeeDenom, baseGasPrice)
minGasPrices := sdk.NewDecCoins(minGasPrice)

if k.resolver == nil {

Choose a reason for hiding this comment

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

if this is a required item we should panic at the start of the node if it is not set. ideally here

func NewKeeper(
or we set the default if its nil by the app dev

Copy link
Author

Choose a reason for hiding this comment

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

it does not seem like a required item. The current default TestDenomResolver is not meant for production and there are no other resolvers. Feemarket still functions as expected without it except for this small bug in the query_server

@freeelancer
Copy link
Author

@freeelancer thanks for opening this.

Could we get a test against this newly added logic?

I have added a simple test

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.

3 participants