Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
20 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
9528a3a
fix: update max leaves constants and comments
mmagician Jan 19, 2026
6b129b0
chore: regen errors file
mmagician Jan 19, 2026
c1ad238
Merge branch 'agglayer' into andrew-keccak-based-mmr-frontier
mmagician Jan 20, 2026
afb71e8
fix: first assert valid u32, only then u32lte
mmagician Jan 21, 2026
62801c5
Merge branch 'agglayer' into andrew-keccak-based-mmr-frontier
mmagician Jan 21, 2026
c4815d6
Merge branch 'agglayer' into andrew-keccak-based-mmr-frontier
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [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)).

### Changes

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

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

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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use miden::agglayer::bridge_in
use miden::agglayer::asset_conversion
use miden::agglayer::bridge::bridge_in
use miden::agglayer::bridge::asset_conversion
use miden::protocol::active_account
use miden::protocol::active_note
use miden::standards::faucets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use miden::agglayer::crypto_utils
use miden::agglayer::bridge::crypto_utils

# Inputs: []
# Output: [GER_ROOT[8]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use miden::protocol::note
use miden::protocol::output_note
use miden::core::crypto::hashes::keccak256
use miden::core::word
use miden::agglayer::local_exit_tree
use miden::agglayer::bridge::local_exit_tree

# CONSTANTS
# =================================================================================================
Expand Down
142 changes: 142 additions & 0 deletions crates/miden-agglayer/asm/lib/collections/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 = [1676014350, 378744630, 4127735880, 2512168523]
const ZERO_0_R = [3362732168, 2839872470, 2825030484, 3656125737]

const ZERO_1_L = [501060780, 3871659214, 3009211592, 2623812180]
const ZERO_1_R = [1269040150, 2402257162, 1716941530, 3619962211]

const ZERO_2_L = [2113874120, 866443917, 1466696484, 1577749685]
const ZERO_2_R = [3266301349, 2378900196, 2613970667, 2822768521]

const ZERO_3_L = [3624627744, 3896701049, 3259095475, 2541063347]
const ZERO_3_R = [2174359630, 3386860883, 819752706, 2663419451]

const ZERO_4_L = [3672259025, 1408703058, 2325593427, 3764368977]
const ZERO_4_R = [1768984761, 3986407010, 3179733816, 3993949676]

const ZERO_5_L = [2772295100, 1943789808, 3975148557, 2783120662]
const ZERO_5_R = [1954699067, 4078189558, 55884592, 3556179934]

const ZERO_6_L = [3620179672, 1669076837, 1951232209, 4187387354]
const ZERO_6_R = [309999657, 4129479497, 530694391, 299727713]

const ZERO_7_L = [2918102591, 119603686, 3125998835, 895130167]
const ZERO_7_R = [245802069, 3845465214, 3934985642, 2837654569]

const ZERO_8_L = [271488435, 1717001085, 1305424546, 538355432]
const ZERO_8_R = [124909746, 644307460, 3419249369, 782880481]

const ZERO_9_L = [2189421404, 1783823289, 3813766329, 1789354560]
const ZERO_9_R = [1855340856, 817123230, 3089942376, 174904954]

const ZERO_10_L = [375743363, 1308858826, 755251446, 911486005]
const ZERO_10_R = [3377776426, 1035832485, 574418250, 1523328736]

const ZERO_11_L = [2621493517, 3341395974, 2070488580, 1721402463]
const ZERO_11_R = [3900508003, 2932864493, 1957185163, 4258202685]

const ZERO_12_L = [1042343921, 1633680683, 847892742, 758594683]
const ZERO_12_R = [4021522957, 604736114, 3833963575, 2741659565]

const ZERO_13_L = [2879246467, 873094143, 882108112, 2788346038]
const ZERO_13_R = [3350696348, 677620407, 4210645142, 2762276002]

const ZERO_14_L = [1657282718, 4264199614, 2599504558, 654282608]
const ZERO_14_R = [3425616321, 2633350903, 86362747, 3453599566]

const ZERO_15_L = [282022813, 2015367434, 943393248, 1652888442]
const ZERO_15_R = [1910064035, 3178820944, 4117352765, 3507547949]

const ZERO_16_L = [2916330304, 3548484307, 3540728028, 4202637705]
const ZERO_16_R = [402644991, 747024330, 2812322100, 3677448823]

const ZERO_17_L = [3813051616, 3086514589, 3853935788, 4010711467]
const ZERO_17_R = [601458450, 666775207, 4093486471, 190965730]

const ZERO_18_L = [3772916734, 774534926, 3186581608, 2535117726]
const ZERO_18_R = [3785211573, 1248984975, 4186670534, 2774811472]

const ZERO_19_L = [2749092066, 939662296, 4004636181, 1083488375]
const ZERO_19_R = [1299043721, 4020210966, 1700478904, 2901673295]

const ZERO_20_L = [2088169657, 3624693886, 884347370, 176375261]
const ZERO_20_R = [1871806964, 862788926, 1107778503, 1960420932]

const ZERO_21_L = [131461836, 1486230444, 2284783064, 3100622900]
const ZERO_21_R = [1289649426, 1453954755, 3662508831, 694219501]

const ZERO_22_L = [1856241950, 1432536952, 3358446991, 777144882]
const ZERO_22_R = [318845628, 1406013311, 506791329, 1472623968]

const ZERO_23_L = [998445550, 1025982451, 2601646095, 1552016407]
const ZERO_23_R = [4003945586, 341877117, 1597614435, 4154697324]

const ZERO_24_L = [266162747, 3127065426, 3067288335, 3049012237]
const ZERO_24_R = [191768599, 2104535560, 2101144575, 284108060]

const ZERO_25_L = [3819429484, 1432116557, 2087882098, 3943272001]
const ZERO_25_R = [1441853131, 3402850067, 3476825864, 3175349503]

const ZERO_26_L = [571159868, 4168749913, 3778954908, 30082537]
const ZERO_26_R = [1012249604, 2795554803, 673147717, 293710789]

const ZERO_27_L = [3862533907, 1949060583, 3570324592, 3397225807]
const ZERO_27_R = [16031537, 3486943421, 4074785471, 4235457039]

const ZERO_28_L = [2088923015, 1814104072, 593632184, 3561994129]
const ZERO_28_R = [1772068067, 3563445487, 3588047122, 2708185215]

const ZERO_29_L = [3116740215, 1050645592, 1804663275, 637099818]
const ZERO_29_R = [2695593158, 3394251134, 1821981233, 3747227518]

const ZERO_30_L = [3188207974, 1911816415, 2923763218, 1938896043]
const ZERO_30_R = [325044474, 3476282389, 975932720, 4200751503]

const ZERO_31_L = [1660898463, 3491256481, 2110686815, 2160185560]
const ZERO_31_R = [3612663449, 900073458, 1379219315, 2880097400]

use ::miden::agglayer::collections::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
Loading