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",
|
"array-bytes",
|
||||||
"log",
|
"log",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
|
"scale-info",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-api",
|
"sp-api",
|
||||||
"sp-core",
|
"sp-core",
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ impl From<Error> for JsonRpseeError {
|
|||||||
// Provides RPC methods for interacting with BEEFY.
|
// Provides RPC methods for interacting with BEEFY.
|
||||||
#[rpc(client, server)]
|
#[rpc(client, server)]
|
||||||
pub trait BeefyApi<Notification, Hash> {
|
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(
|
#[subscription(
|
||||||
name = "beefy_subscribeJustifications" => "beefy_justifications",
|
name = "beefy_subscribeJustifications" => "beefy_justifications",
|
||||||
unsubscribe = "beefy_unsubscribeJustifications",
|
unsubscribe = "beefy_unsubscribeJustifications",
|
||||||
|
|||||||
@@ -508,7 +508,7 @@ where
|
|||||||
|
|
||||||
if let Err(e) = self.backend.append_justification(
|
if let Err(e) = self.backend.append_justification(
|
||||||
BlockId::Number(block_num),
|
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);
|
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`.
|
/// 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> {
|
pub struct MmrLeaf<BlockNumber, Hash, MerkleRoot, ExtraData> {
|
||||||
/// Version of the leaf format.
|
/// 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
|
/// 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
|
/// still decoded, the new fields will simply be ignored). We expect the major version to be bumped
|
||||||
/// very rarely (hopefuly never).
|
/// 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);
|
pub struct MmrLeafVersion(u8);
|
||||||
impl MmrLeafVersion {
|
impl MmrLeafVersion {
|
||||||
/// Create new version object from `major` and `minor` components.
|
/// Create new version object from `major` and `minor` components.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
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 }
|
log = { version = "0.4.17", default-features = false }
|
||||||
serde = { version = "1.0.136", features = ["derive"], optional = true }
|
serde = { version = "1.0.136", features = ["derive"], optional = true }
|
||||||
sp-api = { version = "4.0.0-dev", default-features = false, path = "../api" }
|
sp-api = { version = "4.0.0-dev", default-features = false, path = "../api" }
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
|
use scale_info::TypeInfo;
|
||||||
use sp_debug_derive::RuntimeDebug;
|
use sp_debug_derive::RuntimeDebug;
|
||||||
use sp_runtime::traits;
|
use sp_runtime::traits;
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
@@ -69,7 +70,7 @@ impl<Hash> OnNewRoot<Hash> for () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A MMR proof data for one of the leaves.
|
/// 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> {
|
pub struct Proof<Hash> {
|
||||||
/// The index of the leaf the proof is for.
|
/// The index of the leaf the proof is for.
|
||||||
pub leaf_index: LeafIndex,
|
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);
|
impl_leaf_data_for_tuple!(A:0, B:1, C:2, D:3, E:4);
|
||||||
|
|
||||||
/// A MMR proof data for a group of leaves.
|
/// 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> {
|
pub struct BatchProof<Hash> {
|
||||||
/// The indices of the leaves the proof is for.
|
/// The indices of the leaves the proof is for.
|
||||||
pub leaf_indices: Vec<LeafIndex>,
|
pub leaf_indices: Vec<LeafIndex>,
|
||||||
|
|||||||
Reference in New Issue
Block a user