Skip to content

Commit ce24a42

Browse files
rphmeierpepyakin
authored andcommitted
node: use limiting proposer
1 parent 56de3b3 commit ce24a42

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

sugondat-chain/node/src/proposer.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ pub struct BlockLimitingProposer<P> {
3535
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
3636
}
3737

38+
impl<P> BlockLimitingProposer<P> {
39+
/// Create a new block-limiting proposer.
40+
pub fn new(
41+
inner: P,
42+
para_id: ParaId,
43+
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
44+
) -> Self {
45+
BlockLimitingProposer {
46+
inner,
47+
para_id,
48+
transaction_pool,
49+
}
50+
}
51+
}
52+
3853
#[async_trait::async_trait]
3954
impl<P: ProposerInterface<Block> + Send> ProposerInterface<Block> for BlockLimitingProposer<P> {
4055
async fn propose(

sugondat-chain/node/src/service.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ use sc_transaction_pool_api::OffchainTransactionPoolFactory;
3030
use sp_keystore::KeystorePtr;
3131
use substrate_prometheus_endpoint::Registry;
3232

33+
use crate::proposer::BlockLimitingProposer;
34+
3335
// This is fine, even for the Kusama and Polkadot parachains.
3436
//
3537
// Runtime API invocations are one of the dumbest things in Substrate:
@@ -389,15 +391,19 @@ fn start_consensus(
389391

390392
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
391393

392-
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
393-
task_manager.spawn_handle(),
394-
client.clone(),
395-
transaction_pool,
396-
prometheus_registry,
397-
telemetry.clone(),
398-
);
394+
let proposer = {
395+
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
396+
task_manager.spawn_handle(),
397+
client.clone(),
398+
transaction_pool.clone(),
399+
prometheus_registry,
400+
telemetry.clone(),
401+
);
399402

400-
let proposer = Proposer::new(proposer_factory);
403+
let proposer = Proposer::new(proposer_factory);
404+
405+
BlockLimitingProposer::new(proposer, para_id, transaction_pool)
406+
};
401407

402408
let collator_service = CollatorService::new(
403409
client.clone(),

0 commit comments

Comments
 (0)