From 8e46da77ee260d4f784c734a50bd7bde55a6e16d Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 25 May 2023 17:47:52 +0300 Subject: [PATCH] Remove support for chainHead_storage for light client Signed-off-by: Alexandru Vasile --- examples/examples/unstable_light_client.rs | 17 ----------------- subxt/src/rpc/types.rs | 9 --------- testing/integration-tests/src/client/mod.rs | 6 ++---- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/examples/examples/unstable_light_client.rs b/examples/examples/unstable_light_client.rs index 27de4d2de0..efac778f44 100644 --- a/examples/examples/unstable_light_client.rs +++ b/examples/examples/unstable_light_client.rs @@ -13,11 +13,9 @@ //! This feature is experimental and things might break without notice. use futures::StreamExt; -use sp_keyring::AccountKeyring; use std::sync::Arc; use subxt::{ rpc::{types::FollowEvent, LightClient}, - utils::AccountId32, OnlineClient, PolkadotConfig, }; @@ -82,21 +80,6 @@ async fn main() -> Result<(), Box> { } else { println!(" chainHead_header: Header not in memory for {hash}"); } - - // Make a storage query. - let account_id: AccountId32 = AccountKeyring::Alice.to_account_id().into(); - let addr = polkadot::storage().system().account(account_id); - let addr_bytes = api.storage().address_bytes(&addr).unwrap(); - - let mut sub = api - .rpc() - .chainhead_unstable_storage(sub_id.clone(), hash, &addr_bytes, None) - .await?; - - if let Some(event) = sub.next().await { - let event = event?; - println!(" chainHead_storage event: {event:?}"); - } } } diff --git a/subxt/src/rpc/types.rs b/subxt/src/rpc/types.rs index 3c1794a1f4..14b7fff42b 100644 --- a/subxt/src/rpc/types.rs +++ b/subxt/src/rpc/types.rs @@ -509,16 +509,7 @@ pub enum FollowEvent { #[serde(rename_all = "camelCase")] pub struct ChainHeadResult { /// Result of the method. - #[cfg(not(feature = "unstable-light-client"))] pub result: T, - /// Result of the method. - /// - /// # Note - /// - /// `chainHead_body` returns a vector of values, while - /// `chainHead_storage` returns just one plain element. - #[cfg(feature = "unstable-light-client")] - pub value: T, } /// The event generated by the body / call / storage methods. diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index b2e36185ef..a33d13d64b 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -501,9 +501,8 @@ async fn chainhead_unstable_body() { let extrinsics: Vec> = body.block.extrinsics.into_iter().map(|ext| ext.0).collect(); let expected = format!("0x{}", hex::encode(extrinsics.encode())); - #[cfg(feature = "unstable-light-client")] assert_matches!(event, - ChainHeadEvent::Done(done) if done.value == expected + ChainHeadEvent::Done(done) if done.result == expected ); } @@ -557,8 +556,7 @@ async fn chainhead_unstable_storage() { .unwrap(); let event = sub.next().await.unwrap().unwrap(); - #[cfg(feature = "unstable-light-client")] - assert_matches!(event, ChainHeadEvent::>::Done(done) if done.value.is_some()); + assert_matches!(event, ChainHeadEvent::>::Done(done) if done.result.is_some()); } #[tokio::test]