MCPcopy Create free account
hub / github.com/SeismicSystems/summit / test_subscribe_multiple_subscriptions

Function test_subscribe_multiple_subscriptions

syncer/src/lib.rs:614–686  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

612
613 #[test_traced("WARN")]
614 fn test_subscribe_multiple_subscriptions() {
615 let runner = deterministic::Runner::timed(Duration::from_secs(60));
616 runner.start(|mut context| async move {
617 let mut oracle = setup_network(context.clone(), NZUsize!(1));
618 let Fixture {
619 participants,
620 schemes,
621 ..
622 } = bls12381_threshold::<V, _>(&mut context, NUM_VALIDATORS);
623
624 let mut actors = Vec::new();
625 for (i, validator) in participants.iter().enumerate() {
626 let (_application, actor, _processed_height) = setup_validator(
627 context.with_label(&format!("validator_{i}")),
628 &mut oracle,
629 validator.clone(),
630 ConstantProvider::new(schemes[i].clone()),
631 )
632 .await;
633 actors.push(actor);
634 }
635 let mut actor = actors[0].clone();
636
637 setup_network_links(&mut oracle, &participants, LINK).await;
638
639 let parent = Sha256::hash(b"");
640 let block1 = B::new::<Sha256>(parent, Height::new(1), 1);
641 let block2 = B::new::<Sha256>(block1.digest(), Height::new(2), 2);
642 let commitment1 = block1.digest();
643 let commitment2 = block2.digest();
644
645 let sub1_rx = actor
646 .subscribe(Some(Round::new(Epoch::new(0), View::new(1))), commitment1)
647 .await;
648 let sub2_rx = actor
649 .subscribe(Some(Round::new(Epoch::new(0), View::new(2))), commitment2)
650 .await;
651 let sub3_rx = actor
652 .subscribe(Some(Round::new(Epoch::new(0), View::new(1))), commitment1)
653 .await;
654
655 actor
656 .verified(Round::new(Epoch::new(0), View::new(1)), block1.clone())
657 .await;
658 actor
659 .verified(Round::new(Epoch::new(0), View::new(2)), block2.clone())
660 .await;
661
662 for (view, block) in [(1u64, block1.clone()), (2u64, block2.clone())] {
663 let proposal = Proposal {
664 round: Round::new(Epoch::new(0), View::new(view)),
665 parent: View::new(view.checked_sub(1).unwrap()),
666 payload: block.digest(),
667 };
668 let notarization = make_notarization(proposal.clone(), &schemes, QUORUM);
669 actor.report(Activity::Notarization(notarization)).await;
670
671 let finalization = make_finalization(proposal, &schemes, QUORUM);

Callers

nothing calls this directly

Calls 12

setup_networkFunction · 0.85
setup_validatorFunction · 0.85
setup_network_linksFunction · 0.85
make_notarizationFunction · 0.85
iterMethod · 0.80
pushMethod · 0.80
verifiedMethod · 0.80
make_finalizationFunction · 0.70
startMethod · 0.45
digestMethod · 0.45
subscribeMethod · 0.45
reportMethod · 0.45

Tested by

no test coverage detected