()
| 557 | |
| 558 | #[test_traced("WARN")] |
| 559 | fn test_subscribe_basic_block_delivery() { |
| 560 | let runner = deterministic::Runner::timed(Duration::from_secs(60)); |
| 561 | runner.start(|mut context| async move { |
| 562 | let mut oracle = setup_network(context.clone(), NZUsize!(1)); |
| 563 | let Fixture { |
| 564 | participants, |
| 565 | schemes, |
| 566 | .. |
| 567 | } = bls12381_threshold::<V, _>(&mut context, NUM_VALIDATORS); |
| 568 | |
| 569 | let mut actors = Vec::new(); |
| 570 | for (i, validator) in participants.iter().enumerate() { |
| 571 | let (_application, actor, _processed_height) = setup_validator( |
| 572 | context.with_label(&format!("validator_{i}")), |
| 573 | &mut oracle, |
| 574 | validator.clone(), |
| 575 | ConstantProvider::new(schemes[i].clone()), |
| 576 | ) |
| 577 | .await; |
| 578 | actors.push(actor); |
| 579 | } |
| 580 | let mut actor = actors[0].clone(); |
| 581 | |
| 582 | setup_network_links(&mut oracle, &participants, LINK).await; |
| 583 | |
| 584 | let parent = Sha256::hash(b""); |
| 585 | let block = B::new::<Sha256>(parent, Height::new(1), 1); |
| 586 | let commitment = block.digest(); |
| 587 | |
| 588 | let subscription_rx = actor |
| 589 | .subscribe(Some(Round::new(Epoch::new(0), View::new(1))), commitment) |
| 590 | .await; |
| 591 | |
| 592 | actor |
| 593 | .verified(Round::new(Epoch::new(0), View::new(1)), block.clone()) |
| 594 | .await; |
| 595 | |
| 596 | let proposal = Proposal { |
| 597 | round: Round::new(Epoch::new(0), View::new(1)), |
| 598 | parent: View::new(0), |
| 599 | payload: commitment, |
| 600 | }; |
| 601 | let notarization = make_notarization(proposal.clone(), &schemes, QUORUM); |
| 602 | actor.report(Activity::Notarization(notarization)).await; |
| 603 | |
| 604 | let finalization = make_finalization(proposal, &schemes, QUORUM); |
| 605 | actor.report(Activity::Finalization(finalization)).await; |
| 606 | |
| 607 | let received_block = subscription_rx.await.unwrap(); |
| 608 | assert_eq!(received_block.digest(), block.digest()); |
| 609 | assert_eq!(received_block.height, Height::new(1)); |
| 610 | }) |
| 611 | } |
| 612 | |
| 613 | #[test_traced("WARN")] |
| 614 | fn test_subscribe_multiple_subscriptions() { |
nothing calls this directly
no test coverage detected