Skip to content

Commit

Permalink
HeaderId -> Hash in simple_runtime_version args
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik committed May 6, 2024
1 parent e5ca322 commit 2a548e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions bridges/relays/client-substrate/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl<C: Chain> Client<C> {

impl<C: Chain> Client<C> {
/// Return simple runtime version, only include `spec_version` and `transaction_version`.
pub async fn simple_runtime_version(&self, at: HeaderIdOf<C>) -> Result<SimpleRuntimeVersion> {
pub async fn simple_runtime_version(&self, at: HashOf<C>) -> Result<SimpleRuntimeVersion> {
Ok(match &self.chain_runtime_version {
ChainRuntimeVersion::Auto => {
let runtime_version = self.runtime_version(at).await?;
Expand Down Expand Up @@ -403,9 +403,9 @@ impl<C: Chain> Client<C> {
}

/// Return runtime version.
pub async fn runtime_version(&self, at: HeaderIdOf<C>) -> Result<RuntimeVersion> {
pub async fn runtime_version(&self, at: HashOf<C>) -> Result<RuntimeVersion> {
self.jsonrpsee_execute(move |client| async move {
Ok(SubstrateStateClient::<C>::runtime_version(&*client, Some(at.hash())).await?)
Ok(SubstrateStateClient::<C>::runtime_version(&*client, Some(at)).await?)
})
.await
}
Expand Down Expand Up @@ -491,7 +491,7 @@ impl<C: Chain> Client<C> {
async fn build_sign_params(
&self,
signer: AccountKeyPairOf<C>,
at: HeaderIdOf<C>,
at: HashOf<C>,
) -> Result<SignParam<C>>
where
C: ChainWithTransactions,
Expand Down Expand Up @@ -520,7 +520,7 @@ impl<C: Chain> Client<C> {
C::AccountId: From<<C::AccountKeyPair as Pair>::Public>,
{
let self_clone = self.clone();
let signing_data = self.build_sign_params(signer.clone(), best_header_id).await?;
let signing_data = self.build_sign_params(signer.clone(), best_header_id.hash()).await?;
let _guard = self.submit_signed_extrinsic_lock.lock().await;
let transaction_nonce = self.next_account_index(signer.public().into()).await?;

Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/client-substrate/src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<C: Chain> Environment<C> for Client<C> {

async fn runtime_version(&mut self) -> Result<RuntimeVersion, Self::Error> {
let best_block_id = self.best_header().await?.id();
Client::<C>::runtime_version(self, best_block_id).await
Client::<C>::runtime_version(self, best_block_id.hash()).await
}
}

Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/lib-substrate-relay/src/equivocation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub trait SubstrateEquivocationDetectionPipeline:
let best_block_id = source_client.best_header().await?.id();
relay_substrate_client::guard::abort_on_spec_version_change(
source_client.clone(),
source_client.simple_runtime_version(best_block_id).await?.spec_version,
source_client.simple_runtime_version(best_block_id.hash()).await?.spec_version,
);
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/lib-substrate-relay/src/finality/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub trait SubstrateFinalitySyncPipeline: BaseSubstrateFinalitySyncPipeline {
let best_block_id = target_client.best_header().await?.id();
relay_substrate_client::guard::abort_on_spec_version_change(
target_client.clone(),
target_client.simple_runtime_version(best_block_id).await?.spec_version,
target_client.simple_runtime_version(best_block_id.hash()).await?.spec_version,
);
}
Ok(())
Expand Down

0 comments on commit 2a548e2

Please sign in to comment.