mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 11:57:56 +00:00
Add grandpa telemetry (+ other minor improvements) (#1997)
* Support skipping the interactive purge prompt Skip it via `cargo run -- purge-chain -y`. * Fix typos * Add Grandpa telemetry * Address comments * Revert unnecessary version bump * Version bump to make CI run * Remove unnecessary cast * Do not bump version
This commit is contained in:
committed by
Bastian Köcher
parent
35a67b31e5
commit
c52c528ee8
@@ -51,7 +51,7 @@ const API_VERSION_ATTRIBUTE: &str = "api_version";
|
||||
/// Is used when the function signature changed between different versions of a trait.
|
||||
/// This attribute should be placed on the old signature of the function.
|
||||
const CHANGED_IN_ATTRIBUTE: &str = "changed_in";
|
||||
/// All attributes that we support in the declaratio of a runtime api trait.
|
||||
/// All attributes that we support in the declaration of a runtime api trait.
|
||||
const SUPPORTED_ATTRIBUTE_NAMES: &[&str] = &[
|
||||
CORE_TRAIT_ATTRIBUTE, API_VERSION_ATTRIBUTE, CHANGED_IN_ATTRIBUTE
|
||||
];
|
||||
@@ -127,7 +127,7 @@ fn return_type_is_using_block(ty: &ReturnType) -> bool {
|
||||
visitor.result
|
||||
}
|
||||
|
||||
/// Replace all occurences of `Block` with `NodeBlock`
|
||||
/// Replace all occurrences of `Block` with `NodeBlock`
|
||||
struct ReplaceBlockWithNodeBlock {}
|
||||
|
||||
impl Fold for ReplaceBlockWithNodeBlock {
|
||||
@@ -140,13 +140,13 @@ impl Fold for ReplaceBlockWithNodeBlock {
|
||||
}
|
||||
}
|
||||
|
||||
/// Replace all occurences of `Block` with `NodeBlock`
|
||||
/// Replace all occurrences of `Block` with `NodeBlock`
|
||||
fn fn_arg_replace_block_with_node_block(fn_arg: FnArg) -> FnArg {
|
||||
let mut replace = ReplaceBlockWithNodeBlock {};
|
||||
fold::fold_fn_arg(&mut replace, fn_arg)
|
||||
}
|
||||
|
||||
/// Replace all occurences of `Block` with `NodeBlock`
|
||||
/// Replace all occurrences of `Block` with `NodeBlock`
|
||||
fn return_type_replace_block_with_node_block(return_type: ReturnType) -> ReturnType {
|
||||
let mut replace = ReplaceBlockWithNodeBlock {};
|
||||
fold::fold_return_type(&mut replace, return_type)
|
||||
@@ -162,7 +162,7 @@ fn generate_native_call_generators(decl: &ItemTrait) -> Result<TokenStream> {
|
||||
let trait_ = &decl.ident;
|
||||
let crate_ = generate_crate_access(HIDDEN_INCLUDES_ID);
|
||||
|
||||
// Auxilariy function that is used to convert between types that use different block types.
|
||||
// Auxiliary function that is used to convert between types that use different block types.
|
||||
// The function expects that both a convertable by encoding the one and decoding the other.
|
||||
result.push(quote!(
|
||||
#[cfg(any(feature = "std", test))]
|
||||
|
||||
@@ -407,7 +407,7 @@ fn generate_api_impl_for_runtime(impls: &[ItemImpl]) -> Result<TokenStream> {
|
||||
}
|
||||
|
||||
|
||||
/// Auxilariy data structure that is used to convert `impl Api for Runtime` to
|
||||
/// Auxiliary data structure that is used to convert `impl Api for Runtime` to
|
||||
/// `impl Api for RuntimeApi`.
|
||||
/// This requires us to replace the runtime `Block` with the node `Block`,
|
||||
/// `impl Api for Runtime` with `impl Api for RuntimeApi` and replace the method implementations
|
||||
@@ -483,7 +483,7 @@ impl<'a> Fold for ApiRuntimeImplToApiRuntimeApiImpl<'a> {
|
||||
-> #crate_::error::Result<#crate_::runtime_api::NativeOrEncoded<#ret_type>>
|
||||
);
|
||||
|
||||
// Generate the new method implementation that calls into the runime.
|
||||
// Generate the new method implementation that calls into the runtime.
|
||||
parse_quote!(
|
||||
{
|
||||
// Get the error to the user (if we have one).
|
||||
|
||||
@@ -155,7 +155,7 @@ pub fn impl_runtime_apis(input: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// To support versioning of the traits, the macro supports the attribute `#[api_version(1)]`.
|
||||
/// The attribute supports any `u32` as version. By default, each trait is at version `1`, if no
|
||||
/// version is provided. We also support chaning the signature of a method. This signature
|
||||
/// version is provided. We also support changing the signature of a method. This signature
|
||||
/// change is highlighted with the `#[changed_in(2)]` attribute above a method. A method that is
|
||||
/// tagged with this attribute is callable by the name `METHOD_before_version_VERSION`. This
|
||||
/// method will only support calling into wasm, trying to call into native will fail (change the
|
||||
|
||||
@@ -54,7 +54,7 @@ pub fn generate_hidden_includes(unique_id: &'static str) -> TokenStream {
|
||||
}.into()
|
||||
}
|
||||
|
||||
/// Generates the access to the `subtrate_client` crate.
|
||||
/// Generates the access to the `substrate_client` crate.
|
||||
pub fn generate_crate_access(unique_id: &'static str) -> TokenStream {
|
||||
if env::var("CARGO_PKG_NAME").unwrap() == "substrate-client" {
|
||||
quote!( crate )
|
||||
|
||||
Reference in New Issue
Block a user