mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 20:21:03 +00:00
pallet-mmr: RPC API and Runtime API work with block numbers (#12345)
* pallet-mmr: RPC API works with block_numbers * fixes * update rpc * fmt * final touches in the rpc * temporary fix * fix * fmt * docs * Update lib.rs * use NumberFor * validate input * update runtime * convert block_number to u64 * small edit * update runtime api * test fix * runtime fix * update test function * fmt * fix nits * remove block_num_to_leaf_index from runtime api * Update frame/merkle-mountain-range/src/lib.rs Co-authored-by: Robert Hambrock <roberthambrock@gmail.com> * fix tests * get the code to compile after merge * get the tests to compile * fix in tests? * fix test * Update frame/merkle-mountain-range/src/tests.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update frame/merkle-mountain-range/src/lib.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update primitives/merkle-mountain-range/src/lib.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * fix errors & nits * change block_num_to_leaf_index * don't make any assumptions * Update frame/merkle-mountain-range/src/tests.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update frame/merkle-mountain-range/src/tests.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update frame/merkle-mountain-range/src/tests.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * fix * small fix * use best_known_block_number * best_known_block_number instead of leaves_count * more readable? * remove warning * Update frame/merkle-mountain-range/src/lib.rs Co-authored-by: Robert Hambrock <roberthambrock@gmail.com> * simplify * update docs * nits * fmt & fix * merge fixes * fix * small fix * docs & nit fixes * Nit fixes * remove leaf_indices_to_block_numbers() * fmt Co-authored-by: Robert Hambrock <roberthambrock@gmail.com> Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -43,9 +43,7 @@ use beefy_primitives::{
|
||||
KEY_TYPE as BeefyKeyType,
|
||||
};
|
||||
use sc_network::{config::RequestResponseConfig, ProtocolName};
|
||||
use sp_mmr_primitives::{
|
||||
BatchProof, EncodableOpaqueLeaf, Error as MmrError, LeafIndex, MmrApi, Proof,
|
||||
};
|
||||
use sp_mmr_primitives::{BatchProof, EncodableOpaqueLeaf, Error as MmrError, MmrApi, Proof};
|
||||
|
||||
use sp_api::{ApiRef, ProvideRuntimeApi};
|
||||
use sp_consensus::BlockOrigin;
|
||||
@@ -247,8 +245,8 @@ macro_rules! create_test_api {
|
||||
}
|
||||
}
|
||||
|
||||
impl MmrApi<Block, MmrRootHash> for RuntimeApi {
|
||||
fn generate_proof(_leaf_index: LeafIndex)
|
||||
impl MmrApi<Block, MmrRootHash, NumberFor<Block>> for RuntimeApi {
|
||||
fn generate_proof(_block_number: u64)
|
||||
-> Result<(EncodableOpaqueLeaf, Proof<MmrRootHash>), MmrError> {
|
||||
unimplemented!()
|
||||
}
|
||||
@@ -270,13 +268,13 @@ macro_rules! create_test_api {
|
||||
Ok($mmr_root)
|
||||
}
|
||||
|
||||
fn generate_batch_proof(_leaf_indices: Vec<LeafIndex>) -> Result<(Vec<EncodableOpaqueLeaf>, BatchProof<MmrRootHash>), MmrError> {
|
||||
fn generate_batch_proof(_block_numbers: Vec<u64>) -> Result<(Vec<EncodableOpaqueLeaf>, BatchProof<MmrRootHash>), MmrError> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn generate_historical_batch_proof(
|
||||
_leaf_indices: Vec<LeafIndex>,
|
||||
_leaves_count: LeafIndex
|
||||
_block_numbers: Vec<u64>,
|
||||
_best_known_block_number: u64
|
||||
) -> Result<(Vec<EncodableOpaqueLeaf>, BatchProof<MmrRootHash>), MmrError> {
|
||||
unimplemented!()
|
||||
}
|
||||
@@ -349,7 +347,7 @@ fn initialize_beefy<API>(
|
||||
) -> impl Future<Output = ()>
|
||||
where
|
||||
API: ProvideRuntimeApi<Block> + Default + Sync + Send,
|
||||
API::Api: BeefyApi<Block> + MmrApi<Block, MmrRootHash>,
|
||||
API::Api: BeefyApi<Block> + MmrApi<Block, MmrRootHash, NumberFor<Block>>,
|
||||
{
|
||||
let tasks = FuturesUnordered::new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user