mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 04:11:09 +00:00
Make sure to call the runtime trait functions (#1129)
* Make sure to call the runtime trait functions The runtime trait functions export their functions as extern c functions. These functions itself call the trait functions. This commit makes sure that the trait functions are called and not functions with the same name that are implemented for the runtime. * Update the wasm files
This commit is contained in:
@@ -465,14 +465,20 @@ macro_rules! impl_runtime_apis {
|
|||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
impl_runtime_apis! {
|
impl_runtime_apis! {
|
||||||
|
@EXTEND_FUNCTIONS
|
||||||
$runtime;
|
$runtime;
|
||||||
$( $fn_name ( $( $arg_name: $arg_ty ),* ); )*;
|
;
|
||||||
|
$trait_name;
|
||||||
|
$( $( $generic ),* )*;
|
||||||
|
{ $( $fn_name ( $( $arg_name: $arg_ty ),* ); )* }
|
||||||
$( $rest )*
|
$( $rest )*
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
(
|
(
|
||||||
$runtime:ident;
|
$runtime:ident;
|
||||||
$( $fn_name_parsed:ident ( $( $arg_name_parsed:ident : $arg_ty_parsed:ty ),* ); )*;
|
$( $trait_name_parsed:ident $( < $( $parsed_generic:ident ),* > )*::$fn_name_parsed:ident (
|
||||||
|
$( $arg_name_parsed:ident : $arg_ty_parsed:ty ),* );
|
||||||
|
)*;
|
||||||
impl $trait_name:ident $( < $( $generic:ident ),* > )* for $runtime_ignore:ident {
|
impl $trait_name:ident $( < $( $generic:ident ),* > )* for $runtime_ignore:ident {
|
||||||
$(
|
$(
|
||||||
fn $fn_name:ident ( $( $arg_name:ident : $arg_ty:ty ),* ) $( -> $return_ty:ty )* {
|
fn $fn_name:ident ( $( $arg_name:ident : $arg_ty:ty ),* ) $( -> $return_ty:ty )* {
|
||||||
@@ -490,15 +496,73 @@ macro_rules! impl_runtime_apis {
|
|||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
impl_runtime_apis! {
|
impl_runtime_apis! {
|
||||||
|
@EXTEND_FUNCTIONS
|
||||||
$runtime;
|
$runtime;
|
||||||
$( $fn_name_parsed ( $( $arg_name_parsed: $arg_ty_parsed ),* ); )*
|
$(
|
||||||
$( $fn_name ( $( $arg_name: $arg_ty ),* ); )*;
|
$trait_name_parsed $( < $( $parsed_generic ),* > )*
|
||||||
|
::$fn_name_parsed ( $( $arg_name_parsed: $arg_ty_parsed ),* );
|
||||||
|
)*;
|
||||||
|
$trait_name;
|
||||||
|
$( $( $generic ),* )*;
|
||||||
|
{ $( $fn_name ( $( $arg_name: $arg_ty ),* ); )* }
|
||||||
|
$( $rest )*
|
||||||
|
}
|
||||||
|
};
|
||||||
|
(@EXTEND_FUNCTIONS
|
||||||
|
$runtime:ident;
|
||||||
|
$( $trait_name_parsed:ident $( < $( $parsed_generic:ident ),* > )*::$fn_name_parsed:ident (
|
||||||
|
$( $arg_name_parsed:ident : $arg_ty_parsed:ty ),* );
|
||||||
|
)*;
|
||||||
|
$trait_name:ident;
|
||||||
|
$( $generic:ident ),*;
|
||||||
|
{
|
||||||
|
$fn_name_extend:ident ( $( $arg_name_extend:ident : $arg_ty_extend:ty ),* );
|
||||||
|
$( $extend_rest:tt )*
|
||||||
|
}
|
||||||
|
$( $rest:tt )*
|
||||||
|
) => {
|
||||||
|
impl_runtime_apis! {
|
||||||
|
@EXTEND_FUNCTIONS
|
||||||
|
$runtime;
|
||||||
|
$(
|
||||||
|
$trait_name_parsed $( < $( $parsed_generic ),* > )*
|
||||||
|
::$fn_name_parsed ( $( $arg_name_parsed: $arg_ty_parsed ),* );
|
||||||
|
)*
|
||||||
|
$trait_name < $( $generic ),* >
|
||||||
|
::$fn_name_extend ( $( $arg_name_extend: $arg_ty_extend ),* );;
|
||||||
|
$trait_name;
|
||||||
|
$( $generic ),*;
|
||||||
|
{
|
||||||
|
$( $extend_rest )*
|
||||||
|
}
|
||||||
|
$( $rest )*
|
||||||
|
}
|
||||||
|
};
|
||||||
|
(@EXTEND_FUNCTIONS
|
||||||
|
$runtime:ident;
|
||||||
|
$( $trait_name_parsed:ident $( < $( $parsed_generic:ident ),* > )*::$fn_name_parsed:ident (
|
||||||
|
$( $arg_name_parsed:ident : $arg_ty_parsed:ty ),* );
|
||||||
|
)*;
|
||||||
|
$trait_name:ident;
|
||||||
|
$( $generic:ident ),*;
|
||||||
|
{}
|
||||||
|
$( $rest:tt )*
|
||||||
|
) => {
|
||||||
|
impl_runtime_apis! {
|
||||||
|
$runtime;
|
||||||
|
$(
|
||||||
|
$trait_name_parsed $( < $( $parsed_generic ),* > )*
|
||||||
|
::$fn_name_parsed ( $( $arg_name_parsed: $arg_ty_parsed ),* );
|
||||||
|
)*;
|
||||||
$( $rest )*
|
$( $rest )*
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
(
|
(
|
||||||
$runtime:ident;
|
$runtime:ident;
|
||||||
$( $fn_name:ident ( $( $arg_name:ident : $arg_ty:ty ),* ); )*;
|
$(
|
||||||
|
$trait_name:ident $( < $( $generic:ident ),* > )*
|
||||||
|
::$fn_name:ident ( $( $arg_name:ident : $arg_ty:ty ),* );
|
||||||
|
)*;
|
||||||
) => {
|
) => {
|
||||||
pub mod api {
|
pub mod api {
|
||||||
use super::*;
|
use super::*;
|
||||||
@@ -511,6 +575,7 @@ macro_rules! impl_runtime_apis {
|
|||||||
Some({impl_runtime_apis! {
|
Some({impl_runtime_apis! {
|
||||||
@GENERATE_IMPL_CALL
|
@GENERATE_IMPL_CALL
|
||||||
$runtime;
|
$runtime;
|
||||||
|
$trait_name $( < $( $generic ),* > )*;
|
||||||
$fn_name;
|
$fn_name;
|
||||||
$( $arg_name : $arg_ty ),*;
|
$( $arg_name : $arg_ty ),*;
|
||||||
data;
|
data;
|
||||||
@@ -536,6 +601,7 @@ macro_rules! impl_runtime_apis {
|
|||||||
let output = { impl_runtime_apis! {
|
let output = { impl_runtime_apis! {
|
||||||
@GENERATE_IMPL_CALL
|
@GENERATE_IMPL_CALL
|
||||||
$runtime;
|
$runtime;
|
||||||
|
$trait_name $( < $( $generic ),* > )*;
|
||||||
$fn_name;
|
$fn_name;
|
||||||
$( $arg_name : $arg_ty ),*;
|
$( $arg_name : $arg_ty ),*;
|
||||||
input;
|
input;
|
||||||
@@ -553,6 +619,7 @@ macro_rules! impl_runtime_apis {
|
|||||||
};
|
};
|
||||||
(@GENERATE_IMPL_CALL
|
(@GENERATE_IMPL_CALL
|
||||||
$runtime:ident;
|
$runtime:ident;
|
||||||
|
$trait_name:ident $( < $( $generic:ident ),* > )*;
|
||||||
$fn_name:ident;
|
$fn_name:ident;
|
||||||
$arg_name:ident : $arg_ty:ty;
|
$arg_name:ident : $arg_ty:ty;
|
||||||
$input:ident;
|
$input:ident;
|
||||||
@@ -562,11 +629,12 @@ macro_rules! impl_runtime_apis {
|
|||||||
None => panic!("Bad input data provided to {}", stringify!($fn_name)),
|
None => panic!("Bad input data provided to {}", stringify!($fn_name)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let output = $runtime::$fn_name($arg_name);
|
let output = <$runtime as $trait_name $( < $( $generic ),* > )*>::$fn_name($arg_name);
|
||||||
$crate::runtime_api::Encode::encode(&output)
|
$crate::runtime_api::Encode::encode(&output)
|
||||||
};
|
};
|
||||||
(@GENERATE_IMPL_CALL
|
(@GENERATE_IMPL_CALL
|
||||||
$runtime:ident;
|
$runtime:ident;
|
||||||
|
$trait_name:ident $( < $( $generic:ident ),* > )*;
|
||||||
$fn_name:ident;
|
$fn_name:ident;
|
||||||
$( $arg_name:ident : $arg_ty:ty ),*;
|
$( $arg_name:ident : $arg_ty:ty ),*;
|
||||||
$input:ident;
|
$input:ident;
|
||||||
@@ -576,7 +644,7 @@ macro_rules! impl_runtime_apis {
|
|||||||
None => panic!("Bad input data provided to {}", stringify!($fn_name)),
|
None => panic!("Bad input data provided to {}", stringify!($fn_name)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let output = $runtime::$fn_name($( $arg_name ),*);
|
let output = <$runtime as $trait_name $( < $( $generic ),* > )*>::$fn_name($( $arg_name ),*);
|
||||||
$crate::runtime_api::Encode::encode(&output)
|
$crate::runtime_api::Encode::encode(&output)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user