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

Add new entrypoint for IBCv2 Timeout #2435

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

vishalmaurya850
Copy link

@vishalmaurya850 vishalmaurya850 commented Mar 21, 2025

Fixes #2422

Add new entry point for IBCv2 Timeout in contracts/ibc2/src/contract.rs.

  • State Struct
    • Add ibc2_timeout_counter field to State struct.
  • QueryMsg Enum
    • Add QueryTimeoutCounter message to retrieve the timeout counter.
  • Query Function
    • Update query function to handle QueryTimeoutCounter message.
  • ibc2_timeout Function
    • Add ibc2_timeout entry point function to handle IBCv2 timeouts.
    • Increment ibc2_timeout_counter in State struct within ibc2_timeout.
  • Tests
    • Add test for ibc2_timeout entry point function.
    • Verify ibc2_timeout_counter increments correctly.
    • Add test for QueryTimeoutCounter message.

For more details, open the Copilot Workspace session.

Fixes CosmWasm#2422

Add new entry point for IBCv2 Timeout in `contracts/ibc2/src/contract.rs`.

* **State Struct**
  - Add `ibc2_timeout_counter` field to `State` struct.
* **QueryMsg Enum**
  - Add `QueryTimeoutCounter` message to retrieve the timeout counter.
* **Query Function**
  - Update `query` function to handle `QueryTimeoutCounter` message.
* **ibc2_timeout Function**
  - Add `ibc2_timeout` entry point function to handle IBCv2 timeouts.
  - Increment `ibc2_timeout_counter` in `State` struct within `ibc2_timeout`.
* **Tests**
  - Add test for `ibc2_timeout` entry point function.
  - Verify `ibc2_timeout_counter` increments correctly.
  - Add test for `QueryTimeoutCounter` message.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/CosmWasm/cosmwasm/issues/2422?shareId=XXXX-XXXX-XXXX-XXXX).
* Verify `ibc2_timeout_counter` increments correctly
* Add test for `QueryTimeoutCounter` message
* Add `do_ibc2_timeout` to imports in `contracts/ibc2/src/contract.rs`
* Add `Empty` to imports in `contracts/ibc2/tests/integration.rs`
* Increment `ibc2_timeout_counter` in `State` struct within `ibc2_timeout`
* Update `State` struct to include `ibc2_timeout_counter` field
* Add `QueryTimeoutCounter` message to retrieve the timeout counter
* Update `query` function to handle `QueryTimeoutCounter` message
* Import `do_ibc2_timeout` function from `cosmwasm_std`
* Add `ibc2_timeout` entry point function to handle IBCv2 timeouts in `contracts/ibc2/src/contract.rs`
* Add tests for `ibc2_timeout` entry point in `contracts/ibc2/tests/integration.rs`
  - Verify `ibc2_timeout_counter` increments correctly
* Add `QueryTimeoutCounter` message to retrieve timeout counter in `contracts/ibc2/schema/raw/query.json`
…ct.rs`

* Add `ibc2_timeout` entry point function to handle IBCv2 timeouts
* Update imports to include necessary dependencies for `ibc2_timeout` function
* Import `do_ibc2_timeout` function from `cosmwasm_std` to handle IBCv2 timeouts
* Replace `do_ibc2_timeout` with `ibc2_timeout` in the import list
* Update import list to include `ibc2_timeout` instead of `do_ibc2_timeout`
* Add `ibc2_timeout` entry point function to handle IBCv2 timeouts
* Increment `ibc2_timeout_counter` in the `State` struct
* Update `State` struct to include `ibc2_timeout_counter`
* Fix error in `from_json` function call
* Update import statements to include necessary dependencies
Copy link
Collaborator

@chipshort chipshort left a comment

Choose a reason for hiding this comment

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

Nice start, but you are missing the actual implementation of the entrypoint in the VM

pub fn ibc2_timeout(
deps: DepsMut,
_env: Env,
_msg: Ibc2PacketReceiveMsg,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs its own type.

Comment on lines +20 to +21
#[returns(u32)]
QueryTimeoutCounter {},
Copy link
Collaborator

Choose a reason for hiding this comment

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

There isn't really a need for this query, since the QueryState already contains the timeout counter.

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.

feat: Add new entrypoint for IBCv2 Timeout
2 participants