-
Notifications
You must be signed in to change notification settings - Fork 240
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
Problem: ibc channel upgrade related methods are not supported #1612
Conversation
WalkthroughThe changes introduce new functionality to support Inter-Blockchain Communication (IBC) channel upgrades across various modules and integration tests. Key updates include the addition of methods for upgrading IBC channels, modifications to existing functions for enhanced flexibility, and improvements in test cases to accommodate these new features. The updates are reflected in the changelog and involve changes to several files, enhancing the overall capability to manage IBC operations. Changes
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1612 +/- ##
==========================================
- Coverage 36.97% 36.88% -0.10%
==========================================
Files 102 102
Lines 8035 8055 +20
==========================================
Hits 2971 2971
- Misses 4686 4706 +20
Partials 378 378
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Outside diff range and nitpick comments (6)
integration_tests/ibc_utils.py (1)
Line range hint
776-785
: Approved: Good update toregister_acc
function.The changes to the
register_acc
function are well-implemented:
- The function now returns
port_id
along withica_address
andchannel_id
, which provides more comprehensive information about the registered account.- The
port_id
is correctly obtained from theassert_channel_open_init
function.These changes align with the AI-generated summary and improve the function's utility.
Consider updating the function's docstring (if it exists) to reflect the new return value. If there's no docstring, it would be beneficial to add one:
def register_acc(cli, connid, ordering=ChannelOrder.ORDERED.value, signer="signer2"): """ Register an interchain account. :param cli: The client object :param connid: The connection ID :param ordering: The channel ordering (default: ORDERED) :param signer: The signer (default: "signer2") :return: A tuple containing (ica_address, port_id, channel_id) """ # ... rest of the function ...CHANGELOG.md (1)
Line range hint
1-1185
: Well-structured and comprehensive changelog.The CHANGELOG.md file provides a detailed history of changes for the Cronos project. It's well-organized, with clear version numbering and release dates. Each version includes categorized changes (e.g., State Machine Breaking, Bug Fixes, Improvements, Features), making it easy for users and developers to understand the evolution of the project.
Some suggestions for improvement:
- Consider adding links to relevant pull requests or issues for each change, which would allow readers to dive deeper into specific changes if needed.
- Maintain consistency in formatting across all versions (some older entries have slightly different formatting).
- Consider summarizing major changes or themes for each version at the top of its section, especially for releases with many changes.
Overall, this changelog serves as an excellent record of the project's development and will be valuable for users upgrading between versions.
integration_tests/test_ibc.py (1)
91-91
: Add error handling for file operationsConsider adding error handling around the proposal file writing to catch potential exceptions, which can improve test robustness.
You might use a try-except block:
try: proposal.write_text(json.dumps(proposal_src)) except Exception as e: pytest.fail(f"Failed to write proposal file: {e}")x/cronos/middleware/conversion_middleware.go (1)
268-268
: Typo in comment: Extra space in 'implements'There's a typo in the comment; the word "implements" has an extra space between "implement" and "s."
Apply this diff to correct the typo:
-// OnChanUpgradeTry implement s the IBCModule interface +// OnChanUpgradeTry implements the IBCModule interfaceintegration_tests/cosmoscli.py (2)
1241-1261
: Consider adding a docstring to theibc_upgrade_channels
methodAdding a docstring would improve understandability by explaining the method's purpose, parameters, and return value.
Apply this diff to add a docstring:
def ibc_upgrade_channels(self, version, from_addr, **kwargs): + """ + Upgrade IBC channels to a new version. + + :param version: The new version information for the IBC channels. + :param from_addr: The address initiating the upgrade. + :param kwargs: Additional arguments for the transaction. + :return: JSON response of the upgrade transaction. + """ kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
1452-1468
: Consider adding a docstring to theibc_query_channel
methodIncluding a docstring would enhance code readability by providing documentation on the method's purpose and usage.
Apply this diff to add a docstring:
def ibc_query_channel(self, port_id, channel_id, **kwargs): + """ + Query the status of an IBC channel given the port ID and channel ID. + + :param port_id: The port identifier. + :param channel_id: The channel identifier. + :param kwargs: Additional arguments for the query. + :return: JSON response of the channel status. + """ default_kwargs = {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (7)
- CHANGELOG.md (1 hunks)
- integration_tests/cosmoscli.py (4 hunks)
- integration_tests/ibc_utils.py (4 hunks)
- integration_tests/test_ibc.py (3 hunks)
- integration_tests/test_ica.py (4 hunks)
- integration_tests/test_ica_incentivized.py (1 hunks)
- x/cronos/middleware/conversion_middleware.go (2 hunks)
🔇 Additional comments (14)
integration_tests/ibc_utils.py (1)
Line range hint
804-813
: LGTM:assert_channel_open_init
function updated correctly.The changes to the
assert_channel_open_init
function are appropriate and consistent with the modifications in theregister_acc
function:
- The function now correctly returns both
port_id
andchannel_id
.- The extraction of these values from the event attributes is implemented correctly.
This update ensures that the necessary information is available for the IBC channel initialization process.
CHANGELOG.md (2)
11-11
: LGTM: Clear and concise bug fix description.The bug fix for the inconsistent state during upgrade migration interruption is well-documented and important for maintaining system integrity during upgrades.
12-12
: LGTM: Appropriate dependency update.Updating IAVL to v0.19.4 is a good practice to ensure the system is using the latest stable version of its dependencies.
integration_tests/test_ica.py (3)
43-43
: Addition oftmp_path
fixture to thetest_ica
functionThe inclusion of the
tmp_path
fixture in thetest_ica
function is appropriate. It allows for the creation of temporary files needed during the test execution.
150-150
: Verify the correctness of the channel state'STATE_FLUSHCOMPLETE'
Ensure that
'STATE_FLUSHCOMPLETE'
is the correct state name when checking the channel status. An incorrect state name could cause thewait_for_check_channel_ready
function to fail.
122-124
: Reopening ICA account after channel closureReopening the Interchain Account after the channel closure correctly results in the same
ica_address
and a newchannel_id
. This behavior aligns with expected ICA functionality.integration_tests/test_ibc.py (5)
1-2
: Added import ofjson
moduleThe
json
module is correctly imported to handle JSON serialization needed for proposal file operations.
Line range hint
5-17
: Included necessary imports for upgraded channel logicThe additional imports of
module_address
,register_fee_payee
,wait_for_check_channel_ready
, andapprove_proposal
are appropriate and support the new functionality in the test.Also applies to: 22-22
67-67
: Updated test function signature to includetmp_path
fixtureThe
tmp_path
fixture is properly added to thetest_ibc_incentivized_transfer
function to handle temporary file creation for the proposal JSON.
68-99
: Implemented channel upgrade logic for incentivized transfersThe code correctly adds logic to upgrade to an incentivized IBC channel when
ibc.incentivized
isFalse
. This includes:
- Constructing the proposal with the appropriate parameters.
- Writing the proposal to a temporary JSON file.
- Submitting and approving the proposal.
- Waiting for the channel to reach the desired state.
- Registering the fee payee.
99-99
: Registered fee payee after channel upgradeThe call to
register_fee_payee
ensures that fee distribution is properly set up following the channel upgrade.integration_tests/cosmoscli.py (3)
17-17
: Import statements updated appropriatelyThe import of
CRONOS_ADDRESS_PREFIX
andget_sync_info
is necessary and correctly implemented.
37-44
: Enhancement ofmodule_address
function for custom prefixesThe addition of the
prefix
parameter with a default valueCRONOS_ADDRESS_PREFIX
to themodule_address
function increases its flexibility without affecting existing functionality.
1241-1261
: Addition ofibc_upgrade_channels
methodThe new
ibc_upgrade_channels
method provides functionality to upgrade IBC channels, aligning with the PR objectives to support IBC channel upgrade methods.
1226cce
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)
Summary by CodeRabbit
New Features
Bug Fixes
Tests