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

#11 in #factory

Download history 2144/week @ 2024-09-08 2323/week @ 2024-09-15 3040/week @ 2024-09-22 3059/week @ 2024-09-29 1783/week @ 2024-10-06 2285/week @ 2024-10-13 2983/week @ 2024-10-20 2870/week @ 2024-10-27 2626/week @ 2024-11-03 1672/week @ 2024-11-10 2749/week @ 2024-11-17 2822/week @ 2024-11-24 3254/week @ 2024-12-01 4126/week @ 2024-12-08 4656/week @ 2024-12-15 1849/week @ 2024-12-22

14,158 downloads per month
Used in 15 crates (8 directly)

GPL-3.0-or-later…

1.5MB
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

~79–120MB
~2M SLoC