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: reimplement sig verification for app v2 #21386

Merged
merged 10 commits into from
Aug 26, 2024
Merged

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Aug 23, 2024

Description

  • makes x/auth/tx an actual app module, which currently just contains a ValidateTx method
  • TestStakeUnstake has a small change that we need to remove once we fix the fee decorator + skipping the UnorderedTx test for now
  • Changed the gas meter type in SignatureVerificationGasConsumer for core gas.Meter
  • Fixed issue in the account retriever that caused issues when queries were routed through CometBFT (not sure the details on this one)

I also removed the usages of !ctx.IsSigverifyTx(), I'm unsure of the impact of this handling it optionally now, only if context is an sdk.Context, otherwise we'll always verify the signature


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

  • Bug Fixes

    • Enhanced error handling in account retrieval to manage potential wrapped errors effectively.
  • Tests

    • Updated balance assertion in staking tests to reflect expected changes due to upcoming fee modifications.
    • Disabled a test for duplicate transactions to indicate it is currently incomplete or not applicable.
    • Improved gas consumption testing for signature verification processes using a new mock gas meter.
    • Enhanced context setup in testing to include blockchain header information.
  • New Features

    • Improved transaction handling architecture with new modules for enhanced signature verification and validation processes.
    • Updated build and environment configurations to support versioning changes.
    • Introduced mock implementations for service and meter interfaces to enhance testing capabilities.

@facundomedica facundomedica requested a review from a team as a code owner August 23, 2024 10:38
Copy link
Contributor

coderabbitai bot commented Aug 23, 2024

Walkthrough

Walkthrough

The changes involve a series of updates across multiple files aimed at enhancing command execution outputs, refining testing expectations, and restructuring the gas management system within the Cosmos SDK. Key modifications include transitioning from storetypes.GasMeter to gas.Meter, improving transaction validation processes, bolstering error handling in account retrieval, and updating the Dockerfile and associated scripts for a new version of the SIMD binary.

Changes

File Change Summary
tests/systemtests/cli.go Changed cmd.Output() to cmd.CombinedOutput() in runWithInput to capture both standard output and error streams.
tests/systemtests/staking_test.go Modified expected balance in TestStakeUnstake from 9989999 to 9990000 due to pending fee decorator implementation.
tests/systemtests/unordered_tx_test.go Added t.Skip() in TestUnorderedTXDuplicate to disable the test temporarily.
x/auth/ante/ante.go Changed SigGasConsumer parameter type from storetypes.GasMeter to gas.Meter.
x/auth/ante/sigverify.go Updated multiple functions to use gas.Meter; enhanced error handling and event emissions in signature verification.
x/auth/ante/ante_test.go Updated TestCustomSignatureVerificationGasConsumer to use gas.Meter as the parameter type.
x/auth/tx/config/depinject.go Introduced new dependencies and fields in ModuleInputs and ModuleOutputs; implemented AppModule for transaction validation.
x/auth/types/account_retriever.go Enhanced error handling in GetAccountNumberSequence to gracefully manage wrapped errors.
contrib/images/simd-env/Dockerfile Updated build command to include COSMOS_BUILD_OPTIONS=v2; renamed output binary from simd to simdv2.
contrib/images/simd-env/wrapper.sh Changed default values for BINARY and SIMDHOME to reference simdv2.
scripts/init-simapp-v2.sh Updated chain ID in genesis transaction command from demo to simapp-v2-chain.
core/testing/gas/service_mocks.go Introduced mock implementations for Service and Meter interfaces to enhance testing capabilities.
core/testing/go.mod Added dependency on github.com/golang/mock version v1.6.0 for improved testing support.
scripts/mockgen.sh Added command to generate mocks for the core/gas/service.go file.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLIWrapper
    participant Command as Command Execution
    CLI->>Command: runWithInput()
    Command-->>CLI: CombinedOutput()
    Note over CLI: Captures stdout and stderr together
Loading
sequenceDiagram
    participant Validator as TxValidator
    participant Decorator as SigVerificationDecorator
    participant Module as AppModule

    Module->>Validator: ValidateTx(tx)
    Validator->>Decorator: AnteHandle(tx)
    Decorator-->>Validator: Error or success
    Validator-->>Module: Validation Result
Loading

Possibly related issues


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.

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.

Copy link
Contributor

@facundomedica your pull request is missing a changelog!

@@ -19,5 +19,5 @@ jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/ge
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation
$SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test
$SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test
$SIMD_BIN genesis gentx alice 1000000stake --chain-id demo
$SIMD_BIN genesis gentx alice 1000000stake --chain-id simapp-v2-chain
Copy link
Member Author

Choose a reason for hiding this comment

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

this was failing now that we check sigs 😅

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

Outside diff range, codebase verification and nitpick comments (2)
tests/systemtests/staking_test.go (1)

38-39: Clarify the TODO comment and expected balance assertion.

The TODO comment indicates that the balance assertion is temporary until the fee decorator is implemented. Ensure that this is tracked and updated once the decorator is complete.

Consider adding a reference to the issue or task tracking the fee decorator implementation for better traceability.

x/auth/ante/ante.go (1)

5-5: Refactor remaining references to storetypes.GasMeter.

The codebase still contains several references to storetypes.GasMeter, which suggests that the refactoring to gas.Meter is incomplete. Please review and update the following occurrences to ensure consistency:

  • types/context.go: Multiple references.
  • x/auth/ante/sigverify_test.go: Line with storetypes.GasMeter.
  • x/auth/ante/ante_test.go: Line with SigGasConsumer.
  • server/mock/store.go: Function using storetypes.GasMeter.
  • runtime/gas.go: Reference to storetypes.GasMeter.
  • baseapp/baseapp.go: Function returning storetypes.GasMeter.
Analysis chain

Review the change in SigGasConsumer function signature.

The change from storetypes.GasMeter to gas.Meter suggests a refactoring of the gas management system. Ensure that all dependent code is updated to accommodate this change.

Check for any other references to storetypes.GasMeter in the codebase to ensure consistency. Use the following script to verify:

Also applies to: 24-24

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify references to `storetypes.GasMeter` in the codebase.

# Test: Search for references. Expect: No occurrences of `storetypes.GasMeter`.
rg --type go 'storetypes.GasMeter'

Length of output: 1123

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8ddea56 and d5018f0.

Files selected for processing (7)
  • tests/systemtests/cli.go (1 hunks)
  • tests/systemtests/staking_test.go (1 hunks)
  • tests/systemtests/unordered_tx_test.go (1 hunks)
  • x/auth/ante/ante.go (2 hunks)
  • x/auth/ante/sigverify.go (12 hunks)
  • x/auth/tx/config/depinject.go (5 hunks)
  • x/auth/types/account_retriever.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • tests/systemtests/unordered_tx_test.go
Additional context used
Path-based instructions (6)
tests/systemtests/staking_test.go (3)

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


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


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

x/auth/ante/ante.go (1)

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

x/auth/types/account_retriever.go (1)

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

x/auth/tx/config/depinject.go (1)

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

tests/systemtests/cli.go (2)

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


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"

x/auth/ante/sigverify.go (1)

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

Additional comments not posted (15)
x/auth/types/account_retriever.go (1)

79-80: Enhance error handling in GetAccountNumberSequence.

The additional condition for checking wrapped errors from CometBFT improves the robustness of error handling. This ensures that the method can gracefully handle cases where an account might not exist.

Ensure that similar error handling improvements are applied consistently across other methods if applicable.

x/auth/tx/config/depinject.go (5)

18-19: Imports look good.

The new imports appmodulev2 and transaction are appropriate for the added functionalities.


58-58: Addition of AccountAbstractionKeeper is appropriate.

The new field enhances the module's capability to handle account abstractions.


69-69: Addition of Module field is appropriate.

The new field encapsulates transaction validation functionality, aligning with architectural goals.


147-155: Integration of AppModule with signature verification is appropriate.

The changes enhance transaction validation capabilities by integrating signature verification into the module's output.


241-254: AppModule struct and methods are well-implemented.

The struct and its methods align with the architectural goal of enhancing transaction validation.

tests/systemtests/cli.go (1)

226-226: Use of CombinedOutput() is a good change.

Capturing both stdout and stderr enhances debugging capabilities.

x/auth/ante/sigverify.go (8)

51-51: Transition to gas.Meter is appropriate.

The change aligns with updated standards for gas management.


502-515: Use of gas.Meter in DefaultSigVerificationGasConsumer is appropriate.

The change aligns with the updated gas management approach.


594-594: Use of context.Context in GetSignerAcc is appropriate.

The change aligns with broader Go conventions, improving consistency.


230-230: Use of context.Context in authenticate is appropriate.

The change aligns with broader Go conventions, improving consistency.


Line range hint 287-302: Use of context.Context in consumeSignatureGas is appropriate.

The change aligns with broader Go conventions, improving consistency.


306-306: Use of context.Context in verifySig is appropriate.

The change aligns with broader Go conventions, improving consistency.


379-379: Use of context.Context in setPubKey is appropriate.

The change aligns with broader Go conventions, improving consistency.


427-427: Use of context.Context in authenticateAbstractedAccount is appropriate.

The change aligns with broader Go conventions, improving consistency.

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 d5018f0 and ad4ab1e.

Files selected for processing (4)
  • contrib/images/simd-env/Dockerfile (2 hunks)
  • contrib/images/simd-env/wrapper.sh (2 hunks)
  • scripts/init-simapp-v2.sh (1 hunks)
  • simapp/simd/cmd/testnet_test.go (1 hunks)
Additional context used
Path-based instructions (1)
simapp/simd/cmd/testnet_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"

Additional comments not posted (6)
contrib/images/simd-env/wrapper.sh (2)

5-5: Update binary path to simdv2.

The binary path has been updated to use simdv2, which aligns with the new versioning. Ensure that the simdv2 binary is available in the specified location.


14-14: Update SIMD home directory to simdv2.

The home directory path has been updated to simdv2, which is consistent with the new binary version. Verify that the directory structure supports this change.

scripts/init-simapp-v2.sh (1)

22-22: Update chain ID to simapp-v2-chain.

The chain ID has been updated to simapp-v2-chain, which reflects the new version of the simulation application. Ensure that all configurations and dependencies are aligned with this new chain ID.

contrib/images/simd-env/Dockerfile (2)

36-36: Set COSMOS_BUILD_OPTIONS to v2.

The build options have been updated to v2, indicating a version update in the build configuration. Ensure that the build process and dependencies are compatible with this change.


49-49: Update output binary name to simdv2.

The output binary name has been changed to simdv2, reflecting a version update. Verify that all references to the binary are updated accordingly.

simapp/simd/cmd/testnet_test.go (1)

48-48: Verify the module registration.

The change in the expected length of moduleManager.Modules from 8 to 9 suggests an additional module registration. Ensure that this aligns with the application's requirements and that all necessary modules are correctly registered and tested.

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 d5018f0 and ad4ab1e.

Files selected for processing (4)
  • contrib/images/simd-env/Dockerfile (2 hunks)
  • contrib/images/simd-env/wrapper.sh (2 hunks)
  • scripts/init-simapp-v2.sh (1 hunks)
  • simapp/simd/cmd/testnet_test.go (1 hunks)
Additional context used
Path-based instructions (1)
simapp/simd/cmd/testnet_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"

Additional comments not posted (6)
contrib/images/simd-env/wrapper.sh (2)

5-5: Update binary version reference.

The BINARY variable has been updated to default to simdv2, reflecting a version change. Ensure that this change is consistent with the rest of the system and that all references to the binary are updated accordingly.


14-14: Update SIMDHOME path for new version.

The SIMDHOME variable now points to a directory with simdv2, indicating a version update. Verify that all configurations and dependencies are aligned with this new path.

scripts/init-simapp-v2.sh (1)

22-22: Update chain ID for genesis transaction.

The chain ID has been updated to simapp-v2-chain, which matches the versioning of the application. Ensure that this change is reflected in all relevant configurations and documentation.

contrib/images/simd-env/Dockerfile (2)

36-36: Introduce COSMOS_BUILD_OPTIONS for build process.

The build command now includes COSMOS_BUILD_OPTIONS=v2, indicating a new build configuration. Verify that this option is correctly supported and documented in the build process.


49-49: Update output binary name to simdv2.

The output binary is now named simdv2, reflecting a version update. Ensure that all scripts and configurations that reference the binary are updated to use this new name.

simapp/simd/cmd/testnet_test.go (1)

48-48: LGTM! Verify module registration.

The update in the expected length of moduleManager.Modules from 8 to 9 reflects the addition of a new module. Ensure that the module registration is correctly handled elsewhere in the codebase.

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 d5018f0 and ad4ab1e.

Files selected for processing (4)
  • contrib/images/simd-env/Dockerfile (2 hunks)
  • contrib/images/simd-env/wrapper.sh (2 hunks)
  • scripts/init-simapp-v2.sh (1 hunks)
  • simapp/simd/cmd/testnet_test.go (1 hunks)
Additional context used
Path-based instructions (1)
simapp/simd/cmd/testnet_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"

Additional comments not posted (6)
contrib/images/simd-env/wrapper.sh (2)

5-5: Verify the availability of the new binary.

The BINARY variable now defaults to simdv2. Ensure that this binary is available in the expected location and is compatible with the rest of the system.


14-14: Verify the directory structure for SIMDHOME.

The SIMDHOME path now reflects the new binary version. Ensure that the directory structure supports this change and that all related configurations are updated accordingly.

scripts/init-simapp-v2.sh (1)

22-22: Verify the consistency of the chain ID update.

The chain ID has been updated to simapp-v2-chain. Ensure that all related configurations, scripts, and dependencies are updated to reflect this change.

contrib/images/simd-env/Dockerfile (2)

36-36: Verify the integration of the new build option.

The build command now includes COSMOS_BUILD_OPTIONS=v2. Ensure that this option is correctly integrated and compatible with the build process.


49-49: Verify the consistency of the artifact name update.

The output artifact has been renamed to simdv2. Ensure that all references to this artifact in the system are updated to reflect this change.

simapp/simd/cmd/testnet_test.go (1)

48-48: Update the assertion to reflect the correct number of modules.

The assertion now expects 9 modules instead of 8, which aligns with the updated test setup. The comment provides clarity on the inclusion of the runtime module.

@facundomedica facundomedica marked this pull request as draft August 23, 2024 12:34
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 ad4ab1e and 35228ab.

Files ignored due to path filters (1)
  • core/testing/go.sum is excluded by !**/*.sum
Files selected for processing (6)
  • core/testing/gas/service_mocks.go (1 hunks)
  • core/testing/go.mod (1 hunks)
  • scripts/mockgen.sh (1 hunks)
  • x/auth/ante/ante_test.go (2 hunks)
  • x/auth/ante/sigverify.go (14 hunks)
  • x/auth/ante/sigverify_test.go (5 hunks)
Files skipped from review due to trivial changes (1)
  • core/testing/gas/service_mocks.go
Files skipped from review as they are similar to previous changes (1)
  • x/auth/ante/sigverify.go
Additional context used
Path-based instructions (2)
x/auth/ante/sigverify_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/auth/ante/ante_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"

Additional comments not posted (7)
core/testing/go.mod (1)

9-9: Addition of github.com/golang/mock dependency is appropriate.

The inclusion of github.com/golang/mock v1.6.0 enhances the testing framework by enabling mock object usage, which is beneficial for isolating components during testing.

scripts/mockgen.sh (1)

29-29: Addition of mock generation for core/gas/service.go is appropriate.

The new command enhances the script's functionality by allowing for the mocking of the gas service, which is crucial for testing purposes.

x/auth/ante/sigverify_test.go (4)

11-12: New imports for gas management are appropriate.

The additions of cosmossdk.io/core/gas and gastestutil are necessary for the updated gas management structure and mock gas meter utility.


61-131: Enhancements to TestConsumeSignatureVerificationGas improve test precision.

The introduction of a mock gas meter and the malleate function allows for more precise and clear testing of gas consumption during signature verification.


196-196: Update to noOpGasConsume aligns with new gas management.

The change to use gas.Meter ensures consistency with the updated gas management structure.


Line range hint 318-318: Comprehensive test coverage in TestAnteHandlerChecks.

The test cases cover various scenarios for signature verification with different key types, ensuring thorough testing of the logic.

x/auth/ante/ante_test.go (1)

1269-1272: Verify the change in gas meter type and method.

The meter parameter type has been updated from storetypes.GasMeter to gas.Meter, and ConsumeGas is replaced with Consume. Ensure that this change is consistent with the rest of the codebase and that the new method behaves as expected.

Run the following script to verify the usage of gas.Meter and Consume in the codebase:

Verification successful

Change Verified: Consistent Usage of gas.Meter and Consume

The update from storetypes.GasMeter to gas.Meter and from ConsumeGas to Consume is consistent across the codebase. The Consume method is used in various contexts, confirming that the change aligns with the expected behavior. No issues were found with this refactoring.

  • The gas.Meter type and Consume method are used consistently in both tests and implementations.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `gas.Meter` and `Consume` in the codebase.

# Test: Search for the usage of `gas.Meter` and `Consume`. Expect: Consistent usage across the codebase.
rg --type go -A 5 'gas.Meter'
rg --type go -A 5 'Consume'

Length of output: 85191

core/testing/gas/service_mocks.go Dismissed Show dismissed Hide dismissed
@github-actions github-actions bot added the C:CLI label Aug 23, 2024
@facundomedica facundomedica marked this pull request as ready for review August 23, 2024 13:32
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 35228ab and c5b4912.

Files selected for processing (5)
  • x/auth/ante/ante_test.go (4 hunks)
  • x/auth/ante/sigverify.go (14 hunks)
  • x/auth/ante/sigverify_test.go (8 hunks)
  • x/auth/ante/testutil_test.go (2 hunks)
  • x/auth/client/cli/tx_multisign.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/auth/client/cli/tx_multisign.go
Files skipped from review as they are similar to previous changes (1)
  • x/auth/ante/ante_test.go
Additional context used
Path-based instructions (3)
x/auth/ante/testutil_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/auth/ante/sigverify_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/auth/ante/sigverify.go (1)

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

Additional comments not posted (9)
x/auth/ante/testutil_test.go (1)

81-81: LGTM: Addition of header information to context.

The inclusion of WithHeaderInfo enhances the context setup by providing block height and chain ID, which is useful for tests requiring blockchain state awareness.

x/auth/ante/sigverify_test.go (2)

11-11: LGTM: Import of gas package.

The import of the gas package is necessary for the updated gas management system.


197-197: LGTM: Update to noOpGasConsume function.

The update to use gas.Meter instead of storetypes.GasMeter aligns with the new gas management structure.

x/auth/ante/sigverify.go (6)

13-14: LGTM: Import of event and gas packages.

The import of these packages is necessary for the updated event management and gas consumption logic.


51-51: LGTM: Update to SignatureVerificationGasConsumer type.

The change to use gas.Meter reflects the updated gas management system.


154-158: LGTM: Update to AnteHandle method.

The inclusion of ValidateTx enhances error handling by directly returning errors.


203-226: LGTM: Use of event manager for event emission.

The structured event emission using an event manager improves the organization and handling of emitted events.


512-526: LGTM: Update to DefaultSigVerificationGasConsumer.

The transition to gas.Meter and the updated logic for consuming gas based on public key type align with the new gas management structure.


604-604: Verify the impact of context changes on the codebase.

The change from sdk.Context to context.Context in function signatures may affect other parts of the codebase.

Run the following script to verify the usage of updated function signatures:

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

ACK

@@ -12,6 +12,7 @@ import (
)

func TestUnorderedTXDuplicate(t *testing.T) {
t.Skip()
Copy link
Member

Choose a reason for hiding this comment

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

can you add a short todo as to why its skipped?

Copy link
Member Author

Choose a reason for hiding this comment

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

will do this and merge

Copy link
Contributor

@hieuvubk hieuvubk left a comment

Choose a reason for hiding this comment

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

LGTM

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 c5b4912 and 280babb.

Files selected for processing (2)
  • tests/systemtests/staking_test.go (1 hunks)
  • tests/systemtests/unordered_tx_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • tests/systemtests/staking_test.go
  • tests/systemtests/unordered_tx_test.go

@facundomedica facundomedica added this pull request to the merge queue Aug 26, 2024
Merged via the queue into main with commit 7c85b98 Aug 26, 2024
75 of 77 checks passed
@facundomedica facundomedica deleted the facu/fix-sig-verify-v2 branch August 26, 2024 09:45
@julienrbrt
Copy link
Member

@Mergifyio backport release/v0.52.x

Copy link
Contributor

mergify bot commented Aug 26, 2024

backport release/v0.52.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Aug 26, 2024
(cherry picked from commit 7c85b98)

# Conflicts:
#	core/testing/go.mod
#	core/testing/go.sum
@randygrok randygrok mentioned this pull request Aug 26, 2024
1 task
julienrbrt added a commit that referenced this pull request Aug 26, 2024
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.

4 participants