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

LO2302 support timeout #158

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

dai1975
Copy link
Contributor

@dai1975 dai1975 commented Mar 17, 2025

No description provided.

@dai1975 dai1975 requested review from siburu and Copilot March 17, 2025 10:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for packet timeout functionality as part of LO2302. The key changes include introducing a new SortUnrelayedPackets function in the naive strategy, updating the RelayService logic to use the sorted relay packets, and adding tests to validate timeout behavior.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
core/naive-strategy.go Added SortUnrelayedPackets method with logic to mark timeout packets and adjust packet routing based on channel order.
core/service.go Updated RelayService to use the sorted relay packets for further processing.
chains/tendermint/query.go Introduced QueryNextSequenceReceive along with its underlying helper functions.
core/chain.go Added go:generate directive and QueryNextSequenceReceive to the Chain interface.
core/strategies.go Added SortUnrelayedPackets to the StrategyI interface.
core/types.go Added a new Sort field to the PacketInfo struct to support timeout sorting.
core/provers.go Updated type references to use the correct ibcexported package.
core/service_test.go Added and modified tests to validate the new timeout support in various scenarios.

Copy link
Contributor

@siburu siburu left a comment

Choose a reason for hiding this comment

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

@dai1975 I have put some comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this file is used only in testing, the file name should end with _test.go, for example mock_chain_test.go.

core/types.go Outdated
@@ -13,6 +13,7 @@ type PacketInfo struct {
chantypes.Packet
Acknowledgement []byte `json:"acknowledgement"`
EventHeight clienttypes.Height `json:"event_height"`
Sort string `json:"sort"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't TimedOut bool (for example) a more suitable definition?

@@ -199,6 +200,74 @@ func (st *NaiveStrategy) UnrelayedPackets(ctx context.Context, src, dst *Provabl
}, nil
}

func (st *NaiveStrategy) SortUnrelayedPackets(ctx context.Context, src, dst *ProvableChain, sh SyncHeaders, rp *RelayPackets) (*RelayPackets, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this process is not "sort", right?
For example ProcessTimeoutPackets is more straightforward.

Daisuke Kanda added 10 commits March 31, 2025 06:03
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
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