Add mmr_root() to pallet-mmr API to expose root from state (companion for substrate#11183) (#5276)

* Add mmr_root() to pallet-mmr API to expose root from state

* use the right MmrApi primitives

* bridges: use correct mmr primitives

* rococo: beefy-mmr deposit mmr root digest

* fix lockfile

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Adrian Catangiu
2022-04-13 13:55:18 +03:00
committed by GitHub
parent ff18cabbc5
commit a46237cebb
20 changed files with 262 additions and 220 deletions
+205 -189
View File
File diff suppressed because it is too large Load Diff
@@ -44,7 +44,6 @@ pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "mast
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -57,6 +56,7 @@ sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch =
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -114,6 +114,7 @@ std = [
"sp-core/std",
"sp-finality-grandpa/std",
"sp-inherents/std",
"sp-mmr-primitives/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
@@ -39,7 +39,7 @@ use bridge_runtime_common::messages::{
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
use pallet_mmr_primitives::{
use sp_mmr_primitives::{
DataOrHash, EncodableOpaqueLeaf, Error as MmrError, LeafDataProvider, Proof as MmrProof,
};
use pallet_transaction_payment::{FeeDetails, Multiplier, RuntimeDispatchInfo};
@@ -680,7 +680,7 @@ impl_runtime_apis! {
}
}
impl pallet_mmr_primitives::MmrApi<Block, MmrHash> for Runtime {
impl sp_mmr_primitives::MmrApi<Block, MmrHash> for Runtime {
fn generate_proof(leaf_index: u64)
-> Result<(EncodableOpaqueLeaf, MmrProof<MmrHash>), MmrError>
{
+1 -1
View File
@@ -35,7 +35,6 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch =
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
node-inspect = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-mmr-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -51,6 +50,7 @@ sc-executor = { git = "https://github.com/paritytech/substrate", branch = "maste
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master"}
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -44,7 +44,6 @@ pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "mast
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -58,6 +57,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master",
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -108,7 +108,6 @@ std = [
"pallet-bridge-messages/std",
"pallet-grandpa/std",
"pallet-mmr/std",
"pallet-mmr-primitives/std",
"pallet-shift-session-manager/std",
"pallet-sudo/std",
"pallet-timestamp/std",
@@ -127,6 +126,7 @@ std = [
"sp-finality-grandpa/std",
"sp-inherents/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
@@ -40,7 +40,7 @@ use bridge_runtime_common::messages::{
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
use pallet_mmr_primitives::{
use sp_mmr_primitives::{
DataOrHash, EncodableOpaqueLeaf, Error as MmrError, LeafDataProvider, Proof as MmrProof,
};
use pallet_transaction_payment::{FeeDetails, Multiplier, RuntimeDispatchInfo};
@@ -626,7 +626,7 @@ impl_runtime_apis! {
}
}
impl pallet_mmr_primitives::MmrApi<Block, Hash> for Runtime {
impl sp_mmr_primitives::MmrApi<Block, Hash> for Runtime {
fn generate_proof(leaf_index: u64)
-> Result<(EncodableOpaqueLeaf, MmrProof<Hash>), MmrError>
{
+1 -2
View File
@@ -28,14 +28,13 @@ sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch =
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-offchain = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" }
beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot Runtimes
+2 -2
View File
@@ -128,7 +128,7 @@ pub trait RuntimeApiCollection:
+ ParachainHost<Block>
+ sp_block_builder::BlockBuilder<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_mmr_primitives::MmrApi<Block, <Block as BlockT>::Hash>
+ sp_mmr_primitives::MmrApi<Block, <Block as BlockT>::Hash>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
@@ -149,7 +149,7 @@ where
+ ParachainHost<Block>
+ sp_block_builder::BlockBuilder<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_mmr_primitives::MmrApi<Block, <Block as BlockT>::Hash>
+ sp_mmr_primitives::MmrApi<Block, <Block as BlockT>::Hash>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
-1
View File
@@ -54,7 +54,6 @@ pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "maste
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Substrate Other
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
+2 -1
View File
@@ -1116,6 +1116,7 @@ where
let beefy_params = beefy_gadget::BeefyParams {
client: client.clone(),
backend: backend.clone(),
runtime: client.clone(),
key_store: keystore_opt.clone(),
network: network.clone(),
signed_commitment_sender: beefy_links.0,
@@ -1125,7 +1126,7 @@ where
protocol_name: beefy_protocol_name,
};
let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _>(beefy_params);
let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _, _>(beefy_params);
// Wococo's purpose is to be a testbed for BEEFY, so if it fails we'll
// bring the node down with it to make sure it is noticed.
+2 -2
View File
@@ -26,6 +26,7 @@ offchain-primitives = { package = "sp-offchain", git = "https://github.com/parit
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-arithmetic = { package = "sp-arithmetic", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -55,7 +56,6 @@ pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -161,6 +161,7 @@ std = [
"pallet-vesting/std",
"pallet-babe/std",
"pallet-xcm/std",
"sp-mmr-primitives/std",
"sp-runtime/std",
"sp-staking/std",
"frame-system/std",
@@ -177,7 +178,6 @@ std = [
"sp-npos-elections/std",
"beefy-primitives/std",
"kusama-runtime-constants/std",
"pallet-mmr-primitives/std",
"xcm/std",
"xcm-executor/std",
"xcm-builder/std",
+7 -1
View File
@@ -62,10 +62,10 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_mmr_primitives as mmr;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use sp_core::OpaqueMetadata;
use sp_mmr_primitives as mmr;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
@@ -1795,6 +1795,12 @@ sp_api::impl_runtime_apis! {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
fn mmr_root() -> Result<Hash, mmr::Error> {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
}
impl fg_primitives::GrandpaApi<Block> for Runtime {
+2 -2
View File
@@ -26,6 +26,7 @@ tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/parit
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -52,7 +53,6 @@ pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -119,6 +119,7 @@ std = [
"block-builder-api/std",
"offchain-primitives/std",
"sp-std/std",
"sp-mmr-primitives/std",
"frame-support/std",
"frame-executive/std",
"pallet-authority-discovery/std",
@@ -167,7 +168,6 @@ std = [
"frame-try-runtime/std",
"sp-npos-elections/std",
"beefy-primitives/std",
"pallet-mmr-primitives/std",
"frame-election-provider-support/std",
"pallet-xcm/std",
"xcm/std",
+6 -1
View File
@@ -53,7 +53,6 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_mmr_primitives as mmr;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
@@ -65,6 +64,7 @@ use primitives::v2::{
ValidationCodeHash, ValidatorId, ValidatorIndex,
};
use sp_core::OpaqueMetadata;
use sp_mmr_primitives as mmr;
use sp_runtime::{
create_runtime_str,
curve::PiecewiseLinear,
@@ -1943,6 +1943,11 @@ sp_api::impl_runtime_apis! {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
fn mmr_root() -> Result<Hash, mmr::Error> {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
}
impl fg_primitives::GrandpaApi<Block> for Runtime {
+2 -2
View File
@@ -17,6 +17,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "mas
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -44,7 +45,6 @@ pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -118,7 +118,6 @@ std = [
"pallet-sudo/std",
"pallet-membership/std",
"pallet-mmr/std",
"pallet-mmr-primitives/std",
"pallet-indices/std",
"pallet-im-online/std",
"pallet-session/std",
@@ -137,6 +136,7 @@ std = [
"sp-api/std",
"sp-core/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
+7 -3
View File
@@ -33,7 +33,6 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_mmr_primitives as mmr;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
@@ -51,6 +50,7 @@ use runtime_common::{
use runtime_parachains::{self, runtime_api_impl::v2 as runtime_api_impl};
use scale_info::TypeInfo;
use sp_core::{OpaqueMetadata, RuntimeDebug, H256};
use sp_mmr_primitives as mmr;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
@@ -1371,7 +1371,7 @@ sp_api::impl_runtime_apis! {
}
}
impl pallet_mmr_primitives::MmrApi<Block, Hash> for Runtime {
impl mmr::MmrApi<Block, Hash> for Runtime {
fn generate_proof(leaf_index: u64)
-> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof<Hash>), mmr::Error>
{
@@ -1383,7 +1383,7 @@ sp_api::impl_runtime_apis! {
-> Result<(), mmr::Error>
{
pub type Leaf = <
<Runtime as pallet_mmr::Config>::LeafData as mmr::LeafDataProvider
<Runtime as pallet_mmr::Config>::LeafData as pallet_mmr::LeafDataProvider
>::LeafData;
let leaf: Leaf = leaf
@@ -1402,6 +1402,10 @@ sp_api::impl_runtime_apis! {
let node = mmr::DataOrHash::Data(leaf.into_opaque_leaf());
pallet_mmr::verify_leaf_proof::<MmrHashing, _>(root, node, proof)
}
fn mmr_root() -> Result<Hash, mmr::Error> {
Ok(Mmr::mmr_root())
}
}
impl bp_rococo::RococoFinalityApi<Block> for Runtime {
+1 -1
View File
@@ -26,6 +26,7 @@ sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", de
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -41,7 +42,6 @@ pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/parityt
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+7 -1
View File
@@ -40,7 +40,6 @@ use frame_support::{
traits::{Everything, KeyOwnerProofSystem},
};
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_mmr_primitives as mmr;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use polkadot_runtime_parachains::reward_points::RewardValidatorsWithEraPoints;
@@ -57,6 +56,7 @@ use runtime_common::{
SlowAdjustingFeeUpdate,
};
use sp_core::OpaqueMetadata;
use sp_mmr_primitives as mmr;
use sp_runtime::{
create_runtime_str,
curve::PiecewiseLinear,
@@ -930,6 +930,12 @@ sp_api::impl_runtime_apis! {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
fn mmr_root() -> Result<Hash, mmr::Error> {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
}
impl fg_primitives::GrandpaApi<Block> for Runtime {
+2 -2
View File
@@ -23,6 +23,7 @@ offchain-primitives = { package = "sp-offchain", git = "https://github.com/parit
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -52,7 +53,6 @@ pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -135,7 +135,6 @@ std = [
"pallet-im-online/std",
"pallet-indices/std",
"pallet-membership/std",
"pallet-mmr-primitives/std",
"beefy-primitives/std",
"pallet-multisig/std",
"pallet-nicks/std",
@@ -156,6 +155,7 @@ std = [
"pallet-babe/std",
"pallet-bags-list/std",
"frame-executive/std",
"sp-mmr-primitives/std",
"sp-runtime/std",
"sp-staking/std",
"frame-system/std",
+7 -2
View File
@@ -32,7 +32,6 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_mmr_primitives as mmr;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
@@ -58,6 +57,7 @@ use runtime_parachains::{
};
use scale_info::TypeInfo;
use sp_core::{OpaqueMetadata, RuntimeDebug};
use sp_mmr_primitives as mmr;
use sp_runtime::{
create_runtime_str,
curve::PiecewiseLinear,
@@ -1326,7 +1326,7 @@ sp_api::impl_runtime_apis! {
}
}
impl pallet_mmr_primitives::MmrApi<Block, Hash> for Runtime {
impl mmr::MmrApi<Block, Hash> for Runtime {
fn generate_proof(_leaf_index: u64)
-> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof<Hash>), mmr::Error>
{
@@ -1349,6 +1349,11 @@ sp_api::impl_runtime_apis! {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
fn mmr_root() -> Result<Hash, mmr::Error> {
// dummy implementation due to lack of MMR pallet.
Err(mmr::Error::Verify)
}
}
impl fg_primitives::GrandpaApi<Block> for Runtime {