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

Problem: no plan for testnet to update default max_callback_gas param #1252

Merged
merged 11 commits into from
Dec 7, 2023

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Dec 6, 2023

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features

    • Introduced a new upgrade plan v1.1.0-testnet to enhance system performance.
    • Deployed new contract interaction capabilities for improved functionality.
    • Implemented a new method for legacy governance proposal submissions.
  • Bug Fixes

    • Adjusted the max_callback_gas parameter to optimize resource usage.
    • Refined transaction sending and message submission processes for better reliability.
  • Documentation

    • Updated configuration files to reflect new system parameters and package versions.
  • Refactor

    • Enhanced error handling and control flow in various integration test functions.
    • Streamlined proposal submission and approval processes in testing utilities.
  • Tests

    • Modified test assertions to align with the new max_callback_gas parameter value.
    • Refined test setups for more accurate testing scenarios.

Copy link
Contributor

coderabbitai bot commented Dec 6, 2023

Walkthrough

The changes involve a new testnet plan v1.1.0-testnet which adjusts the max_callback_gas parameter, affecting gas consumption and resource allocation. Upgrade handlers have been updated to accommodate this change, including a function to enlarge the block gas limit. Python integration tests reflect these updates, with new functions and modified assertions to align with the new gas limit. Configuration files and Nix expressions have been updated, and test logic has been refined across various files.

Changes

File(s) Summary
CHANGELOG.md Added new plan v1.1.0-testnet updating max_callback_gas.
app/upgrades.go Added upgrade handler for "v1.1.0-testnet" and enlargeBlockGasLimit function.
integration_tests/.../test_ica.py, .../cosmoscli.py Added deploy_contract, check_for_ack functions; modified send_tx, submit_msgs, gov_propose_legacy.
integration_tests/.../test_upgrade.py, .../test_upgrade_testnet.py Updated max_callback_gas assertion value from "300000" to "50000".
x/cronos/types/params.go Changed MaxCallbackGasDefaultValue from 300000 to 50000.
integration_tests/configs/.../*.jsonnet Modified app_state sections, removed gov section, changed max gas limit.
integration_tests/configs/.../*.nix Updated package paths and fetching logic, added new package versions.
integration_tests/.../test_broadcast.py, .../test_gov_update_params.py Removed argument from function call and line related to data preparation.
integration_tests/upgrade_utils.py, .../utils.py Added init_cosmovisor, post_init functions; modified gov_vote.

🐇✨
In the code's burrow, deep and vast,
A rabbit hopped, changes cast.
Gas limits grow and shrink in play,
As the testnet finds its way. 🌟🚀


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: mmsqe <[email protected]>
app/upgrades.go Fixed Show fixed Hide fixed
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Merging #1252 (b71000d) into main (abc3297) will decrease coverage by 0.04%.
The diff coverage is 8.33%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1252      +/-   ##
==========================================
- Coverage   35.79%   35.75%   -0.04%     
==========================================
  Files         116      116              
  Lines       10651    10663      +12     
==========================================
+ Hits         3812     3813       +1     
- Misses       6464     6474      +10     
- Partials      375      376       +1     
Files Coverage Δ
x/cronos/types/params.go 68.91% <ø> (ø)
app/upgrades.go 42.15% <8.33%> (-4.51%) ⬇️

@yihuang yihuang marked this pull request as ready for review December 6, 2023 08:15
@yihuang yihuang requested a review from a team as a code owner December 6, 2023 08:15
@yihuang yihuang requested review from calvinaco and devashishdxt and removed request for a team December 6, 2023 08:15
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between abc3297 and 36f74a2.
Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • app/upgrades.go (1 hunks)
  • integration_tests/test_ica.py (4 hunks)
  • integration_tests/test_upgrade.py (1 hunks)
  • x/cronos/types/params.go (1 hunks)
Additional comments: 9
CHANGELOG.md (1)
  • 20-20: The addition of the new plan v1.1.0-testnet to update the default max_callback_gas parameter is correctly documented in the CHANGELOG.md and aligns with the PR objectives and the AI-generated summaries.
app/upgrades.go (3)
  • 121-133: The addition of the v1.1.0-testnet upgrade handler correctly implements the new plan to update the max_callback_gas parameter as per the PR objective.

  • 135-137: The code for reading upgrade information from disk and handling errors is correctly implemented and will panic if it fails to read the information, which is a standard approach for critical startup operations.

  • 117-118: The change to enlarge the block gas limit is not mentioned in the PR objective or the AI-generated summaries. Ensure this change is intentional and documented appropriately.

integration_tests/test_ica.py (3)
  • 36-81: The addition of deploy_contract and check_for_ack functions, and modifications to send_tx are consistent with the summary provided. These changes introduce new functionality and modify existing behavior to accommodate the updated max_callback_gas parameter.

  • 98-104: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [100-125]

The submit_msgs function has been modified to include a timeout_in_s parameter and a timeout variable to handle timeouts, which is not mentioned in the summary. This change is significant as it introduces new behavior for handling transaction timeouts.

  • 123-128: The logic for reopening the ICA account after the channel gets closed is present in the code but not mentioned in the summary. This is an important aspect of the test that ensures the ICA account can be re-established after a channel closure.
integration_tests/test_upgrade.py (1)
  • 180-182: The assertion for max_callback_gas has been correctly updated to "50000" to reflect the new expected value as per the PR objectives and summary. However, there is an additional assertion for min_timeout_duration being "3600s" which is not mentioned in the summary. Please ensure that this change is intentional and documented if necessary.
x/cronos/types/params.go (1)
  • 28-28: The change in MaxCallbackGasDefaultValue from 300000 to 50000 aligns with the PR objectives to update the max_callback_gas parameter on the testnet.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 36f74a2 and 9711214.
Files selected for processing (5)
  • app/upgrades.go (2 hunks)
  • integration_tests/configs/cosmovisor.jsonnet (1 hunks)
  • integration_tests/configs/upgrade-test-package.nix (1 hunks)
  • integration_tests/cosmoscli.py (7 hunks)
  • integration_tests/test_upgrade.py (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/upgrades.go
  • integration_tests/test_upgrade.py
Additional comments: 8
integration_tests/configs/cosmovisor.jsonnet (1)
  • 12-23: The summary states that the params field was removed from bank, but the hunk shows that send_enabled has been added or modified within bank. This is an inconsistency that should be clarified.
integration_tests/configs/upgrade-test-package.nix (1)
  • 10-16: The updates to the Nix expression file correctly reflect the new version and commit hash for the v1.1.0-testnet upgrade plan as described in the PR objectives and AI-generated summaries.
integration_tests/cosmoscli.py (6)
  • 715-728: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [670-741]

The refactoring of the gov_propose_legacy method to include error handling based on the response code is a good practice, as it allows for more granular control over the function's output and error management.

  • 715-728: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [670-741]

The refactoring of the gov_propose_legacy method to include error handling based on the response code is a good practice, as it allows for more granular control over the function's output and error management.

  • 736-748: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [743-760]

The gov_vote method has been updated to include error handling similar to the gov_propose_legacy method. This consistency in error handling across methods is beneficial for maintainability and reliability of the code.

  • 736-748: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [743-760]

The gov_vote method has been updated to include error handling similar to the gov_propose_legacy method. This consistency in error handling across methods is beneficial for maintainability and reliability of the code.

  • 1147-1153: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1148-1164]

The submit_gov_proposal method has been updated to include error handling based on the response code. This change aligns with the updates made to the gov_propose_legacy and gov_vote methods, ensuring a consistent approach to error handling across the class.

  • 1147-1153: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1148-1164]

The submit_gov_proposal method has been updated to include error handling based on the response code. This change aligns with the updates made to the gov_propose_legacy and gov_vote methods, ensuring a consistent approach to error handling across the class.

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9711214 and 41ef44c.
Files selected for processing (10)
  • app/upgrades.go (1 hunks)
  • integration_tests/configs/cosmovisor.jsonnet (1 hunks)
  • integration_tests/configs/cosmovisor_testnet.jsonnet (1 hunks)
  • integration_tests/configs/default.jsonnet (1 hunks)
  • integration_tests/configs/upgrade-test-package.nix (1 hunks)
  • integration_tests/configs/upgrade-testnet-test-package.nix (1 hunks)
  • integration_tests/cosmoscli.py (7 hunks)
  • integration_tests/test_upgrade.py (1 hunks)
  • integration_tests/test_upgrade_testnet.py (1 hunks)
  • integration_tests/utils.py (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • app/upgrades.go
  • integration_tests/configs/cosmovisor.jsonnet
  • integration_tests/configs/upgrade-test-package.nix
  • integration_tests/test_upgrade.py
Additional comments: 11
integration_tests/configs/cosmovisor_testnet.jsonnet (1)
  • 1-33: The changes to the cosmovisor_testnet.jsonnet file reflect updates to the bank and feemarket sections within the app_state of the genesis configuration, as mentioned in the summary. However, the summary also mentions the removal of the gov section within app_state, adjustments to the maximum gas limit for block validation, and updates to package paths and version references, which are not visible in the provided hunk. Please verify if these changes are part of other hunks or files.
integration_tests/configs/default.jsonnet (2)
  • 64-69: The change in the max_gas parameter from 81,500,000 to 60,000,000 is correctly implemented in the hunk. This adjustment will affect the block validation process and should be communicated to the network participants.

  • 64-70: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-70]

No further issues or changes are detected in the provided hunk and surrounding context.

integration_tests/cosmoscli.py (4)
  • 716-729: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [670-742]

The refactoring of the gov_propose_legacy method to handle different proposal types and conditionally process the response is a significant improvement in error handling and control flow. This change should make the method more robust and easier to maintain.

  • 737-749: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [744-761]

The update to the gov_vote method to check the response code before querying the transaction event is a good practice for robust error handling.

  • 1148-1154: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1149-1165]

The addition of default keyword arguments for gas prices and gas adjustment in the submit_gov_proposal method is a good practice for providing sensible defaults.

  • 1160-1168: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1167-1174]

The update to the update_token_mapping method to check the response code before querying the transaction event is a good practice for robust error handling.

integration_tests/test_upgrade_testnet.py (3)
  • 77-197: The test_cosmovisor_upgrade function appears to be well-structured and follows the described upgrade testing process. It includes proposing an upgrade, stopping and starting services, waiting for blocks, deploying contracts, and checking various parameters post-upgrade. Ensure that the upgrade process is thoroughly tested and that all assertions accurately reflect the expected state of the system after the upgrade.

  • 25-53: The init_cosmovisor and post_init functions are utility functions that set up the cosmovisor directory structure and prepare cosmovisor for each node, respectively. They seem to be correctly implemented and serve their purpose without any apparent issues.

  • 56-74: The custom_cronos fixture is responsible for setting up a custom Cronos test environment, which includes building the upgrade package and initializing with the genesis binary. It seems to be correctly implemented and serves its purpose without any apparent issues.

integration_tests/utils.py (1)
  • 145-151: The addition of the event_query_tx parameter to the gov_vote method call within the approve_proposal function is a significant change that alters the control flow. Ensure that all calls to gov_vote are updated accordingly if this is a required change across the codebase.

integration_tests/configs/upgrade-testnet-test-package.nix Outdated Show resolved Hide resolved
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9711214 and 42ae371.
Files selected for processing (10)
  • app/upgrades.go (1 hunks)
  • integration_tests/configs/cosmovisor.jsonnet (1 hunks)
  • integration_tests/configs/cosmovisor_testnet.jsonnet (1 hunks)
  • integration_tests/configs/default.jsonnet (1 hunks)
  • integration_tests/configs/upgrade-testnet-test-package.nix (1 hunks)
  • integration_tests/cosmoscli.py (7 hunks)
  • integration_tests/test_upgrade.py (3 hunks)
  • integration_tests/test_upgrade_testnet.py (1 hunks)
  • integration_tests/upgrade_utils.py (1 hunks)
  • integration_tests/utils.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • integration_tests/configs/default.jsonnet
Files skipped from review as they are similar to previous changes (8)
  • app/upgrades.go
  • integration_tests/configs/cosmovisor.jsonnet
  • integration_tests/configs/cosmovisor_testnet.jsonnet
  • integration_tests/configs/upgrade-testnet-test-package.nix
  • integration_tests/cosmoscli.py
  • integration_tests/test_upgrade.py
  • integration_tests/test_upgrade_testnet.py
  • integration_tests/utils.py
Additional comments: 2
integration_tests/upgrade_utils.py (2)
  • 8-15: The init_cosmovisor function correctly sets up the cosmovisor directory structure.

  • 18-35: Verify that the hardcoded chain_id is consistent with the rest of the codebase and that the config.json file structure matches the expected format.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 42ae371 and 2d9befa.
Files selected for processing (3)
  • integration_tests/test_upgrade.py (2 hunks)
  • integration_tests/test_upgrade_testnet.py (1 hunks)
  • integration_tests/upgrade_utils.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • integration_tests/test_upgrade.py
Additional comments: 7
integration_tests/test_upgrade_testnet.py (2)
  • 10-28: The fixture custom_cronos is correctly set up to build the test environment using Nix and to initialize the testnet with a genesis binary. Ensure that the paths and configurations specified are consistent with the new testnet setup.

  • 31-32: The test_cosmovisor_upgrade function appears to be correctly structured to test the upgrade process. Ensure that the exec function is properly implemented to handle the upgrade logic as intended.

integration_tests/upgrade_utils.py (5)
  • 1-189: The summary mentions changes to MaxCallbackGasDefaultValue and the addition of an enlargeBlockGasLimit function, but these changes are not visible in the provided hunks. Please ensure that all relevant changes are included in the review to verify their correctness and impact.

  • 23-30: The init_cosmovisor function correctly sets up the cosmovisor directory structure as described in the summary.

  • 1-189: The summary indicates updates to configuration files, but these changes are not visible in the provided hunks. Please ensure that all relevant changes are included in the review to verify their correctness and impact.

  • 1-189: The summary describes significant changes to the gov_propose_legacy method in the integration_tests/cosmoscli.py file, but this file is not included in the provided hunks. Please ensure that all relevant changes are included in the review to verify their correctness and impact.

  • 54-189: The exec function has been modified to handle the upgrade process, including proposing an upgrade, waiting for it to happen, and verifying the upgrade's success. Ensure that the logic within this function is robust and correctly implements the upgrade process as intended by the PR objectives.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7a8bb6f and b71000d.
Files selected for processing (5)
  • integration_tests/cosmoscli.py (8 hunks)
  • integration_tests/test_broadcast.py (1 hunks)
  • integration_tests/test_gov_update_params.py (1 hunks)
  • integration_tests/test_upgrade.py (7 hunks)
  • integration_tests/utils.py (3 hunks)
Files skipped from review due to trivial changes (1)
  • integration_tests/test_broadcast.py
Files skipped from review as they are similar to previous changes (2)
  • integration_tests/test_gov_update_params.py
  • integration_tests/test_upgrade.py
Additional comments: 8
integration_tests/cosmoscli.py (5)
  • 716-729: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [670-742]

The changes to the gov_propose_legacy method introduce new branches for handling different proposal types. Ensure that the logic for each branch correctly processes the proposal based on its kind and that the rsp variable is correctly used to capture the response from the self.raw calls.

  • 737-749: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [744-761]

The gov_vote method now includes additional logic to check the response code and query the transaction event if the response code is 0. Verify that this new logic is intended and correctly implemented.

  • 1124-1130: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1124-1150]

The gov_propose_update_client_legacy method has been updated to include default gas prices and amounts. Verify that these defaults are appropriate for the expected transactions and that the logic for handling the response is correct.

  • 1145-1157: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1152-1168]

The submit_gov_proposal method has been updated to include default gas prices and amounts. Verify that these defaults are appropriate for the expected transactions and that the logic for handling the response is correct.

  • 1170-1171: The update_token_mapping method has been updated to include default gas prices and amounts. Verify that these defaults are appropriate for the expected transactions and that the logic for handling the response is correct.
integration_tests/utils.py (3)
  • 136-136: The summary states that the approve_proposal function's event_query_tx parameter default value was changed from True to False, but the provided hunk shows that the parameter's default value was already False. This indicates a discrepancy between the summary and the actual code.

  • 652-652: The summary indicates that the submit_any_proposal function had the event_query_tx parameter removed from its signature, but the provided hunk does not show the function signature or its call to approve_proposal, so we cannot verify this change. We would need to see the previous version of the function to confirm this change.

  • 649-649: The function module_address is shown in the hunk, but there is no context provided in the summary about any changes to this function. Without additional context or a previous version of the code, it's unclear if any changes were made here.

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