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

feat: implement query methods for unreceived packets and acks #226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Farhad-Shabani
Copy link
Member

Closes: #219

Description

This PR introduces two new methods, unreceived_packet_sequences and unreceived_ack_sequences to the IChannelQuery interface. These methods filter pending packets based on a provided list of sequences.

If an empty array of sequences is passed, the methods throw an error. This behavior differs from the typical implementation in Cosmos chains, where passing an empty array would return all unreceived packets. The decision to deviate from this convention is intentional. Otherwise it requires the Cairo contract to maintain and update a list of received commitment and acknowledgment keys (computed from paths using Poseidon hashing), where the size of list only can be up to the 255 elements. This also would necessitate to deal with deletion upon packet processing completion, adding significant on-chain costs. Thus, for each packet, this would involve:

  • Computing the storage key based on the IBC path string.
  • Iterating through the list of keys to remove the record upon completion.

For these, providing query endpoints that return comprehensive lists of packet commitments and acknowledgments isn't efficient as well. Similarly, for the send packet endpoint, our internal discussions concluded that maintaining such data on-chain would unnecessarily bloat Cairo storage. Plus, implementing a robust on-chain query language would also be burdensome.

Instead, Starknet nodes offer a get_events endpoint with adequate filtering options. Leveraging get_events should be a more efficient for obtaining a list of packet commitments or acknowledgments when relayers need them.

@Farhad-Shabani Farhad-Shabani marked this pull request as ready for review January 22, 2025 17:00
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.

Implement Cairo query endpoints to support packet clearing
1 participant