Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

pallet-mmr: fix batch proof failures#11840

Merged
acatangiu merged 13 commits intoparitytech:masterfrom
Lederstrumpf:mmr_fix_batch_proof_failures
Jul 21, 2022
Merged

pallet-mmr: fix batch proof failures#11840
acatangiu merged 13 commits intoparitytech:masterfrom
Lederstrumpf:mmr_fix_batch_proof_failures

Conversation

@Lederstrumpf
Copy link
Contributor

Description:

This PR fixes the incorrect upper bound on batch proof items that was used when verifying batch proofs, which would then throw false negatives. This failure was reported and discussed in #11753.

Side note: The test coverage for batch proofs has been expanded: tests all possible batch proofs for mmr size < 8 and 2-leaf batch proofs until mmr size < 15. This does increase the test suite runtime for pallet-mmr quite a bit (on my system, roughly from 0.5s to 4s). If this is a concern, I'm happy to reduce the test coverage.

Related Issues:
Fixes #11753

@Lederstrumpf Lederstrumpf added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Jul 14, 2022
note: right now, since not killing old chain, it keeps growing by 7
blocks for every leaf selection (added after proof generation), hence
heavier to compute.
@Lederstrumpf Lederstrumpf force-pushed the mmr_fix_batch_proof_failures branch from 1d8399e to 11ee5d7 Compare July 20, 2022 21:53
Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@acatangiu acatangiu requested a review from svyatonik July 21, 2022 12:55
@acatangiu acatangiu merged commit 1399afd into paritytech:master Jul 21, 2022
DaviRain-Su pushed a commit to octopus-network/substrate that referenced this pull request Aug 23, 2022
* pallet-mmr: extend batch proof verification test

covers all possible 2-leaf combinations now, including current
verification failures that batch proof item count limit is too low
sometimes.

* raise upper bound on proof item number

as described in
paritytech#11753 (comment)

* test for powerset of leaves

* refactor batch proof verification test

* test all batch proofs for mmr sizes up to n=13

* limit mmr size to reduce batch proof test duration

* use saturating integer addition for proof check

* extract common chain building in batch proof tests

note: right now, since not killing old chain, it keeps growing by 7
blocks for every leaf selection (added after proof generation), hence
heavier to compute.

* only add blocks after a proof generation once

* increase batch proof testing range

* register offchain extensions only once

* fmt & remove unused util
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* pallet-mmr: extend batch proof verification test

covers all possible 2-leaf combinations now, including current
verification failures that batch proof item count limit is too low
sometimes.

* raise upper bound on proof item number

as described in
paritytech#11753 (comment)

* test for powerset of leaves

* refactor batch proof verification test

* test all batch proofs for mmr sizes up to n=13

* limit mmr size to reduce batch proof test duration

* use saturating integer addition for proof check

* extract common chain building in batch proof tests

note: right now, since not killing old chain, it keeps growing by 7
blocks for every leaf selection (added after proof generation), hence
heavier to compute.

* only add blocks after a proof generation once

* increase batch proof testing range

* register offchain extensions only once

* fmt & remove unused util
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pallet-mmr: batch proofs are sometimes broken

3 participants