Set R/WococoBridgeHub bundle runtime version (#1756)

* Define SimpleRuntimeVersion

* Set R/WococoBridgeHub bundle runtime version
This commit is contained in:
Serban Iorga
2023-01-11 09:45:22 +02:00
committed by Bastian Köcher
parent 70eb076ab2
commit b4c338f77d
14 changed files with 68 additions and 50 deletions
@@ -20,7 +20,7 @@ use structopt::StructOpt;
use strum::{EnumString, EnumVariantNames};
use crate::cli::CliChain;
pub use relay_substrate_client::ChainRuntimeVersion;
pub use relay_substrate_client::{ChainRuntimeVersion, SimpleRuntimeVersion};
use substrate_relay_helper::TransactionParams;
#[doc = "Runtime version params."]
@@ -57,25 +57,24 @@ macro_rules! declare_chain_runtime_version_params_cli_schema {
/// Converts self into `ChainRuntimeVersion`.
pub fn into_runtime_version(
self,
bundle_runtime_version: Option<sp_version::RuntimeVersion>,
bundle_runtime_version: Option<SimpleRuntimeVersion>,
) -> anyhow::Result<ChainRuntimeVersion> {
Ok(match self.[<$chain_prefix _version_mode>] {
RuntimeVersionType::Auto => ChainRuntimeVersion::Auto,
RuntimeVersionType::Custom => {
let except_spec_version = self.[<$chain_prefix _spec_version>]
let custom_spec_version = self.[<$chain_prefix _spec_version>]
.ok_or_else(|| anyhow::Error::msg(format!("The {}-spec-version is required when choose custom mode", stringify!($chain_prefix))))?;
let except_transaction_version = self.[<$chain_prefix _transaction_version>]
let custom_transaction_version = self.[<$chain_prefix _transaction_version>]
.ok_or_else(|| anyhow::Error::msg(format!("The {}-transaction-version is required when choose custom mode", stringify!($chain_prefix))))?;
ChainRuntimeVersion::Custom(
except_spec_version,
except_transaction_version
SimpleRuntimeVersion {
spec_version: custom_spec_version,
transaction_version: custom_transaction_version
}
)
},
RuntimeVersionType::Bundle => match bundle_runtime_version {
Some(runtime_version) => ChainRuntimeVersion::Custom(
runtime_version.spec_version,
runtime_version.transaction_version
),
Some(runtime_version) => ChainRuntimeVersion::Custom(runtime_version),
None => ChainRuntimeVersion::Auto
},
})
+2 -1
View File
@@ -28,6 +28,7 @@ use structopt::{clap::arg_enum, StructOpt};
use strum::{EnumString, EnumVariantNames};
use bp_messages::LaneId;
use relay_substrate_client::SimpleRuntimeVersion;
pub(crate) mod bridge;
pub(crate) mod encode_message;
@@ -194,7 +195,7 @@ pub trait CliChain: relay_substrate_client::Chain {
/// Current version of the chain runtime, known to relay.
///
/// can be `None` if relay is not going to submit transactions to that chain.
const RUNTIME_VERSION: Option<sp_version::RuntimeVersion>;
const RUNTIME_VERSION: Option<SimpleRuntimeVersion>;
}
/// Lane id.
@@ -403,7 +403,7 @@ async fn update_transaction_tip<C: ChainWithTransactions>(
})?;
let old_tip = unsigned_tx.tip;
let (spec_version, transaction_version) = client.simple_runtime_version().await?;
let runtime_version = client.simple_runtime_version().await?;
while current_priority < target_priority {
let next_tip = unsigned_tx.tip + tip_step;
if next_tip > tip_limit {
@@ -425,8 +425,8 @@ async fn update_transaction_tip<C: ChainWithTransactions>(
at_block.1,
C::sign_transaction(
SignParam {
spec_version,
transaction_version,
spec_version: runtime_version.spec_version,
transaction_version: runtime_version.transaction_version,
genesis_hash: *client.genesis_hash(),
signer: transaction_params.signer.clone(),
},
@@ -449,8 +449,8 @@ async fn update_transaction_tip<C: ChainWithTransactions>(
old_tip != unsigned_tx.tip,
C::sign_transaction(
SignParam {
spec_version,
transaction_version,
spec_version: runtime_version.spec_version,
transaction_version: runtime_version.transaction_version,
genesis_hash: *client.genesis_hash(),
signer: transaction_params.signer.clone(),
},