chore: opinionated improvements to #2528#2602
chore: opinionated improvements to #2528#2602partylikeits1983 merged 9 commits intoajl-reorient-claim-note-flowfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates AggLayer asset conversion verification to be “assert-only” (no stack return value), then propagates the new stack behavior through bridge claim logic and the associated tests.
Changes:
- Change
verify_u128_to_native_amount_conversion/verify_u256_to_native_amount_conversionMASM procedures to return no outputs (validation via successful execution). - Update bridge
claimflow to keep faucet ID on the operand stack instead of storing/loading it from global memory during claim verification and note construction. - Adjust Rust tests to stop asserting on returned stack values for scale-down verification.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| crates/miden-testing/tests/agglayer/asset_conversion.rs | Updates tests to treat successful execution of the verifier as sufficient validation. |
| crates/miden-agglayer/asm/agglayer/common/asset_conversion.masm | Updates verifier procedures to produce no stack outputs and adjusts internal stack choreography accordingly. |
| crates/miden-agglayer/asm/agglayer/bridge/bridge_in.masm | Refactors claim flow to thread faucet ID via stack and updates verifier usage to match the new “no output” convention. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR updates Agglayer asset conversion verification procedures to consume their inputs without leaving values on the stack, and adjusts bridge-in flow and tests accordingly.
Changes:
- Update
verify_u128_to_native_amount_conversion/verify_u256_to_native_amount_conversionto return no outputs and adjust internal stack choreography. - Refactor
bridge_in::claimflow to avoid storing faucet account ID in global memory, keeping it on the operand stack across calls instead. - Update Rust tests to treat successful execution of the verifier as validation (since the verifier no longer returns
y).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/miden-testing/tests/agglayer/asset_conversion.rs | Adjusts scale-down tests to align with verifier procedures no longer returning y. |
| crates/miden-agglayer/asm/agglayer/common/asset_conversion.masm | Changes verifier procedures to Outputs: [] and updates stack manipulation accordingly. |
| crates/miden-agglayer/asm/agglayer/bridge/bridge_in.masm | Removes faucet-id global-memory storage and threads faucet ID through claim logic via the stack. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
partylikeits1983
left a comment
There was a problem hiding this comment.
Looks good, thank you for making these changes. I checked out the branch and made minor changes to co-pilot's suggestions.
dc72124
into
ajl-reorient-claim-note-flow
* feat: wip CLAIM note flow reorientation * wip: build MINT note from aggbridge * wip: created MINT note encodes incorrect public P2ID or public P2ID not in DataStore * feat: working e2e CLAIM flow reordering * fix: cleanup rm debug.stack * refactor: improve readability of MINT note memory addresses * refactor: fix stack comments * fix: rm println statements * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/note_scripts/CLAIM.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_in.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_in.masm Co-authored-by: Andrey Khmuro <[email protected]> * Update crates/miden-agglayer/asm/agglayer/bridge/bridge_in.masm Co-authored-by: Andrey Khmuro <[email protected]> * refactor: improve bridge_in doc comments * refactor: add constants for memory addresses * refactor: cleanup memory layout in bridge_in * fix: update comment in CLAIM note * refactor: remove redundant dropw * refactor: use execution_hint::ALWAYS * refactor: rm redundant const note type * refactor: simplify loc_store/load ops in bridge_in * refactor: decompose build_mint_output_note into modular helpers * refactor: remove pad(x) stack comments from exec'ed procs * feat: add constants for attachement types * fix: add call to verify_u256_scale_down procedure * refactor: use ATTACHMENT_KIND_NONE const * fix: use truncate_stack proc for FPI call & exec compatibility * refactor: add get_scale & get_scale_inner for call vs exec * refactor: use local memory for TOKEN_ADDR_HASH_PTR * refactor: look up faucet by token address only once during claim * fix: fix array comment syntax * refactor: rm pad comments from exec'ed proc * refactor: rm swapw & replace w padw * fix: update comment * refactor: refactor is_token_registered proc * chore: more explicit mem constant names * fix: explicit pad before FPI call * refactor: remove unused bridge account ID storage slot from AggLayer faucet * chore: opinionated improvements to #2528 (#2602) * chore: pass faucet ID on stack to verify_claim_amount * chore: pass faucet ID on stack to build_mint_output_note * chore: completely remove CLAIM_FAUCET_ID_PREFIX_MEM_ADDR * chore: drop "y" in verify_u128_to_native_amount_conversion * chore: avoid uplicating y only to drop it later * chore: adjust comments; no longer reading faucetID from mem * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * fix: rename to output & fix copilot suggestion --------- Co-authored-by: Alexander John Lee <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]> Co-authored-by: riemann <[email protected]> * refactor: move bridge & faucet code from lib.rs to dedicated modules --------- Co-authored-by: Andrey Khmuro <[email protected]> Co-authored-by: Marti <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
* chore: pass faucet ID on stack to verify_claim_amount * chore: pass faucet ID on stack to build_mint_output_note * chore: completely remove CLAIM_FAUCET_ID_PREFIX_MEM_ADDR * chore: drop "y" in verify_u128_to_native_amount_conversion * chore: avoid uplicating y only to drop it later * chore: adjust comments; no longer reading faucetID from mem * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * fix: rename to output & fix copilot suggestion --------- Co-authored-by: Alexander John Lee <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]> Co-authored-by: riemann <[email protected]>
Addresses own PR review comments:
CLAIMnote consumption flow #2528 (comment) (no need to returnyfromverify_u128_to_native_amount_conversion)CLAIMnote consumption flow #2528 (comment))