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 unsupported sign-mode issue #8728

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

harish551
Copy link
Contributor

Closes: #8727

What is the purpose of the change

This PR fixes issue with signing unjail transaction with v26.0.1 binary

adds sign-mode textual to the enabled sign-modes
adds tx config options to the autocli app options

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?

Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

Walkthrough

The changes in this pull request modify the NewRootCmd function in the cmd/root.go file of the osmosisd module. A new import for transaction signing modes is added, along with a conditional setup for transaction configuration options based on the client's online status. This includes enabling the SIGN_MODE_TEXTUAL signing mode and updating the autoCliOpts function to include these configurations. Additionally, the changelog is updated to reflect these changes.

Changes

File Change Summary
cmd/osmosisd/cmd/root.go Added import for github.com/cosmos/cosmos-sdk/x/auth/tx, modified NewRootCmd to configure transaction signing modes, and updated autoCliOpts to include new transaction configuration options.
CHANGELOG.md Updated to include entries for pull request #8563 and a fix for unsupported sign mode issue from pull request #8728.

Assessment against linked issues

Objective Addressed Explanation
Unable to unjail a validator due to unsupported sign mode (8727)

Possibly related PRs

Suggested reviewers

  • mattverse

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between de43ce8 and 3170f81.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 133d623 and b20aac5.

<details>
Files selected for processing (1)
  • cmd/osmosisd/cmd/root.go (4 hunks)
Additional comments not posted (1)
cmd/osmosisd/cmd/root.go (1)

23-23: Imported packages are appropriate and necessary

The added import statements for github.com/cosmos/cosmos-sdk/x/auth/tx, github.com/cosmos/cosmos-sdk/types/tx/signing, and authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" are essential for configuring transaction signing modes and handling SIGN_MODE_TEXTUAL.

Also applies to: 65-65, 67-67

Comment on lines +390 to +403
if !initClientCtx.Offline {
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfigWithTextual, err := tx.NewTxConfigWithOptions(
initClientCtx.Codec,
txConfigOpts,
)
if err != nil {
return err
}
initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistent sign mode configuration across the application

You have correctly enabled SIGN_MODE_TEXTUAL in the NewRootCmd function when the client is online. However, in the autoCliOpts function (lines 1324-1327), EnabledSignModes is set to tx.DefaultSignModes without including SIGN_MODE_TEXTUAL. This inconsistency might lead to issues with transaction signing in the auto-generated CLI commands.

Apply this diff to include SIGN_MODE_TEXTUAL in autoCliOpts:

 func autoCliOpts(initClientCtx client.Context, tempApp *osmosis.OsmosisApp) autocli.AppOptions {
     ...
     TxConfigOpts: tx.ConfigOptions{
-        EnabledSignModes:           tx.DefaultSignModes,
+        EnabledSignModes:           append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
         TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
     },
     ...
 }
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if !initClientCtx.Offline {
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfigWithTextual, err := tx.NewTxConfigWithOptions(
initClientCtx.Codec,
txConfigOpts,
)
if err != nil {
return err
}
initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual)
}
func autoCliOpts(initClientCtx client.Context, tempApp *osmosis.OsmosisApp) autocli.AppOptions {
...
TxConfigOpts: tx.ConfigOptions{
EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
},
...
}

@PaddyMc
Copy link
Collaborator

PaddyMc commented Sep 24, 2024

Thanks for both of your PRs, would you be able to add a changelog here as well?

@PaddyMc PaddyMc added V:state/compatible/backport State machine compatible PR, should be backported A:backport/v26.x backport patches to v26.x branch labels Sep 24, 2024
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 and nitpick comments (1)
CHANGELOG.md (1)

Discrepancy Found in CHANGELOG.md Updates

The CHANGELOG.md suggests that certain code segments have been removed or replaced in lines 52-58. However, the executed shell scripts reveal multiple references to v18 within the codebase, indicating that some changes may not have been fully implemented.

Notable Findings:

  • app/app.go
    • Imports and upgrade references still include v18.
  • .github/mergify.yml
    • Contains backport configurations for v18.x branches.
  • Networks and Scripts
    • Multiple files in networks/osmosis-1/ and scripts/release/ directories reference v18.0.0.
  • CHANGELOG.md
    • Entries under ## v18.0.0 indicate ongoing references despite intended removals.

These lingering references suggest that the removal or replacement of v18 may be incomplete, potentially leading to inconsistencies or unexpected behaviors in the system.

Analysis chain

Line range hint 131-242: Major update with state-breaking changes and new features.

This v19.0.0 release introduces significant changes:

  1. New modules:

    • ProtoRev module for MEV capture
    • Validator Set Preference module
    • Pool Manager module
  2. State-breaking changes:

    • Updates to GAMM API
    • Changes to superfluid staking
    • Modifications to tokenfactory and protorev modules
  3. Major features:

    • Taker fee implementation
    • IBC composability improvements
    • Cosmwasm upgrades
  4. Configuration changes:

    • Updates to app.toml and config.toml

These changes will require careful consideration during the upgrade process. Node operators and developers should pay close attention to the upgrade instructions and potential impacts on their systems.

To ensure a smooth upgrade process, it's recommended to run the following commands to check for any potential issues:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any deprecated API usage in custom modules
grep -R "github.com/osmosis-labs/osmosis/v18" .

# Verify that all necessary modules are imported in app.go
grep "import" app/app.go

# Check for any hardcoded version numbers that might need updating
grep -R "v18" .

Length of output: 5680

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b20aac5 and 13cdf48.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional comments not posted (4)
CHANGELOG.md (4)

Line range hint 55-91: LGTM! Minor improvements and API refinements.

This section introduces several improvements and minor API changes:

  1. Fixes for state export and CW pool gauges
  2. Performance improvements for IAVL
  3. New helper functions in osmoutils
  4. Refinements to Concentrated Liquidity queries and functions
  5. Internal API changes to improve code quality and performance

These changes appear to be beneficial for the project without introducing major breaking changes.


Line range hint 93-129: LGTM! Performance improvements and bug fixes.

This section introduces several performance improvements and bug fixes:

  1. New helper functions in osmoutils for efficient calculations
  2. Performance improvements in Concentrated Liquidity math operations
  3. Bug fixes for CLI commands and error handling
  4. Improvements to TWAP calculations and pool creation fees

These changes should enhance the overall performance and reliability of the system.


Line range hint 244-2172: Well-structured changelog providing comprehensive project history.

The CHANGELOG.md file offers a detailed history of the Osmosis project's development:

  1. Consistent structure: Each version is clearly marked with features, bug fixes, and improvements.
  2. Detailed descriptions: Changes are explained with references to pull requests and commits.
  3. Version coverage: The changelog covers multiple major and minor versions, allowing users to track changes over time.
  4. Upgrade instructions: For major versions, links to upgrade guides are provided.
  5. Breaking changes: Clearly marked sections for state-breaking changes and API breaks.

This changelog serves as an excellent resource for developers, node operators, and users to understand the project's evolution and prepare for upgrades.


Line range hint 1-2172: Excellent changelog following best practices.

The CHANGELOG.md file is well-maintained and follows best practices:

  1. Clear version demarcation
  2. Consistent structure across versions
  3. Detailed descriptions of changes with PR references
  4. Proper categorization of changes (features, bug fixes, breaking changes)
  5. Upgrade instructions for major versions
  6. Comprehensive coverage of the project's history

This changelog serves as a valuable resource for all stakeholders in the Osmosis project, facilitating smooth upgrades and providing a clear picture of the project's evolution.

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

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

hey thanks for the PR!

Can you also leave a log of how you have tested correctness and how we can test correct implementation? 🙇

@harish551
Copy link
Contributor Author

hey thanks for the PR!

Can you also leave a log of how you have tested correctness and how we can test correct implementation? 🙇

Hi @mattverse

we can test it by executing unjail command with any address
with v26.0.1
Screenshot 2024-09-28 at 1 57 53 AM

with patch
Screenshot 2024-09-28 at 1 58 32 AM

@PaddyMc PaddyMc merged commit 502f559 into osmosis-labs:main Oct 2, 2024
1 check passed
@PaddyMc
Copy link
Collaborator

PaddyMc commented Oct 2, 2024

Thank you for the PR ❤️

mergify bot pushed a commit that referenced this pull request Oct 2, 2024
* fix unsupported sign-mode issue

* update changelog

---------

Co-authored-by: PaddyMc <[email protected]>
(cherry picked from commit 502f559)

# Conflicts:
#	CHANGELOG.md
PaddyMc added a commit that referenced this pull request Oct 2, 2024
* fix unsupported sign-mode issue (#8728)

* fix unsupported sign-mode issue

* update changelog

---------

Co-authored-by: PaddyMc <[email protected]>
(cherry picked from commit 502f559)

# Conflicts:
#	CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Marri Harish <[email protected]>
Co-authored-by: PaddyMc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v26.x backport patches to v26.x branch V:state/compatible/backport State machine compatible PR, should be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: unjail transaction signing issue with sign modes
3 participants