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

#6 in #factory

Download history 1807/week @ 2024-07-12 1724/week @ 2024-07-19 1587/week @ 2024-07-26 1729/week @ 2024-08-02 2351/week @ 2024-08-09 2371/week @ 2024-08-16 2053/week @ 2024-08-23 1677/week @ 2024-08-30 2052/week @ 2024-09-06 2356/week @ 2024-09-13 2848/week @ 2024-09-20 3283/week @ 2024-09-27 1879/week @ 2024-10-04 2060/week @ 2024-10-11 3027/week @ 2024-10-18 2304/week @ 2024-10-25

9,813 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

~77–115MB
~2M SLoC