From b0565fc30c443c123b431bf1777c4fa11537af59 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Wed, 27 Dec 2023 17:12:24 -0800 Subject: [PATCH] node: use limiting proposer --- sugondat-chain/node/src/proposer.rs | 15 +++++++++++++++ sugondat-chain/node/src/service.rs | 22 ++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/sugondat-chain/node/src/proposer.rs b/sugondat-chain/node/src/proposer.rs index 0244ffd9..f69271ab 100644 --- a/sugondat-chain/node/src/proposer.rs +++ b/sugondat-chain/node/src/proposer.rs @@ -35,6 +35,21 @@ pub struct BlockLimitingProposer

{ transaction_pool: Arc>, } +impl

BlockLimitingProposer

{ + /// Create a new block-limiting proposer. + pub fn new( + inner: P, + para_id: ParaId, + transaction_pool: Arc>, + ) -> Self { + BlockLimitingProposer { + inner, + para_id, + transaction_pool, + } + } +} + #[async_trait::async_trait] impl + Send> ProposerInterface for BlockLimitingProposer

{ async fn propose( diff --git a/sugondat-chain/node/src/service.rs b/sugondat-chain/node/src/service.rs index e2277740..842b9338 100644 --- a/sugondat-chain/node/src/service.rs +++ b/sugondat-chain/node/src/service.rs @@ -30,6 +30,8 @@ use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_keystore::KeystorePtr; use substrate_prometheus_endpoint::Registry; +use crate::proposer::BlockLimitingProposer; + // This is fine, even for the Kusama and Polkadot parachains. // // Runtime API invocations are one of the dumbest things in Substrate: @@ -389,15 +391,19 @@ fn start_consensus( let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; - let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( - task_manager.spawn_handle(), - client.clone(), - transaction_pool, - prometheus_registry, - telemetry.clone(), - ); + let proposer = { + let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( + task_manager.spawn_handle(), + client.clone(), + transaction_pool.clone(), + prometheus_registry, + telemetry.clone(), + ); - let proposer = Proposer::new(proposer_factory); + let proposer = Proposer::new(proposer_factory); + + BlockLimitingProposer::new(proposer, para_id, transaction_pool) + }; let collator_service = CollatorService::new( client.clone(),