Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Improve BLS performance: cache parsed keys, add batch verification, add benchmarks

Đang mở
#635 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust

Hướng nghiên cứu

Bắt đầu với crates/crypto/src/blst_impl.rs và lần theo các đường dẫn xác minh qua crates/eth2util/src/signing.rs, dkg/src/aggregate.rs và cluster/src/lock.rs. Sử dụng crates/k1util/benches làm mẫu benchmark và xem xét crates/frost/src/curve.rs để tìm các wrapper hiện có. Công việc được coi là hoàn tất khi caching được đề xuất, xác minh theo lô, tổng hợp an toàn, scalar-hoisting và các benchmark của criterion đã được triển khai và có thể đo lường.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement rust

Summary

All BLS operations take raw byte arrays (types.rs#L17-L21), so every call re-deserializes (verify does a G1 decompression per call) and re-runs subgroup checks — verify passes pk_validate = true and sig_groupcheck = true on every invocation. For a DV node the public shares are cluster-constant; nothing is memoized.

There is also no batch verification: blst's verify_multiple_aggregate_signatures is unused, and the hot paths verify one signature at a time — every incoming peer partial signature (parsigex → verify_eth2_signed_data → signing.rs#L148), a nested validators×partials loop in dkg/src/aggregate.rs#L146, and one builder registration per validator in cluster/src/lock.rs#L427.

Additionally, aggregate_public_keys hand-rolls point addition through unsafe FFI and skips per-key subgroup validation — blst's safe AggregatePublicKey::aggregate(..., validate) covers it. A second independent blst wrapper with safe constructors already exists in pluto-frost (crates/frost/src/curve.rs); the ad-hoc scalar helpers in blst_impl.rs duplicate it.

There are no benchmarks: the only criterion setup in the workspace is crates/k1util/benches, while Charon benchmarks its BLS backend (tbls_test.go BenchmarkHerumiImplementation).

Proposed change

  • Introduce parsed key/signature types (wrapping blst types) validated once at construction; keep raw bytes only at serialization boundaries.
  • Add a batch-verification entry point and use it on the partial-signature paths.
  • Replace the unsafe aggregation with the blst safe API; consolidate scalar helpers with pluto-frost's wrappers.
  • Hoist the O(n²) scalar_from_u64 recomputation out of the interpolation loops — evaluate_polynomial rebuilds the same scalar every iteration and compute_lagrange_coefficients reconstructs per-index scalars inside the inner loop; build them once per index.
  • Add criterion benches (sign/verify/aggregate/threshold_aggregate) using the k1util bench as a template, so wins are measurable.
Ngôn ngữ chính
Rust
Star
8
Fork
5
Merge trung bình
4 ngày 18 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NethermindEth/pluto

Tất cả issue của NethermindEth/pluto

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.