-
-
Notifications
You must be signed in to change notification settings - Fork 411
feat: lazy load pending deposit using generator #7584
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
base: unstable
Are you sure you want to change the base?
Conversation
6724128 to
8eb6b38
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #7584 +/- ##
============================================
- Coverage 50.24% 50.22% -0.02%
============================================
Files 604 605 +1
Lines 40466 40485 +19
Branches 2229 2229
============================================
+ Hits 20331 20333 +2
- Misses 20093 20110 +17
Partials 42 42 🚀 New features to boost your workflow:
|
Performance Report✔️ no performance regression detected Full benchmark results
|
|
do we still want this? seems to me like we do, cc @twoeths |
Yes. Still relevant |
| export function* pendingDepositIterator( | ||
| state: BeaconStateElectra, | ||
| startIndex?: number, | ||
| chunkSize?: number | ||
| ): Generator<CompositeViewDU<DepositType>> { | ||
| for (const deposit of chunkedIterator(state.pendingDeposits, startIndex, chunkSize)) { | ||
| yield deposit as CompositeViewDU<DepositType>; | ||
| } | ||
| } |
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 exported function pendingDepositIterator would benefit from JSDoc documentation that describes its purpose, parameters, and return value. This would maintain consistency with the documentation standards in the codebase and make the API more accessible to other developers. Consider adding a comment similar to the one provided for the chunkedIterator function below it.
GitHub: Fixes #1234
/**
* Generator function that yields pending deposits from the beacon state
* @param state - The beacon state containing pending deposits
* @param startIndex - Optional starting index for iteration (default: 0)
* @param chunkSize - Optional number of items to retrieve per chunk (default: 100)
* @returns A generator that yields deposit objects
*/
export function* pendingDepositIterator(...)| export function* pendingDepositIterator( | |
| state: BeaconStateElectra, | |
| startIndex?: number, | |
| chunkSize?: number | |
| ): Generator<CompositeViewDU<DepositType>> { | |
| for (const deposit of chunkedIterator(state.pendingDeposits, startIndex, chunkSize)) { | |
| yield deposit as CompositeViewDU<DepositType>; | |
| } | |
| } | |
| /** | |
| * Generator function that yields pending deposits from the beacon state | |
| * @param state - The beacon state containing pending deposits | |
| * @param startIndex - Optional starting index for iteration (default: 0) | |
| * @param chunkSize - Optional number of items to retrieve per chunk (default: 100) | |
| * @returns A generator that yields deposit objects | |
| */ | |
| export function* pendingDepositIterator( | |
| state: BeaconStateElectra, | |
| startIndex?: number, | |
| chunkSize?: number | |
| ): Generator<CompositeViewDU<DepositType>> { | |
| for (const deposit of chunkedIterator(state.pendingDeposits, startIndex, chunkSize)) { | |
| yield deposit as CompositeViewDU<DepositType>; | |
| } | |
| } | |
Spotted by Diamond (based on custom rules)
Is this helpful? React 👍 or 👎 to let us know.
Note: This PR has a dependency on ssz v1.2.0. Staying as draft for now