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

Remove async_trait in favor of native support #2171

Closed
wants to merge 1 commit into from
Closed
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
1 change: 0 additions & 1 deletion cumulus/client/collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ cumulus-client-network = { path = "../network" }
cumulus-primitives-core = { path = "../../primitives/core" }

[dev-dependencies]
async-trait = "0.1.73"

# Substrate
sp-maybe-compressed-blob = { path = "../../../substrate/primitives/maybe-compressed-blob" }
Expand Down
3 changes: 0 additions & 3 deletions cumulus/client/collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ pub fn start_collator_sync<Block, RA, BS, Spawner>(
#[cfg(test)]
mod tests {
use super::*;
use async_trait::async_trait;
use cumulus_client_consensus_common::ParachainCandidate;
use cumulus_primitives_core::ParachainBlockData;
use cumulus_test_client::{
Expand All @@ -355,7 +354,6 @@ mod tests {

struct AlwaysSupportsParachains;

#[async_trait]
impl HeadSupportsParachains for AlwaysSupportsParachains {
async fn head_supports_parachains(&self, _head: &PHash) -> bool {
true
Expand All @@ -367,7 +365,6 @@ mod tests {
client: Arc<Client>,
}

#[async_trait::async_trait]
impl ParachainConsensus<Block> for DummyParachainConsensus {
async fn produce_candidate(
&mut self,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors.workspace = true
edition.workspace = true

[dependencies]
async-trait = "0.1.73"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
futures = "0.3.28"
tracing = "0.1.37"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ struct Verifier<P, Client, Block, CIDP> {
_phantom: std::marker::PhantomData<fn() -> (Block, P)>,
}

#[async_trait::async_trait]
impl<P, Client, Block, CIDP> VerifierT<Block> for Verifier<P, Client, Block, CIDP>
where
P: Pair,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ where
}
}

#[async_trait::async_trait]
impl<B, CIDP, W> ParachainConsensus<B> for AuraConsensus<B, CIDP, W>
where
B: BlockT,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors.workspace = true
edition.workspace = true

[dependencies]
async-trait = "0.1.73"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
dyn-clone = "1.0.12"
futures = "0.3.28"
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/common/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ use crate::ParachainBlockImportMarker;
/// This should only be used when the runtime is responsible for checking block seals and inherents.
pub struct VerifyNothing;

#[async_trait::async_trait]
impl<Block: BlockT> Verifier<Block> for VerifyNothing {
async fn verify(
&mut self,
Expand Down
3 changes: 0 additions & 3 deletions cumulus/client/consensus/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub struct ParachainCandidate<B> {
/// decide if this specific collator should build a candidate for the given relay chain block. The
/// consensus implementation could, for example, check whether this specific collator is part of a
/// staked set.
#[async_trait::async_trait]
pub trait ParachainConsensus<B: BlockT>: Send + Sync + dyn_clone::DynClone {
/// Produce a new candidate at the given parent block and relay-parent blocks.
///
Expand All @@ -97,7 +96,6 @@ pub trait ParachainConsensus<B: BlockT>: Send + Sync + dyn_clone::DynClone {

dyn_clone::clone_trait_object!(<B> ParachainConsensus<B> where B: BlockT);

#[async_trait::async_trait]
impl<B: BlockT> ParachainConsensus<B> for Box<dyn ParachainConsensus<B> + Send + Sync> {
async fn produce_candidate(
&mut self,
Expand Down Expand Up @@ -151,7 +149,6 @@ impl<Block: BlockT, I: Clone, BE> Clone for ParachainBlockImport<Block, I, BE> {
}
}

#[async_trait::async_trait]
impl<Block, BI, BE> BlockImport<Block> for ParachainBlockImport<Block, BI, BE>
where
Block: BlockT,
Expand Down
2 changes: 0 additions & 2 deletions cumulus/client/consensus/common/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use crate::*;

use async_trait::async_trait;
use codec::Encode;
use cumulus_client_pov_recovery::RecoveryKind;
use cumulus_primitives_core::{
Expand Down Expand Up @@ -89,7 +88,6 @@ impl Relaychain {
}
}

#[async_trait]
impl RelayChainInterface for Relaychain {
async fn validators(&self, _: PHash) -> RelayChainResult<Vec<ValidatorId>> {
unimplemented!("Not needed for test")
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/proposer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition.workspace = true

[dependencies]
anyhow = "1.0"
async-trait = "0.1.73"
thiserror = "1.0.48"

# Substrate
Expand Down
4 changes: 0 additions & 4 deletions cumulus/client/consensus/proposer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
//!
//! This utility is designed to be composed within any collator consensus algorithm.

use async_trait::async_trait;

use cumulus_primitives_parachain_inherent::ParachainInherentData;
use sp_consensus::{EnableProofRecording, Environment, Proposal, Proposer as SubstrateProposer};
use sp_inherents::InherentData;
Expand Down Expand Up @@ -53,7 +51,6 @@ impl Error {
pub type ProposalOf<B> = Proposal<B, StorageProof>;

/// An interface for proposers.
#[async_trait]
pub trait ProposerInterface<Block: BlockT> {
/// Propose a collation using the supplied `InherentData` and the provided
/// `ParachainInherentData`.
Expand Down Expand Up @@ -92,7 +89,6 @@ impl<B, T> Proposer<B, T> {
}
}

#[async_trait]
impl<B, T> ProposerInterface<B> for Proposer<B, T>
where
B: sp_runtime::traits::Block,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/relay-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors.workspace = true
edition.workspace = true

[dependencies]
async-trait = "0.1.73"
futures = "0.3.28"
parking_lot = "0.12.1"
tracing = "0.1.37"
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/relay-chain/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl<Client, Block, CIDP> Verifier<Client, Block, CIDP> {
}
}

#[async_trait::async_trait]
impl<Client, Block, CIDP> VerifierT<Block> for Verifier<Client, Block, CIDP>
where
Block: BlockT,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/consensus/relay-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ where
}
}

#[async_trait::async_trait]
impl<B, PF, BI, RCInterface, CIDP> ParachainConsensus<B>
for RelayChainConsensus<B, PF, BI, RCInterface, CIDP>
where
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ description = "Cumulus-specific networking protocol"
edition.workspace = true

[dependencies]
async-trait = "0.1.73"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
futures = "0.3.28"
futures-timer = "3.0.2"
Expand Down
2 changes: 0 additions & 2 deletions cumulus/client/network/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

use super::*;
use async_trait::async_trait;
use cumulus_primitives_core::relay_chain::BlockId;
use cumulus_relay_chain_inprocess_interface::{check_block_in_chain, BlockCheckStatus};
use cumulus_relay_chain_interface::{
Expand Down Expand Up @@ -76,7 +75,6 @@ impl DummyRelayChainInterface {
}
}

#[async_trait]
impl RelayChainInterface for DummyRelayChainInterface {
async fn validators(&self, _: PHash) -> RelayChainResult<Vec<ValidatorId>> {
Ok(self.data.lock().validators.clone())
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/pov-recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ polkadot-primitives = { path = "../../../polkadot/primitives" }
# Cumulus
cumulus-primitives-core = { path = "../../primitives/core" }
cumulus-relay-chain-interface = { path = "../relay-chain-interface" }
async-trait = "0.1.73"

[dev-dependencies]
tokio = { version = "1.32.0", features = ["macros"] }
Expand Down
2 changes: 0 additions & 2 deletions cumulus/client/pov-recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const LOG_TARGET: &str = "cumulus-pov-recovery";

/// Test-friendly wrapper trait for the overseer handle.
/// Can be used to simulate failing recovery requests.
#[async_trait::async_trait]
pub trait RecoveryHandle: Send {
async fn send_recovery_msg(
&mut self,
Expand All @@ -91,7 +90,6 @@ pub trait RecoveryHandle: Send {
);
}

#[async_trait::async_trait]
impl RecoveryHandle for OverseerHandle {
async fn send_recovery_msg(
&mut self,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/relay-chain-inprocess-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ version = "0.1.0"
edition.workspace = true

[dependencies]
async-trait = "0.1.73"
futures = "0.3.28"
futures-timer = "3.0.2"

Expand Down
2 changes: 0 additions & 2 deletions cumulus/client/relay-chain-inprocess-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use std::{pin::Pin, sync::Arc, time::Duration};

use async_trait::async_trait;
use cumulus_primitives_core::{
relay_chain::{
runtime_api::ParachainHost, Block as PBlock, BlockId, CommittedCandidateReceipt,
Expand Down Expand Up @@ -66,7 +65,6 @@ impl RelayChainInProcessInterface {
}
}

#[async_trait]
impl RelayChainInterface for RelayChainInProcessInterface {
async fn retrieve_dmq_contents(
&self,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/relay-chain-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ sp-state-machine = { path = "../../../substrate/primitives/state-machine" }
sc-client-api = { path = "../../../substrate/client/api" }

futures = "0.3.28"
async-trait = "0.1.73"
thiserror = "1.0.48"
jsonrpsee-core = "0.16.2"
parity-scale-codec = "3.6.4"
3 changes: 0 additions & 3 deletions cumulus/client/relay-chain-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use sc_client_api::StorageProof;

use futures::Stream;

use async_trait::async_trait;
use jsonrpsee_core::Error as JsonRpcError;
use parity_scale_codec::Error as CodecError;
use sp_api::ApiError;
Expand Down Expand Up @@ -96,7 +95,6 @@ impl<T: std::error::Error + Send + Sync + 'static> From<Box<T>> for RelayChainEr
}

/// Trait that provides all necessary methods for interaction between collator and relay chain.
#[async_trait]
pub trait RelayChainInterface: Send + Sync {
/// Fetch a storage item by key.
async fn get_storage_by_key(
Expand Down Expand Up @@ -196,7 +194,6 @@ pub trait RelayChainInterface: Send + Sync {
) -> RelayChainResult<StorageProof>;
}

#[async_trait]
impl<T> RelayChainInterface for Arc<T>
where
T: RelayChainInterface + ?Sized,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/relay-chain-minimal-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ cumulus-primitives-core = { path = "../../primitives/core" }

array-bytes = "6.1"
tracing = "0.1.37"
async-trait = "0.1.73"
futures = "0.3.28"

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ impl BlockChainRpcClient {
}
}

#[async_trait::async_trait]
impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn validators(
&self,
Expand Down Expand Up @@ -366,7 +365,6 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
}
}

#[async_trait::async_trait]
impl AuthorityDiscovery<Block> for BlockChainRpcClient {
async fn authorities(
&self,
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/relay-chain-rpc-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ futures-timer = "3.0.2"
parity-scale-codec = "3.6.4"
jsonrpsee = { version = "0.16.2", features = ["ws-client"] }
tracing = "0.1.37"
async-trait = "0.1.73"
url = "2.4.0"
serde_json = "1.0.107"
serde = "1.0.188"
Expand Down
2 changes: 0 additions & 2 deletions cumulus/client/relay-chain-rpc-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use async_trait::async_trait;
use core::time::Duration;
use cumulus_primitives_core::{
relay_chain::{
Expand Down Expand Up @@ -64,7 +63,6 @@ impl RelayChainRpcInterface {
}
}

#[async_trait]
impl RelayChainInterface for RelayChainRpcInterface {
async fn retrieve_dmq_contents(
&self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ struct SimpleStringSender {
chain_id: ChainId,
}

#[async_trait::async_trait]
impl TransportSenderT for SimpleStringSender {
type Error = LightClientError;

Expand All @@ -76,7 +75,6 @@ struct SimpleStringReceiver {
inner: JsonRpcResponses,
}

#[async_trait::async_trait]
impl TransportReceiverT for SimpleStringReceiver {
type Error = LightClientError;

Expand Down
1 change: 0 additions & 1 deletion cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ name = "polkadot-parachain"
path = "src/main.rs"

[dependencies]
async-trait = "0.1.73"
clap = { version = "4.4.6", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
futures = "0.3.28"
Expand Down
2 changes: 0 additions & 2 deletions cumulus/polkadot-parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,6 @@ impl<Client, AuraId> Clone for WaitForAuraConsensus<Client, AuraId> {
}
}

#[async_trait::async_trait]
impl<Client, AuraId> ParachainConsensus<Block> for WaitForAuraConsensus<Client, AuraId>
where
Client: sp_api::ProvideRuntimeApi<Block> + Send + Sync,
Expand Down Expand Up @@ -1215,7 +1214,6 @@ struct Verifier<Client, AuraId> {
_phantom: PhantomData<AuraId>,
}

#[async_trait::async_trait]
impl<Client, AuraId> VerifierT<Block> for Verifier<Client, AuraId>
where
Client: sp_api::ProvideRuntimeApi<Block> + Send + Sync,
Expand Down
2 changes: 0 additions & 2 deletions cumulus/primitives/parachain-inherent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ authors.workspace = true
edition.workspace = true

[dependencies]
async-trait = { version = "0.1.73", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
tracing = { version = "0.1.37", optional = true }
Expand All @@ -29,7 +28,6 @@ cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder",
[features]
default = [ "std" ]
std = [
"async-trait",
"codec/std",
"cumulus-primitives-core/std",
"cumulus-relay-chain-interface",
Expand Down
1 change: 0 additions & 1 deletion cumulus/primitives/parachain-inherent/src/client_side.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ impl ParachainInherentData {
}
}

#[async_trait::async_trait]
impl sp_inherents::InherentDataProvider for ParachainInherentData {
async fn provide_inherent_data(
&self,
Expand Down
1 change: 0 additions & 1 deletion cumulus/primitives/parachain-inherent/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ impl MockXcmConfig {
}
}

#[async_trait::async_trait]
impl<R: Send + Sync + GenerateRandomness<u64>> InherentDataProvider
for MockValidationDataInherentDataProvider<R>
{
Expand Down
1 change: 0 additions & 1 deletion cumulus/test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ name = "test-parachain"
path = "src/main.rs"

[dependencies]
async-trait = "0.1.73"
clap = { version = "4.4.6", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
criterion = { version = "0.5.1", features = [ "async_tokio" ] }
Expand Down
Loading