-
Notifications
You must be signed in to change notification settings - Fork 625
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(core/eureka): add packet handler #7048
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.
looks great! left some initial comments
channel := channeltypes.Channel{ | ||
Ordering: channeltypes.ORDERED, | ||
ConnectionHops: []string{sourceChannel}, | ||
} |
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.
I guess this is slightly nicer since it doesn't involve changing channel arg to pointer. Might be nice to move this into a sentinelChannel helper func that takes client id as arg to put in connection hops.
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.
Yes, tho I think we will want to eventually break the event function signature
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.
Also I did it this way, since once we add aliasing, sourceChannelID may not necessarily equal sourceClientID
} | ||
|
||
// check that the client of receiver chain is still active | ||
status := k.clientKeeper.GetClientStatus(ctx, sourceChannel) |
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.
if status := ...; status != exported.Active
as an alt since we don't use status
elsewhere.
|
||
// retrieve the sequence send for this channel | ||
// if no packets have been sent yet, initialize the sequence to 1. | ||
sequence, found := k.channelKeeper.GetNextSequenceSend(ctx, sourcePort, sourceChannel) |
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.
nice, basically handling chan handshake initialization here. No point in setting ones for ordered channels, I'd assume.
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.
we need SequenceSend in UNORDERED also. But we don't need SequenceRecv or SequenceAck so i don't initialize those here
_ *capabilitytypes.Capability, | ||
sourceChannel string, | ||
sourcePort string, | ||
destPort string, |
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.
destPort must be passed in but destChannel does not since we have it in the counterparty
channel := channeltypes.Channel{ | ||
Ordering: channeltypes.ORDERED, | ||
ConnectionHops: []string{sourceChannel}, | ||
} |
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.
Yes, tho I think we will want to eventually break the event function signature
channel := channeltypes.Channel{ | ||
Ordering: channeltypes.ORDERED, | ||
ConnectionHops: []string{sourceChannel}, | ||
} |
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.
Also I did it this way, since once we add aliasing, sourceChannelID may not necessarily equal sourceClientID
return 0, errorsmod.Wrap(timeout.ErrTimeoutElapsed(latestHeight, latestTimestamp), "invalid packet timeout") | ||
} | ||
|
||
commitment := channeltypes.CommitPacket(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.
This will commit with Eureka since PacketWithVersion always creates a Eureka 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.
lgtm! will defo do some reformatting of the test spacing on the side at some point 😅
// set the counterparties | ||
path.SetupCounterparties() | ||
}, nil}, | ||
{"counterparty not found", func() {}, channeltypes.ErrChannelNotFound}, |
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.
could set source channel to ibctesting.FirstChannelID
instead, this will also make it so that all SetupCounterparties
calls can be removed (and SetupV2
can be used)
latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, sourceChannel) | ||
if latestHeight.IsZero() { | ||
return 0, errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceChannel) | ||
} | ||
|
||
latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceChannel, latestHeight) | ||
if err != nil { | ||
return 0, err | ||
} |
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.
would be nice to get cov for these
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.
Hmm seems a bit hard given that I'd have to manually write a zero consensus height and remove the ones automatically created.
Let's leave off for now
Quality Gate passed for 'ibc-go'Issues Measures |
Description
closes: #6999
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.