refactor(cache): skip empty data in pending data#3046
Conversation
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @julienrbrt's task in 2m 47s —— View job Code Review CompleteI've completed a comprehensive review of this PR. The changes correctly address the issue where Todo List:
SummaryThe PR successfully implements automatic advancement past empty data blocks in the Critical Issues1. Context Handling in
|
Summary of ChangesHello @julienrbrt, 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 refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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.
Code Review
This pull request refactors the PendingData and PendingHeaders caches to correctly account for and skip empty data blocks when calculating the number of pending items. This addresses an issue where NumPendingData() was returning an inflated value due to counting empty blocks that would not be submitted to the Data Availability (DA) layer. The changes include introducing an advancePastEmptyData method in PendingData and updating test cases to reflect this new behavior, including comprehensive tests for various empty data scenarios. Additionally, redundant init() methods were removed, and a minor correction from require.Empty to require.Nil was made in a test assertion for better precision.
| } | ||
|
|
||
| func (pd *PendingData) NumPendingData() uint64 { | ||
| pd.advancePastEmptyData(context.Background()) |
There was a problem hiding this comment.
The advancePastEmptyData function is called with context.Background(). While NumPendingData itself doesn't accept a context, advancePastEmptyData performs store operations that could potentially be long-running or require cancellation. Using context.Background() means these operations are not cancellable and will run indefinitely if the underlying store operations hang. Consider if NumPendingData should accept a context, or if a context with a timeout/cancellation should be derived for advancePastEmptyData to ensure responsiveness in scenarios where NumPendingData might be called in a cancellable loop.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3046 +/- ##
==========================================
+ Coverage 56.17% 56.19% +0.02%
==========================================
Files 118 118
Lines 12066 12075 +9
==========================================
+ Hits 6778 6786 +8
+ Misses 4543 4542 -1
- Partials 745 747 +2
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:
|
Overview
NumPendingData()is giving a right but out of proportion value because empty data isn't submitted to DA, this led to a lagging submitted value and a way too high missing submission counts.Discovered thanks to #3038.