From 5605372302f6966b3d40f3605ff09ae196f73f04 Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Fri, 7 Jul 2023 16:33:21 +0300 Subject: [PATCH] Define generate_grandpa_key_ownership_proof() (#2247) (#2248) --- bridges/relays/client-substrate/Cargo.toml | 1 + bridges/relays/client-substrate/src/client.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/bridges/relays/client-substrate/Cargo.toml b/bridges/relays/client-substrate/Cargo.toml index 4dd7975280409..359f049d9dbd0 100644 --- a/bridges/relays/client-substrate/Cargo.toml +++ b/bridges/relays/client-substrate/Cargo.toml @@ -39,6 +39,7 @@ pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "ma sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/bridges/relays/client-substrate/src/client.rs b/bridges/relays/client-substrate/src/client.rs index a1c8a22be19d0..8a0875a89763e 100644 --- a/bridges/relays/client-substrate/src/client.rs +++ b/bridges/relays/client-substrate/src/client.rs @@ -52,6 +52,8 @@ use sp_version::RuntimeVersion; use std::future::Future; const SUB_API_GRANDPA_AUTHORITIES: &str = "GrandpaApi_grandpa_authorities"; +const SUB_API_GRANDPA_GENERATE_KEY_OWNERSHIP_PROOF: &str = + "GrandpaApi_generate_key_ownership_proof"; const SUB_API_TXPOOL_VALIDATE_TRANSACTION: &str = "TaggedTransactionQueue_validate_transaction"; const SUB_API_TX_PAYMENT_QUERY_INFO: &str = "TransactionPaymentApi_query_info"; const MAX_SUBSCRIPTION_CAPACITY: usize = 4096; @@ -713,6 +715,23 @@ impl Client { Ok(Subscription(Mutex::new(receiver))) } + // TODO: remove warning after implementing + // https://github.com/paritytech/parity-bridges-common/issues/39 + #[allow(dead_code)] + async fn generate_grandpa_key_ownership_proof( + &self, + at: HashOf, + set_id: sp_consensus_grandpa::SetId, + authority_id: sp_consensus_grandpa::AuthorityId, + ) -> Result> { + self.typed_state_call( + SUB_API_GRANDPA_GENERATE_KEY_OWNERSHIP_PROOF.into(), + (set_id, authority_id), + Some(at), + ) + .await + } + /// Execute jsonrpsee future in tokio context. async fn jsonrpsee_execute(&self, make_jsonrpsee_future: MF) -> Result where