Skip to content

feat: multi-threaded verify#60

Closed
spiral-ladder wants to merge 5 commits intomainfrom
bing/mt-verify
Closed

feat: multi-threaded verify#60
spiral-ladder wants to merge 5 commits intomainfrom
bing/mt-verify

Conversation

@spiral-ladder
Copy link
Copy Markdown
Contributor

make verification of multiple aggregate signatures multithreaded above a certain number of elements.

@spiral-ladder spiral-ladder self-assigned this Mar 3, 2026
Copy link
Copy Markdown

@nazarhussain nazarhussain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initiating main thread work, before spawning workers enforces that main thread work is finished before child threads started, defeats parallelism.

Comment thread src/fast_verify.zig Outdated
Comment on lines +128 to +133
// Main thread does worker 0's work
workerFn(&contexts[0]);
for (0..n_workers - 1) |t| {
threads[t] = std.Thread.spawn(.{}, workerFn, .{&contexts[t + 1]}) catch return BlstError.VerifyFail;
spawned += 1;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Main thread does worker 0's work
workerFn(&contexts[0]);
for (0..n_workers - 1) |t| {
threads[t] = std.Thread.spawn(.{}, workerFn, .{&contexts[t + 1]}) catch return BlstError.VerifyFail;
spawned += 1;
}
for (0..n_workers - 1) |t| {
threads[t] = std.Thread.spawn(.{}, workerFn, .{&contexts[t + 1]}) catch return BlstError.VerifyFail;
spawned += 1;
}
// Main thread does worker 0's work in parallel with spawned threads
workerFn(&contexts[0]);

@spiral-ladder spiral-ladder mentioned this pull request Mar 5, 2026
@spiral-ladder
Copy link
Copy Markdown
Contributor Author

closing this in favour of ChainSafe/lodestar-z#231

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