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

Compare Timeout timestamps in seconds instead of nanoseconds #7857

Merged
merged 4 commits into from
Jan 20, 2025

Conversation

AdityaSripal
Copy link
Member

Description

closes: #7512


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 the 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/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@AdityaSripal AdityaSripal changed the base branch from main to feat/ibc-eureka January 20, 2025 12:52
@AdityaSripal AdityaSripal marked this pull request as ready for review January 20, 2025 12:52
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Great! 🙌 LGTM!

@@ -53,15 +54,17 @@ func (k *Keeper) sendPacket(
return 0, "", errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceClient)
}

// client timestamps are in nanoseconds while packet timeouts are in seconds
// thus to compare them, we convert the client timestamp to seconds in uint64
// to be consistent with IBC V2 specified timeout behaviour
latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceClient, latestHeight)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would be slightly easier to read the code below if this was called latestTimestampNano (and would avoid accidental usage later)

// check that timeout timestamp has passed on the other end
// client timestamps are in nanoseconds while packet timeouts are in seconds
// so we convert client timestamp to seconds in uint64 to be consistent
// with IBC V2 timeout behaviour
proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packet.SourceClient, proofHeight)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link

Quality Gate Failed Quality Gate failed for 'ibc-go'

Failed conditions
1 Security Hotspot
67.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Looks great. LGTM!

@gjermundgaraba gjermundgaraba enabled auto-merge (squash) January 20, 2025 16:28
@gjermundgaraba gjermundgaraba merged commit 3fefb28 into feat/ibc-eureka Jan 20, 2025
63 checks passed
@gjermundgaraba gjermundgaraba deleted the aditya/timeout-to-secs branch January 20, 2025 18:48
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.

Consider converting proof timestamps to secs and floor (ignore nanos)
2 participants