Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fb09b70
feat: impl fist frontier version, add (yet buggy) test
Fumuran Jan 8, 2026
1d71ed5
test: fix the test, fix the bug in algorithm
Fumuran Jan 11, 2026
645b3ad
chore: update changelog
Fumuran Jan 11, 2026
13d756e
docs: add docs for the MMR frontier in the masm file
Fumuran Jan 11, 2026
dec8cfa
refactor: update the doc comments, slightly update code
Fumuran Jan 13, 2026
5820f55
Merge branch 'next' into andrew-keccak-based-mmr-frontier
Fumuran Jan 13, 2026
32d7b4c
refactor: update docs and comments, add overflow check, update test
Fumuran Jan 15, 2026
1252871
test: add more leaves
Fumuran Jan 15, 2026
ee5564f
test: add zero root test
Fumuran Jan 15, 2026
fe7bc87
Merge branch 'agglayer' into andrew-keccak-based-mmr-frontier
Fumuran Jan 15, 2026
fc86060
chore: rename `root` -> `expected_root`
mmagician Jan 19, 2026
53e1788
Merge branch 'agglayer' into andrew-keccak-based-mmr-frontier
mmagician Jan 19, 2026
f015d31
chore: lint
mmagician Jan 19, 2026
089eafd
chore: revert to using old dir structure
mmagician Jan 19, 2026
d370ba6
feat: generate test vectors with foundry
mmagician Jan 19, 2026
3b1ff17
feat: use agglayer submodule instead of copying source files
mmagician Jan 19, 2026
a551790
chore: use generated test vectors in compat tests
mmagician Jan 19, 2026
9ebf857
chore: remove the human-readable fn
mmagician Jan 19, 2026
3f08e25
chore: split test vectors
mmagician Jan 19, 2026
b4d80e7
chore: remove unnecessary metadata
mmagician Jan 19, 2026
32783f2
chore: cleanup readme
mmagician Jan 19, 2026
46f912e
changelog
mmagician Jan 19, 2026
db45701
chore: ignore submodule from typos check
mmagician Jan 19, 2026
d105a95
chore: exclude submodule from toml fmt
mmagician Jan 19, 2026
9528a3a
fix: update max leaves constants and comments
mmagician Jan 19, 2026
6b129b0
chore: regen errors file
mmagician Jan 19, 2026
db5f8da
refactor: use foundry cheatcode (#2314)
partylikeits1983 Jan 20, 2026
c1ad238
Merge branch 'agglayer' into andrew-keccak-based-mmr-frontier
mmagician Jan 20, 2026
9823c68
Merge branch 'andrew-keccak-based-mmr-frontier' into mmagician-solidi…
mmagician Jan 20, 2026
3b02574
chore: use workspace serde dep
mmagician Jan 20, 2026
73bf320
chore: cleanup changelog
mmagician Jan 20, 2026
16d810d
Merge branch 'agglayer' into mmagician-solidity-compat
mmagician Jan 23, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
- [BREAKING] Allowed account components to share identical account code procedures ([#2164](https://github.com/0xMiden/miden-base/pull/2164)).
- Add `From<&ExecutedTransaction> for TransactionHeader` implementation ([#2178](https://github.com/0xMiden/miden-base/pull/2178)).
- 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] Introduce `NoteAttachment` as part of `NoteMetadata` and remove `aux` and `execution_hint` ([#2249](https://github.com/0xMiden/miden-base/pull/2249)).
- [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)).
- [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)).
- [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)).

### 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.

7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ 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

# --- 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 = { version = "3" }
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
142 changes: 142 additions & 0 deletions crates/miden-agglayer/asm/bridge/canonical_zeros.masm
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# This file is generated by build.rs, do not modify

# This file contains the canonical zeros for the Keccak hash function.
# Zero of height `n` (ZERO_N) is the root of the binary tree of height `n` with leaves equal zero.
#
# Since the Keccak hash is represented by eight u32 values, each constant consists of two Words.

const ZERO_0_L = [0, 0, 0, 0]
const ZERO_0_R = [0, 0, 0, 0]

const ZERO_1_L = [3042949783, 3846789184, 2990541491, 2447652395]
const ZERO_1_R = [2532382527, 1151697986, 3453220726, 3056087725]

const ZERO_2_L = [806175122, 2661877378, 3993486975, 3704028736]
const ZERO_2_R = [1186125340, 4132056164, 2406448277, 1360642484]

const ZERO_3_L = [2243606276, 2319049635, 2778422344, 3686444836]
const ZERO_3_R = [836748766, 3055947948, 1063027030, 2746866977]

const ZERO_4_L = [1150525734, 2360852476, 3881358125, 3462706719]
const ZERO_4_R = [224004420, 1513564138, 4058651434, 3010037733]

const ZERO_5_L = [768598281, 293668224, 2114802790, 2680951561]
const ZERO_5_R = [523052921, 3386889228, 1344794057, 3206459406]

const ZERO_6_L = [1746508463, 578821813, 283579568, 4134788524]
const ZERO_6_R = [756088757, 1715252246, 1087590535, 3173153928]

const ZERO_7_L = [2205136186, 3475749318, 613780937, 1818541875]
const ZERO_7_R = [40140559, 91932979, 4234379492, 1459738623]

const ZERO_8_L = [2941712185, 3321779339, 1227307046, 4069577285]
const ZERO_8_R = [611590243, 2128798138, 2473269631, 1607231384]

const ZERO_9_L = [3763621903, 1154705673, 1903710296, 1972812290]
const ZERO_9_R = [4216691121, 4275626407, 3113795592, 3855940302]

const ZERO_10_L = [2781069751, 774786966, 4112065289, 2182953470]
const ZERO_10_R = [3567589455, 861991663, 1356863200, 2134826233]

const ZERO_11_L = [2465787000, 4149924453, 2720076317, 1467765009]
const ZERO_11_R = [1838648827, 866654147, 167150306, 1228583416]

const ZERO_12_L = [2631517602, 171349786, 79648606, 4164671431]
const ZERO_12_R = [270336915, 2195882716, 3960096235, 3469119540]

const ZERO_13_L = [3152187846, 1895984889, 2047814617, 1944734805]
const ZERO_13_R = [3551827087, 82830058, 326416580, 3649232833]

const ZERO_14_L = [3435063385, 3598841737, 2762164692, 1894305546]
const ZERO_14_R = [3658789242, 3755895333, 49531590, 3618465628]

const ZERO_15_L = [3525744215, 708101859, 2574387782, 3790037114]
const ZERO_15_R = [3700193742, 843132861, 3055060558, 2681109466]

const ZERO_16_L = [530120689, 2718529082, 3981742412, 4194160956]
const ZERO_16_R = [4065390056, 824943129, 4207046226, 266679079]

const ZERO_17_L = [2062522595, 650244466, 598998238, 1099357850]
const ZERO_17_R = [1543068721, 3603315816, 3833704967, 3367359457]

const ZERO_18_L = [2692314236, 1072797208, 2923625471, 4157324078]
const ZERO_18_R = [746357617, 2400147060, 3144187786, 181284186]

const ZERO_19_L = [2691355510, 1491476508, 3986541574, 2665487122]
const ZERO_19_R = [1032730592, 1039549588, 4164965877, 3056102068]

const ZERO_20_L = [3803705507, 1732703975, 3478010394, 1535003327]
const ZERO_20_R = [4242360534, 719184416, 3062253412, 1167482566]

const ZERO_21_L = [3655320222, 899251086, 3853444828, 1001466509]
const ZERO_21_R = [4045815225, 971767692, 1168258541, 2290434548]

const ZERO_22_L = [2011403911, 3698331664, 3934089079, 946955861]
const ZERO_22_R = [3411854989, 1866109879, 418371072, 3692469338]

const ZERO_23_L = [1390808632, 3168994683, 4234662665, 2053609922]
const ZERO_23_R = [2805567324, 2651248336, 696388782, 1078982733]

const ZERO_24_L = [4011431532, 565969590, 1910056709, 4220355468]
const ZERO_24_R = [1681176506, 4292988995, 276516087, 2502281165]

const ZERO_25_L = [2371989742, 3318538162, 999806777, 2066155765]
const ZERO_25_R = [1956437264, 2768897524, 1475191156, 3378167562]

const ZERO_26_L = [3498569445, 3649628337, 1786802573, 2038831148]
const ZERO_26_R = [1678762243, 2385297319, 4030198639, 74763704]

const ZERO_27_L = [516194684, 3360338824, 2165369292, 1916245748]
const ZERO_27_R = [3748991331, 1513828739, 3418759627, 1431735427]

const ZERO_28_L = [787185022, 1571753335, 2366459736, 3067898230]
const ZERO_28_R = [79972070, 2975955312, 3165837101, 3722718822]

const ZERO_29_L = [581144193, 3146618532, 1244629930, 2215341298]
const ZERO_29_R = [2551087773, 3876094376, 1909551909, 246581816]

const ZERO_30_L = [903308566, 578217418, 2128594844, 1787682571]
const ZERO_30_R = [1078065138, 2904706143, 1223587258, 1350312851]

const ZERO_31_L = [2840985724, 1653344606, 4049365781, 2389186238]
const ZERO_31_R = [3759582231, 2660540036, 1648733876, 2340505732]

use ::miden::agglayer::mmr_frontier32_keccak::mem_store_double_word

#! Inputs: [zeros_ptr]
#! Outputs: []
pub proc load_zeros_to_memory
push.ZERO_0_L.ZERO_0_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_1_L.ZERO_1_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_2_L.ZERO_2_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_3_L.ZERO_3_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_4_L.ZERO_4_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_5_L.ZERO_5_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_6_L.ZERO_6_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_7_L.ZERO_7_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_8_L.ZERO_8_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_9_L.ZERO_9_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_10_L.ZERO_10_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_11_L.ZERO_11_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_12_L.ZERO_12_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_13_L.ZERO_13_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_14_L.ZERO_14_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_15_L.ZERO_15_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_16_L.ZERO_16_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_17_L.ZERO_17_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_18_L.ZERO_18_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_19_L.ZERO_19_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_20_L.ZERO_20_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_21_L.ZERO_21_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_22_L.ZERO_22_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_23_L.ZERO_23_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_24_L.ZERO_24_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_25_L.ZERO_25_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_26_L.ZERO_26_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_27_L.ZERO_27_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_28_L.ZERO_28_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_29_L.ZERO_29_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_30_L.ZERO_30_R exec.mem_store_double_word dropw dropw add.8
push.ZERO_31_L.ZERO_31_R exec.mem_store_double_word dropw dropw add.8
drop
end
Loading