Rewrite `core/qbft` to async-Rust-friendly API
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
- 25/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- rust
- Lĩnh vực
- distributed-systems
Hướng nghiên cứu
Bắt đầu với crates/core/src/qbft/mod.rs và internal_test.rs của nó, sau đó so sánh với bản tham chiếu Go và strategysim_internal_test.go. Chạy các test QBFT hiện có trước khi thay đổi mô hình đồng thời. Công việc được xem là hoàn tất khi có API công khai bất đồng bộ, các test bất đồng bộ tương đương bao gồm tính tương đương với strategysim, clippy và định dạng sạch, cùng với các mục công khai được ghi tài liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
The current Rust port of core/qbft (crates/core/src/qbft/mod.rs) is a faithful translation of the Go reference but built on synchronous, thread-based primitives:
crossbeam::channelfor transportstd::thread::scopefor spawning per-process workers- A blocking
pub fn run(...)entry point cancellation::CancellationToken(third-party crate, nottokio_util)
This is at odds with the rest of Pluto, which is tokio-async end to end. Every consumer that will eventually wire QBFT in (core/consensus, core/scheduler, the duty pipeline) is async. The current shape forces either (a) bridging via spawn_blocking and ad-hoc channel adapters, or (b) blocking inside async tasks — both bad.
Closes the gap left by #13, which produced the initial sync port.
Goal
Rewrite core/qbft with an async-Rust-native API that integrates cleanly with the rest of the workspace and preserves the Byzantine-safety guarantees of the Go reference.
Scope
API
runbecomespub async fn run(...) -> Result<Decision, QbftError>Transporttrait methods returnimpl Future<Output = Result<...>> + Send(or areasync fnvia trait async)- Cancellation uses
tokio_util::sync::CancellationToken(already used elsewhere in Pluto) - Channels:
tokio::sync::mpsc(andoneshotwhere appropriate) - No
std::thread, nocrossbeam, nostd::sync::mpscanywhere in the public or internal API
Internals
- Replace
thread::scopewithtokio::spawn+JoinSet(orselect!for per-instance loops) - Replace blocking sleeps/timers with
tokio::time::sleep/Interval - Clock abstraction (
fake_clock.rs) becomes async-aware so deterministic tests still work — likely usingtokio::time::pause()+advance()rather than the current fake clock - Keep the algorithm shape (rounds, justifications, message bookkeeping) bit-for-bit identical to the Go reference — only the concurrency primitives change
Safety net (mandatory)
- Port
charon/core/consensus/qbft/strategysim_internal_test.go(~1040 LOC) as the parity gate. This is the test that catches BFT correctness regressions; without it we cannot trust the rewrite. - All current
crates/core/src/qbft/internal_test.rscases pass (or are replaced by equivalent async versions)
Acceptance criteria
- Public API is fully async; no
pub fn runblocking entry point remains - No
crossbeam,std::thread, or third-partycancellationcrate usage incrates/core/src/qbft/ - All existing QBFT unit tests pass (rewritten as async where needed)
- Strategysim parity test ported from Go and green
-
cargo clippy --workspace --all-targets --all-features -- -D warningsclean -
cargo +nightly fmt --all --checkclean - Public API documented;
missing_docswarning re-enabled for the module
References
- Go source: https://github.com/ObolNetwork/charon/blob/main/core/qbft/qbft.go
- Go strategysim test: https://github.com/ObolNetwork/charon/blob/main/core/consensus/qbft/strategysim_internal_test.go
- Current Rust port:
crates/core/src/qbft/mod.rs(1305 LOC) - Predecessor issue: #13 (closed — produced the initial sync port)
Notes
This is on the critical path for the duty-flow pipeline. core/consensus (#157) and downstream modules (core/scheduler #176, etc.) will consume the new async API directly, so this should land before consensus framework integration begins.
- Ngôn ngữ chính
- Rust
- Star
- 8
- Fork
- 5
- Merge trung bình
- 3 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NethermindEth/pluto
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
NethermindEth/pluto#719 ·
-
enhancement rust
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
NethermindEth/pluto#640 ·
-
rust
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
NethermindEth/pluto#638 · 1 bình luận ·
-
enhancement rust
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
NethermindEth/pluto#635 ·
-
Improve `alpha test peers`: match Charon's probes; reduce timeoutsCó thể đã có người làm @varex83agent đã nhận 29 ngày trước. Đang mởbug track:orchestration-cli
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
NethermindEth/pluto#632 ·
Tất cả issue của NethermindEth/pluto
Issue tương tự
-
spurctld: a user with no usage gets a lower fair-share factor than a user with a little usageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ci kind:bug priority:p3 ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
srikanth235/centraid#1155 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dotfiles: failed batch untrack removes earlier tracking declarationsCó thể đã có người làm @jdx đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày