Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 3397395

Browse files
committed
rename block announcement validator to be more specific
1 parent ae07088 commit 3397395

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

client/network/src/lib.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,16 @@ impl TryFrom<&'_ CollationSecondedSignal> for BlockAnnounceData {
186186
}
187187
}
188188

189+
/// A type alias for the [`RequireSecondedInBlockAnnounce`] validator.
190+
#[deprecated = "This has been renamed to RequireSecondedInBlockAnnounce"]
191+
pub type BlockAnnounceValidator<Block, RCInterface> = RequireSecondedInBlockAnnounce<Block, RCInterface>;
192+
189193
/// Parachain specific block announce validator.
190194
///
195+
/// This is not required when the collation mechanism itself is sybil-resistant, as it is a spam protection
196+
/// mechanism used to prevent nodes from dealing with unbounded numbers of blocks. For sybil-resistant
197+
/// collation mechanisms, this will only slow things down.
198+
///
191199
/// This block announce validator is required if the parachain is running
192200
/// with the relay chain provided consensus to make sure each node only
193201
/// imports a reasonable number of blocks per round. The relay chain provided
@@ -214,23 +222,23 @@ impl TryFrom<&'_ CollationSecondedSignal> for BlockAnnounceData {
214222
/// it. However, if the announcement is for a block below the tip the announcement is accepted
215223
/// as it probably comes from a node that is currently syncing the chain.
216224
#[derive(Clone)]
217-
pub struct BlockAnnounceValidator<Block, RCInterface> {
225+
pub struct RequireSecondedInBlockAnnounce<Block, RCInterface> {
218226
phantom: PhantomData<Block>,
219227
relay_chain_interface: RCInterface,
220228
para_id: ParaId,
221229
}
222230

223-
impl<Block, RCInterface> BlockAnnounceValidator<Block, RCInterface>
231+
impl<Block, RCInterface> RequireSecondedInBlockAnnounce<Block, RCInterface>
224232
where
225233
RCInterface: Clone,
226234
{
227-
/// Create a new [`BlockAnnounceValidator`].
235+
/// Create a new [`RequireSecondedInBlockAnnounce`].
228236
pub fn new(relay_chain_interface: RCInterface, para_id: ParaId) -> Self {
229237
Self { phantom: Default::default(), relay_chain_interface, para_id }
230238
}
231239
}
232240

233-
impl<Block: BlockT, RCInterface> BlockAnnounceValidator<Block, RCInterface>
241+
impl<Block: BlockT, RCInterface> RequireSecondedInBlockAnnounce<Block, RCInterface>
234242
where
235243
RCInterface: RelayChainInterface + Clone,
236244
{
@@ -315,7 +323,7 @@ where
315323
}
316324

317325
impl<Block: BlockT, RCInterface> BlockAnnounceValidatorT<Block>
318-
for BlockAnnounceValidator<Block, RCInterface>
326+
for RequireSecondedInBlockAnnounce<Block, RCInterface>
319327
where
320328
RCInterface: RelayChainInterface + Clone + 'static,
321329
{

0 commit comments

Comments
 (0)