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(e2e): added timeout tests and switch to seconds in timestamps #17

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Aug 5, 2024

No description provided.

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.

The changes mostly look reasonable to me. I just left two comments with what I believe to be the implications. Let me know if you agree with that or not :) If we are OK with those, I think we can just merge this.

uint64 nanoTimestamp = uint64(block.timestamp * 1_000_000_000);
if (msg_.packet.timeoutTimestamp <= nanoTimestamp) {
revert IBCInvalidTimeoutTimestamp(msg_.packet.timeoutTimestamp, nanoTimestamp);
if (msg_.packet.timeoutTimestamp <= block.timestamp) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The implications of this, combined with the packetCommitment creation that changes from seconds to nanoseconds, as far as I can tell are:

  • The packet from the other chain will need to use seconds
  • The packet commitment from the other chain will need to also commit to nanoseconds

Copy link
Member Author

Choose a reason for hiding this comment

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

The packet commitment from the other chain is ibc-go, so it already uses nanoseconds.

We do not impose any requirements on the packet being submitted to the counterparty chain. We only require that packets submitted to this chain by the relayer use seconds.

Copy link
Contributor

@gjermundgaraba gjermundgaraba Aug 5, 2024

Choose a reason for hiding this comment

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

Ok, I see. All packet and light clients need to be nanoseconds on ibc-go and all packets and light clients need to be second in the evm implementation. And the relayers just need to translate the timestamps, is that correct?

uint64 nanoTimestamp = uint64(block.timestamp * 1_000_000_000);
if (msg_.timeoutTimestamp <= nanoTimestamp) {
revert IBCInvalidTimeoutTimestamp(msg_.timeoutTimestamp, nanoTimestamp);
if (msg_.timeoutTimestamp <= block.timestamp) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The implications for sending packets like this would only be that the light client needs to use seconds (since that is what it will check against for a timeout). That seems both reasonable and easy to reason about.

Copy link
Member Author

Choose a reason for hiding this comment

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

sp1 light client is already using seconds for timestamps

@srdtrk srdtrk merged commit 1993aed into main Aug 5, 2024
7 checks passed
@srdtrk srdtrk deleted the serdar/xxx-e2e-timeout branch August 5, 2024 16:03
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