mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 19:11:02 +00:00
MMR: impl TypeInfo for some structures (#12423)
* BEEFY client: avoid unnecessary clone * MMR: impl TypeInfo for some structures
This commit is contained in:
Generated
+1
@@ -9999,6 +9999,7 @@ dependencies = [
|
||||
"array-bytes",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"serde",
|
||||
"sp-api",
|
||||
"sp-core",
|
||||
|
||||
@@ -84,7 +84,7 @@ impl From<Error> for JsonRpseeError {
|
||||
// Provides RPC methods for interacting with BEEFY.
|
||||
#[rpc(client, server)]
|
||||
pub trait BeefyApi<Notification, Hash> {
|
||||
/// Returns the block most recently finalized by BEEFY, alongside side its justification.
|
||||
/// Returns the block most recently finalized by BEEFY, alongside its justification.
|
||||
#[subscription(
|
||||
name = "beefy_subscribeJustifications" => "beefy_justifications",
|
||||
unsubscribe = "beefy_unsubscribeJustifications",
|
||||
|
||||
@@ -508,7 +508,7 @@ where
|
||||
|
||||
if let Err(e) = self.backend.append_justification(
|
||||
BlockId::Number(block_num),
|
||||
(BEEFY_ENGINE_ID, finality_proof.clone().encode()),
|
||||
(BEEFY_ENGINE_ID, finality_proof.encode()),
|
||||
) {
|
||||
error!(target: "beefy", "🥩 Error {:?} on appending justification: {:?}", e, finality_proof);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ impl BeefyDataProvider<Vec<u8>> for () {
|
||||
}
|
||||
|
||||
/// A standard leaf that gets added every block to the MMR constructed by Substrate's `pallet_mmr`.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
|
||||
pub struct MmrLeaf<BlockNumber, Hash, MerkleRoot, ExtraData> {
|
||||
/// Version of the leaf format.
|
||||
///
|
||||
@@ -73,7 +73,7 @@ pub struct MmrLeaf<BlockNumber, Hash, MerkleRoot, ExtraData> {
|
||||
/// Given that adding new struct elements in SCALE is backward compatible (i.e. old format can be
|
||||
/// still decoded, the new fields will simply be ignored). We expect the major version to be bumped
|
||||
/// very rarely (hopefuly never).
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
|
||||
pub struct MmrLeafVersion(u8);
|
||||
impl MmrLeafVersion {
|
||||
/// Create new version object from `major` and `minor` components.
|
||||
|
||||
@@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
serde = { version = "1.0.136", features = ["derive"], optional = true }
|
||||
sp-api = { version = "4.0.0-dev", default-features = false, path = "../api" }
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use scale_info::TypeInfo;
|
||||
use sp_debug_derive::RuntimeDebug;
|
||||
use sp_runtime::traits;
|
||||
#[cfg(not(feature = "std"))]
|
||||
@@ -69,7 +70,7 @@ impl<Hash> OnNewRoot<Hash> for () {
|
||||
}
|
||||
|
||||
/// A MMR proof data for one of the leaves.
|
||||
#[derive(codec::Encode, codec::Decode, RuntimeDebug, Clone, PartialEq, Eq)]
|
||||
#[derive(codec::Encode, codec::Decode, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)]
|
||||
pub struct Proof<Hash> {
|
||||
/// The index of the leaf the proof is for.
|
||||
pub leaf_index: LeafIndex,
|
||||
@@ -352,7 +353,7 @@ impl_leaf_data_for_tuple!(A:0, B:1, C:2, D:3);
|
||||
impl_leaf_data_for_tuple!(A:0, B:1, C:2, D:3, E:4);
|
||||
|
||||
/// A MMR proof data for a group of leaves.
|
||||
#[derive(codec::Encode, codec::Decode, RuntimeDebug, Clone, PartialEq, Eq)]
|
||||
#[derive(codec::Encode, codec::Decode, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)]
|
||||
pub struct BatchProof<Hash> {
|
||||
/// The indices of the leaves the proof is for.
|
||||
pub leaf_indices: Vec<LeafIndex>,
|
||||
|
||||
Reference in New Issue
Block a user