-
Notifications
You must be signed in to change notification settings - Fork 246
feat: use DA timestamp #2939
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: use DA timestamp #2939
Conversation
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @tac0turtle's task in 3m 14s —— View job Code Review CompleteI've completed a comprehensive review of this PR. The implementation successfully addresses issue #2936 by replacing 1. Code Quality & Architecture✅ Strengths
|
Summary of ChangesHello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Data Availability (DA) client by integrating with the DA layer's header module to retrieve accurate and deterministic block timestamps. Previously, DA operations like blob retrieval relied on the local system's Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces the use of block header timestamps to ensure deterministic responses, which is a great improvement. The changes are well-implemented across the DA client and JSON-RPC layers, including adding a new header API client and associated mocks and tests. The fallback logic in getBlockTimestamp to use time.Now() is robust. I have one suggestion to improve the robustness of the new getBlockTimestamp function by adding a timeout to the API call.
block/internal/da/client.go
Outdated
| return time.Now() | ||
| } | ||
|
|
||
| header, err := c.headerAPI.GetByHeight(ctx, height) |
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.
The call to c.headerAPI.GetByHeight uses the original context ctx directly. This could lead to long waits if the header API is unresponsive and the parent context doesn't have a timeout. It's a good practice to use a timeout for this network call, similar to how c.blobAPI.GetAll is called with a timeout in the Retrieve function. Consider creating a new context with c.defaultTimeout for this call to prevent potential hangs.
headerCtx, cancel := context.WithTimeout(ctx, c.defaultTimeout)
defer cancel()
header, err := c.headerAPI.GetByHeight(headerCtx, height)
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2939 +/- ##
==========================================
- Coverage 60.14% 59.23% -0.91%
==========================================
Files 88 90 +2
Lines 8427 8575 +148
==========================================
+ Hits 5068 5079 +11
- Misses 2787 2920 +133
- Partials 572 576 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
julienrbrt
left a comment
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! The fallback to time.Now() isn't great however and you may fail on the next correct fetch with a quite undescriptive error.
julienrbrt
left a comment
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.
utACK
Closes: #2936
Summary
time.Now()for deterministic blob retrieval responsesChanges
HeaderAPIto the DA client for fetching block timestamps from the DA layertime.Now()with header-derived timestamps inRetrieveresponses for determinismgetBlockTimestamphelper with proper timeout handlingjsonrpc.Clientto connect to bothblobandheadernamespacesHeaderModuleinterface and mock for testing