Skip to content

refactor(bls): allocations around VMAS - #395

Merged
spiral-ladder merged 3 commits into
mainfrom
bing/cap-alloc-msg-copy
Jun 10, 2026
Merged

refactor(bls): allocations around VMAS#395
spiral-ladder merged 3 commits into
mainfrom
bing/cap-alloc-msg-copy

Conversation

@spiral-ladder

Copy link
Copy Markdown
Member

rework allocations around verifyMultipleAggregateSignatures.

  • we're batching on average about ~30 signature sets per batch on our highest load fleet (according to metrics), so a cap of about 32 makes sense for stack allocations. Anything beyond that, use heap allocations.
  • avoid copies for msgs which was unnecessary

This is based on 2 things:

1) On lodestar (the consumer) we [batch by a minimum of
   16](https://github.com/ChainSafe/lodestar/blob/8d5a6a4fc1d2c362902db875758df19c7970cf93/packages/beacon-node/src/chain/bls/multithread/worker.ts#L8-L15)
2) Metrics suggest that the sas fleet sees about ~30 signature sets as
   the average size.

So we use stack allocations for any sets of size 32 and below, and use
heap allocations otherwise.
@spiral-ladder spiral-ladder self-assigned this Jun 9, 2026
@spiral-ladder
spiral-ladder requested a review from a team as a code owner June 9, 2026 14:13
@spiral-ladder
spiral-ladder merged commit dfda58c into main Jun 10, 2026
30 checks passed
markolazic01 pushed a commit to markolazic01/lodestar-z that referenced this pull request Jun 17, 2026
rework allocations around `verifyMultipleAggregateSignatures`.

- we're batching on average about ~30 signature sets per batch on our
highest load fleet (according to metrics), so a cap of about 32 makes
sense for stack allocations. Anything beyond that, use heap allocations.
- avoid copies for `msgs` which was unnecessary
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants