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

refactor(x/feegrant): set environment in context #20529

Merged
merged 16 commits into from
Jun 3, 2024
Merged

Conversation

hieuvubk
Copy link
Contributor

@hieuvubk hieuvubk commented Jun 3, 2024

Description

Closes: #19640

  • Set env in context for Accept calls

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, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • 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.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

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

Summary by CodeRabbit

  • New Features

    • Improved context handling and header information retrieval in fee grant functionalities.
    • Enhanced gas metering in fee grant allowances.
  • Bug Fixes

    • Fixed issues with context and runtime environment handling in fee grant tests.
  • Chores

    • Updated imports and context handling for better integration with Cosmos SDK core modules.

@hieuvubk hieuvubk requested a review from a team as a code owner June 3, 2024 11:37
Copy link
Contributor

coderabbitai bot commented Jun 3, 2024

Walkthrough

Walkthrough

The recent updates focus on modifying context handling and header information retrieval across various files in the x/feegrant module. This involves replacing sdk.UnwrapSDKContext(ctx) with ctx.Value(corecontext.EnvironmentContextKey).(appmodule.Environment) for environment retrieval and updating gas metering functionality to align with the new context management approach. The changes ensure compatibility with Cosmos SDK's server/v2 architecture.

Changes

Files Change Summary
x/feegrant/basic_fee.go Updated context handling and header information retrieval in the Accept method of BasicAllowance to use the new environment context.
x/feegrant/filtered_fee.go Introduced new imports and updated gas metering functionality within the AllowedMsgAllowance struct methods.
x/feegrant/keeper/keeper.go Modified the UseGrantedFees function to pass corecontext.EnvironmentContextKey when accepting a grant.
x/feegrant/periodic_fee.go Changed context handling and block time retrieval in the Accept method of PeriodicAllowance.
x/feegrant/CHANGELOG.md Updated to reflect that the Accept method in the FeeAllowanceI interface now expects the feegrant environment in the context.Context.
x/feegrant/basic_fee_test.go Introduced context and runtime environment handling for fee deduction in test functions.
x/feegrant/filtered_fee_test.go Added imports and modified the TestFilteredFeeValidAllow function to include the creation of a new environment using context.WithValue.
x/feegrant/mock_test.go Introduced mock implementations for gas and header services used in Cosmos SDK.
x/feegrant/periodic_fee_test.go Added imports and updated the usage of ctx with a new environment setup.

Sequence Diagram(s) (Beta)

Not applicable for this set of changes.

Assessment against linked issues

Objective (Issue #19640) Addressed Explanation
Ensure FeeAllowanceI Accept method uses environment in context.Context
Update context handling to avoid sdk.UnwrapSDKContext
Ensure compatibility with Cosmos SDK's server/v2
Modify gas metering functionality to align with new context management
Update tests to handle new environment context

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

x/feegrant/filtered_fee.go Outdated Show resolved Hide resolved
x/feegrant/filtered_fee.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b245252 and bdb5fc1.

Files selected for processing (4)
  • x/feegrant/basic_fee.go (2 hunks)
  • x/feegrant/filtered_fee.go (3 hunks)
  • x/feegrant/keeper/keeper.go (2 hunks)
  • x/feegrant/periodic_fee.go (2 hunks)
Additional context used
Path-based instructions (4)
x/feegrant/basic_fee.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/feegrant/filtered_fee.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/feegrant/periodic_fee.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/feegrant/keeper/keeper.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

Additional comments not posted (7)
x/feegrant/basic_fee.go (3)

9-10: The changes to the imports and the context handling in the Accept method align with the PR's goal to avoid using sdk.UnwrapSDKContext and instead use the new corecontext.EnvironmentContextKey. This is a good application of the proposed solution to use module-specific context keys.

Also applies to: 28-33


30-33: The use of errorsmod.Wrap for error handling in the Accept method is appropriate and enhances the clarity and maintainability of error management. The error messages are specific and informative, aiding in debugging and user feedback.


Line range hint 43-62: The ValidateBasic method's implementation is robust, ensuring that the SpendLimit and Expiration are valid. The use of detailed error messages with errorsmod.Wrap and errorsmod.Wrapf enhances error clarity, which is crucial for debugging and user feedback.
[APROVED]

x/feegrant/filtered_fee.go (2)

11-12: The changes to the imports and the context handling in the allowedMsgsToMap and allMsgTypesAllowed methods align with the PR's goal to avoid using sdk.UnwrapSDKContext and instead use the new corecontext.EnvironmentContextKey. The integration of the gas meter through the environment is a good application of the proposed solution to use module-specific context keys.

Also applies to: 95-101, 110-116


Line range hint 72-89: The use of errorsmod.Wrap for error handling in the Accept method is appropriate and enhances the clarity and maintainability of error management. The error messages are specific and informative, aiding in debugging and user feedback.

x/feegrant/periodic_fee.go (1)

9-10: The changes to the imports and the context handling in the Accept method align with the PR's goal to avoid using sdk.UnwrapSDKContext and instead use the new corecontext.EnvironmentContextKey. This is a good application of the proposed solution to use module-specific context keys.

Also applies to: 28-32

x/feegrant/keeper/keeper.go (1)

236-236: The change to the context handling in the UseGrantedFees method aligns with the PR's goal to avoid using sdk.UnwrapSDKContext and instead use the new corecontext.EnvironmentContextKey. This is a good application of the proposed solution to use module-specific context keys.

x/feegrant/basic_fee.go Outdated Show resolved Hide resolved
x/feegrant/filtered_fee.go Fixed Show fixed Hide fixed
x/feegrant/filtered_fee.go Fixed Show fixed Hide fixed
x/feegrant/CHANGELOG.md Outdated Show resolved Hide resolved
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/feegrant"

corecontext "cosmossdk.io/core/context"
"github.com/cosmos/cosmos-sdk/runtime"
Copy link
Member

Choose a reason for hiding this comment

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

we are trying to avoid runtime/v2 imports in modules. IMHO we should do the same for runtime v0

Copy link
Member

Choose a reason for hiding this comment

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

Can we just add mocks service instead? And when #20487 is merged, we can add those mocks there and use them here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it, makes sense to avoid dependency import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Outside diff range and nitpick comments (2)
x/feegrant/basic_fee.go (1)

Line range hint 16-16: Resolve undefined references to BasicAllowance and interface FeeAllowanceI.

Ensure that BasicAllowance and FeeAllowanceI are properly defined and imported in this file, as they are referenced but not defined within the visible scope.

Also applies to: 28-28, 52-52, 70-70, 75-75

x/feegrant/CHANGELOG.md (1)

Line range hint 66-66: Correct the typographical error in the changelog.

- ValidateBasic` is treated as a no op now with with acceptance of RFC001
+ ValidateBasic` is treated as a no op now with acceptance of RFC001

Remove the repeated word "with" to improve the readability of the changelog entry.

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bdb5fc1 and 28c22f9.

Files ignored due to path filters (1)
  • x/feegrant/go.mod is excluded by !**/*.mod
Files selected for processing (6)
  • x/feegrant/CHANGELOG.md (1 hunks)
  • x/feegrant/basic_fee.go (2 hunks)
  • x/feegrant/basic_fee_test.go (2 hunks)
  • x/feegrant/filtered_fee.go (3 hunks)
  • x/feegrant/filtered_fee_test.go (3 hunks)
  • x/feegrant/periodic_fee_test.go (2 hunks)
Additional context used
Path-based instructions (6)
x/feegrant/basic_fee.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/feegrant/CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

x/feegrant/basic_fee_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

x/feegrant/filtered_fee.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/feegrant/filtered_fee_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

x/feegrant/periodic_fee_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

golangci-lint
x/feegrant/basic_fee.go

16-16: undefined: FeeAllowanceI


28-28: undefined: BasicAllowance


52-52: undefined: BasicAllowance


70-70: undefined: BasicAllowance


75-75: undefined: BasicAllowance


35-35: undefined: ErrFeeLimitExpired


41-41: undefined: ErrFeeLimitExceeded


63-63: undefined: ErrInvalidDuration

x/feegrant/filtered_fee.go

26-26: undefined: FeeAllowanceI


27-27: undefined: AllowedMsgAllowance


31-31: undefined: AllowedMsgAllowance


37-37: undefined: FeeAllowanceI


54-54: undefined: AllowedMsgAllowance


64-64: undefined: AllowedMsgAllowance


75-75: undefined: AllowedMsgAllowance


98-98: undefined: AllowedMsgAllowance


115-115: undefined: AllowedMsgAllowance


138-138: undefined: AllowedMsgAllowance


155-155: undefined: AllowedMsgAllowance


164-164: undefined: AllowedMsgAllowance


32-32: undefined: FeeAllowanceI


47-47: undefined: AllowedMsgAllowance


57-57: undefined: ErrNoAllowance


81-81: undefined: ErrMessageNotAllowed


140-140: undefined: ErrNoAllowance


143-143: undefined: ErrNoMessages


8-8: "github.com/cosmos/gogoproto/proto" imported and not used

LanguageTool
x/feegrant/CHANGELOG.md

[duplication] ~66-~66: Possible typo: you repeated a word
Context: ...alidateBasic` is treated as a no op now with with acceptance of RFC001 * [#17869](https:/...

Additional comments not posted (5)
x/feegrant/CHANGELOG.md (1)

34-34: Ensure the changelog entry accurately reflects the changes made.

The changelog correctly notes the requirement for the authz environment in the context.Context for the Accept method on the FeeAllowanceI interface. This aligns with the changes made in the PR.

x/feegrant/basic_fee_test.go (1)

144-146: Ensure the environment is correctly set up in the test context.

The test correctly sets up the environment using runtime.NewEnvironment and passes it into the context. This is crucial for ensuring that the unit tests accurately reflect the new context handling introduced in the PR.

x/feegrant/filtered_fee.go (1)

76-80: Properly handle errors when messages are not allowed.

The code correctly handles the scenario where a message is not allowed by returning an appropriate error. This ensures that the function behaves as expected in cases where the conditions for message allowance are not met.

x/feegrant/filtered_fee_test.go (1)

Line range hint 152-164: Ensure the environment is correctly set up in the test context.

The test correctly sets up the environment using runtime.NewEnvironment and passes it into the context. This is crucial for ensuring that the unit tests accurately reflect the new context handling introduced in the PR.

x/feegrant/periodic_fee_test.go (1)

225-228: Ensure the environment is correctly set up in the test context.

The test correctly sets up the environment using runtime.NewEnvironment and passes it into the context. This is crucial for ensuring that the unit tests accurately reflect the new context handling introduced in the PR.

Comment on lines +10 to +11
"cosmossdk.io/core/appmodule"
corecontext "cosmossdk.io/core/context"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling when the environment is not set in the context.

- if !ok {
-   return false, fmt.Errorf("environment not set")
+ if !ok {
+   return false, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "environment not set in context")

This change aligns error handling with Cosmos SDK's standard practices by using sdkerrors.Wrap for consistency and clarity.

Also applies to: 29-34

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
"cosmossdk.io/core/appmodule"
corecontext "cosmossdk.io/core/context"
"cosmossdk.io/core/appmodule"
corecontext "cosmossdk.io/core/context"
// ... other code ...
if !ok {
return false, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "environment not set in context")
}

return false, fmt.Errorf("environment not set")
}
headerInfo := environment.HeaderService.HeaderInfo(ctx)
if a.Expiration != nil && a.Expiration.Before(headerInfo.Time) {
return true, errorsmod.Wrap(ErrFeeLimitExpired, "basic allowance")
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the undefined error constants used in the file.

- errorsmod.Wrap(ErrFeeLimitExpired, "basic allowance")
+ errorsmod.Wrap(sdkerrors.ErrFeeLimitExpired, "basic allowance")
- errorsmod.Wrap(ErrFeeLimitExceeded, "basic allowance")
+ errorsmod.Wrap(sdkerrors.ErrFeeLimitExceeded, "basic allowance")
- errorsmod.Wrap(ErrInvalidDuration, "expiration time cannot be negative")
+ errorsmod.Wrap(sdkerrors.ErrInvalidDuration, "expiration time cannot be negative")

Replace the undefined error constants with the correct ones from the sdkerrors package to ensure that the code compiles and the errors are correctly categorized.

Also applies to: 41-41, 63-63

Committable suggestion was skipped due low confidence.

Tools
golangci-lint

35-35: undefined: ErrFeeLimitExpired


Tip

Codebase Verification

The search results show numerous instances where HeaderInfo().Time is accessed, but there are no explicit nil checks for HeaderInfo in the surrounding code. This indicates a potential risk of nil pointer dereference.

To address this, it is crucial to ensure that HeaderInfo is always non-nil before accessing its Time property. Here are the steps to mitigate this risk:

  1. Add nil checks: Ensure that HeaderInfo is checked for nil before accessing its Time property in all relevant parts of the code.
  2. Refactor code: Refactor the code to handle cases where HeaderInfo might be nil, providing appropriate fallback mechanisms or error handling.

Locations to Address:

  • x/feegrant/basic_fee.go line 35
  • Any other instances where HeaderInfo().Time is accessed without a nil check.

Suggested Code Change:

Before accessing HeaderInfo().Time, add a nil check like this:

headerInfo := ctx.HeaderInfo()
if headerInfo == nil {
    return false, errors.New("headerInfo is nil")
}
return true, errorsmod.Wrap(ErrFeeLimitExpired, "basic allowance")

Action Required:

  • Review and update the code to include nil checks for HeaderInfo before accessing its Time property.
  • Test the changes to ensure that they handle nil cases gracefully and do not introduce new issues.
Analysis chain

Handle potential nil pointer dereference when accessing headerInfo.Time.

Ensure that HeaderInfo is always properly checked for nil before accessing its Time property to prevent runtime panics.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `HeaderInfo` is always non-nil when accessed.

# Test: Search for potential nil checks around `HeaderInfo` usage.
rg --type go $'HeaderInfo\\(\\)\\.Time' -C 3

Length of output: 56167



Script:

#!/bin/bash
# Description: Verify that `HeaderInfo` is always non-nil when accessed.

# Test: Search for all instances where `HeaderInfo` is accessed and check for nil checks in the surrounding code.
rg --type go 'HeaderInfo\(\)' -C 5

Length of output: 139685

Tools
golangci-lint

35-35: undefined: ErrFeeLimitExpired

Comment on lines +100 to +108
environment, ok := ctx.Value(corecontext.EnvironmentContextKey).(appmodule.Environment)
if !ok {
return nil, fmt.Errorf("environment not set")
}
gasMeter := environment.GasService.GasMeter(ctx)
for _, msg := range a.AllowedMessages {
sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg")
if err := gasMeter.Consume(gasCostPerIteration, "check msg"); err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle potential issues when the environment is not set in the context.

- if !ok {
-   return nil, fmt.Errorf("environment not set")
+ if !ok {
+   return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "environment not set in context")

This change aligns error handling with Cosmos SDK's standard practices by using sdkerrors.Wrap for consistency and clarity.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
environment, ok := ctx.Value(corecontext.EnvironmentContextKey).(appmodule.Environment)
if !ok {
return nil, fmt.Errorf("environment not set")
}
gasMeter := environment.GasService.GasMeter(ctx)
for _, msg := range a.AllowedMessages {
sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg")
if err := gasMeter.Consume(gasCostPerIteration, "check msg"); err != nil {
return nil, err
}
environment, ok := ctx.Value(corecontext.EnvironmentContextKey).(appmodule.Environment)
if !ok {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "environment not set in context")
}
gasMeter := environment.GasService.GasMeter(ctx)
for _, msg := range a.AllowedMessages {
if err := gasMeter.Consume(gasCostPerIteration, "check msg"); err != nil {
return nil, err
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 28c22f9 and 7cfec62.

Files selected for processing (9)
  • x/feegrant/CHANGELOG.md (1 hunks)
  • x/feegrant/basic_fee.go (2 hunks)
  • x/feegrant/basic_fee_test.go (2 hunks)
  • x/feegrant/filtered_fee.go (3 hunks)
  • x/feegrant/filtered_fee_test.go (2 hunks)
  • x/feegrant/keeper/keeper.go (2 hunks)
  • x/feegrant/mock_test.go (1 hunks)
  • x/feegrant/periodic_fee.go (2 hunks)
  • x/feegrant/periodic_fee_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (7)
  • x/feegrant/basic_fee.go
  • x/feegrant/basic_fee_test.go
  • x/feegrant/filtered_fee.go
  • x/feegrant/filtered_fee_test.go
  • x/feegrant/keeper/keeper.go
  • x/feegrant/periodic_fee.go
  • x/feegrant/periodic_fee_test.go
Additional context used
Path-based instructions (2)
x/feegrant/mock_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

x/feegrant/CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

LanguageTool
x/feegrant/CHANGELOG.md

[uncategorized] ~30-~30: Possible missing comma found.
Context: ... is extracted to have a separate go.mod file which allows it to be a standalone modu...


[duplication] ~66-~66: Possible typo: you repeated a word
Context: ...alidateBasic` is treated as a no op now with with acceptance of RFC001 * [#17869](https:/...

Additional comments not posted (3)
x/feegrant/mock_test.go (2)

22-24: LGTM! Correct use of the new environment context key.


30-32: LGTM! Simple and effective mock implementation.

x/feegrant/CHANGELOG.md (1)

34-34: LGTM! Clear and informative changelog entry.

Comment on lines +14 to +16
func (h mockHeaderService) HeaderInfo(ctx context.Context) coreheader.Info {
return sdk.UnwrapSDKContext(ctx).HeaderInfo()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace sdk.UnwrapSDKContext to align with PR goals.

- return sdk.UnwrapSDKContext(ctx).HeaderInfo()
+ // Replace with direct use of environment's header service if available
+ return environment.HeaderService.HeaderInfo(ctx)

Committable suggestion was skipped due low confidence.

@hieuvubk hieuvubk enabled auto-merge June 3, 2024 14:32
@hieuvubk hieuvubk added this pull request to the merge queue Jun 3, 2024
Merged via the queue into main with commit d1aab15 Jun 3, 2024
65 of 67 checks passed
@hieuvubk hieuvubk deleted the hieu/env-in-module-ctx branch June 3, 2024 14:56
alpe added a commit that referenced this pull request Jun 3, 2024
* main:
  refactor(x/feegrant): set environment in context (#20529)
  refactor(x/accounts)!: accounts and auth module use the same account number tracking (#20405)
  chore: remove sonar from simapp (#20528)
  docs: add docs on permissions (#20526)
  refactor(x/gov): set environment in context for legacy proposals (#20521)
  docs: migrate diagrams to mermaidjs (#20503)
  refactor(tools/hubl): don't use nil panic (#20515)
  refactor(x/authz): set environment in context (#20502)
  build(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0 (#20519)
  feat(x/bank): Placing SendRestriction before Deduction of Coins in SendCoins (#20517)
  chore: sonar ignore directories with their own go.mods  (#20509)
  ci: run action in merge queue (#20508)
  refactor(server/v2/cometbft): update function comments (#20506)
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.

Environment in context
3 participants