Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: use limiting proposer #157

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sugondat-chain/node/src/proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ pub struct BlockLimitingProposer<P> {
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
}

impl<P> BlockLimitingProposer<P> {
/// Create a new block-limiting proposer.
pub fn new(
inner: P,
para_id: ParaId,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
) -> Self {
BlockLimitingProposer {
inner,
para_id,
transaction_pool,
}
}
}

#[async_trait::async_trait]
impl<P: ProposerInterface<Block> + Send> ProposerInterface<Block> for BlockLimitingProposer<P> {
async fn propose(
Expand Down
22 changes: 14 additions & 8 deletions sugondat-chain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(),
Expand Down