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

chore: update send packet api #3573

Closed
wants to merge 49 commits into from

Conversation

charleenfei
Copy link
Contributor

Description

this pr updates the SendPacket API to use the new Timeout struct

closes: #3551


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@damiannolan damiannolan mentioned this pull request May 15, 2023
9 tasks
Comment on lines 137 to 168
// NewTimeout creates a new Timeout instance.
func NewTimeout(height clienttypes.Height, timestamp uint64) Timeout {
return Timeout{
Height: height,
Timestamp: timestamp,
}
}

// AfterHeight returns true if Timeout height is greater than the provided height.
func (t Timeout) AfterHeight(height clienttypes.Height) bool {
return t.Height.GT(height)
}

// AfterTimestamp returns true is Timeout timestamp is greater than the provided timestamp.
func (t Timeout) AfterTimestamp(timestamp uint64) bool {
return t.Timestamp > timestamp
}

// IsValid validates the Timeout. It ensures that either height or timestamp is set.
func (t Timeout) IsValid() bool {
return !t.ZeroHeight() || !t.ZeroTimestamp()
}

// ZeroHeight returns true if Timeout height is zero, otherwise false.
func (t Timeout) ZeroHeight() bool {
return t.Height.IsZero()
}

// ZeroTimestamp returns true if Timeout timestamp is zero, otherwise false.
func (t Timeout) ZeroTimestamp() bool {
return t.Timestamp == 0
}
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to add a timeout.go file maybe, as Timeout will be used for both packets and upgrades

@@ -431,7 +431,8 @@ func (endpoint *Endpoint) SendPacket(
channelCap := endpoint.Chain.GetChannelCapability(endpoint.ChannelConfig.PortID, endpoint.ChannelID)
Copy link
Contributor

@DimitrisJim DimitrisJim May 15, 2023

Choose a reason for hiding this comment

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

Adding here now so I don't forget about it: there's also SendPacket in endpoint.go which might need to be updated to match SendPacket in packet.go.

@charleenfei
Copy link
Contributor Author

closing in favour of #3732

@charleenfei charleenfei closed this Jun 6, 2023
@charleenfei charleenfei deleted the charly/update_send_packet_api branch December 18, 2023 13:38
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.

3 participants