Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Rename to offchain_tx_pool_factory
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr committed Jun 5, 2023
1 parent 67b1730 commit b1bb12d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
prometheus_registry,
shared_voter_state: SharedVoterState::empty(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
offchain_tx_pool: OffchainTransactionPoolFactory::new(transaction_pool),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool),
};

// the GRANDPA voter task is considered infallible, i.e.
Expand Down
4 changes: 2 additions & 2 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub fn new_partial(
spawner: &task_manager.spawn_essential_handle(),
registry: config.prometheus_registry(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
offchain_tx_pool: OffchainTransactionPoolFactory::new(transaction_pool.clone()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool.clone()),
})?;

let import_setup = (block_import, grandpa_link, babe_link);
Expand Down Expand Up @@ -548,7 +548,7 @@ pub fn new_full_base(
voting_rule: grandpa::VotingRulesBuilder::default().build(),
prometheus_registry: prometheus_registry.clone(),
shared_voter_state,
offchain_tx_pool: OffchainTransactionPoolFactory::new(transaction_pool.clone()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool.clone()),
};

// the GRANDPA voter task is considered infallible, i.e.
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/babe/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ mod tests {
spawner: &task_executor,
registry: None,
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
})
.unwrap();

Expand Down
10 changes: 5 additions & 5 deletions client/consensus/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ pub struct BabeVerifier<Block: BlockT, Client, SelectChain, CIDP> {
config: BabeConfiguration,
epoch_changes: SharedEpochChanges<Block, Epoch>,
telemetry: Option<TelemetryHandle>,
offchain_tx_pool: OffchainTransactionPoolFactory<Block>,
offchain_tx_pool_factory: OffchainTransactionPoolFactory<Block>,
}

impl<Block, Client, SelectChain, CIDP> BabeVerifier<Block, Client, SelectChain, CIDP>
Expand Down Expand Up @@ -1102,7 +1102,7 @@ where
let mut runtime_api = self.client.runtime_api();

// Register the offchain tx pool to be able to use it from the runtime.
runtime_api.register_extension(self.offchain_tx_pool.offchain_transaction_pool(best_hash));
runtime_api.register_extension(self.offchain_tx_pool_factory.offchain_transaction_pool(best_hash));

runtime_api
.submit_report_equivocation_unsigned_extrinsic(
Expand Down Expand Up @@ -1801,7 +1801,7 @@ pub struct ImportQueueParams<'a, Block: BlockT, BI, Client, CIDP, SelectChain, S
/// The offchain transaction pool factory.
///
/// Will be used when sending equivocation reports.
pub offchain_tx_pool: OffchainTransactionPoolFactory<Block>,
pub offchain_tx_pool_factory: OffchainTransactionPoolFactory<Block>,
}

/// Start an import queue for the BABE consensus algorithm.
Expand All @@ -1824,7 +1824,7 @@ pub fn import_queue<Block: BlockT, Client, SelectChain, BI, CIDP, Spawn>(
spawner,
registry,
telemetry,
offchain_tx_pool,
offchain_tx_pool_factory,
}: ImportQueueParams<'_, Block, BI, Client, CIDP, SelectChain, Spawn>,
) -> ClientResult<(DefaultImportQueue<Block, Client>, BabeWorkerHandle<Block>)>
where
Expand Down Expand Up @@ -1857,7 +1857,7 @@ where
epoch_changes: babe_link.epoch_changes.clone(),
telemetry,
client: client.clone(),
offchain_tx_pool,
offchain_tx_pool_factory,
};

let (worker_tx, worker_rx) = channel(HANDLE_BUFFER_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/babe/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl TestNetFactory for BabeTestNet {
config: data.link.config.clone(),
epoch_changes: data.link.epoch_changes.clone(),
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
},
mutator: MUTATOR.with(|m| m.borrow().clone()),
}
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/grandpa/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ pub(crate) struct Environment<
pub(crate) metrics: Option<Metrics>,
pub(crate) justification_sender: Option<GrandpaJustificationSender<Block>>,
pub(crate) telemetry: Option<TelemetryHandle>,
pub(crate) offchain_tx_pool: OffchainTransactionPoolFactory<Block>,
pub(crate) offchain_tx_pool_factory: OffchainTransactionPoolFactory<Block>,
pub(crate) _phantom: PhantomData<Backend>,
}

Expand Down Expand Up @@ -576,7 +576,7 @@ where
let mut runtime_api = self.client.runtime_api();

runtime_api
.register_extension(self.offchain_tx_pool.offchain_transaction_pool(best_block_hash));
.register_extension(self.offchain_tx_pool_factory.offchain_transaction_pool(best_block_hash));

runtime_api
.submit_report_equivocation_unsigned_extrinsic(
Expand Down
12 changes: 6 additions & 6 deletions client/consensus/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ pub struct GrandpaParams<Block: BlockT, C, N, S, SC, VR> {
///
/// This will be used to create an offchain transaction pool instance for sending an
/// equivocation report from the runtime.
pub offchain_tx_pool: OffchainTransactionPoolFactory<Block>,
pub offchain_tx_pool_factory: OffchainTransactionPoolFactory<Block>,
}

/// Returns the configuration value to put in
Expand Down Expand Up @@ -742,7 +742,7 @@ where
prometheus_registry,
shared_voter_state,
telemetry,
offchain_tx_pool,
offchain_tx_pool_factory,
} = grandpa_params;

// NOTE: we have recently removed `run_grandpa_observer` from the public
Expand Down Expand Up @@ -817,7 +817,7 @@ where
shared_voter_state,
justification_sender,
telemetry,
offchain_tx_pool,
offchain_tx_pool_factory,
);

let voter_work = voter_work.map(|res| match res {
Expand Down Expand Up @@ -887,7 +887,7 @@ where
shared_voter_state: SharedVoterState,
justification_sender: GrandpaJustificationSender<Block>,
telemetry: Option<TelemetryHandle>,
offchain_tx_pool: OffchainTransactionPoolFactory<Block>,
offchain_tx_pool_factory: OffchainTransactionPoolFactory<Block>,
) -> Self {
let metrics = match prometheus_registry.as_ref().map(Metrics::register) {
Some(Ok(metrics)) => Some(metrics),
Expand All @@ -912,7 +912,7 @@ where
metrics: metrics.as_ref().map(|m| m.environment.clone()),
justification_sender: Some(justification_sender),
telemetry: telemetry.clone(),
offchain_tx_pool,
offchain_tx_pool_factory,
_phantom: PhantomData,
});

Expand Down Expand Up @@ -1064,7 +1064,7 @@ where
metrics: self.env.metrics.clone(),
justification_sender: self.env.justification_sender.clone(),
telemetry: self.telemetry.clone(),
offchain_tx_pool: self.env.offchain_tx_pool.clone(),
offchain_tx_pool_factory: self.env.offchain_tx_pool_factory.clone(),
_phantom: PhantomData,
});

Expand Down
14 changes: 7 additions & 7 deletions client/consensus/grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ fn initialize_grandpa(
voting_rule: (),
prometheus_registry: None,
shared_voter_state: SharedVoterState::empty(),
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
telemetry: None,
};
let voter =
Expand Down Expand Up @@ -483,7 +483,7 @@ async fn finalize_3_voters_1_full_observer() {
prometheus_registry: None,
shared_voter_state: SharedVoterState::empty(),
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
};

run_grandpa_voter(grandpa_params).expect("all in order with client and network")
Expand Down Expand Up @@ -576,7 +576,7 @@ async fn transition_3_voters_twice_1_full_observer() {
prometheus_registry: None,
shared_voter_state: SharedVoterState::empty(),
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
};

voters
Expand Down Expand Up @@ -1044,7 +1044,7 @@ async fn voter_persists_its_votes() {
prometheus_registry: None,
shared_voter_state: SharedVoterState::empty(),
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
};

run_grandpa_voter(grandpa_params).expect("all in order with client and network")
Expand Down Expand Up @@ -1088,7 +1088,7 @@ async fn voter_persists_its_votes() {
prometheus_registry: None,
shared_voter_state: SharedVoterState::empty(),
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
};

run_grandpa_voter(grandpa_params)
Expand Down Expand Up @@ -1299,7 +1299,7 @@ async fn voter_catches_up_to_latest_round_when_behind() {
prometheus_registry: None,
shared_voter_state: SharedVoterState::empty(),
telemetry: None,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
};

Box::pin(run_grandpa_voter(grandpa_params).expect("all in order with client and network"))
Expand Down Expand Up @@ -1429,7 +1429,7 @@ where
justification_sender: None,
telemetry: None,
_phantom: PhantomData,
offchain_tx_pool: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(RejectAllTxPool::default()),
}
}

Expand Down

0 comments on commit b1bb12d

Please sign in to comment.