refactor: reorient CLAIM note consumption flow#2528
Open
partylikeits1983 wants to merge 44 commits intoagglayerfrom
Open
refactor: reorient CLAIM note consumption flow#2528partylikeits1983 wants to merge 44 commits intoagglayerfrom
CLAIM note consumption flow#2528partylikeits1983 wants to merge 44 commits intoagglayerfrom
Conversation
55ee9fb to
57cfbb5
Compare
Fumuran
requested changes
Mar 2, 2026
Contributor
Fumuran
left a comment
There was a problem hiding this comment.
Looks great, thank you! I left some nits and questions inline.
This is partial review, I only looked through the MASM code (but mostly in a way of code optimization, not the algorithm correctness).
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
ee64a9b to
6a602df
Compare
mmagician
requested changes
Mar 4, 2026
mmagician
reviewed
Mar 10, 2026
Fumuran
approved these changes
Mar 11, 2026
Contributor
Fumuran
left a comment
There was a problem hiding this comment.
Looks great, thank you! I left just one nit inline.
mmagician
requested changes
Mar 11, 2026
mmagician
reviewed
Mar 14, 2026
Comment on lines
407
to
+410
| exec.asset_conversion::verify_u256_to_native_amount_conversion | ||
| # => [y, pad(15)] | ||
| # => [y] | ||
|
|
||
| drop push.0 | ||
| # => [pad(16)] | ||
| drop |
0d19a5e to
cfb6211
Compare
mmagician
requested changes
Mar 14, 2026
Comment on lines
+313
to
+316
| static AGGLAYER_FAUCET_SLOT_NAME: LazyLock<StorageSlotName> = LazyLock::new(|| { | ||
| StorageSlotName::new("miden::agglayer::faucet") | ||
| .expect("agglayer faucet storage slot name should be valid") | ||
| }); |
Collaborator
There was a problem hiding this comment.
the faucet no longer calls the bridge via FPI, so this slot is no longer needed AFAICS
| /// ## Storage Layout | ||
| /// | ||
| /// - [`Self::metadata_slot`]: Stores [`TokenMetadata`]. | ||
| /// - [`Self::bridge_account_id_slot`]: Stores the AggLayer bridge account ID. |
Collaborator
There was a problem hiding this comment.
to be removed as well, see above
Comment on lines
+424
to
+431
| let bridge_account_id_word = Word::new([ | ||
| Felt::ZERO, | ||
| Felt::ZERO, | ||
| faucet.bridge_account_id.suffix(), | ||
| faucet.bridge_account_id.prefix().as_felt(), | ||
| ]); | ||
| let bridge_slot = | ||
| StorageSlot::with_value(AGGLAYER_FAUCET_SLOT_NAME.clone(), bridge_account_id_word); |
Collaborator
There was a problem hiding this comment.
as per above comments, no longer needed
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.
This PR reorients the flow in which the
CLAIMnote is consumed.This PR reorients the flow from:
CLAIM note is consumed by AggFaucet account, which does an FPI call to bridge to verify merkle proof, if valid creates P2ID note
to:
CLAIM note is consumed by AggBridge account which verifies the merkle proof, if valid creates a MINT note, which is then consumed by AggFaucet account in separate tx, which creates P2ID note.
This PR adds a mapping to the AggBridge which stores the
bytes20origin token address in the faucet registry ashash(bytes20)->AccountId.This is so that when creating the
MINTnote, the correct network note attachment target can be set. Storing the hash of the destination address as the key in a mapping, where the value is the aggfaucetAccountIdis essential, as previously we only stored registered AggFaucets in a mapping like this:AccountId->bool.Note: Both the
MINTnote &P2IDnote which created by the consumption of theMINTnote, both use thePROOF_DATA_KEY(hash of proof data) as their serial numbers.Resolves #2506