Skip to content

Sync Head: pystarport#2

Merged
mmsqe merged 8 commits intoMANTRA-Chain:mainfrom
crypto-com:main
Oct 9, 2025
Merged

Sync Head: pystarport#2
mmsqe merged 8 commits intoMANTRA-Chain:mainfrom
crypto-com:main

Conversation

@AaronForce1
Copy link
Copy Markdown

@AaronForce1 AaronForce1 commented Mar 23, 2025

Summary by CodeRabbit

  • New Features

    • Introduced multi-chain support with enhanced command flag usage.
    • Improved account creation by allowing coin type specification.
    • Added IBC denomination queries to support inter-chain communication.
    • Enhanced transaction handling with smarter event checks and backward compatibility.
    • Provided additional debugging options for more flexible cluster management.
  • Chores

    • Added Flake8 configuration for code style enforcement and linting exclusions.
    • Removed deprecated script for generating gRPC code and related shell hooks.
  • Documentation

    • Updated release notes to capture these multi-chain, account creation, and compatibility improvements.

mmsqe and others added 5 commits December 5, 2024 12:06
* Problem: wrong cmd runs with chain_binary

* Revert "Problem: wrong cmd runs with chain_binary"

This reverts commit 8f26321.

* Problem: cmd flag don't support multiple chains

* changelog

* Update pystarport/cluster.py

Signed-off-by: yihuang <huang@crypto.com>

---------

Signed-off-by: yihuang <huang@crypto.com>
Co-authored-by: HuangYi <huang@crypto.com>
* Problem: debug-addr rename to debug-listen-addr in relayer

for more info, https://github.com/cosmos/relayer/pull/1504/files

* keep previous
* Problem: event-query-tx-for not compatible with chain-main

* Update CHANGELOG.md

Signed-off-by: yihuang <huang@crypto.com>

* fix lint

---------

Signed-off-by: yihuang <huang@crypto.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request introduces a new Flake8 configuration file and updates the changelog with a new entry for external community pool queries. It modifies the cluster management and Cosmos CLI modules by updating method signatures to accept flexible keyword arguments, adding a coin type parameter, and introducing new methods for querying IBC denominations. Conditional logic is added to detect the availability of a new event query subcommand, affecting transaction processing. The cluster initialization flow is enhanced for multi-chain commands and debugging options. Additionally, the convert.sh script and its invocation in the Nix shell configuration are removed.

Changes

File(s) Change Summary
.flake8 New configuration file added with settings: max-line-length = 88, extend-ignore = E203, and exclusions for .git, __pycache__, and integration test directories and files.
CHANGELOG.md New changelog entry added documenting support for queries exposed by the external community pool ([crypto-com#147]).
pystarport/cluster.py Updated create_node to accept coin_type; modified create_account, create_account_ledger, distribution_community, and make_multisig to accept **kwargs; added new method ibc_denom; enhanced init_cluster and init_devnet.
pystarport/cosmoscli.py Added prob_event_query_tx_for method; updated create_account, create_account_ledger, make_multisig, and distribution_community to accept **kwargs; added new method ibc_denom; adjusted transaction logic for event query support.
pystarport/convert.sh Removed Bash script that generated Python gRPC code from proto files for Cosmos SDK and Tendermint.
pystarport/default.nix Removed shellHook that executed ./convert.sh on shell startup; no other changes to build inputs or shell configuration.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ClusterCLI as Cluster CLI
  participant Account as create_account
  User->>ClusterCLI: Invoke create_node(coin_type, ...)
  ClusterCLI->>Account: Call create_account(name, coin_type, **kwargs)
  Account-->>ClusterCLI: Return account details
  ClusterCLI-->>User: Return node creation result
Loading
sequenceDiagram
  participant User
  participant CosmosCLI as Cosmos CLI
  participant ChainCmd as ChainCommand
  User->>CosmosCLI: Invoke transaction-related command
  CosmosCLI->>ChainCmd: Call prob_event_query_tx_for()
  ChainCmd-->>CosmosCLI: Return event query availability (True/False)
  alt Event Query Available
    CosmosCLI->>User: Execute event query transaction flow
  else Event Query Not Available
    CosmosCLI->>User: Proceed with standard transaction processing
  end
Loading

Poem

I'm a rabbit, coding on the run,
Hopping through settings, enjoying the fun.
A checkout of changes in modules so neat,
New methods and kwargs make my heart beat.
I leap with joy at each updated line—
In our code garden, everything's truly divine! 🐰


🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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
Copy Markdown

@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

🧹 Nitpick comments (2)
CHANGELOG.md (1)

28-30: New changelog entries align with code changes

The changelog entries accurately reflect the changes implemented in the code base, providing good documentation of the new features and compatibility improvements.

Minor grammatical issue in the third entry - consider changing "binary that don't" to "binaries that don't" or "binary that doesn't" for grammatical correctness.

- - [#145](https://github.com/crypto-com/pystarport/pull/145) Backward compatible with binary that don't have event-query-tx-for.
+ - [#145](https://github.com/crypto-com/pystarport/pull/145) Backward compatible with binaries that don't have event-query-tx-for.
🧰 Tools
🪛 LanguageTool

[grammar] ~30-~30: There seems to be a noun/verb agreement error. Did you mean “doesn't” or “didn't”?
Context: ...5) Backward compatible with binary that don't have event-query-tx-for. Feb 7, 2023...

(SINGULAR_NOUN_AGREEMENT_WHO_DONT)

pystarport/cluster.py (1)

1253-1259: Added support for multiple chain commands

This enhancement allows different commands to be specified for different chains, making the configuration more flexible.

Consider using a ternary operator for conciseness:

- if cmd is not None:
-     cmds = cmd.split(",")
- else:
-     cmds = [None] * len(chains)
+ cmds = cmd.split(",") if cmd is not None else [None] * len(chains)

Additionally, consider adding validation to ensure that when cmd is provided, the number of comma-separated commands matches the number of chains:

if cmd is not None:
    cmds = cmd.split(",")
    if len(cmds) != len(chains):
        raise ValueError(f"Number of commands ({len(cmds)}) does not match number of chains ({len(chains)})")
else:
    cmds = [None] * len(chains)
🧰 Tools
🪛 Ruff (0.8.2)

1254-1257: Use ternary operator cmds = cmd.split(",") if cmd is not None else [None] * len(chains) instead of if-else-block

Replace if-else-block with cmds = cmd.split(",") if cmd is not None else [None] * len(chains)

(SIM108)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2e6e59 and 5ed0026.

📒 Files selected for processing (4)
  • .flake8 (1 hunks)
  • CHANGELOG.md (1 hunks)
  • pystarport/cluster.py (9 hunks)
  • pystarport/cosmoscli.py (31 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
pystarport/cluster.py (2)
pystarport/cosmoscli.py (5)
  • create_account (133-157)
  • create_account_ledger (159-187)
  • make_multisig (584-594)
  • ibc_denom (1476-1487)
  • account (335-340)
pystarport/cli.py (1)
  • cli (174-181)
🪛 LanguageTool
CHANGELOG.md

[grammar] ~30-~30: There seems to be a noun/verb agreement error. Did you mean “doesn't” or “didn't”?
Context: ...5) Backward compatible with binary that don't have event-query-tx-for. Feb 7, 2023...

(SINGULAR_NOUN_AGREEMENT_WHO_DONT)

🪛 Ruff (0.8.2)
pystarport/cluster.py

1254-1257: Use ternary operator cmds = cmd.split(",") if cmd is not None else [None] * len(chains) instead of if-else-block

Replace if-else-block with cmds = cmd.split(",") if cmd is not None else [None] * len(chains)

(SIM108)

🔇 Additional comments (20)
.flake8 (1)

1-4: LGTM: Well-configured Flake8 settings

The Flake8 configuration follows good Python practices:

  • Line length of 88 characters aligns with Black formatter
  • Ignoring E203 (whitespace before ':') is standard when using Black
  • Appropriate exclusions for generated files and non-source directories
pystarport/cosmoscli.py (10)

71-79: Good feature detection implementation

The addition of this method to check for the availability of the "event-query-tx-for" subcommand is a good practice for ensuring backward compatibility.


113-113: LGTM: Initializing the feature detection flag

Properly initializes the feature flag during object construction, which will be used throughout the class.


133-157: Method signature enhancement for flexibility

Adding **kwargs to the method signature allows passing additional parameters like coin_type without breaking existing code.


159-187: Flexible parameter passing for ledger account creation

Similar to the previous change, this makes the method more adaptable to future parameter additions.


294-296: Added handling for nested commission response format

This change improves the robustness of the code by handling both direct and nested commission response formats.


405-412: Improved backward compatibility for event queries

The conditional check now verifies if the event-query-tx-for feature is available before attempting to use it.


446-453: Feature availability check for ledger transfers

Similar to the previous change, this ensures backward compatibility when transferring from a ledger device.


507-509: Consistent feature checking across all transaction methods

The pattern of checking for feature availability has been consistently applied across all transaction methods, ensuring complete backward compatibility.

Also applies to: 529-531, 560-562, 580-582, 724-726, 773-775, 823-825, 863-865, 957-959, 980-982, 1057-1059, 1095-1097, 1154-1156, 1191-1193, 1223-1225, 1253-1255, 1326-1328, 1386-1388, 1441-1443, 1459-1461


584-594: Enhanced multisig account creation with flexible parameters

Added **kwargs to allow passing additional parameters like coin_type to multisig account creation.


1476-1488: Added IBC denomination query capability

This new method provides functionality to query IBC denominations by path, enhancing the IBC-related capabilities of the client.

pystarport/cluster.py (9)

189-189: Added coin_type parameter for more flexible chain configuration

This new parameter allows specifying the coin type when creating a node, supporting different blockchain ecosystems.


261-262: Properly passing coin_type to account creation

The coin_type parameter is correctly passed to the validator account creation.


315-318: Enhanced account creation with flexible parameters

Updated method signature to accept **kwargs, allowing for more flexible parameter passing including coin_type.


319-322: Flexible parameters for ledger account creation

Similar to the regular account creation, this enhances flexibility for ledger accounts.


514-516: Updated multisig creation with flexible parameters

Consistent with other account creation methods, this now accepts additional parameters.


838-840: Added IBC denomination query capability

This method provides a convenient way to access IBC denomination information for a chain node.


907-917: Improved account creation with coin type support

Account creation now properly extracts and passes the coin-type parameter from the configuration.


1023-1026: Enhanced validator account creation with coin type support

Validator accounts are now created with the specified coin type from configuration.


1301-1303: Added debug server configuration

The configuration enables a debug server on port 5183 and specifies the listen address for debugging.

Copy link
Copy Markdown

@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

🧹 Nitpick comments (3)
CHANGELOG.md (2)

30-30: Fix grammar in changelog entry.

There's a subject-verb agreement issue in the PR crypto-com#145 description.

-Backward compatible with binary that don't have event-query-tx-for.
+Backward compatible with binary that doesn't have event-query-tx-for.
🧰 Tools
🪛 LanguageTool

[grammar] ~30-~30: There seems to be a noun/verb agreement error. Did you mean “doesn't” or “didn't”?
Context: ...5) Backward compatible with binary that don't have event-query-tx-for. - [crypto-com#147](https...

(SINGULAR_NOUN_AGREEMENT_WHO_DONT)


31-31: Fix typo in changelog entry.

There's a minor typo in the PR crypto-com#147 description.

-suppport query exposed by the external community pool.
+support query exposed by the external community pool.
pystarport/cluster.py (1)

1253-1258: Simplify conditional logic.

This code can be simplified using a ternary operator.

-# for multiple chains, there can be multiple cmds splited by `,`
-if cmd is not None:
-    cmds = cmd.split(",")
-else:
-    cmds = [None] * len(chains)
+# for multiple chains, there can be multiple cmds split by `,`
+cmds = cmd.split(",") if cmd is not None else [None] * len(chains)
🧰 Tools
🪛 Ruff (0.8.2)

1254-1257: Use ternary operator cmds = cmd.split(",") if cmd is not None else [None] * len(chains) instead of if-else-block

Replace if-else-block with cmds = cmd.split(",") if cmd is not None else [None] * len(chains)

(SIM108)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 1f29855 and 165e8b5.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • pystarport/cluster.py (10 hunks)
  • pystarport/cosmoscli.py (31 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
pystarport/cluster.py (2)
pystarport/cosmoscli.py (6)
  • create_account (133-157)
  • create_account_ledger (159-187)
  • distribution_community (298-319)
  • make_multisig (595-605)
  • ibc_denom (1487-1498)
  • account (346-351)
pystarport/cli.py (1)
  • cli (174-181)
🪛 LanguageTool
CHANGELOG.md

[grammar] ~30-~30: There seems to be a noun/verb agreement error. Did you mean “doesn't” or “didn't”?
Context: ...5) Backward compatible with binary that don't have event-query-tx-for. - [crypto-com#147](https...

(SINGULAR_NOUN_AGREEMENT_WHO_DONT)

🪛 Ruff (0.8.2)
pystarport/cluster.py

1254-1257: Use ternary operator cmds = cmd.split(",") if cmd is not None else [None] * len(chains) instead of if-else-block

Replace if-else-block with cmds = cmd.split(",") if cmd is not None else [None] * len(chains)

(SIM108)

🔇 Additional comments (12)
pystarport/cosmoscli.py (6)

71-79: Properly handle event query feature detection.

This new method is well implemented and follows the existing pattern for feature detection. Good approach to ensure backward compatibility with binaries that don't support this feature.


113-113: Good feature detection implementation.

Setting this flag in the constructor allows conditional execution throughout the codebase, ensuring backward compatibility.


133-156: Great flexibility improvement with kwargs.

Adding **kwargs to these methods improves flexibility and extendability, allowing additional parameters to be passed through to the underlying CLI commands.

Also applies to: 159-173, 595-605


298-319: Robust implementation for community pool queries.

This enhancement properly handles queries to both the "distribution" and "protocolpool" modules with appropriate error handling. The approach to gracefully fall back if a specific error is encountered is well done.


416-422: Consistent conditional event query checks.

These conditional checks properly guard against calling the event query feature when it's not available, ensuring backward compatibility with older binaries.

Also applies to: 457-463, 518-519, 540-541, 571-572, 591-592, 734-736, 784-785, 834-835, 874-875, 968-969, 991-992, 1068-1069, 1106-1107, 1165-1166, 1202-1203, 1234-1235, 1264-1265, 1337-1338, 1397-1398, 1452-1454, 1470-1471


1487-1498: New IBC denomination query method.

The ibc_denom method complements the existing ibc_denom_trace method and expands the functionality for IBC-related queries.

pystarport/cluster.py (6)

189-189: Support for coin type in account creation.

Adding coin_type parameter to node creation and validator account setup allows for greater flexibility when working with different chains and wallet types.

Also applies to: 261-261


315-317: Consistent API enhancement with kwargs support.

These methods now properly forward additional keyword arguments to the underlying CLI commands, providing a consistent interface with the cosmoscli module.

Also applies to: 319-321, 372-373, 514-515


838-840: Exposed IBC denomination functionality.

Adding the ibc_denom method exposes the new functionality from the CosmosCLI class to the cluster level.


907-917: Account creation with coin type support.

The code now properly extracts and uses the coin type parameter when creating accounts, which enables better support for different blockchain networks.

Also applies to: 1023-1026


1252-1263: Good support for multiple chain commands.

The ability to specify different commands for different chains is a nice feature, allowing more flexible configurations when dealing with multi-chain setups.

🧰 Tools
🪛 Ruff (0.8.2)

1254-1257: Use ternary operator cmds = cmd.split(",") if cmd is not None else [None] * len(chains) instead of if-else-block

Replace if-else-block with cmds = cmd.split(",") if cmd is not None else [None] * len(chains)

(SIM108)


1301-1302: Added debug server configuration.

New debug server settings enhance the troubleshooting capabilities for the relayer configuration.

Bumps [setuptools](https://github.com/pypa/setuptools) from 70.0.0 to 78.1.1.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](pypa/setuptools@v70.0.0...v78.1.1)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-version: 78.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@mmsqe mmsqe merged commit 595d7d2 into MANTRA-Chain:main Oct 9, 2025
1 check passed
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.

2 participants