Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7899c23
feat: add `getLeafValue` procedure (#2262)
mmagician Jan 27, 2026
1a1513a
`CLAIM` note followup: helper functions & refactoring (#2270)
partylikeits1983 Jan 22, 2026
ebf6b30
Merge branch 'next' into agglayer
mmagician Jan 23, 2026
0b23645
feat: implement Keccak-based MMR frontier (#2245)
Fumuran Jan 23, 2026
c596be2
feat(AggLayer): Solidity compatibility tests for MMR frontier code (#…
mmagician Jan 23, 2026
bdb456b
feat(AggLayer): add `leafType` param to `CLAIM` note (#2290)
mmagician Jan 23, 2026
a5ac23e
feat(AggLayer): `UPDATE_GER` note (#2333)
mmagician Jan 24, 2026
df1ea7b
Merge branch 'next' into agglayer-fixed-2
mmagician Jan 27, 2026
1f5e907
feat: port of #2352 to next
mmagician Jan 27, 2026
1beb904
Merge branch 'next' into agglayer-fixed-2
mmagician Jan 28, 2026
3bbea70
Merge branch 'next' into agglayer-fixed-2
bobbinth Jan 29, 2026
de62ecf
chore: use `bytes_to_packed_u32_felts` instead of defining our own in…
mmagician Jan 29, 2026
62f9e73
Merge branch 'next' into agglayer-fixed-2
mmagician Jan 29, 2026
768b496
feat(AggLayer): implement `verify_leaf_bridge` (#2288)
mmagician Feb 1, 2026
f07f8d1
Merge branch 'next' into agglayer-fixed-2
mmagician Feb 1, 2026
23716be
Merge branch 'next' into agglayer-fixed-2
mmagician Feb 2, 2026
8154910
fix: address merge leftovers
mmagician Feb 2, 2026
a96e029
lint
mmagician Feb 2, 2026
6f6b40e
feat: Implement `verify_merkle_proof` for `miden::agglayer` (#2361)
Fumuran Feb 4, 2026
a1f3b48
feat(AggLayer): `B2AGG` note consumption check (#2334)
mmagician Feb 4, 2026
52cd415
Merge branch 'next' into agglayer-fixed-2
mmagician Feb 5, 2026
82504a7
Merge branch 'next' into agglayer-fixed-2
mmagician Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "crates/miden-agglayer/solidity-compat/lib/forge-std"]
path = crates/miden-agglayer/solidity-compat/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "crates/miden-agglayer/solidity-compat/lib/agglayer-contracts"]
path = crates/miden-agglayer/solidity-compat/lib/agglayer-contracts
url = https://github.com/agglayer/agglayer-contracts
2 changes: 2 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
exclude = ["crates/miden-agglayer/solidity-compat/lib/*"]

[formatting]
align_entries = true
column_width = 120
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
- Enable `CodeBuilder` to add advice map entries to compiled scripts ([#2275](https://github.com/0xMiden/miden-base/pull/2275)).
- Added `BlockNumber::MAX` constant to represent the maximum block number ([#2324](https://github.com/0xMiden/miden-base/pull/2324)).
- Added single-word `Array` standard ([#2203](https://github.com/0xMiden/miden-base/pull/2203)).
- Added B2AGG and UPDATE_GER note attachment target checks ([#2334](https://github.com/0xMiden/miden-base/pull/2334)).
- Added double-word array data structure abstraction over storage maps ([#2299](https://github.com/0xMiden/miden-base/pull/2299)).
- Implemented verification of AggLayer deposits (claims) against GER ([#2295](https://github.com/0xMiden/miden-base/pull/2295), [#2288](https://github.com/0xMiden/miden-base/pull/2288)).
- Added `SignedBlock` struct ([#2355](https://github.com/0xMiden/miden-base/pull/2235)).
- Added `PackageKind` and `ProcedureExport` ([#2358](https://github.com/0xMiden/miden-base/pull/2358)).
- [BREAKING] Added `get_asset` and `get_initial_asset` kernel procedures and removed `get_balance`, `get_initial_balance` and `has_non_fungible_asset` kernel procedures ([#2369](https://github.com/0xMiden/miden-base/pull/2369)).
Expand Down Expand Up @@ -52,12 +54,15 @@
- [BREAKING] Refactored storage slots to be accessed by names instead of indices ([#1987](https://github.com/0xMiden/miden-base/pull/1987), [#2025](https://github.com/0xMiden/miden-base/pull/2025), [#2149](https://github.com/0xMiden/miden-base/pull/2149), [#2150](https://github.com/0xMiden/miden-base/pull/2150), [#2153](https://github.com/0xMiden/miden-base/pull/2153), [#2154](https://github.com/0xMiden/miden-base/pull/2154), [#2160](https://github.com/0xMiden/miden-base/pull/2160), [#2161](https://github.com/0xMiden/miden-base/pull/2161), [#2170](https://github.com/0xMiden/miden-base/pull/2170)).
- [BREAKING] Allowed account components to share identical account code procedures ([#2164](https://github.com/0xMiden/miden-base/pull/2164)).
- Add `AccountId::parse()` helper function to parse both hex and bech32 formats ([#2223](https://github.com/0xMiden/miden-base/pull/2223)).
- Add Keccak-based MMR frontier structure to the Agglayer library ([#2245](https://github.com/0xMiden/miden-base/pull/2245)).
- Add `read_foreign_account_inputs()`, `read_vault_asset_witnesses()`, and `read_storage_map_witness()` for `TransactionInputs` ([#2246](https://github.com/0xMiden/miden-base/pull/2246)).
- [BREAKING] Introduced `NoteAttachment` as part of `NoteMetadata` and remove `aux` and `execution_hint` ([#2249](https://github.com/0xMiden/miden-base/pull/2249), [#2252](https://github.com/0xMiden/miden-base/pull/2252), [#2260](https://github.com/0xMiden/miden-base/pull/2260), [#2268](https://github.com/0xMiden/miden-base/pull/2268), [#2279](https://github.com/0xMiden/miden-base/pull/2279)).
- [BREAKING] Introduce `NoteAttachment` as part of `NoteMetadata` and remove `aux` and `execution_hint` ([#2249](https://github.com/0xMiden/miden-base/pull/2249), [#2252](https://github.com/0xMiden/miden-base/pull/2252), [#2260](https://github.com/0xMiden/miden-base/pull/2260), [#2268](https://github.com/0xMiden/miden-base/pull/2268), [#2279](https://github.com/0xMiden/miden-base/pull/2279)).
- Introduce standard `NetworkAccountTarget` attachment for use in network transactions which replaces `NoteTag::NetworkAccount` ([#2257](https://github.com/0xMiden/miden-base/pull/2257)).
- Add a foundry test suite for verifying AggLayer contracts compatibility ([#2312](https://github.com/0xMiden/miden-base/pull/2312)).
- Added `AccountSchemaCommitment` component to expose account storage schema commitments ([#2253](https://github.com/0xMiden/miden-base/pull/2253)).
- Introduced standard `NetworkAccountTarget` attachment for use in network transactions which replaces `NoteTag::NetworkAccount` ([#2257](https://github.com/0xMiden/miden-base/pull/2257)).
- Added an `AccountBuilder` extension trait to help build the schema commitment; added `AccountComponentMetadata` to `AccountComponent` ([#2269](https://github.com/0xMiden/miden-base/pull/2269)).
- Added `miden::standards::access::ownable` standard module for component ownership management, and integrated it into the `network_fungible` faucet (including new tests). ([#2228](https://github.com/0xMiden/miden-base/pull/2228)).
- [BREAKING] Add `leaf_value` to `CLAIM` note inputs ([#2290](https://github.com/0xMiden/miden-base/pull/2290)).

### Changes

Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ build-no-std: ## Build without the standard library
build-no-std-testing: ## Build without the standard library. Includes the `testing` feature
$(BUILD_GENERATED_FILES_IN_SRC) cargo build --no-default-features --target wasm32-unknown-unknown --workspace --exclude bench-transaction --features testing

# --- test vectors --------------------------------------------------------------------------------

.PHONY: generate-solidity-test-vectors
generate-solidity-test-vectors: ## Regenerate Solidity MMR test vectors using Foundry
cd crates/miden-agglayer/solidity-compat && forge test -vv --match-test test_generateVectors
cd crates/miden-agglayer/solidity-compat && forge test -vv --match-test test_generateCanonicalZeros
cd crates/miden-agglayer/solidity-compat && forge test -vv --match-test test_generateVerificationProofData

# --- benchmarking --------------------------------------------------------------------------------

.PHONY: bench-tx
Expand Down
3 changes: 3 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[default]
extend-ignore-identifiers-re = [".*1st.*", ".*2nd.*", ".*3rd.*"]

[files]
extend-exclude = ["crates/miden-agglayer/solidity-compat/lib"]
1 change: 1 addition & 0 deletions crates/miden-agglayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fs-err = { workspace = true }
miden-assembly = { workspace = true }
miden-core = { workspace = true }
miden-core-lib = { workspace = true }
miden-crypto = { workspace = true }
miden-protocol = { features = ["testing"], workspace = true }
miden-standards = { workspace = true }
regex = { version = "1.11" }
Expand Down
94 changes: 57 additions & 37 deletions crates/miden-agglayer/asm/bridge/agglayer_faucet.masm
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use miden::agglayer::bridge_in
use miden::agglayer::asset_conversion
use miden::agglayer::eth_address
use miden::protocol::active_account
use miden::protocol::active_note
use miden::standards::faucets
use miden::protocol::note
use miden::protocol::tx
use miden::core::mem
use miden::core::word


# CONSTANTS
Expand All @@ -15,7 +17,7 @@ use miden::core::mem
const BRIDGE_ID_SLOT = word("miden::agglayer::faucet")

const PROOF_DATA_WORD_LEN = 134
const LEAF_DATA_WORD_LEN = 6
const LEAF_DATA_WORD_LEN = 8
const OUTPUT_NOTE_DATA_WORD_LEN = 2

const PROOF_DATA_START_PTR = 0
Expand All @@ -31,8 +33,14 @@ const CLAIM_NOTE_DATA_MEM_ADDR = 712
const OUTPUT_NOTE_INPUTS_MEM_ADDR = 0
const OUTPUT_NOTE_TAG_MEM_ADDR = 574
const OUTPUT_NOTE_SERIAL_NUM_MEM_ADDR = 568
const OUTPUT_NOTE_ASSET_AMOUNT_MEM_ADDR_0 = 548
const OUTPUT_NOTE_ASSET_AMOUNT_MEM_ADDR_1 = 552
const OUTPUT_NOTE_ASSET_AMOUNT_MEM_ADDR_0 = 552
const OUTPUT_NOTE_ASSET_AMOUNT_MEM_ADDR_1 = 556

const DESTINATION_ADDRESS_0 = 547
const DESTINATION_ADDRESS_1 = 548
const DESTINATION_ADDRESS_2 = 549
const DESTINATION_ADDRESS_3 = 550
const DESTINATION_ADDRESS_4 = 551

# P2ID output note constants
const P2ID_NOTE_NUM_STORAGE_ITEMS = 2
Expand All @@ -46,7 +54,7 @@ const P2ID_OUTPUT_NOTE_AMOUNT_MEM_PTR = 611

const ERR_INVALID_CLAIM_PROOF = "invalid claim proof"

#! Inputs: [PROOF_DATA_KEY, LEAF_DATA_KEY]
#! Inputs: [LEAF_DATA_KEY, PROOF_DATA_KEY]
#! Outputs: []
#!
#! Panics if:
Expand All @@ -56,28 +64,23 @@ const ERR_INVALID_CLAIM_PROOF = "invalid claim proof"
#!
#! Invocation: exec
proc validate_claim
# Get bridge_in::check_claim_proof procedure MAST root
procref.bridge_in::check_claim_proof
# => [BRIDGE_PROC_MAST_ROOT]
# get bridge_in::verify_leaf_bridge procedure MAST root
procref.bridge_in::verify_leaf_bridge
# => [BRIDGE_PROC_MAST_ROOT, LEAF_DATA_KEY, PROOF_DATA_KEY]

push.BRIDGE_ID_SLOT[0..2]
# => [bridge_id_idx, BRIDGE_PROC_MAST_ROOT]
# => [bridge_id_idx, BRIDGE_PROC_MAST_ROOT, LEAF_DATA_KEY, PROOF_DATA_KEY]

# Get Bridge AccountId
# get bridge account ID
exec.active_account::get_item
# => [bridge_account_id_prefix, bridge_account_id_suffix, 0, 0, BRIDGE_PROC_MAST_ROOT]
# => [bridge_account_id_prefix, bridge_account_id_suffix, 0, 0, BRIDGE_PROC_MAST_ROOT, LEAF_DATA_KEY, PROOF_DATA_KEY]

movup.2 drop movup.2 drop
# => [bridge_account_id_prefix, bridge_account_id_suffix, BRIDGE_PROC_MAST_ROOT]
# => [bridge_account_id_prefix, bridge_account_id_suffix, BRIDGE_PROC_MAST_ROOT, LEAF_DATA_KEY, PROOF_DATA_KEY]

# Call check_claim_proof procedure on Bridge
# Calling: bridge_in::check_claim_proof
# call bridge_in::verify_leaf_bridge
exec.tx::execute_foreign_procedure
# => [validation_result]

# Assert valid proof data
assert.err=ERR_INVALID_CLAIM_PROOF drop
# => []
# => []
end

# Inputs: []
Expand All @@ -93,12 +96,6 @@ proc scale_down_amount
repeat.7 drop end
end

# Inputs: []
# Outputs: [prefix, suffix]
proc get_destination_account_id
mem_load.543 mem_load.544
end

# Inputs: [PROOF_DATA_KEY, LEAF_DATA_KEY, OUTPUT_NOTE_DATA_KEY]
# Outputs: []
proc batch_pipe_double_words
Expand Down Expand Up @@ -127,6 +124,27 @@ proc batch_pipe_double_words
exec.mem::pipe_double_words_preimage_to_memory drop
end

#! Extracts the destination account ID as address[5] from memory.
#!
#! This procedure reads the destination address from the leaf data and converts it from
#! Ethereum address format to AccountId format (prefix, suffix).
#!
#! Inputs: []
#! Outputs: [prefix, suffix]
#!
#! Invocation: exec
proc get_destination_account_id_data
mem_load.DESTINATION_ADDRESS_4
mem_load.DESTINATION_ADDRESS_3
mem_load.DESTINATION_ADDRESS_2
mem_load.DESTINATION_ADDRESS_1
mem_load.DESTINATION_ADDRESS_0
# => [address[5]]

exec.eth_address::to_account_id
# => [prefix, suffix]
end

#! Builds a P2ID output note for the claim recipient.
#!
#! This procedure expects the claim data to be already written to memory via batch_pipe_double_words.
Expand All @@ -148,15 +166,16 @@ proc build_p2id_output_note
push.P2ID_NOTE_NUM_STORAGE_ITEMS
# => [note_num_storage_items, SERIAL_NUM, SCRIPT_ROOT]

exec.get_destination_account_id
# => [account_id_prefix, account_id_suffix, note_num_storage_items, SERIAL_NUM, SCRIPT_ROOT]

mem_store.0 mem_store.1
# => [note_num_storage_items, SERIAL_NUM, SCRIPT_ROOT]

push.OUTPUT_NOTE_INPUTS_MEM_ADDR
# => [storage_ptr = 0, note_num_storage_items, SERIAL_NUM, SCRIPT_ROOT]

exec.get_destination_account_id_data
# => [prefix, suffix]

# Write destination account id into memory
mem_store.1 mem_store.0
# => []

exec.note::build_recipient
# => [RECIPIENT]

Expand Down Expand Up @@ -207,7 +226,6 @@ end
#! destinationAddress[5], // Destination address (5 felts, address as 5 u32 felts)
#! amount[8], // Amount of tokens (8 felts, uint256 as 8 u32 felts)
#! metadata[8], // ABI encoded metadata (8 felts, fixed size)
#! EMPTY_WORD // padding
#! ],
#! OUTPUT_NOTE_DATA_KEY => [
#! output_p2id_serial_num[4], // P2ID note serial number (4 felts, Word)
Expand All @@ -224,20 +242,22 @@ end
pub proc claim
# Check AdviceMap values hash to keys & write CLAIM inputs & DATA_KEYs to global memory
exec.batch_pipe_double_words
# => []
# => [pad(16)]

# VALIDATE CLAIM
mem_loadw_be.LEAF_DATA_KEY_MEM_ADDR padw
mem_loadw_be.PROOF_DATA_KEY_MEM_ADDR
# => [PROOF_DATA_KEY, LEAF_DATA_KEY]
mem_loadw_be.PROOF_DATA_KEY_MEM_ADDR
# => [PROOF_DATA_KEY, pad(12)]
swapw
mem_loadw_be.LEAF_DATA_KEY_MEM_ADDR
# => [LEAF_DATA_KEY, PROOF_DATA_KEY, pad(8)]

# Errors on invalid proof
exec.validate_claim
# => []
# => [pad(16)]

# Create P2ID output note
exec.build_p2id_output_note
# => []
# => [pad(16)]
end

#! Burns the fungible asset from the active note.
Expand Down
Loading