Bridge program upgrade: hook data, multiple attesters, ceiling burn limit, burn_public_as_signer method#3
Open
Roee-87 wants to merge 17 commits into
Open
Bridge program upgrade: hook data, multiple attesters, ceiling burn limit, burn_public_as_signer method#3Roee-87 wants to merge 17 commits into
Roee-87 wants to merge 17 commits into
Conversation
Roee-87
commented
Apr 20, 2026
|
|
||
| const USDCX_PAUSE_KEY: address = aleo16s9af9darj0j5k7fpaxjq0u9fepd6sc4svrkr9vs4d3wlmp5lqyq4h3fpl; | ||
| const USDCX_MANAGER_KEY: address = aleo13zt4uq0u09sffnf4ctgu47k5n30txjx2w9cwcqgneapjeqsywsqqu6hspt; | ||
| const PRIVATE_MINT_WRAPPER_ADDRESS: address = usdcx_private_mint.aleo; |
Collaborator
Author
There was a problem hiding this comment.
We can choose whatever program name we want.
eranrund
suggested changes
Apr 20, 2026
eranrund
left a comment
There was a problem hiding this comment.
Mostly looks good, I think there is one important assertion that is missing and another optional one that wouldn't hurt to add.
Thank you!
Roee-87
commented
Apr 21, 2026
| for i in 0u8..253u8 { | ||
| sliced_bits[i] = address_bits[i]; | ||
| } | ||
| for i in 0u8..3u8 { |
Collaborator
Author
There was a problem hiding this comment.
This check ensures that an invalid address cannot "mask" a valid address by leveraging the unused bits.
eranrund
reviewed
Apr 21, 2026
d0cd
reviewed
Apr 23, 2026
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.
The modifications to the bridge program are intended to enable users to mint private tokens via a wrapper contract. In order to support this feature, we expand the deposit payload array size from 240 byte to 305 bytes in order to accommodate a 65 byte
hookDatafield. The first byte will be used as a flag to indicate whethermint_public_v2ormint_private_v2should be used. The next 32 bytes will contain an encoding that will permit a user to atomically mint privately via a wrapper program. The remaining 32 bytes will remain unused.Furthermore, we add support for minting from multiple source chains by matching the
localTokenfield with its correct attester key. This enables users to mint using deposit attestations generated from both ARC chain and Ethereum mainnet by matching thelocalTokenfield of the deposit payload to an attester key via a new mapping calledcircle_attesters. We also include a configurable ceiling limit for individual burn transactions. Finally, we add aburn_public_as_signermethod that explicitly burn funds from the signer.This PR contains modifications which require deprecating some existing functions and replacing them with nearly identical implementation that include some additional minor changes. The features enabled by this PR are:
check_mint_invariantsmethod withcheck_mint_invariants_v2. The main changes to this new method are:deposit_input: [u8; 305]now encompasses a byte array with 305 elements.hookDataLenportion of the deposit payload is equal to 65:local_token_contract_addressvariable, which will be used to select the correct attester key for ECDSA signature verification.mint_privatewithmint_private_v2. NOTE that this preserves the existing private minting feature which exposes the user's Aleo address in the deposit payload. This is unrelated to the private mint via wrapper program implementation.deposit_input: [u8; 305]type.check_mint_invariants_v2(deposit_input, digest)method.mint_private_v2method:local_tokento the correct attester key:mint_publicwithmint_public_v2.deposit_input: [u8; 305]type.check_mint_invariants_v2(deposit_input, digest)method.mint_public_v2method:local_tokento the correct attester key:Adding a
burn_public_as_signermethod which is a copy of theburn_publicmethod with the exception of the sender field being replaced with `self.signer.We also add a check for unused bits in the address (indices 253, 254, 255) and make sure they are all set to zero. This is referenced in a comment in the PR.
Private mint and burn wrapper program. This wrapper programs leverages the
hookDatafield of the deposit payload to to mint private USDCx without leaking the final recipient's Aleo address. This is accomplished by first minting public USDCx to the wrapper program and then transferring the funds to the final recipient viatransfer_public_to_privatein one transaction. In order to ensure that the caller is authorized to call this method, the caller must prove that they are able to generate the 32 byte encoding from thehookDatafield.The second method allows a user to burn private USDCx by first sending private USDCx to the wrapper program via
transfer_private_to_publicand then calling the bridge'sburn_publicmethod in one transaction.