Skip to content

Commit e3e254a

Browse files
committed
patbot
1 parent 353b5ef commit e3e254a

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

consensus/src/marshal/coding/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ mod tests {
119119
#[test]
120120
fn mailbox_provides_application_blocks() {
121121
fn assert_provider<P: BlockProvider<Block = CodingB>>() {}
122-
123122
assert_provider::<core::Mailbox<S, TestCodingVariant>>();
124123
}
125124

consensus/src/marshal/standard/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ mod tests {
4343
use super::{Deferred, Inline, Standard};
4444
use crate::{
4545
marshal::{
46+
ancestry::BlockProvider,
4647
config::Config,
4748
core::{cache, Actor, CommitmentFallback, Mailbox},
4849
mocks::{
@@ -105,6 +106,12 @@ mod tests {
105106
time::Duration,
106107
};
107108

109+
#[test]
110+
fn mailbox_provides_application_blocks() {
111+
fn assert_provider<P: BlockProvider<Block = B>>() {}
112+
assert_provider::<Mailbox<S, Standard<B>>>();
113+
}
114+
108115
fn assert_finalize_deterministic<H: TestHarness>(
109116
seed: u64,
110117
link: commonware_p2p::simulated::Link,

consensus/src/marshal/standard/variant.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
//! receives the full block directly from the proposer or via gossip.
55
66
use crate::{
7-
marshal::core::{Buffer, Variant},
7+
marshal::{
8+
ancestry::BlockProvider,
9+
core::{Buffer, DigestFallback, Mailbox, Variant},
10+
},
811
types::Round,
912
Block,
1013
};
1114
use commonware_broadcast::{buffered, Broadcaster};
1215
use commonware_codec::Read;
13-
use commonware_cryptography::{Digestible, PublicKey};
16+
use commonware_cryptography::{certificate::Scheme, Digestible, PublicKey};
1417
use commonware_p2p::Recipients;
1518
use commonware_utils::channel::oneshot;
1619

@@ -89,3 +92,17 @@ where
8992
Broadcaster::broadcast(self, recipients, block);
9093
}
9194
}
95+
96+
impl<S, B> BlockProvider for Mailbox<S, Standard<B>>
97+
where
98+
S: Scheme,
99+
B: Block,
100+
{
101+
type Block = B;
102+
103+
async fn subscribe(self, digest: B::Digest) -> Option<Self::Block> {
104+
self.subscribe_by_digest(digest, DigestFallback::Wait)
105+
.await
106+
.ok()
107+
}
108+
}

0 commit comments

Comments
 (0)