refactor(bench): measure the leaf image that would actually ship - #400
Open
bahdotsh wants to merge 1 commit into
Open
refactor(bench): measure the leaf image that would actually ship#400bahdotsh wants to merge 1 commit into
bahdotsh wants to merge 1 commit into
Conversation
bahdotsh
force-pushed
the
feat/harnesses-use-leaf-crate
branch
from
August 21, 2026 17:21
7b9e938 to
c80fd78
Compare
The footprint harness's leaf image drove mls-rs directly, which meant it linked the MLS calls and nothing around them: no envelope codec, no control-frame signing, no address derivation. It priced an image nobody could ship. It now runs `offline-protocol-leaf`, so the number covers the code a device runs. The figure moves from 390.2 KiB to 435.7 KiB of flash, a little over a quarter of a 1536 KiB xG24. That is the honest number and it is worth being plain about how it relates to the 400 KiB in ADR 0021: that was a decision gate, set to answer whether MLS on a leaf node was viable at all before anything was built, and it did that job. It is not a budget the shipping image is being held to. The recovery lever recorded beside it is still worth more than the growth: about 111 KiB of this image is P-384 and P-256 arithmetic nothing uses, linked because the provider keeps four curves in one enum with no feature gating. The `leaf-min` image is deleted rather than fixed. It priced application messages with the resilience features off, and the crate requires all four mls-rs features, so cargo's unification made the variant measure the same bytes as `leaf`: two rows, one image, and a reader with no way to tell. A row reporting a number for a configuration nobody can build is worse than no row, and this is the second time a gate in this tree has gone vacuous without saying so. `tools/mls-interop` is deliberately NOT converted, and the plan that said it would be was working from a premise that does not hold. The harness operates at the MLS layer, trading key package bytes and MLS messages; `LeafDevice` operates at the frame layer. Converting it would force the harness to build signed control frames on the PHONE side too, and its phone is raw OpenMLS rather than the SDK engine, so that means a second implementation of the engine's frame building living in a harness. That is the exact failure ADR 0022 names, and the exact way this harness acquired its copies last time. The frame layer is covered instead by the leaf crate's own tests, which run a real MlsManager phone against the device in one process; the harness keeps doing the job only it can do, which is two pinned MLS libraries meeting out of process.
bahdotsh
force-pushed
the
feat/harnesses-use-leaf-crate
branch
from
August 21, 2026 17:22
c80fd78 to
9720df7
Compare
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.
Stage 3 of the leaf payload crypto work, part D of four. Stacked on #399.
The measurement was pricing something unshippable
The footprint harness's leaf image drove mls-rs directly, so it linked the MLS calls and nothing around them: no envelope codec, no control-frame signing, no address derivation. It now runs
offline-protocol-leaf, so the number covers the code a device actually runs.rfc_compliant, X.509 included (upper bound)The figure moved from 390.2 KiB to 435.7 KiB, a little over a quarter of a 1536 KiB xG24.
Worth being plain about how that relates to the 400 KiB in ADR 0021: that was a decision gate, set to answer whether MLS on a leaf node was viable at all before anything was built, and it did that job. It is not a budget the shipping image is being held to. The recovery lever recorded beside it is still worth more than the growth: about 111 KiB of this image is P-384 and P-256 arithmetic nothing uses, linked because the crypto provider keeps all four curves in one enum with no feature gating.
leaf-minis deleted, not fixedIt priced application messages with the resilience features off.
offline-protocol-leafrequires all four mls-rs features, cargo unifies features, and so the variant silently began measuring the same bytes asleaf: two rows, one image, and a reader with no way to tell.A row reporting a number for a configuration nobody can build is worse than no row. This is the second time a gate in this tree has gone vacuous without announcing it, which is why the removal is called out here rather than done quietly.
tools/mls-interopis deliberately not convertedMy plan said this PR would move the harness's leaf side onto the crate. That premise does not hold, and I'd rather say so than force it through.
The harness operates at the MLS layer, trading key package bytes and MLS messages.
LeafDeviceoperates at the frame layer. Converting the harness would force it to build signed control frames on the phone side too, and its phone is raw OpenMLS rather than the SDK engine, so that means a second implementation of the engine's frame building living inside a harness. That is the exact failure ADR 0022 names, and the exact way this harness acquired its copies last time.The frame layer is covered instead by the leaf crate's own tests (#399), which run a real
MlsManagerphone against the device in one process. The harness keeps doing the job only it can do: two pinned MLS libraries meeting out of process. It still passes untouched, all ten steps plus the three step-0 negative controls.The remaining duplication is two lines (unwrapping the MLS message to a bare key package), and both copies are exercised against a real OpenMLS phone, so a drift would fail somewhere rather than pass everywhere. The values that could drift silently, the backdate and the lifetime, already come from
offline-protocol-sealed.Verification
The CI clippy loop drops
leaf-minalongside the feature itself, so the job lints exactly the variants that exist.