Skip to content

Commit d213412

Browse files
[consensus/ordered-broadcast] Add External Sequencer Test + Improve Coverage on Sequencer Checks + Emit Tip Even if Sequencer (#834)
1 parent 5acdc54 commit d213412

5 files changed

Lines changed: 296 additions & 71 deletions

File tree

consensus/src/ordered_broadcast/engine.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,15 @@ impl<
488488
return Err(Error::AppVerifiedPayloadMismatch);
489489
}
490490

491-
// Construct partial signature
491+
// Emit the activity
492+
self.reporter
493+
.report(Activity::Tip(Proposal::new(
494+
tip.chunk.clone(),
495+
tip.signature.clone(),
496+
)))
497+
.await;
498+
499+
// Construct partial signature (if a validator)
492500
let Some(share) = self.validators.share(self.epoch) else {
493501
return Err(Error::UnknownShare(self.epoch));
494502
};
@@ -524,14 +532,6 @@ impl<
524532
.await
525533
.map_err(|_| Error::UnableToSendMessage)?;
526534

527-
// Emit the activity
528-
self.reporter
529-
.report(Activity::Proposal(Proposal::new(
530-
tip.chunk,
531-
tip.signature.clone(),
532-
)))
533-
.await;
534-
535535
Ok(())
536536
}
537537

consensus/src/ordered_broadcast/mocks/reporter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<C: Verifier, D: Digest> Z for Mailbox<C, D> {
175175

176176
async fn report(&mut self, activity: Self::Activity) {
177177
match activity {
178-
Activity::Proposal(proposal) => {
178+
Activity::Tip(proposal) => {
179179
self.sender
180180
.send(Message::Proposal(proposal))
181181
.await

consensus/src/ordered_broadcast/mocks/validators.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ pub struct Validators<P: Array> {
1111
identity: Poly<Public>,
1212
validators: Vec<P>,
1313
validators_map: HashMap<P, u32>,
14-
share: Share,
14+
share: Option<Share>,
1515
}
1616

1717
impl<P: Array> Validators<P> {
18-
pub fn new(identity: Poly<Public>, mut validators: Vec<P>, share: Share) -> Self {
18+
pub fn new(identity: Poly<Public>, mut validators: Vec<P>, share: Option<Share>) -> Self {
1919
// Setup validators
2020
validators.sort();
2121
let mut validators_map = HashMap::new();
@@ -63,6 +63,6 @@ impl<P: Array> ThresholdSupervisor for Validators<P> {
6363
}
6464

6565
fn share(&self, _: Self::Index) -> Option<&Self::Share> {
66-
Some(&self.share)
66+
self.share.as_ref()
6767
}
6868
}

0 commit comments

Comments
 (0)