feat(core): implement priority#489
Conversation
|
@claude review this pr |
|
Claude finished @iamquang95's task in 4m 59s —— View job Review:
|
|
@claude review this pr |
|
Claude finished @iamquang95's task in 4m 59s —— View job Review:
|
Fix #177
Summary
Ports Charon's
core/priorityprotocol to Rust as new cratecrates/priority, plus a small vendored fork of libp2pmultistream-selectso Pluto can negotiate Charon's slash-less protocol idcharon/priority/2.0.0and interop with unmodified Charon nodes.The protocol resolves a deterministic, cluster-wide priority result per duty: peers exchange signed
PriorityMsgs, every node computes the same result, and it's committed via QBFT. Output must be bit-for-bit identical to Charon Go — that drives the review risk below. ~7k insertions (~3.6k crate, ~3.4k vendored fork).Breakdown
src/calculate.rscalculate.gosrc/component.rscomponent.gosrc/prioritiser.rsprioritiser.gosrc/consensus.rs,src/error.rssrc/p2p/*p2p/sender.go,receive.gotests/*prioritiser_test.gothird_party/multistream-select/[patch.crates-io]; only delta = relax leading-/(3// PLUTO PATCH:edits inprotocol.rs)Supporting (mechanical):
qbft/msg.rs+p2p/utils.rsmade some fnspub;deadline/calculator.rsaddsimpl ... for Arc<T>;Cargo.tomlmember + patch.Suggested review order
PATCHES.md+Cargo.tomlpatch + the 3protocol.rsedits — the interop hack, riskiest non-obvious piece (rest of fork is upstream-identical).calculate.rsvscalculate.go— read closely, must match Go exactly.component.rs(signing/Any) →prioritiser.rs(engine) →consensus.rs/error.rs→p2p/*→ tests.Intentional deviations (not bugs)
RECEIVE_TIMEOUT5s inhandle_request(Go has none);DuplicateInstanceguard (Go tolerates concurrent per-duty);peer_idderived from privkey; typed errors; in-processMemoryTransportin e2e test, slash-less negotiation proven separately over TCP.Minor:
PATCHES.md"no other files differ" misses a behaviour-neutral test removal inlength_delimited.rs:486.