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

Optimizing IBC Transaction Searches: Implementing a Unique Event Attribute for Enhanced Relayer Performance #7285

Open
4 tasks
beer-1 opened this issue Sep 11, 2024 · 0 comments
Labels
04-channel needs discussion Issues that need discussion before they can be worked on type: improvement User-facing improvements of an existing feature

Comments

@beer-1
Copy link

beer-1 commented Sep 11, 2024

Summary

Adding a new event attribute for packet send, receive, acknowledgment, and timeout events can address performance issues in relayers.

Problem Definition

As described here, there are many cases where we need to search the IBC transaction body.

CometBFT's current txSearch implementation attempts to load all transactions that match each condition and then find their intersection. This approach causes millions of transactions to be loaded into memory, forcing CometBFT to iterate through these millions of transactions to find the intersection.

Use cases

Currently, all stateless IBC Relayers use transaction or block searches to retrieve the transaction body from the event in order to clear stalled packets.

Proposal

We propose introducing a new event attribute as follows:

sdk.NewAttribute(types.AttributeKeyId, sha3.Sum256(
	append([]byte(packet.GetSourcePort()), 
	append([]byte(packet.GetSourceChannel()), 
	append([]byte(packet.GetDestPort()), 
	append([]byte(packet.GetDestChannel(), 
	[]byte(fmt.Sprintf("%d", packet.GetSequence()))...)...)...)...))),

Then we can search IBC tx body with unique tx search key.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
  • Estimate provided
@beer-1 beer-1 changed the title feat: adding IBC event to easily search the tx with single event attribute. feat: adding IBC event to easily search the tx with unique event attribute. Sep 11, 2024
@beer-1 beer-1 changed the title feat: adding IBC event to easily search the tx with unique event attribute. Optimizing IBC Transaction Searches: Implementing a Unique Event Attribute for Enhanced Relayer Performance Sep 11, 2024
@crodriguezvega crodriguezvega added needs discussion Issues that need discussion before they can be worked on 04-channel type: improvement User-facing improvements of an existing feature labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
04-channel needs discussion Issues that need discussion before they can be worked on type: improvement User-facing improvements of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants