55 releases (36 breaking)
0.45.0 | Sep 26, 2024 |
---|---|
0.44.0 | Jul 18, 2024 |
0.42.0 | Jul 12, 2024 |
0.37.0 | Mar 18, 2024 |
0.8.0-alpha.5 | Mar 24, 2020 |
#7 in #factory
10,678 downloads per month
Used in 14 crates
(8 directly)
1MB
17K
SLoC
Basic implementation of block-authoring logic.
Example
// The first step is to create a `ProposerFactory`.
let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None);
// From this factory, we create a `Proposer`.
let proposer = proposer_factory.init(
&client.header(client.chain_info().genesis_hash).unwrap().unwrap(),
);
// The proposer is created asynchronously.
let proposer = futures::executor::block_on(proposer).unwrap();
// This `Proposer` allows us to create a block proposition.
// The proposer will grab transactions from the transaction pool, and put them into the block.
let future = proposer.propose(
Default::default(),
Default::default(),
Duration::from_secs(2),
);
// We wait until the proposition is performed.
let block = futures::executor::block_on(future).unwrap();
println!("Generated block: {:?}", block.block);
License: GPL-3.0-or-later WITH Classpath-exception-2.0
Release
Polkadot SDK stable2409
lib.rs
:
Basic implementation of block-authoring logic.
Example
// The first step is to create a `ProposerFactory`.
let mut proposer_factory = ProposerFactory::new(
spawner,
client.clone(),
txpool.clone(),
None,
None,
);
// From this factory, we create a `Proposer`.
let proposer = proposer_factory.init(
&client.header(client.chain_info().genesis_hash).unwrap().unwrap(),
);
// The proposer is created asynchronously.
let proposer = futures::executor::block_on(proposer).unwrap();
// This `Proposer` allows us to create a block proposition.
// The proposer will grab transactions from the transaction pool, and put them into the block.
let future = proposer.propose(
Default::default(),
Default::default(),
Duration::from_secs(2),
None,
);
// We wait until the proposition is performed.
let block = futures::executor::block_on(future).unwrap();
println!("Generated block: {:?}", block.block);
Dependencies
~78–120MB
~2M SLoC