Some remaining fixes (mostly insubstantial) for relay (#2859)

* if bundled version is `None` and cli said "use bundled" => error

* update chain spec and transaction versions

* use generated runtime wrapper for PBH and KBH

* trigger CI

* Revert "trigger CI"

This reverts commit 7d9f51e34829d9224b352300d062e365243def5e.

* Revert "Revert "trigger CI""

This reverts commit c86ca0e264367e39abad29b9f09f09578a980568.

* Revert "Revert "Revert "trigger CI"""

This reverts commit 95e7da258bb2ace4ed2cafdb01833317f38cfcfc.
This commit is contained in:
Svyatoslav Nikolsky
2024-03-04 17:46:09 +03:00
committed by Bastian Köcher
parent 80604ffeaa
commit a822b82c85
21 changed files with 8234 additions and 81 deletions
@@ -36,15 +36,15 @@ impl MessagesCliBridge for BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge {
substrate_relay_helper::generate_receive_message_proof_call_builder!(
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane,
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesProofCallBuilder,
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaMessages,
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaMessagesCall::receive_messages_proof
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaMessages,
relay_bridge_hub_polkadot_client::BridgeKusamaMessagesCall::receive_messages_proof
);
substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane,
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesDeliveryProofCallBuilder,
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotMessages,
relay_bridge_hub_kusama_client::runtime::BridgePolkadotMessagesCall::receive_messages_delivery_proof
relay_bridge_hub_kusama_client::RuntimeCall::BridgePolkadotMessages,
relay_bridge_hub_kusama_client::BridgeMessagesCall::receive_messages_delivery_proof
);
/// BridgeHubKusama-to-BridgeHubPolkadot messages lane.
@@ -36,15 +36,15 @@ impl MessagesCliBridge for BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge {
substrate_relay_helper::generate_receive_message_proof_call_builder!(
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane,
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLaneReceiveMessagesProofCallBuilder,
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotMessages,
relay_bridge_hub_kusama_client::runtime::BridgePolkadotMessagesCall::receive_messages_proof
relay_bridge_hub_kusama_client::RuntimeCall::BridgePolkadotMessages,
relay_bridge_hub_kusama_client::BridgeMessagesCall::receive_messages_proof
);
substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane,
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLaneReceiveMessagesDeliveryProofCallBuilder,
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaMessages,
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaMessagesCall::receive_messages_delivery_proof
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaMessages,
relay_bridge_hub_polkadot_client::BridgeKusamaMessagesCall::receive_messages_delivery_proof
);
/// BridgeHubPolkadot-to-BridgeHubKusama messages lane.
@@ -34,8 +34,8 @@ pub struct KusamaFinalityToBridgeHubPolkadot;
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
KusamaFinalityToBridgeHubPolkadot,
SubmitFinalityProofCallBuilder,
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaGrandpa,
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaGrandpaCall::submit_finality_proof
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaGrandpa,
relay_bridge_hub_polkadot_client::BridgeKusamaGrandpaCall::submit_finality_proof
);
substrate_relay_helper::generate_report_equivocation_call_builder!(
@@ -44,8 +44,8 @@ impl SubmitParachainHeadsCallBuilder<BridgeHubKusamaToBridgeHubPolkadot>
parachains: Vec<(ParaId, ParaHash)>,
parachain_heads_proof: ParaHeadsProof,
) -> CallOf<relay_bridge_hub_polkadot_client::BridgeHubPolkadot> {
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaParachain(
relay_bridge_hub_polkadot_client::runtime::BridgeParachainCall::submit_parachain_heads {
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaParachains(
relay_bridge_hub_polkadot_client::BridgeParachainCall::submit_parachain_heads {
at_relay_block: (at_relay_block.0, at_relay_block.1),
parachains,
parachain_heads_proof,
@@ -34,8 +34,8 @@ pub struct PolkadotFinalityToBridgeHubKusama;
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
PolkadotFinalityToBridgeHubKusama,
SubmitFinalityProofCallBuilder,
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotGrandpa,
relay_bridge_hub_kusama_client::runtime::BridgePolkadotGrandpaCall::submit_finality_proof
relay_bridge_hub_kusama_client::RuntimeCall::BridgePolkadotGrandpa,
relay_bridge_hub_kusama_client::BridgeGrandpaCall::submit_finality_proof
);
substrate_relay_helper::generate_report_equivocation_call_builder!(
@@ -44,8 +44,8 @@ impl SubmitParachainHeadsCallBuilder<BridgeHubPolkadotToBridgeHubKusama>
parachains: Vec<(ParaId, ParaHash)>,
parachain_heads_proof: ParaHeadsProof,
) -> CallOf<relay_bridge_hub_kusama_client::BridgeHubKusama> {
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotParachain(
bp_parachains::BridgeParachainCall::submit_parachain_heads {
relay_bridge_hub_kusama_client::RuntimeCall::BridgePolkadotParachains(
relay_bridge_hub_kusama_client::BridgeParachainCall::submit_parachain_heads {
at_relay_block: (at_relay_block.0, at_relay_block.1),
parachains,
parachain_heads_proof,
@@ -43,8 +43,9 @@ substrate_relay_helper::generate_receive_message_proof_call_builder!(
substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
BridgeHubPolkadotMessagesToPolkadotBulletinMessageLane,
BridgeHubPolkadotMessagesToPolkadotBulletinMessageLaneReceiveMessagesDeliveryProofCallBuilder,
relay_bridge_hub_polkadot_client::runtime::Call::BridgePolkadotBulletinMessages,
relay_bridge_hub_polkadot_client::runtime::BridgePolkadotBulletinMessagesCall::receive_messages_delivery_proof
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2547 - use BridgePolkadotBulletinMessages
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaMessages,
relay_bridge_hub_polkadot_client::BridgePolkadotBulletinMessagesCall::receive_messages_delivery_proof
);
/// BridgeHubPolkadot-to-PolkadotBulletin messages lane.
@@ -35,8 +35,9 @@ pub struct PolkadotBulletinFinalityToBridgeHubPolkadot;
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
PolkadotBulletinFinalityToBridgeHubPolkadot,
SubmitFinalityProofCallBuilder,
relay_bridge_hub_polkadot_client::runtime::Call::BridgePolkadotBulletinGrandpa,
relay_bridge_hub_polkadot_client::runtime::BridgePolkadotBulletinGrandpaCall::submit_finality_proof
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2547 - use BridgePolkadotBulletinGrandpa
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaGrandpa,
relay_bridge_hub_polkadot_client::BridgePolkadotBulletinGrandpaCall::submit_finality_proof
);
substrate_relay_helper::generate_report_equivocation_call_builder!(
@@ -36,8 +36,9 @@ impl MessagesCliBridge for PolkadotBulletinToBridgeHubPolkadotMessagesCliBridge
substrate_relay_helper::generate_receive_message_proof_call_builder!(
PolkadotBulletinMessagesToBridgeHubPolkadotMessageLane,
PolkadotBulletinMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesProofCallBuilder,
relay_bridge_hub_polkadot_client::runtime::Call::BridgePolkadotBulletinMessages,
relay_bridge_hub_polkadot_client::runtime::BridgePolkadotBulletinMessagesCall::receive_messages_proof
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2547 - use BridgePolkadotBulletinMessages
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaMessages,
relay_bridge_hub_polkadot_client::BridgePolkadotBulletinMessagesCall::receive_messages_proof
);
substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
@@ -22,10 +22,11 @@ use relay_kusama_client::Kusama;
use relay_substrate_client::SimpleRuntimeVersion;
impl CliChain for Kusama {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> = None;
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 1_001_002, transaction_version: 25 });
}
impl CliChain for BridgeHubKusama {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 9410, transaction_version: 21 });
Some(SimpleRuntimeVersion { spec_version: 1_001_000, transaction_version: 4 });
}
@@ -22,10 +22,11 @@ use relay_polkadot_client::Polkadot;
use relay_substrate_client::SimpleRuntimeVersion;
impl CliChain for Polkadot {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> = None;
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 1_001_002, transaction_version: 25 });
}
impl CliChain for BridgeHubPolkadot {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 9410, transaction_version: 22 });
Some(SimpleRuntimeVersion { spec_version: 1_001_000, transaction_version: 3 });
}
@@ -22,10 +22,11 @@ use relay_rococo_client::Rococo;
use relay_substrate_client::SimpleRuntimeVersion;
impl CliChain for Rococo {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> = None;
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 1_008_000, transaction_version: 24 });
}
impl CliChain for BridgeHubRococo {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 1_003_000, transaction_version: 3 });
Some(SimpleRuntimeVersion { spec_version: 1_008_000, transaction_version: 4 });
}
@@ -22,10 +22,11 @@ use relay_substrate_client::SimpleRuntimeVersion;
use relay_westend_client::Westend;
impl CliChain for Westend {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> = None;
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 1_008_000, transaction_version: 24 });
}
impl CliChain for BridgeHubWestend {
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
Some(SimpleRuntimeVersion { spec_version: 1_003_000, transaction_version: 3 });
Some(SimpleRuntimeVersion { spec_version: 1_008_000, transaction_version: 4 });
}
@@ -75,7 +75,9 @@ macro_rules! declare_chain_runtime_version_params_cli_schema {
},
RuntimeVersionType::Bundle => match bundle_runtime_version {
Some(runtime_version) => ChainRuntimeVersion::Custom(runtime_version),
None => ChainRuntimeVersion::Auto
None => {
return Err(anyhow::format_err!("Cannot use bundled runtime version of {}: it is not known to the relay", stringify!($chain_prefix)));
}
},
})
}
@@ -146,10 +146,8 @@ impl BridgeInitializer for KusamaToBridgeHubPolkadotCliBridge {
fn encode_init_bridge(
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
) -> <Self::Target as Chain>::Call {
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaGrandpa(
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaGrandpaCall::initialize {
init_data,
},
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaGrandpa(
relay_bridge_hub_polkadot_client::BridgeKusamaGrandpaCall::initialize { init_data },
)
}
}
@@ -160,10 +158,8 @@ impl BridgeInitializer for PolkadotToBridgeHubKusamaCliBridge {
fn encode_init_bridge(
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
) -> <Self::Target as Chain>::Call {
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotGrandpa(
relay_bridge_hub_kusama_client::runtime::BridgePolkadotGrandpaCall::initialize {
init_data,
},
relay_bridge_hub_kusama_client::RuntimeCall::BridgePolkadotGrandpa(
relay_bridge_hub_kusama_client::BridgeGrandpaCall::initialize { init_data },
)
}
}
@@ -191,8 +187,9 @@ impl BridgeInitializer for PolkadotBulletinToBridgeHubPolkadotCliBridge {
fn encode_init_bridge(
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
) -> <Self::Target as Chain>::Call {
relay_bridge_hub_polkadot_client::runtime::Call::BridgePolkadotBulletinGrandpa(
relay_bridge_hub_polkadot_client::runtime::BridgePolkadotBulletinGrandpaCall::initialize {
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2547 - use BridgePolkadotBulletinGrandpa
relay_bridge_hub_polkadot_client::RuntimeCall::BridgeKusamaGrandpa(
relay_bridge_hub_polkadot_client::BridgePolkadotBulletinGrandpaCall::initialize {
init_data,
},
)
@@ -11,19 +11,22 @@ workspace = true
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
relay-substrate-client = { path = "../client-substrate" }
#relay-substrate-client = { path = "../client-substrate" }
subxt = { version = "0.32.1", default-features = false, features = ["native"] }
# Bridge dependencies
bp-bridge-hub-kusama = { path = "../../primitives/chain-bridge-hub-kusama" }
bp-bridge-hub-polkadot = { path = "../../primitives/chain-bridge-hub-polkadot" }
bp-header-chain = { path = "../../primitives/header-chain" }
bp-messages = { path = "../../primitives/messages" }
bp-parachains = { path = "../../primitives/parachains" }
bp-polkadot = { path = "../../primitives/chain-polkadot" }
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
bridge-runtime-common = { path = "../../bin/runtime-common" }
relay-substrate-client = { path = "../client-substrate" }
# Substrate Dependencies
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
File diff suppressed because it is too large Load Diff
@@ -16,21 +16,28 @@
//! Types used to connect to the BridgeHub-Kusama-Substrate parachain.
use bp_bridge_hub_kusama::AVERAGE_BLOCK_INTERVAL;
pub mod codegen_runtime;
use bp_bridge_hub_kusama::{SignedExtension, AVERAGE_BLOCK_INTERVAL};
use bp_polkadot::SuffixedCommonSignedExtensionExt;
use codec::Encode;
use relay_substrate_client::{
Chain, ChainWithBalances, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet,
Error as SubstrateError, MockedRuntimeUtilityPallet, SignParam, UnderlyingChainProvider,
UnsignedTransaction,
calls::UtilityCall as MockUtilityCall, Chain, ChainWithBalances, ChainWithMessages,
ChainWithTransactions, ChainWithUtilityPallet, Error as SubstrateError,
MockedRuntimeUtilityPallet, SignParam, UnderlyingChainProvider, UnsignedTransaction,
};
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount};
use std::time::Duration;
/// Re-export runtime wrapper
pub mod runtime_wrapper;
pub use runtime_wrapper as runtime;
pub use codegen_runtime::api::runtime_types;
pub type RuntimeCall = runtime_types::bridge_hub_kusama_runtime::RuntimeCall;
pub type BridgeMessagesCall = runtime_types::pallet_bridge_messages::pallet::Call;
pub type BridgeGrandpaCall = runtime_types::pallet_bridge_grandpa::pallet::Call;
pub type BridgeParachainCall = runtime_types::pallet_bridge_parachains::pallet::Call;
type UncheckedExtrinsic = bp_bridge_hub_kusama::UncheckedExtrinsic<RuntimeCall, SignedExtension>;
type UtilityCall = runtime_types::pallet_utility::pallet::Call;
/// Kusama chain definition
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -47,7 +54,7 @@ impl Chain for BridgeHubKusama {
const AVERAGE_BLOCK_INTERVAL: Duration = AVERAGE_BLOCK_INTERVAL;
type SignedBlock = bp_bridge_hub_kusama::SignedBlock;
type Call = runtime::Call;
type Call = RuntimeCall;
}
impl ChainWithBalances for BridgeHubKusama {
@@ -56,13 +63,22 @@ impl ChainWithBalances for BridgeHubKusama {
}
}
impl From<MockUtilityCall<RuntimeCall>> for RuntimeCall {
fn from(value: MockUtilityCall<RuntimeCall>) -> RuntimeCall {
match value {
MockUtilityCall::batch_all(calls) =>
RuntimeCall::Utility(UtilityCall::batch_all { calls }),
}
}
}
impl ChainWithUtilityPallet for BridgeHubKusama {
type UtilityPallet = MockedRuntimeUtilityPallet<runtime::Call>;
type UtilityPallet = MockedRuntimeUtilityPallet<RuntimeCall>;
}
impl ChainWithTransactions for BridgeHubKusama {
type AccountKeyPair = sp_core::sr25519::Pair;
type SignedTransaction = runtime::UncheckedExtrinsic;
type SignedTransaction = UncheckedExtrinsic;
fn sign_transaction(
param: SignParam<Self>,
@@ -70,7 +86,7 @@ impl ChainWithTransactions for BridgeHubKusama {
) -> Result<Self::SignedTransaction, SubstrateError> {
let raw_payload = SignedPayload::new(
unsigned.call,
runtime::SignedExtension::from_params(
SignedExtension::from_params(
param.spec_version,
param.transaction_version,
unsigned.era,
@@ -85,7 +101,7 @@ impl ChainWithTransactions for BridgeHubKusama {
let signer: sp_runtime::MultiSigner = param.signer.public().into();
let (call, extra, _) = raw_payload.deconstruct();
Ok(runtime::UncheckedExtrinsic::new_signed(
Ok(UncheckedExtrinsic::new_signed(
call,
signer.into_account().into(),
signature.into(),
@@ -127,13 +143,13 @@ mod tests {
use super::*;
use relay_substrate_client::TransactionEra;
type SystemCall = runtime_types::frame_system::pallet::Call;
#[test]
fn parse_transaction_works() {
let unsigned = UnsignedTransaction {
call: runtime::Call::System(relay_substrate_client::calls::SystemCall::remark(
b"Hello world!".to_vec(),
))
.into(),
call: RuntimeCall::System(SystemCall::remark { remark: b"Hello world!".to_vec() })
.into(),
nonce: 777,
tip: 888,
era: TransactionEra::immortal(),
@@ -11,26 +11,23 @@ workspace = true
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
relay-substrate-client = { path = "../client-substrate" }
subxt = { version = "0.32.1", default-features = false, features = ["native"] }
# Bridge dependencies
bp-bridge-hub-kusama = { path = "../../primitives/chain-bridge-hub-kusama" }
bp-bridge-hub-polkadot = { path = "../../primitives/chain-bridge-hub-polkadot" }
bp-header-chain = { path = "../../primitives/header-chain" }
bp-messages = { path = "../../primitives/messages" }
bp-parachains = { path = "../../primitives/parachains" }
bp-polkadot-bulletin = { path = "../../primitives/chain-polkadot-bulletin" }
bp-polkadot = { path = "../../primitives/chain-polkadot" }
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
bp-kusama = { path = "../../primitives/chain-kusama" }
bp-runtime = { path = "../../primitives/runtime" }
bridge-runtime-common = { path = "../../bin/runtime-common" }
relay-substrate-client = { path = "../client-substrate" }
# Substrate Dependencies
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
[dev-dependencies]
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
File diff suppressed because it is too large Load Diff
@@ -16,21 +16,32 @@
//! Types used to connect to the BridgeHub-Polkadot-Substrate parachain.
use bp_bridge_hub_polkadot::AVERAGE_BLOCK_INTERVAL;
pub mod codegen_runtime;
use bp_bridge_hub_polkadot::{SignedExtension, AVERAGE_BLOCK_INTERVAL};
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
use codec::Encode;
use relay_substrate_client::{
Chain, ChainWithBalances, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet,
Error as SubstrateError, MockedRuntimeUtilityPallet, SignParam, UnderlyingChainProvider,
UnsignedTransaction,
calls::UtilityCall as MockUtilityCall, Chain, ChainWithBalances, ChainWithMessages,
ChainWithTransactions, ChainWithUtilityPallet, Error as SubstrateError,
MockedRuntimeUtilityPallet, SignParam, UnderlyingChainProvider, UnsignedTransaction,
};
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount};
use std::time::Duration;
/// Re-export runtime wrapper
pub mod runtime_wrapper;
pub use runtime_wrapper as runtime;
pub use codegen_runtime::api::runtime_types;
pub type RuntimeCall = runtime_types::bridge_hub_polkadot_runtime::RuntimeCall;
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2547 - regenerate when ready
pub type BridgePolkadotBulletinMessagesCall = runtime_types::pallet_bridge_messages::pallet::Call;
pub type BridgeKusamaMessagesCall = runtime_types::pallet_bridge_messages::pallet::Call;
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2547 - regenerate when ready
pub type BridgePolkadotBulletinGrandpaCall = runtime_types::pallet_bridge_grandpa::pallet::Call;
pub type BridgeKusamaGrandpaCall = runtime_types::pallet_bridge_grandpa::pallet::Call;
pub type BridgeParachainCall = runtime_types::pallet_bridge_parachains::pallet::Call;
type UncheckedExtrinsic = bp_bridge_hub_polkadot::UncheckedExtrinsic<RuntimeCall, SignedExtension>;
type UtilityCall = runtime_types::pallet_utility::pallet::Call;
/// Polkadot chain definition
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -47,7 +58,7 @@ impl Chain for BridgeHubPolkadot {
const AVERAGE_BLOCK_INTERVAL: Duration = AVERAGE_BLOCK_INTERVAL;
type SignedBlock = bp_bridge_hub_polkadot::SignedBlock;
type Call = runtime::Call;
type Call = RuntimeCall;
}
impl ChainWithBalances for BridgeHubPolkadot {
@@ -56,13 +67,22 @@ impl ChainWithBalances for BridgeHubPolkadot {
}
}
impl From<MockUtilityCall<RuntimeCall>> for RuntimeCall {
fn from(value: MockUtilityCall<RuntimeCall>) -> RuntimeCall {
match value {
MockUtilityCall::batch_all(calls) =>
RuntimeCall::Utility(UtilityCall::batch_all { calls }),
}
}
}
impl ChainWithUtilityPallet for BridgeHubPolkadot {
type UtilityPallet = MockedRuntimeUtilityPallet<runtime::Call>;
type UtilityPallet = MockedRuntimeUtilityPallet<RuntimeCall>;
}
impl ChainWithTransactions for BridgeHubPolkadot {
type AccountKeyPair = sp_core::sr25519::Pair;
type SignedTransaction = runtime::UncheckedExtrinsic;
type SignedTransaction = UncheckedExtrinsic;
fn sign_transaction(
param: SignParam<Self>,
@@ -70,7 +90,7 @@ impl ChainWithTransactions for BridgeHubPolkadot {
) -> Result<Self::SignedTransaction, SubstrateError> {
let raw_payload = SignedPayload::new(
unsigned.call,
runtime::SignedExtension::from_params(
SignedExtension::from_params(
param.spec_version,
param.transaction_version,
unsigned.era,
@@ -85,7 +105,7 @@ impl ChainWithTransactions for BridgeHubPolkadot {
let signer: sp_runtime::MultiSigner = param.signer.public().into();
let (call, extra, _) = raw_payload.deconstruct();
Ok(runtime::UncheckedExtrinsic::new_signed(
Ok(UncheckedExtrinsic::new_signed(
call,
signer.into_account().into(),
signature.into(),
@@ -127,10 +147,12 @@ mod tests {
use super::*;
use relay_substrate_client::TransactionEra;
type SystemCall = runtime_types::frame_system::pallet::Call;
#[test]
fn parse_transaction_works() {
let unsigned = UnsignedTransaction {
call: runtime::Call::System(runtime::SystemCall::remark(b"Hello world!".to_vec()))
call: RuntimeCall::System(SystemCall::remark { remark: b"Hello world!".to_vec() })
.into(),
nonce: 777,
tip: 888,