-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) | ||
|
There was a problem hiding this comment.
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} { |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
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, | ||
}, |
There was a problem hiding this comment.
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.
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. |
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
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