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

getCommitteeAssignment performance issue #2690

Closed
dapplion opened this issue Jun 13, 2021 · 0 comments · Fixed by #2698
Closed

getCommitteeAssignment performance issue #2690

dapplion opened this issue Jun 13, 2021 · 0 comments · Fixed by #2698
Assignees
Labels
scope-performance Performance issue and ideas to improve performance.

Comments

@dapplion
Copy link
Contributor

Describe the bug

getCommitteeAssignment() will loop through the entire shuffled index list (worst case) for every validator connected to the beacon node.

const epochStartSlot = computeStartSlotAtEpoch(epoch);
for (let slot = epochStartSlot; slot < epochStartSlot + SLOTS_PER_EPOCH; slot++) {
const committeeCount = this.getCommitteeCountAtSlot(slot);
for (let i = 0; i < committeeCount; i++) {
const committee = this.getBeaconCommittee(slot, i);
if (committee.includes(validatorIndex)) {
return {
validators: committee as List<number>,
committeeIndex: i,
slot,

Expected behavior

Find a more efficient approach

@dapplion dapplion added the scope-performance Performance issue and ideas to improve performance. label Jun 13, 2021
@3xtr4t3rr3str14l 3xtr4t3rr3str14l self-assigned this Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope-performance Performance issue and ideas to improve performance.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants