[consensus] codec migration (Attempt 2)#735
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request migrates several consensus components to use the new codec “types” and updates the generics by replacing the Array constraints with Digest where appropriate. Key changes include refactoring of the simplex resolver actor, removal of legacy proto-based modules (wire.proto, parsed, serializer, prover, namespace), and a renaming of committers to reporters in the ordered broadcast module and associated mocks and configuration.
Reviewed Changes
Copilot reviewed 72 out of 72 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| consensus/src/simplex/actors/resolver/actor.rs | Updated to use structured types, replaced deprecated namespace functions, and adjusted generic bounds (Array → Digest). |
| consensus/src/ordered_broadcast/* | Removed legacy proto definitions and related modules; updated usage to reference new types and shifted from Scheme to Verifier where applicable. |
| Various mocks and config files | Transition from using Committer to Reporter along with corresponding test updates. |
| consensus/src/ordered_broadcast/ack_manager.rs | Updated the ack aggregation to use the new signature field and adjusted generic parameter ordering. |
| consensus/build.rs & Cargo.toml | Removed build dependencies for the obsolete proto files and adjusted dependency declarations. |
Comments suppressed due to low confidence (3)
consensus/src/ordered_broadcast/ack_manager.rs:75
- The change from using 'ack.partial.index' to 'ack.signature.index' assumes that all Ack objects are constructed with a valid signature field. Please verify that all Ack producers have been updated accordingly to prevent potential mismatches.
if (!p.shares.insert(ack.signature.index)) {
consensus/src/ordered_broadcast/wire.proto:1
- The entire 'wire.proto' file has been removed. Please ensure that no lingering dependencies or build scripts rely on this file to avoid integration issues.
syntax = "proto3";
consensus/src/ordered_broadcast/mocks/reporter.rs:1
- [nitpick] With the migration from Committer to Reporter in mocks, please double-check that all tests cover the new Reporter flow and any behavioral differences that may impact consensus reporting.
use crate::{ordered_broadcast::types::{Activity, Chunk, Epoch, Lock, Proposal}, Reporter as Z};
| impl Debug for Scalar { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| write!(f, "{}", hex(&self.as_slice())) | ||
| } | ||
| } | ||
|
|
||
| impl Display for Scalar { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| write!(f, "{}", hex(&self.as_slice())) | ||
| } | ||
| } |
There was a problem hiding this comment.
To prevent writing these functions twice, should we have one be the primary (say Debug) and have Display call Debug::fmt(self, f)?
There was a problem hiding this comment.
This is a pattern I adapted from elsewhere in cryptography. Happy to migrate to a shared implementation but think we should do all at once.
BrendanChou
left a comment
There was a problem hiding this comment.
None of my comments are blocking, feel free to merge
|
Nits addressed here: #772 |
Replaces: #675
Resolves: #444
Replaces: #462
Related: #707
Resolves: #712
TODO
threshold-simplexsignoperations totypes: [consensus/threshold-simplex] Addsign()#742types(fromwire.proto): [consensus/types] Add comments #766simplex: [consensus] Migratesimplex#743types(fromwire.proto): [consensus/types] Add comments #766ordered-broadcast: [consensus] Migrateordered-broadcast#737verify/signercaller): [consensus] SimplifynamespaceUsage #761Encode both: [consensus] Useu32andu64asvarintvarintfor all number encoding #765Use: [utils] Review usage ofunion_uniqueunionvsunion_unique#759Add: [consensus/simplex + threshold-simplex] EmitProposalactivity tosimplexandthreshold-simplexProposalActivity (likeordered-broadcast) after Verification #767codecMigration Nits #772Use: [cryptography/bls12381] Review Whether We Should UseIteratorinstead ofIntoIteratorIteratorinstead ofIntoIterator#773