Improve BLS performance: cache parsed keys, add batch verification, add benchmarks
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- rust
调研方向
从 crates/crypto/src/blst_impl.rs 开始,沿着 crates/eth2util/src/signing.rs、dkg/src/aggregate.rs 和 cluster/src/lock.rs 中的验证路径进行追踪。使用 crates/k1util/benches 作为基准测试模板,并检查 crates/frost/src/curve.rs 中现有的包装器。完成的标准是:实现所提议的缓存、批量验证、安全聚合、scalar-hoisting 和 criterion 基准测试,并且能够对其进行测量。
由索引模型根据 Issue 内容生成。
描述
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
blsttypes) 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_u64recomputation out of the interpolation loops —evaluate_polynomialrebuilds the same scalar every iteration andcompute_lagrange_coefficientsreconstructs 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.
- 主要语言
- Rust
- 星标
- 8
- 派生
- 5
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NethermindEth/pluto 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 69/100
NethermindEth/pluto#722 ·
-
难度 4/5 3-5 天 新手友好度 52/100
NethermindEth/pluto#719 ·
-
enhancement rust
难度 4/5 3-5 天 新手友好度 45/100
NethermindEth/pluto#640 ·
-
rust
难度 5/5 一周以上 新手友好度 45/100
NethermindEth/pluto#638 · 1 条评论 ·
-
Improve `alpha test peers`: match Charon's probes; reduce timeouts可能已有人在做 @varex83agent 于 37 天前认领。 未关闭bug track:orchestration-cli
难度 5/5 一周以上 新手友好度 28/100
NethermindEth/pluto#632 ·
查看 NethermindEth/pluto 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
pop-os/cosmic-applets#1619 ·
维护者通常 3 天内回复
-
binding:python bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
coollabsio/orbit#72 ·
维护者通常 1 天内回复
-
swc_common: Mark::least_ancestor never returns when the answer is the root mark (ANT-2026-JYDQGGRT)未关闭
难度 2/5 1-3 小时 新手友好度 72/100
swc-project/swc-ai-issues#137 ·
-
Synth suite fails unless run from the repo root: signal_flow's default machine path is cwd-relative未关闭bug
难度 2/5 1-3 小时 新手友好度 80/100
Nimblesite/osprey#370 ·
维护者通常 1 天内回复