mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Refactor sc_executor::RuntimeInfo trait into 2 parts (#9498)
* Split native executor stuff from wasm executor stuff * Remove `native_runtime_version` in places * Fix warning * Fix test warning * Remove redundant NativeRuntimeInfo trait * Add a warning for use_native * Run cargo fmt * Revert "Add a warning for use_native" This reverts commit 9494f765a06037e991dd60524f2ed1b14649bfd6.
This commit is contained in:
@@ -251,27 +251,36 @@ impl NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
/// Something that can provide the runtime version at a given block and the native runtime version.
|
||||
#[cfg(feature = "std")]
|
||||
pub trait GetRuntimeVersion<Block: BlockT> {
|
||||
/// Returns the version of the native runtime.
|
||||
pub trait GetNativeVersion {
|
||||
/// Returns the version of the native runtime.
|
||||
fn native_version(&self) -> &NativeVersion;
|
||||
}
|
||||
|
||||
/// Something that can provide the runtime version at a given block.
|
||||
#[cfg(feature = "std")]
|
||||
pub trait GetRuntimeVersionAt<Block: BlockT> {
|
||||
/// Returns the version of runtime at the given block.
|
||||
fn runtime_version(&self, at: &BlockId<Block>) -> Result<RuntimeVersion, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: GetRuntimeVersion<Block>, Block: BlockT> GetRuntimeVersion<Block> for std::sync::Arc<T> {
|
||||
fn native_version(&self) -> &NativeVersion {
|
||||
(&**self).native_version()
|
||||
}
|
||||
|
||||
impl<T: GetRuntimeVersionAt<Block>, Block: BlockT> GetRuntimeVersionAt<Block>
|
||||
for std::sync::Arc<T>
|
||||
{
|
||||
fn runtime_version(&self, at: &BlockId<Block>) -> Result<RuntimeVersion, String> {
|
||||
(&**self).runtime_version(at)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: GetNativeVersion> GetNativeVersion for std::sync::Arc<T> {
|
||||
fn native_version(&self) -> &NativeVersion {
|
||||
(&**self).native_version()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
mod apis_serialize {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user