mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 16:41:10 +00:00
Move registration of ReadRuntimeVersionExt to ExecutionExtension (#13820)
Instead of registering `ReadRuntimeVersionExt` in `sp-state-machine` it is moved to `ExecutionExtension` which provides the default extensions.
This commit is contained in:
@@ -157,6 +157,16 @@ pub trait ReadRuntimeVersion: Send + Sync {
|
||||
) -> Result<Vec<u8>, String>;
|
||||
}
|
||||
|
||||
impl ReadRuntimeVersion for std::sync::Arc<dyn ReadRuntimeVersion> {
|
||||
fn read_runtime_version(
|
||||
&self,
|
||||
wasm_code: &[u8],
|
||||
ext: &mut dyn Externalities,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
(**self).read_runtime_version(wasm_code, ext)
|
||||
}
|
||||
}
|
||||
|
||||
sp_externalities::decl_extension! {
|
||||
/// An extension that provides functionality to read version information from a given wasm blob.
|
||||
pub struct ReadRuntimeVersionExt(Box<dyn ReadRuntimeVersion>);
|
||||
|
||||
@@ -163,7 +163,7 @@ mod execution {
|
||||
use sp_core::{
|
||||
hexdisplay::HexDisplay,
|
||||
storage::{ChildInfo, ChildType, PrefixedStorageKey},
|
||||
traits::{CallContext, CodeExecutor, ReadRuntimeVersionExt, RuntimeCode},
|
||||
traits::{CallContext, CodeExecutor, RuntimeCode},
|
||||
};
|
||||
use sp_externalities::Extensions;
|
||||
use std::{
|
||||
@@ -322,12 +322,10 @@ mod execution {
|
||||
exec: &'a Exec,
|
||||
method: &'a str,
|
||||
call_data: &'a [u8],
|
||||
mut extensions: Extensions,
|
||||
extensions: Extensions,
|
||||
runtime_code: &'a RuntimeCode,
|
||||
context: CallContext,
|
||||
) -> Self {
|
||||
extensions.register(ReadRuntimeVersionExt::new(exec.clone()));
|
||||
|
||||
Self {
|
||||
backend,
|
||||
exec,
|
||||
|
||||
Reference in New Issue
Block a user