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: support timeout handling in chain provider #57

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

Conversation

fragwuerdig
Copy link

This PR will introduce timeout handling capabilities to the ethereum chain provider for yui-relayer.

Note: this is a preparation step to update dependencies in backward compatible manner. The timeout handling feature for yui-relayer is currently under development at Vector Smart Chain. There are further dependency upgrades.

Changes Include

  • Allow and Support Timeout Handling Messages on the IBC Handler
  • In the query for unrelayed packets forward packets only if they have an active packet commitment on the IBCHandler

The latter step is required for supporting timeout handling in the future. Currently the to-be-relayed packets are filtered by querying the sent packets event from the IBC Handler and then compare the result against the list of unreceived sequences on the counterparty chain. However, the solidity IBC Handler will acknowledge a MsgTimeout only by deleting it's active packet commitment - which does NOT change the event list of sent packets (because it's historic).

By filtering out packets that have a deleted packet commitment we can identify packets for which the MsgTimeout has been applied.

Thank you for your review and continued support.

Best,
Till

@fragwuerdig fragwuerdig changed the title Frag/timeouts feat: support timeout handling in chain provider Oct 16, 2024
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.

@fragwuerdig Thank you for your contribution!
This PR is welcome, I have left some comments, but they are all nitpicky. However, for supporting packet timeout, the core (yui-relayer) needs to be fixed first before the chain module. Therefore I can't merge this PR immediately. I also saw your modification to yui-relayer, but it can't be simply merged since some parts of it have dependencies on VSC. Do you intend to separate the parts from the remainder in the next step? We plan to support packet timeout. You can also wait for and use our work.

}

activePackets = append(activePackets, packet)

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove trailing blank lines from both functions and blocks.

return packets, err
}

if res == [32]byte{0} {
Copy link
Contributor

Choose a reason for hiding this comment

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

[32]byte{0} and [32]byte{0,0} and [32]byte{0,0,0} and ... are all equivalent, but [32]byte{} is the simplest within this family.


for _, packet := range packets {
commitmentPath := host.PacketCommitmentPath(packet.SourcePort, packet.SourceChannel, packet.Sequence)
commitmentKey := crypto.Keccak256([]byte(commitmentPath))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can directly obtain an array value by using crypto.Keccak256Hash.
Also, you can use host.PacketCommitmentKey to remove a type casting.

Comment on lines +361 to +370
Packet: ibchandler.Packet{
Sequence: msg.Packet.Sequence,
SourcePort: msg.Packet.SourcePort,
SourceChannel: msg.Packet.SourceChannel,
DestinationPort: msg.Packet.DestinationPort,
DestinationChannel: msg.Packet.DestinationChannel,
Data: msg.Packet.Data,
TimeoutHeight: ibchandler.HeightData(msg.Packet.TimeoutHeight),
TimeoutTimestamp: msg.Packet.TimeoutTimestamp,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Please define and use pbToPacket in pkg/relay/ethereum/types.go.

@fragwuerdig
Copy link
Author

@fragwuerdig Thank you for your contribution! This PR is welcome, I have left some comments, but they are all nitpicky. However, for supporting packet timeout, the core (yui-relayer) needs to be fixed first before the chain module. Therefore I can't merge this PR immediately. I also saw your modification to yui-relayer, but it can't be simply merged since some parts of it have dependencies on VSC. Do you intend to separate the parts from the remainder in the next step? We plan to support packet timeout. You can also wait for and use our work.

Thanks for your reply. I absolutely see where you are coming from. For VSC we needed a forked version of yui-relayer. However, as soon as I am ready with our local setup I will clean it up and provide another PR.

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