57 releases (breaking)

new 0.48.0 Jan 29, 2025
0.45.0 Sep 26, 2024
0.44.0 Jul 18, 2024
0.37.0 Mar 18, 2024
0.8.0-alpha.5 Mar 24, 2020

#11 in #factory

Download history 1920/week @ 2024-10-09 2517/week @ 2024-10-16 3237/week @ 2024-10-23 2795/week @ 2024-10-30 1941/week @ 2024-11-06 2277/week @ 2024-11-13 2944/week @ 2024-11-20 2872/week @ 2024-11-27 3387/week @ 2024-12-04 5015/week @ 2024-12-11 3317/week @ 2024-12-18 1704/week @ 2024-12-25 2575/week @ 2025-01-01 3540/week @ 2025-01-08 5062/week @ 2025-01-15 3335/week @ 2025-01-22

14,834 downloads per month
Used in 17 crates (9 directly)

GPL-3.0-or-later…

1.5MB
18K 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 Stable 2412


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

~73–110MB
~2M SLoC