feat: add computePtcIndices and computePtcIndicesForEpoch - #24
Open
guha-rahul wants to merge 8 commits into
Open
guha-rahul wants to merge 8 commits into
guha-rahul wants to merge 8 commits into
Conversation
Reverts the following commits (in reverse order): - 496bb40 chore: add prebuilt linux-x64-gnu binary - 64bd5ed chore: rebuild darwin-arm64 binary with computePtcIndicesForEpoch - 2648085 chore: allow .node binary in npm pack for compute_ptc branch - 1c430b9 feat: add prebuilt darwin-arm64 binary for compute_ptc
This was referenced Apr 16, 2026
This was referenced Aug 13, 2026
nazarhussain
added a commit
to ChainSafe/lodestar-z
that referenced
this pull request
Aug 27, 2026
## Summary Adds payload timeliness committee (PTC) sampling to the Zig `swap_or_not_shuffle` module and its JS binding, so ChainSafe/lodestar#9263 can stop computing it in JS. - Ports `compute_ptc_indices` and `compute_ptc_indices_for_epoch`, whose original implementation is ChainSafe/swap-or-not-shuffle#24 (`453b639b`). - Exposes a per-slot entry point and a whole-epoch one that derives each slot's seed and returns the committees concatenated. - Returns explicit errors for degenerate inputs that the reference package would crash or hang on. - Runs the epoch variant sequentially where the Rust uses rayon; still roughly 287x the naive JS path Lodestar uses today. ## Testing - Added Zig vectors generated from the naive Lodestar sampler, plus epoch/per-slot consistency and error-path coverage. - Added JS tests comparing the binding against the naive sampler at full PTC size for one slot and across a full epoch. - Added per-slot and per-epoch benches alongside the existing shuffle ones. ## Follow-ups - The epoch variant can be parallelised if its sequential cost ever matters. AI assistance was used for drafting and implementation support. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: bing <spiralladder@fastmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
ChainSafe/lodestar#9013
Description
This pr implements
compute_ptc_indiceswhich will be used incomputePayloadTimelinessCommitteesForSlotin lodestar andcompute_ptc_indices_for_epochwhich will be used incomputePayloadTimelinessCommitteesForEpoch.Current benchmark