Skip to content

Commit

Permalink
change mmr proof generation back to leaf numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Lederstrumpf committed Dec 7, 2022
1 parent b0e994c commit 72cdcad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions frame/merkle-mountain-range/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub trait MmrApi<BlockHash, BlockNumber> {
#[method(name = "mmr_generateProof")]
fn generate_proof(
&self,
block_number: BlockNumber,
leaf_index: sp_mmr_primitives::LeafIndex,
at: Option<BlockHash>,
) -> RpcResult<LeafProof<BlockHash>>;

Expand Down Expand Up @@ -179,7 +179,7 @@ where
{
fn generate_proof(
&self,
block_number: NumberFor<Block>,
leaf_index: sp_mmr_primitives::LeafIndex,
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<LeafProof<Block::Hash>> {
let api = self.client.runtime_api();
Expand All @@ -189,7 +189,7 @@ where
.generate_proof_with_context(
&BlockId::hash(block_hash),
sp_core::ExecutionContext::OffchainCall(None),
block_number,
leaf_index,
)
.map_err(runtime_error_into_rpc_error)?
.map_err(mmr_error_into_rpc_error)?;
Expand Down
2 changes: 1 addition & 1 deletion primitives/merkle-mountain-range/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ sp_api::decl_runtime_apis! {
/// API to interact with MMR pallet.
pub trait MmrApi<Hash: codec::Codec, BlockNumber: codec::Codec> {
/// Generate MMR proof for a block with a specified `block_number`.
fn generate_proof(block_number: BlockNumber) -> Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>;
fn generate_proof(leaf_index: LeafIndex) -> Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>;

/// Verify MMR proof against on-chain MMR.
///
Expand Down

0 comments on commit 72cdcad

Please sign in to comment.