Snowbridge: Linear-parameterized receipt-log benchmarks#12177
Open
yrong wants to merge 4 commits into
Open
Conversation
| } | ||
| } | ||
|
|
||
| /// Build a real receipts trie with `n` leaves, each holding the same `s`-byte receipt |
Contributor
There was a problem hiding this comment.
n is documented as nodes everywhere but here it is documented as leaves. Are we just using leaves to build up the the receipt proof with mock data (no nodes).
| // `MaxMessageSize` (the upper bound on the inbound message payload). | ||
| let max_message_size = T::MaxMessageSize::get(); | ||
| let weight_fee = T::WeightToFee::weight_to_fee(&T::WeightInfo::submit( | ||
| max_message_size, |
Contributor
There was a problem hiding this comment.
We are parsing in max_message_size as the proof node count. Wont this bloat the delivery cost?
| - audience: Runtime Dev | ||
| description: |- | ||
| Replaces the constant-time weights for snowbridge's three Ethereum-event-consuming extrinsics with `Linear<MIN, MAX>` benchmarks parameterized by the actual cost drivers: receipt-proof node count `n` and receipt envelope size `s`. Affects `pallet-inbound-queue::submit`, `pallet-inbound-queue-v2::submit`, and `pallet-outbound-queue-v2::submit_delivery_receipt`. | ||
| Each pallet's `BenchmarkHelper::initialize_storage` now takes `(n, s)`, the corresponding `WeightInfo` method takes `(u32, u32)`, and the dispatch reads `n` / `s` from `event.proof.receipt_proof` so callers are charged in proportion to verifier work rather than worst-case. Adds runtime-benchmarks-only Config items `MaxProofNodes` and `MaxReceiptBytes` as benchmark-fit upper bounds (they do NOT bound proof or receipt sizes at runtime; the verifier already enforces gas-style cost limits). |
Contributor
There was a problem hiding this comment.
the verifier already enforces gas-style cost limits
What do we mean by this?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replaces the constant-time submit / submit_delivery_receipt weights for snowbridge's three Ethereum-event-consuming extrinsics (pallet-inbound-queue::submit,
pallet-inbound-queue-v2::submit, pallet-outbound-queue-v2::submit_delivery_receipt) with Linear<MIN, MAX> benchmarks parameterized by the actual cost drivers: receipt-proof
node count n and receipt size s. Charges callers in proportion to the work the verifier does on their input rather than worst-case.
Why
Today these extrinsics declare a single constant weight, which has two failure modes:
Both costs are dominated by:
So a 2-D linear fit over (n, s) is the right shape.
How
Introduces a shared dynamic-fixture builder in
snowbridge-pallet-ethereum-client-fixtures::dynamic(the inverse ofpallet-ethereum-client::Pallet::verify) that synthesizesEventFixtures mirroring the verifier's SSZ + merkle + receipts-trie logic.