Add mmr_generateAncestryProof
rpc call
#9295
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds
generateAncestryProof
to the mmr RPC. An RPC method for generating ancestry proofs is required for cross-chain slashing by cross-chain fishermen Snowfork/snowbridge#1493.Consequently, this PR also adds the mmr runtime api method
generate_ancestry_proof
. While such a method was already exposed by the beefy-mmr runtime api, this PR opts for moving it to the mmr runtime api instead due to the following considerations:generate_proof
method via RPC would require adding the offchain-db extension to the beefy-rpc, which is a more invasive change with boilerplate that's not needed since the mmr RPC already uses the offchain-db extension for generating leaf proofs.generate_proof
method is merely a wrapper around the mmr pallet'sgenerate_ancestry_proof
method.Some other misc. changes documented under
Review Notes
.Integration
The integration is the same as for the beefy-mmr runtime api's
generate_proof
method, except that the optionalat
specifier is removed for the method here since the method is idempotent wrt. the block height invoked at, so long asat
>=best_known_block_number
. Removing the specifier reduces likelihood of spurious errors from incorrect usage. I can revert theat
specifier removal however if desired for compatibility.For example use, see Snowfork/snowbridge#1493.
Review Notes
generate_ancestry_proof
method to mmr runtime api (Lederstrumpf@682eb4a)mmr_generateAncestryProof
rpc method (Lederstrumpf@5d0eac9, Lederstrumpf@5d0eac9f1f)InvalidEquivocationProofSessionMember
error to beefy pallet (Lederstrumpf@682eb4a141) (note: this change is unrelated to the PR's main purpose, but helps implementers with more granular error reporting. I'm open to removing this change).pallet_beefy::generate_ancestry_proof::generate_ancestry_proof
andpallet_beefy::AncestryHelper::generate_proof
. Deprecation penciled in for September 2025 - I'm open to change this date or undo the deprecation. (Lederstrumpf@6619169ecd)at
specifier forpallet_mmr::generate_ancestry_proof
(Lederstrumpf@bcadda2) (as mentioned in theIntegration
section, fine to undo)PR can be tested using Snowfork/snowbridge#1493.