From 5e68a81a65bab5dbf1ac954edfdb78974658bd5e Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Tue, 2 Apr 2024 11:39:39 +0200 Subject: [PATCH 01/14] version with hash and hashoutput --- .../frame/remote-externalities/src/lib.rs | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index 254d33deec80..9e9efd444435 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -36,7 +36,7 @@ use sp_core::{ }, }; use sp_runtime::{ - traits::{Block as BlockT, HashingFor}, + traits::{Block as BlockT, HashingFor, Hash, HashOutput}, StateVersion, }; use sp_state_machine::TestExternalities; @@ -63,21 +63,21 @@ const SNAPSHOT_VERSION: SnapshotVersion = Compact(3); /// The snapshot that we store on disk. #[derive(Decode, Encode)] -struct Snapshot { +struct Snapshot { snapshot_version: SnapshotVersion, state_version: StateVersion, - block_hash: B::Hash, + block_hash: H, // > raw_storage: Vec<(Vec, (Vec, i32))>, - storage_root: B::Hash, + storage_root: H, } -impl Snapshot { +impl Snapshot { pub fn new( state_version: StateVersion, - block_hash: B::Hash, + block_hash: H, raw_storage: Vec<(Vec, (Vec, i32))>, - storage_root: B::Hash, + storage_root: H, ) -> Self { Self { snapshot_version: SNAPSHOT_VERSION, @@ -88,7 +88,7 @@ impl Snapshot { } } - fn load(path: &PathBuf) -> Result, &'static str> { + fn load(path: &PathBuf) -> Result, &'static str> { let bytes = fs::read(path).map_err(|_| "fs::read failed.")?; // The first item in the SCALE encoded struct bytes is the snapshot version. We decode and // check that first, before proceeding to decode the rest of the snapshot. @@ -105,21 +105,21 @@ impl Snapshot { /// An externalities that acts exactly the same as [`sp_io::TestExternalities`] but has a few extra /// bits and pieces to it, and can be loaded remotely. -pub struct RemoteExternalities { +pub struct RemoteExternalities { /// The inner externalities. - pub inner_ext: TestExternalities>, - /// The block hash it which we created this externality env. - pub block_hash: B::Hash, + pub inner_ext: TestExternalities, + /// The block hash with which we created this externality env. + pub block_hash: H::Out, } -impl Deref for RemoteExternalities { - type Target = TestExternalities>; +impl Deref for RemoteExternalities { + type Target = TestExternalities; fn deref(&self) -> &Self::Target { &self.inner_ext } } -impl DerefMut for RemoteExternalities { +impl DerefMut for RemoteExternalities { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.inner_ext } @@ -127,16 +127,16 @@ impl DerefMut for RemoteExternalities { /// The execution mode. #[derive(Clone)] -pub enum Mode { +pub enum Mode { /// Online. Potentially writes to a snapshot file. - Online(OnlineConfig), + Online(OnlineConfig), /// Offline. Uses a state snapshot file and needs not any client config. Offline(OfflineConfig), /// Prefer using a snapshot file if it exists, else use a remote server. - OfflineOrElseOnline(OfflineConfig, OnlineConfig), + OfflineOrElseOnline(OfflineConfig, OnlineConfig), } -impl Default for Mode { +impl Default for Mode { fn default() -> Self { Mode::Online(OnlineConfig::default()) } @@ -221,10 +221,10 @@ impl From for Transport { /// /// A state snapshot config may be present and will be written to in that case. #[derive(Clone)] -pub struct OnlineConfig { +pub struct OnlineConfig { /// The block hash at which to get the runtime state. Will be latest finalized head if not /// provided. - pub at: Option, + pub at: Option, /// An optional state snapshot file to WRITE to, not for reading. Not written if set to `None`. pub state_snapshot: Option, /// The pallets to scrape. These values are hashed and added to `hashed_prefix`. @@ -240,7 +240,7 @@ pub struct OnlineConfig { pub hashed_keys: Vec>, } -impl OnlineConfig { +impl OnlineConfig { /// Return rpc (http) client reference. fn rpc_client(&self) -> &HttpClient { self.transport @@ -248,12 +248,12 @@ impl OnlineConfig { .expect("http client must have been initialized by now; qed.") } - fn at_expected(&self) -> B::Hash { + fn at_expected(&self) -> H { self.at.expect("block at must be initialized; qed") } } -impl Default for OnlineConfig { +impl Default for OnlineConfig { fn default() -> Self { Self { transport: Transport::from(DEFAULT_HTTP_ENDPOINT.to_owned()), @@ -267,7 +267,7 @@ impl Default for OnlineConfig { } } -impl From for OnlineConfig { +impl From for OnlineConfig { fn from(t: String) -> Self { Self { transport: t.into(), ..Default::default() } } @@ -307,7 +307,7 @@ pub struct Builder { /// The keys that will be excluded from the final externality. The *hashed* key must be given. hashed_blacklist: Vec>, /// Connectivity mode, online or offline. - mode: Mode, + mode: Mode, /// If provided, overwrite the state version with this. Otherwise, the state_version of the /// remote node is used. All cache files also store their state version. /// @@ -328,7 +328,7 @@ impl Default for Builder { // Mode methods impl Builder { - fn as_online(&self) -> &OnlineConfig { + fn as_online(&self) -> &OnlineConfig { match &self.mode { Mode::Online(config) => config, Mode::OfflineOrElseOnline(_, config) => config, @@ -336,7 +336,7 @@ impl Builder { } } - fn as_online_mut(&mut self) -> &mut OnlineConfig { + fn as_online_mut(&mut self) -> &mut OnlineConfig { match &mut self.mode { Mode::Online(config) => config, Mode::OfflineOrElseOnline(_, config) => config, @@ -1055,7 +1055,7 @@ where // If we need to save a snapshot, save the raw storage and root hash to the snapshot. if let Some(path) = self.as_online().state_snapshot.clone().map(|c| c.path) { let (raw_storage, storage_root) = pending_ext.into_raw_snapshot(); - let snapshot = Snapshot::::new( + let snapshot = Snapshot::::new( state_version, self.as_online() .at @@ -1083,7 +1083,7 @@ where Ok(pending_ext) } - async fn do_load_remote(&mut self) -> Result, &'static str> { + async fn do_load_remote(&mut self) -> Result>, &'static str> { self.init_remote_client().await?; let block_hash = self.as_online().at_expected(); let inner_ext = self.load_remote_and_maybe_save().await?; @@ -1093,12 +1093,12 @@ where fn do_load_offline( &mut self, config: OfflineConfig, - ) -> Result, &'static str> { + ) -> Result>, &'static str> { let mut sp = Spinner::with_timer(Spinners::Dots, "Loading snapshot...".into()); let start = Instant::now(); info!(target: LOG_TARGET, "Loading snapshot from {:?}", &config.state_snapshot.path); let Snapshot { snapshot_version: _, block_hash, state_version, raw_storage, storage_root } = - Snapshot::::load(&config.state_snapshot.path)?; + Snapshot::::load(&config.state_snapshot.path)?; let inner_ext = TestExternalities::from_raw_snapshot( raw_storage, @@ -1110,7 +1110,7 @@ where Ok(RemoteExternalities { inner_ext, block_hash }) } - pub(crate) async fn pre_build(mut self) -> Result, &'static str> { + pub(crate) async fn pre_build(mut self) -> Result>, &'static str> { let mut ext = match self.mode.clone() { Mode::Offline(config) => self.do_load_offline(config)?, Mode::Online(_) => self.do_load_remote().await?, @@ -1175,7 +1175,7 @@ where } /// Configure a state snapshot to be used. - pub fn mode(mut self, mode: Mode) -> Self { + pub fn mode(mut self, mode: Mode) -> Self { self.mode = mode; self } @@ -1186,7 +1186,7 @@ where self } - pub async fn build(self) -> Result, &'static str> { + pub async fn build(self) -> Result>, &'static str> { let mut ext = self.pre_build().await?; ext.commit_all().unwrap(); From 860ec01ff06afbb06c13fe341875961e9dfc4f9a Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Wed, 3 Apr 2024 19:06:48 +0200 Subject: [PATCH 02/14] update other types calls --- substrate/frame/state-trie-migration/src/lib.rs | 2 +- substrate/utils/frame/try-runtime/cli/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/substrate/frame/state-trie-migration/src/lib.rs b/substrate/frame/state-trie-migration/src/lib.rs index 6e1de865ab4f..623558f57599 100644 --- a/substrate/frame/state-trie-migration/src/lib.rs +++ b/substrate/frame/state-trie-migration/src/lib.rs @@ -1698,7 +1698,7 @@ pub(crate) mod remote_tests { /// /// This will print some very useful statistics, make sure [`crate::LOG_TARGET`] is enabled. #[allow(dead_code)] - pub(crate) async fn run_with_limits(limits: MigrationLimits, mode: Mode) + pub(crate) async fn run_with_limits(limits: MigrationLimits, mode: Mode) where Runtime: crate::Config, Block: BlockT + DeserializeOwned, diff --git a/substrate/utils/frame/try-runtime/cli/src/lib.rs b/substrate/utils/frame/try-runtime/cli/src/lib.rs index 73952ce816af..606cf8a1e144 100644 --- a/substrate/utils/frame/try-runtime/cli/src/lib.rs +++ b/substrate/utils/frame/try-runtime/cli/src/lib.rs @@ -288,7 +288,7 @@ impl State { executor: &WasmExecutor, state_snapshot: Option, try_runtime_check: bool, - ) -> sc_cli::Result> + ) -> sc_cli::Result>> where Block::Header: DeserializeOwned, ::Err: Debug, From 7b3402b639bf76d8c63f40d79a12b5391dc3460c Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Wed, 3 Apr 2024 18:58:52 +0000 Subject: [PATCH 03/14] ".git/.scripts/commands/fmt/fmt.sh" --- substrate/frame/state-trie-migration/src/lib.rs | 6 ++++-- substrate/utils/frame/remote-externalities/src/lib.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/substrate/frame/state-trie-migration/src/lib.rs b/substrate/frame/state-trie-migration/src/lib.rs index 623558f57599..5c54c27966cd 100644 --- a/substrate/frame/state-trie-migration/src/lib.rs +++ b/substrate/frame/state-trie-migration/src/lib.rs @@ -1698,8 +1698,10 @@ pub(crate) mod remote_tests { /// /// This will print some very useful statistics, make sure [`crate::LOG_TARGET`] is enabled. #[allow(dead_code)] - pub(crate) async fn run_with_limits(limits: MigrationLimits, mode: Mode) - where + pub(crate) async fn run_with_limits( + limits: MigrationLimits, + mode: Mode, + ) where Runtime: crate::Config, Block: BlockT + DeserializeOwned, Block::Header: serde::de::DeserializeOwned, diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index 9e9efd444435..fbdb451be92a 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -36,7 +36,7 @@ use sp_core::{ }, }; use sp_runtime::{ - traits::{Block as BlockT, HashingFor, Hash, HashOutput}, + traits::{Block as BlockT, Hash, HashOutput, HashingFor}, StateVersion, }; use sp_state_machine::TestExternalities; @@ -1110,7 +1110,9 @@ where Ok(RemoteExternalities { inner_ext, block_hash }) } - pub(crate) async fn pre_build(mut self) -> Result>, &'static str> { + pub(crate) async fn pre_build( + mut self, + ) -> Result>, &'static str> { let mut ext = match self.mode.clone() { Mode::Offline(config) => self.do_load_offline(config)?, Mode::Online(_) => self.do_load_remote().await?, From 9d76cf2edec4be46a80ecce60fb1027b7b16cff0 Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Sat, 6 Apr 2024 23:32:42 +0200 Subject: [PATCH 04/14] add prdoc --- prdoc/pr_3953.prdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 prdoc/pr_3953.prdoc diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc new file mode 100644 index 000000000000..644e251b4563 --- /dev/null +++ b/prdoc/pr_3953.prdoc @@ -0,0 +1,16 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: Refactor RemoteExternalities and its related types to depend on Hash/HashOutput + +doc: + - audience: Runtime Dev + description: | + Change traits bound for `RemoteExternalities` types as `RemoteExternalities`, + `Mode`, `OnlineConfig`, `Snapshot` to use `Hash` or `HashOutput` + instead of `BlockT + +crates: +- name: frame-remote-externalities +- name: pallet-state-trie-migration +- name: try-runtime-cli \ No newline at end of file From a8b7f72ea74360ab1978268a36cd2030c5ff05cb Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Sat, 6 Apr 2024 23:34:06 +0200 Subject: [PATCH 05/14] typo prdoc --- prdoc/pr_3953.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index 644e251b4563..da3ed8a2a82d 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -8,7 +8,7 @@ doc: description: | Change traits bound for `RemoteExternalities` types as `RemoteExternalities`, `Mode`, `OnlineConfig`, `Snapshot` to use `Hash` or `HashOutput` - instead of `BlockT + instead of `BlockT` crates: - name: frame-remote-externalities From 4dbb48cb2c79ab4bdf7ca3c0fa7c4ee4f81eb348 Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:59:17 +0200 Subject: [PATCH 06/14] remove bound for snapshot, mode and onlineconfig --- substrate/utils/frame/remote-externalities/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index fbdb451be92a..03b9b816fbc8 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -63,7 +63,7 @@ const SNAPSHOT_VERSION: SnapshotVersion = Compact(3); /// The snapshot that we store on disk. #[derive(Decode, Encode)] -struct Snapshot { +struct Snapshot { snapshot_version: SnapshotVersion, state_version: StateVersion, block_hash: H, @@ -127,7 +127,7 @@ impl DerefMut for RemoteExternalities { /// The execution mode. #[derive(Clone)] -pub enum Mode { +pub enum Mode { /// Online. Potentially writes to a snapshot file. Online(OnlineConfig), /// Offline. Uses a state snapshot file and needs not any client config. @@ -221,7 +221,7 @@ impl From for Transport { /// /// A state snapshot config may be present and will be written to in that case. #[derive(Clone)] -pub struct OnlineConfig { +pub struct OnlineConfig { /// The block hash at which to get the runtime state. Will be latest finalized head if not /// provided. pub at: Option, From 5cbeb90197a9dbe5e9c4df13cd9c267173569465 Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Sun, 7 Apr 2024 19:37:32 +0200 Subject: [PATCH 07/14] update prdoc --- prdoc/pr_3953.prdoc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index da3ed8a2a82d..70b6cb17809e 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -1,16 +1,19 @@ # Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 # See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json -title: Refactor RemoteExternalities and its related types to depend on Hash/HashOutput +title: Adapt RemoteExternalities and its related types to be used with generic hash parameters doc: - audience: Runtime Dev description: | - Change traits bound for `RemoteExternalities` types as `RemoteExternalities`, - `Mode`, `OnlineConfig`, `Snapshot` to use `Hash` or `HashOutput` - instead of `BlockT` + Modify `RemoteExternalities`, `Mode`, `OnlineConfig` and`Snapshot` to rely now on generic parameter, instead of `BlockT` + Modify in consequence their implementation to be used with `Hash` or `HashOutput` + Adapt Builder struct and implementation for these new bounds crates: - name: frame-remote-externalities + bump: major - name: pallet-state-trie-migration -- name: try-runtime-cli \ No newline at end of file + bump: major +- name: try-runtime-cli + bump: major \ No newline at end of file From d4778cdcf5d59d4e05716aee8be8f53641976900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Narzis?= <78718413+lean-apple@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:18:22 +0200 Subject: [PATCH 08/14] Update prdoc/pr_3953.prdoc Co-authored-by: Oliver Tale-Yazdi --- prdoc/pr_3953.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index 70b6cb17809e..30fa3f4e8f19 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -14,6 +14,6 @@ crates: - name: frame-remote-externalities bump: major - name: pallet-state-trie-migration - bump: major + bump: patch - name: try-runtime-cli bump: major \ No newline at end of file From 57caecbb599cb9c4732bf79f3d64710f43eb2100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Narzis?= <78718413+lean-apple@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:18:32 +0200 Subject: [PATCH 09/14] Update prdoc/pr_3953.prdoc Co-authored-by: Oliver Tale-Yazdi --- prdoc/pr_3953.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index 30fa3f4e8f19..d1217e9fbc6a 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -16,4 +16,4 @@ crates: - name: pallet-state-trie-migration bump: patch - name: try-runtime-cli - bump: major \ No newline at end of file + bump: patch \ No newline at end of file From 6d08db4a2c96052303a6b40e46d97432f438e620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Narzis?= <78718413+lean-apple@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:18:45 +0200 Subject: [PATCH 10/14] Update prdoc/pr_3953.prdoc Co-authored-by: Oliver Tale-Yazdi --- prdoc/pr_3953.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index d1217e9fbc6a..f762f428792b 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -8,7 +8,7 @@ doc: description: | Modify `RemoteExternalities`, `Mode`, `OnlineConfig` and`Snapshot` to rely now on generic parameter, instead of `BlockT` Modify in consequence their implementation to be used with `Hash` or `HashOutput` - Adapt Builder struct and implementation for these new bounds + Adapt Builder struct and implementation for these new bounds. crates: - name: frame-remote-externalities From e7cbf22a2ad915fb2b40b1343f9f972833e6e0d0 Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:03:44 +0200 Subject: [PATCH 11/14] remove unecessary bounds for impl --- .../utils/frame/remote-externalities/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index 03b9b816fbc8..ffd3209bb7ed 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -36,7 +36,7 @@ use sp_core::{ }, }; use sp_runtime::{ - traits::{Block as BlockT, Hash, HashOutput, HashingFor}, + traits::{Block as BlockT, Hash, HashingFor}, StateVersion, }; use sp_state_machine::TestExternalities; @@ -72,7 +72,7 @@ struct Snapshot { storage_root: H, } -impl Snapshot { +impl Snapshot { pub fn new( state_version: StateVersion, block_hash: H, @@ -136,7 +136,7 @@ pub enum Mode { OfflineOrElseOnline(OfflineConfig, OnlineConfig), } -impl Default for Mode { +impl Default for Mode { fn default() -> Self { Mode::Online(OnlineConfig::default()) } @@ -240,7 +240,7 @@ pub struct OnlineConfig { pub hashed_keys: Vec>, } -impl OnlineConfig { +impl OnlineConfig { /// Return rpc (http) client reference. fn rpc_client(&self) -> &HttpClient { self.transport @@ -249,11 +249,11 @@ impl OnlineConfig { } fn at_expected(&self) -> H { - self.at.expect("block at must be initialized; qed") + self.clone().at.expect("block at must be initialized; qed") } } -impl Default for OnlineConfig { +impl Default for OnlineConfig { fn default() -> Self { Self { transport: Transport::from(DEFAULT_HTTP_ENDPOINT.to_owned()), @@ -267,7 +267,7 @@ impl Default for OnlineConfig { } } -impl From for OnlineConfig { +impl From for OnlineConfig { fn from(t: String) -> Self { Self { transport: t.into(), ..Default::default() } } From df2cd1907461619c84596bc1e9bdce272e9c8a93 Mon Sep 17 00:00:00 2001 From: lean-apple <78718413+lean-apple@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:04:03 +0200 Subject: [PATCH 12/14] update prdoc --- prdoc/pr_3953.prdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index f762f428792b..155880694f67 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -6,9 +6,9 @@ title: Adapt RemoteExternalities and its related types to be used with generic h doc: - audience: Runtime Dev description: | - Modify `RemoteExternalities`, `Mode`, `OnlineConfig` and`Snapshot` to rely now on generic parameter, instead of `BlockT` - Modify in consequence their implementation to be used with `Hash` or `HashOutput` - Adapt Builder struct and implementation for these new bounds. + Modify `RemoteExternalities`, `Mode`, `OnlineConfig` and`Snapshot` to rely now on generic parameter, instead of `BlockT`. + Adjust in consequence their implementation to be compatible with types `Hash`, or if possible any generic. + Adapt Builder struct and implementation for these bounds. crates: - name: frame-remote-externalities From 7365a05dc1de25016801f1104bdab7484ad8a294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 8 Apr 2024 22:52:12 +0200 Subject: [PATCH 13/14] Update substrate/utils/frame/remote-externalities/src/lib.rs --- substrate/utils/frame/remote-externalities/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index ffd3209bb7ed..e429d39669f1 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -249,7 +249,7 @@ impl OnlineConfig { } fn at_expected(&self) -> H { - self.clone().at.expect("block at must be initialized; qed") + self.at.clone().expect("block at must be initialized; qed") } } From 563d3399bf3f0e7117e83e18ed6e07a9f335465b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 8 Apr 2024 22:52:19 +0200 Subject: [PATCH 14/14] Update prdoc/pr_3953.prdoc --- prdoc/pr_3953.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_3953.prdoc b/prdoc/pr_3953.prdoc index 155880694f67..f52227924604 100644 --- a/prdoc/pr_3953.prdoc +++ b/prdoc/pr_3953.prdoc @@ -4,7 +4,7 @@ title: Adapt RemoteExternalities and its related types to be used with generic hash parameters doc: - - audience: Runtime Dev + - audience: Node Dev description: | Modify `RemoteExternalities`, `Mode`, `OnlineConfig` and`Snapshot` to rely now on generic parameter, instead of `BlockT`. Adjust in consequence their implementation to be compatible with types `Hash`, or if possible any generic.