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

Download history 1550/week @ 2024-07-25 1600/week @ 2024-08-01 2413/week @ 2024-08-08 2285/week @ 2024-08-15 2253/week @ 2024-08-22 1666/week @ 2024-08-29 1927/week @ 2024-09-05 2492/week @ 2024-09-12 2626/week @ 2024-09-19 3214/week @ 2024-09-26 2101/week @ 2024-10-03 2009/week @ 2024-10-10 2771/week @ 2024-10-17 3024/week @ 2024-10-24 2702/week @ 2024-10-31 1769/week @ 2024-11-07

10,678 downloads per month
Used in 14 crates (8 directly)

GPL-3.0-or-later…

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