Replace unwrap() with expect() for StorageSlotName parsing#2451
Merged
mmagician merged 2 commits intommagician-cursor-bridge-out-component-implementation-details-5737from Feb 16, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix storage slot names in AggLayerBridge contract
Replace unwrap() with expect() for StorageSlotName parsing
Feb 16, 2026
Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com>
6355721 to
ee38210
Compare
d94c035
into
mmagician-cursor-bridge-out-component-implementation-details-5737
14 of 15 checks passed
mmagician
added a commit
that referenced
this pull request
Feb 18, 2026
…d update it upon `B2AGG` consumption (#2424) * chore: unify b2agg note storage layout with claim note * chore: clarify destinationAddress in CLAIM note * feat: mem_store_double_word_unaligned * feat: compute leaf value for bridging out * chore: update comment about origin network ID * fix: write_address_to_memory had incorrect address arithmetic The add.N values should all be add.1 (incrementing the running pointer by 1 each time), not add.1, add.2, add.3, add.4 which caused addresses to skip (P, P+1, P+3, P+6, P+10 instead of P, P+1, P+2, P+3, P+4). Also includes byte-order fixes (u256_le_to_abi, swap_u32_bytes for originNetwork and leafType) and test infrastructure for verifying the root against Solidity vectors. Status: the MMR root computation via call is verified correct (test_mmr_append_via_call passes). The write_address_to_memory fix changed the bridge_out root. Still investigating a remaining mismatch related to u256_le_to_abi + mem_store_double_word_unaligned interaction. Co-authored-by: marti <marti@hungrycats.studio> * fix: handling of dest address and ID in B2AGG * feat: reverse_limbs_and_change_byte_endianness * chore: integrate byte and limb swapping to bridging * fix: swap origin net ID endianness; rearrange mem writes Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: pad mem with zeros after metadata * feat: store LET frontier in double-word array * feat: frontier test generation from param"d leaves * feat: verify computed LER against expected root * write leaf"s amounts to JSON * fix: compare LET by elements, rev elements per word * chore: Replace `unwrap()` with `expect()` for StorageSlotName parsing (#2451) * Initial plan * chore: replace unwrap() with expect() for storage slot names Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> * Update crates/miden-testing/tests/agglayer/bridge_out.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: move (de)ser logic to test_utils * chore: organize test_utils better Signed-off-by: Marti <marti@miden.team> * chore: serialize amounts as strings in mmr test vecs Signed-off-by: Marti <marti@miden.team> * test bridge_out frontier persistence across two consumes Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * fix bridge_out frontier reload num_leaves endianness Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * test bridge_out with shared multi-note helper and 32-leaf case Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * refactor bridge_out coverage to direct 32-leaf burn flow Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * refactor MMR vectors to seeded per-leaf destinations Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * chore: cleanup tests Signed-off-by: Marti <marti@miden.team> --------- Signed-off-by: Marti <marti@miden.team> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
mmagician
added a commit
that referenced
this pull request
Feb 18, 2026
* chore: unify b2agg note storage layout with claim note * chore: clarify destinationAddress in CLAIM note * feat: mem_store_double_word_unaligned * feat: compute leaf value for bridging out * chore: update comment about origin network ID * fix: write_address_to_memory had incorrect address arithmetic The add.N values should all be add.1 (incrementing the running pointer by 1 each time), not add.1, add.2, add.3, add.4 which caused addresses to skip (P, P+1, P+3, P+6, P+10 instead of P, P+1, P+2, P+3, P+4). Also includes byte-order fixes (u256_le_to_abi, swap_u32_bytes for originNetwork and leafType) and test infrastructure for verifying the root against Solidity vectors. Status: the MMR root computation via call is verified correct (test_mmr_append_via_call passes). The write_address_to_memory fix changed the bridge_out root. Still investigating a remaining mismatch related to u256_le_to_abi + mem_store_double_word_unaligned interaction. Co-authored-by: marti <marti@hungrycats.studio> * fix: handling of dest address and ID in B2AGG * feat: reverse_limbs_and_change_byte_endianness * chore: integrate byte and limb swapping to bridging * fix: swap origin net ID endianness; rearrange mem writes Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: pad mem with zeros after metadata * feat: store LET frontier in double-word array * feat: frontier test generation from param"d leaves * feat: verify computed LER against expected root * write leaf"s amounts to JSON * fix: compare LET by elements, rev elements per word * feat: add faucet registry * chore: CONFIG note docs * chore: simplify creation of existing agg faucet w/supply * lint * chore: TODO on bridge admin validation * chore: simplify stack operations Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> * chore: Replace `unwrap()` with `expect()` for StorageSlotName parsing (#2451) * Initial plan * chore: replace unwrap() with expect() for storage slot names Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> * Update crates/miden-testing/tests/agglayer/bridge_out.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: only truncate at the end * chore: move (de)ser logic to test_utils * chore: organize test_utils better Signed-off-by: Marti <marti@miden.team> * chore: serialize amounts as strings in mmr test vecs Signed-off-by: Marti <marti@miden.team> * test bridge_out frontier persistence across two consumes Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * fix bridge_out frontier reload num_leaves endianness Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * test bridge_out with shared multi-note helper and 32-leaf case Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * refactor bridge_out coverage to direct 32-leaf burn flow Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * refactor MMR vectors to seeded per-leaf destinations Co-authored-by: marti <marti@hungrycats.studio> Signed-off-by: Marti <marti@miden.team> * chore: cleanup tests Signed-off-by: Marti <marti@miden.team> * fix: rustfmt line wrapping + clippy needless_range_loop Co-authored-by: marti <marti@hungrycats.studio> * fix: read addr conversion slot in reverse * chore: use non-zero address * chore: rename loc const to distinguish * chore: use loc const in create_burn_note * chore: bring back doc and inline comments --------- Signed-off-by: Marti <marti@miden.team> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
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.
Addresses review feedback to improve error diagnostics when storage slot name parsing fails.
Changes
.unwrap()with.expect("... should be valid")onStorageSlotName::new()calls increate_bridge_account_builder()Before/After
This matches the existing pattern used elsewhere in the file for storage slot name creation.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.