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

Refactor RoundTimingInfo, fix auctionCloseTicker #2841

Merged

Conversation

Tristan-Wilson
Copy link
Member

The logic for the calculations of "when does the next round start?", "what round is it?", "is the auction closed?", was spread throughout the code and required passing around multiple separate variables that all come from the RoundTimingInfo from the ExpressLaneAuction contract and should never change. This commit adds a domain specific RoundTimingInfo that validates these fields on construction and consolidates the aforementioned calculations.

This commit also contanis a fix for auctionCloseTicker, now roundTicker. It used to assume the initial Offset timestamp fetched from the ExpressLaneAuction contract would always start on a minute boundary, and the round length would be a minute which is not always the case. This commit changes it to be called roundTicker and it now uses standard methods on the new RoundTimingInfo which take into account all possibilities for initial offset and round duration.

Testing done

Unit tests pass.

Re-ran https://github.com/OffchainLabs/timeboost-test against local nitro testnode with offset set to 30s within the minute, it passes up until the end when it has run out of time in the round due to the test also assuming minute boundaries.

The logic for the calculations of "when does the next round start?", "what
round is it?", "is the auction closed?", was spread throughout the code
and required passing around multiple separate variables that all come
from the RoundTimingInfo from the ExpressLaneAuction contract and should
never change. This commit adds a domain specific RoundTimingInfo that
validates these fields on construction and consolidates the
aforementioned calculations.

This commit also contanis a fix for auctionCloseTicker, now roundTicker.
It used to assume the initial Offset timestamp fetched from the
ExpressLaneAuction contract would always start on a minute boundary, and
the round length would be a minute which is not always the case. This
commit changes it to be called roundTicker and it now uses standard
methods on the new RoundTimingInfo which take into account all
possibilities for initial offset and round duration.
@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Dec 18, 2024
@Tristan-Wilson
Copy link
Member Author

Merging into #2561 now so Ganesh and I can keep working against that branch.

@Tristan-Wilson Tristan-Wilson merged commit bbc703a into express-lane-timeboost Dec 18, 2024
5 of 10 checks passed
@Tristan-Wilson Tristan-Wilson deleted the express-lane-timeboost-refactor-fix-time branch December 18, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant