Skip to content

Commit

Permalink
Reexport paste from sp-runtime in bp-runtime to aviod including `…
Browse files Browse the repository at this point in the history
…paste` dependency everywhere (paritytech#1556)

* Reexport paste from `sp-runtime` in `bp-runtime` to aviod including `paste` dependency everywhere

* Add import `bp_runtime` to macro calls: decl_bridge_finality_runtime_apis/decl_bridge_messages_runtime_apis
  • Loading branch information
bkontur authored and serban300 committed Apr 10, 2024
1 parent d82d369 commit 5ce75bb
Show file tree
Hide file tree
Showing 21 changed files with 20 additions and 43 deletions.
1 change: 0 additions & 1 deletion bridges/primitives/chain-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
paste = "1.0"
smallvec = "1.7"

# Bridge Dependencies
Expand Down
4 changes: 1 addition & 3 deletions bridges/primitives/chain-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ use sp_std::prelude::*;
use sp_version::RuntimeVersion;

pub use bp_polkadot_core::*;
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
};
use bp_runtime::decl_bridge_runtime_apis;

/// Kusama Chain
pub type Kusama = PolkadotLike;
Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-millau/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
paste = "1.0"

# Bridge Dependencies

Expand Down
5 changes: 1 addition & 4 deletions bridges/primitives/chain-millau/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ mod millau_hash;
use bp_messages::{
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
};
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
Chain,
};
use bp_runtime::{decl_bridge_runtime_apis, Chain};
use frame_support::{
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, Weight},
Parameter, RuntimeDebug,
Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
smallvec = "1.7"
paste = "1.0"

# Bridge Dependencies

Expand Down
4 changes: 1 addition & 3 deletions bridges/primitives/chain-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ use sp_std::prelude::*;
use sp_version::RuntimeVersion;

pub use bp_polkadot_core::*;
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
};
use bp_runtime::decl_bridge_runtime_apis;

/// Polkadot Chain
pub type Polkadot = PolkadotLike;
Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-rialto-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
paste = "1.0"

# Bridge Dependencies

Expand Down
5 changes: 1 addition & 4 deletions bridges/primitives/chain-rialto-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
use bp_messages::{
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
};
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
Chain,
};
use bp_runtime::{decl_bridge_runtime_apis, Chain};
use frame_support::{
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, Weight},
Parameter, RuntimeDebug,
Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-rialto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
paste = "1.0"

# Bridge Dependencies

Expand Down
5 changes: 1 addition & 4 deletions bridges/primitives/chain-rialto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
use bp_messages::{
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
};
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
Chain,
};
use bp_runtime::{decl_bridge_runtime_apis, Chain};
use frame_support::{
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, Weight},
Parameter, RuntimeDebug,
Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
paste = "1.0"
smallvec = "1.7"

# Bridge Dependencies
Expand Down
4 changes: 1 addition & 3 deletions bridges/primitives/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ use sp_std::prelude::*;
use sp_version::RuntimeVersion;

pub use bp_polkadot_core::*;
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
};
use bp_runtime::decl_bridge_runtime_apis;

/// Rococo Chain
pub type Rococo = PolkadotLike;
Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
paste = "1.0"
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
smallvec = "1.7"

Expand Down
1 change: 0 additions & 1 deletion bridges/primitives/chain-wococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
paste = "1.0"

# Bridge Dependencies
bp-messages = { path = "../messages", default-features = false }
Expand Down
4 changes: 1 addition & 3 deletions bridges/primitives/chain-wococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ use sp_std::prelude::*;
pub use bp_polkadot_core::*;
// Rococo runtime = Wococo runtime
pub use bp_rococo::{WeightToFee, EXISTENTIAL_DEPOSIT, PAY_INBOUND_DISPATCH_FEE_WEIGHT, VERSION};
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, decl_bridge_runtime_apis,
};
use bp_runtime::decl_bridge_runtime_apis;

/// Wococo Chain
pub type Wococo = PolkadotLike;
Expand Down
8 changes: 4 additions & 4 deletions bridges/primitives/runtime/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ pub type TransactionEraOf<C> = crate::TransactionEra<BlockNumberOf<C>, HashOf<C>
#[macro_export]
macro_rules! decl_bridge_finality_runtime_apis {
($chain: ident) => {
paste::item! {
bp_runtime::paste::item! {
mod [<$chain _finality_api>] {
use super::*;

Expand Down Expand Up @@ -263,7 +263,7 @@ macro_rules! decl_bridge_finality_runtime_apis {
#[macro_export]
macro_rules! decl_bridge_messages_runtime_apis {
($chain: ident) => {
paste::item! {
bp_runtime::paste::item! {
mod [<$chain _messages_api>] {
use super::*;

Expand Down Expand Up @@ -339,7 +339,7 @@ macro_rules! decl_bridge_messages_runtime_apis {
#[macro_export]
macro_rules! decl_bridge_runtime_apis {
($chain: ident) => {
decl_bridge_finality_runtime_apis!($chain);
decl_bridge_messages_runtime_apis!($chain);
bp_runtime::decl_bridge_finality_runtime_apis!($chain);
bp_runtime::decl_bridge_messages_runtime_apis!($chain);
};
}
3 changes: 3 additions & 0 deletions bridges/primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ pub mod messages;
mod chain;
mod storage_proof;

// Re-export macro to aviod include paste dependency everywhere
pub use sp_runtime::paste;

/// Use this when something must be shared among all instances.
pub const NO_INSTANCE_ID: ChainId = [0, 0, 0, 0];

Expand Down
1 change: 0 additions & 1 deletion bridges/relays/bin-substrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ hex = "0.4"
log = "0.4.17"
num-format = "0.4"
num-traits = "0.2"
paste = "1.0"
rand = "0.8"
structopt = "0.3"
strum = { version = "0.21.0", features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions bridges/relays/bin-substrate/src/cli/chain_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub enum RuntimeVersionType {
#[macro_export]
macro_rules! declare_chain_runtime_version_params_cli_schema {
($chain:ident, $chain_prefix:ident) => {
paste::item! {
bp_runtime::paste::item! {
#[doc = $chain " runtime version params."]
#[derive(StructOpt, Debug, PartialEq, Eq, Clone, Copy)]
pub struct [<$chain RuntimeVersionParams>] {
Expand Down Expand Up @@ -89,7 +89,7 @@ macro_rules! declare_chain_runtime_version_params_cli_schema {
#[macro_export]
macro_rules! declare_chain_connection_params_cli_schema {
($chain:ident, $chain_prefix:ident) => {
paste::item! {
bp_runtime::paste::item! {
#[doc = $chain " connection params."]
#[derive(StructOpt, Debug, PartialEq, Eq, Clone)]
pub struct [<$chain ConnectionParams>] {
Expand Down Expand Up @@ -157,7 +157,7 @@ pub trait TransactionParamsProvider {
#[macro_export]
macro_rules! declare_chain_signing_params_cli_schema {
($chain:ident, $chain_prefix:ident) => {
paste::item! {
bp_runtime::paste::item! {
#[doc = $chain " signing params."]
#[derive(StructOpt, Debug, PartialEq, Eq, Clone)]
pub struct [<$chain SigningParams>] {
Expand Down Expand Up @@ -263,7 +263,7 @@ macro_rules! declare_chain_signing_params_cli_schema {
#[macro_export]
macro_rules! declare_chain_messages_pallet_owner_signing_params_cli_schema {
($chain:ident, $chain_prefix:ident) => {
paste::item! {
bp_runtime::paste::item! {
#[doc = "Parameters required to sign transaction on behalf of owner of the messages pallet at " $chain "."]
#[derive(StructOpt, Debug, PartialEq, Eq)]
pub struct [<$chain MessagesPalletOwnerSigningParams>] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct RelayToParachainBridge<
macro_rules! declare_relay_to_parachain_bridge_schema {
// chain, parachain, relay-chain-of-parachain
($left_chain:ident, $right_parachain:ident, $right_chain:ident) => {
paste::item! {
bp_runtime::paste::item! {
#[doc = $left_chain ", " $right_parachain " and " $right_chain " headers+parachains+messages relay params."]
#[derive(Debug, PartialEq, StructOpt)]
pub struct [<$left_chain $right_parachain HeadersAndMessages>] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct RelayToRelayBridge<

macro_rules! declare_relay_to_relay_bridge_schema {
($left_chain:ident, $right_chain:ident) => {
paste::item! {
bp_runtime::paste::item! {
#[doc = $left_chain " and " $right_chain " headers+messages relay params."]
#[derive(Debug, PartialEq, StructOpt)]
pub struct [<$left_chain $right_chain HeadersAndMessages>] {
Expand Down

0 comments on commit 5ce75bb

Please sign in to comment.