Skip to content

fix(x/auth): simulation multisig signature verification#19148

Merged
JulianToledano merged 11 commits into
mainfrom
julian/amino-multisig-gas
Feb 1, 2024
Merged

fix(x/auth): simulation multisig signature verification#19148
JulianToledano merged 11 commits into
mainfrom
julian/amino-multisig-gas

Conversation

@JulianToledano
Copy link
Copy Markdown
Contributor

@JulianToledano JulianToledano commented Jan 19, 2024

Description

Closes:
#18441

Adds signature verification gas for multisig simulation tx


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

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
    • Improved multisig pubKey signature verification during simulation, including support for empty public keys in transactions.
  • Tests
    • Added a new test case for multisig simulation signature verification gas consumption.
  • Chores
    • Updated and cleaned up dependencies in the project, ensuring smoother module resolution and compatibility.

@JulianToledano JulianToledano requested a review from a team January 19, 2024 15:59
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 19, 2024

Walkthrough

Walkthrough

The changes focus on fixing a bug related to gas estimation for multisig.LegacyAmino accounts during simulation in the Cosmos SDK. A conditional check for a nil BitArray has been added to improve the handling of multisig pubKey signature verification in simulation mode. Additionally, the update includes renaming parameters for clarity, updating dependency versions, and modifying tests to cover the new multisig simulation scenario.

Changes

File(s) Change Summary
x/auth/ante/sigverify.go Added nil BitArray check and multisignatureSimulationVerificationGas function; Renamed pubkey to pubKey.
x/auth/CHANGELOG.md Documented bug fix related to multisig pubKey signature verification during simulation.
x/auth/ante/sigverify_test.go Introduced new test case for multisig simulation gas consumption.
x/auth/go.mod Updated indirect dependencies and added module replacements for cosmossdk.io/core and cosmossdk.io/x/tx.
x/auth/go.sum Removed specific versions of modules cosmossdk.io/core and cosmossdk.io/x/tx.

Assessment against linked issues

Objective Addressed Explanation
Gas estimation for multisig.LegacyAmino accounts is incorrect in simulate: true mode. (#18441)
SigVerificationDecorator does not properly estimate gas for simulate mode for multisig.LegacyAmino accounts. (#18441)
Signature verification gas is not added for simulation, leading to incorrect gas estimation. (#18441)
Reproduction steps involve adding debugGasMeter and observing the absence of signature verification in logs during multisig.LegacyAmino account transaction simulation. (#18441) The changes address the core issue of gas estimation but do not explicitly mention updates related to debugGasMeter logging.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@JulianToledano JulianToledano linked an issue Jan 19, 2024 that may be closed by this pull request
1 task
@github-actions

This comment has been minimized.

@educlerici-zondax
Copy link
Copy Markdown
Contributor

@likhita-809 can you help us with this review please?

Copy link
Copy Markdown
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

is there any way to add tests for this ?
generally, the code seems fine

@JulianToledano
Copy link
Copy Markdown
Contributor Author

is there any way to add tests for this ?

Added one test

@likhita-809
Copy link
Copy Markdown
Contributor

is there any way to add tests for this ?

Added one test

Seems like the test is not covering the newly added fix

@JulianToledano
Copy link
Copy Markdown
Contributor Author

is there any way to add tests for this ?

Added one test

Seems like the test is not covering the newly added fix

Just run code coverage for TestConsumeSignatureVerificationGas and it covers the added fix.

Screenshot 2024-01-30 at 13 01 37

@likhita-809
Copy link
Copy Markdown
Contributor

is there any way to add tests for this ?

Added one test

Seems like the test is not covering the newly added fix

Just run code coverage for TestConsumeSignatureVerificationGas and it covers the added fix.

Screenshot 2024-01-30 at 13 01 37

I couldn't find any coverage while running locally.
I'll double check.

Copy link
Copy Markdown
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.

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 1277cfc and 55f42da.
Files selected for processing (2)
  • x/auth/go.mod (1 hunks)
  • x/auth/go.sum (2 hunks)
Files skipped from review due to trivial changes (1)
  • x/auth/go.sum

Copy link
Copy Markdown
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.

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 55f42da and 55363c4.
Files selected for processing (2)
  • x/auth/go.mod (4 hunks)
  • x/auth/go.sum (6 hunks)
Additional comments: 4
x/auth/go.mod (3)
  • 42-42: The update of github.com/99designs/keyring to version 1.2.2 is noted. Ensure compatibility with this version as it might introduce breaking changes or new features that could affect the project.
  • 64-64: The update of github.com/danieljoos/wincred to version 1.2.0 is observed. Verify that this version is compatible with the project's requirements, especially if it's used for credential storage or retrieval in Windows environments.
  • 77-77: The update of github.com/go-kit/kit to version 0.13.0 is noted. Given that go-kit is a foundational library for microservices, ensure that this update does not introduce any regressions or incompatibilities with existing service implementations.
x/auth/go.sum (1)
  • 4-9: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The go.sum file has been modified to remove specific versions of modules cosmossdk.io/core and cosmossdk.io/x/tx. Ensure that these removals do not affect the build or any dependencies that require these specific versions.

Comment thread x/auth/go.mod
Comment on lines +168 to +172
cosmossdk.io/core => ../../core
cosmossdk.io/depinject => ../../depinject
cosmossdk.io/x/bank => ../bank
cosmossdk.io/x/staking => ../staking
cosmossdk.io/x/tx => ../tx
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The module replacements for cosmossdk.io/core, cosmossdk.io/depinject, cosmossdk.io/x/bank, cosmossdk.io/x/staking, and cosmossdk.io/x/tx point to local directories. This setup is typically used for local development or testing. Confirm that these replacements are intended for inclusion in the PR and not accidentally committed. If these are temporary for development, they should be removed before merging to maintain module resolution integrity for other developers and in production environments.

@JulianToledano JulianToledano added this pull request to the merge queue Feb 1, 2024
Merged via the queue into main with commit d70eadb Feb 1, 2024
@JulianToledano JulianToledano deleted the julian/amino-multisig-gas branch February 1, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gas is estimated incorrectly for multisig.LegacyAmino accounts

5 participants