osmosis-labs / osmosis

The AMM Laboratory
https://app.osmosis.zone
Apache License 2.0
892 stars 593 forks source link

feat: add callback module for scheduled execution of wasm contracts #8776

Closed rockstarRhino closed 3 weeks ago

rockstarRhino commented 1 month ago

Closes: #XXX

What is the purpose of the change

Add a description of the overall background and high level changes that this PR introduces

(E.g.: This pull request improves documentation of area A by adding ....

Testing and Verifying

(Please pick one of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

Documentation and Release Note

Where is the change documented?

coderabbitai[bot] commented 1 month ago

Walkthrough

The pull request introduces a significant enhancement to the callback functionality within the application. Key changes include the addition of a CallbackKeeper in the AppKeepers struct, updates to various methods for managing parameters and genesis states, and the introduction of new files for testing and defining Protocol Buffers messages related to callbacks. The modifications span several files, including keeper implementations, module registrations, and end-to-end testing utilities, establishing a comprehensive framework for callback operations.

Changes

File Path Change Summary
app/keepers/keepers.go Added CallbackKeeper to AppKeepers, updated InitNormalKeepers, initParamsKeeper, and KVStoreKeys methods.
app/keepers/modules.go Added import for callback module and registered callback.AppModuleBasic{} in AppModuleBasics.
app/modules.go Added imports for callback module, updated moduleAccountPermissions, appModules, and OrderInitGenesis functions.
cosmwasm/contracts/callback-test/.editorconfig Created new .editorconfig file for coding style guidelines.
cosmwasm/contracts/callback-test/.gitignore Added .gitignore file to specify ignored files and directories.
cosmwasm/contracts/callback-test/README.md Introduced sample contract for testing the x/callback module, detailing new message types.
cosmwasm/contracts/callback-test/src/bin/schema.rs Created schema.rs file to define API schema for the contract.
cosmwasm/contracts/callback-test/src/contract.rs Implemented smart contract for callback testing with various entry points.
cosmwasm/contracts/callback-test/src/error.rs Defined custom error type for the contract with various error conditions.
cosmwasm/contracts/callback-test/src/lib.rs Enhanced modular organization by adding multiple modules.
cosmwasm/contracts/callback-test/src/msg.rs Defined data structures and message types used in the contract.
cosmwasm/contracts/callback-test/src/state.rs Defined data structure for managing contract state.
proto/osmosis/callback/v1beta1/callback.proto Introduced Protocol Buffers message definitions for handling callbacks.
proto/osmosis/callback/v1beta1/errors.proto Defined error codes related to callback operations.
proto/osmosis/callback/v1beta1/events.proto Defined message types related to callback events.
proto/osmosis/callback/v1beta1/genesis.proto Introduced GenesisState message for the callback module.
proto/osmosis/callback/v1beta1/query.proto Defined query service for the callback module.
proto/osmosis/callback/v1beta1/tx.proto Outlined messaging service for handling callbacks.
tests/e2e/testing/chain.go Introduced a testing framework for simulating blockchain operations.
tests/e2e/testing/chain_ops.go Added function for executing governance proposals in testing environment.
tests/e2e/testing/chain_ops_contract.go Provided functions for interacting with smart contracts in testing context.
tests/e2e/testing/chain_ops_ibc.go Introduced methods for managing IBC operations in testing framework.
tests/e2e/testing/chain_options.go Defined configuration structure for setting up a test blockchain environment.
tests/e2e/testing/client.go Defined gRPC client structure for interacting with the Osmosis application.
tests/e2e/testing/common.go Introduced utility functions for end-to-end testing.
tests/e2e/testing/ibc_path.go Provided framework for testing IBC paths in a Cosmos SDK environment.
tests/e2e/testing/types.go Defined a new type for managing account data in the testing framework.
tests/e2e/testing/wasmd.go Introduced mock implementations for testing the x/wasmd module.
x/callback/abci.go Introduced functionality for managing and executing callbacks within the blockchain context.
x/callback/keeper/callback.go Defined Keeper struct for managing callback functionalities.
x/callback/keeper/keeper.go Introduced Keeper struct for managing state operations within the callback module.
x/callback/types/callback.go Defined functions for creating and validating callback instances.
x/callback/types/genesis.go Introduced functionality for managing the GenesisState object.
x/callback/types/params.go Defined constants and functions for managing callback parameters.
x/callback/types/sudo_msg.go Defined structures for handling callback messages in a contract context.
x/callback/utils/collcompat.go Introduced utilities for managing key-value stores.
x/callback/utils/utils.go Introduced utility functions for executing operations with a gas limit.

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
coderabbitai[bot] commented 1 month ago

Walkthrough

The changes in this pull request enhance the AppKeepers struct by integrating a new callback mechanism across multiple files. This includes updates to the keeper and module management files, the introduction of new smart contract testing files, and the definition of Protocol Buffers for callback functionalities. Additionally, a comprehensive end-to-end testing framework is established for the Osmosis application, focusing on various functionalities, including chain operations and contract interactions.

Changes

File Path Change Summary
app/keepers/keepers.go, app/keepers/modules.go, app/modules.go Enhanced AppKeepers struct with CallbackKeeper, modified initialization methods, and updated imports.
cosmwasm/contracts/callback-test/.editorconfig, cosmwasm/contracts/callback-test/.gitignore, cosmwasm/contracts/callback-test/README.md Added configuration and documentation files for testing the callback module.
cosmwasm/contracts/callback-test/src/bin/schema.rs, cosmwasm/contracts/callback-test/src/contract.rs, cosmwasm/contracts/callback-test/src/error.rs, cosmwasm/contracts/callback-test/src/lib.rs, cosmwasm/contracts/callback-test/src/msg.rs, cosmwasm/contracts/callback-test/src/state.rs Defined smart contract structure and functionality for testing the callback module.
proto/osmosis/callback/v1beta1/*.proto Defined message structures and services for handling callback functionalities.
tests/e2e/testing/*.go Introduced end-to-end testing framework for various functionalities, including chain and contract operations.
x/callback/*.go Implemented callback module functionality, including management of callbacks, CLI commands, and testing.

Possibly related PRs

Suggested labels

V:state/compatible/no_backport, A:no-changelog

Suggested reviewers


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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
coderabbitai[bot] commented 1 month ago

Walkthrough

This pull request introduces a new callback module into the application, affecting several components, including the core functionality, testing framework, and protocol buffer definitions. Key updates include the integration of a CallbackKeeper in the application structure, the creation of a smart contract for testing the module, and the definition of relevant Protocol Buffers for message handling. Additionally, a comprehensive testing framework for end-to-end blockchain functionalities is established, ensuring robust interaction with the new module.

Changes

File Path Summary of Changes
app/keepers/keepers.go, app/keepers/modules.go, app/modules.go Added CallbackKeeper to AppKeepers, initialized in InitNormalKeepers, and integrated callback module.
cosmwasm/contracts/callback-test/* Introduced a new smart contract for testing the callback module, including various supporting files and logic.
proto/osmosis/callback/v1beta1/* Defined Protocol Buffers for the callback module, including messages, services, and error handling.
tests/e2e/testing/* Established an end-to-end testing framework for the Osmosis application, focusing on blockchain functionalities.
x/callback/* Implemented core functionality of the callback module, including execution logic, CLI commands, and tests.

Possibly related PRs

Suggested labels

V:state/compatible/no_backport, A:no-changelog

Suggested reviewers


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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
PaddyMc commented 1 month ago

Nice, thanks for the PR, would love some more context added to the pull request, would you be able to add that?

PaddyMc commented 3 weeks ago

Closing this as we need to wait for a gov prop and forum post to discuss, looking for to discussing more! :smile: