Skip to content

feat(AggLayer): Solidity compatibility tests for MMR frontier code#2312

Merged
mmagician merged 32 commits intoagglayerfrom
mmagician-solidity-compat
Jan 23, 2026
Merged

feat(AggLayer): Solidity compatibility tests for MMR frontier code#2312
mmagician merged 32 commits intoagglayerfrom
mmagician-solidity-compat

Conversation

@mmagician
Copy link
Copy Markdown
Collaborator

As suggested here, we're getting to a stage with the AggLayer integration where we should check for compatibility with the Solidity implementation.

This PR adds a small foundry project inside the miden-agglayer crate:

  • forge commands to generate the test vectors. The vectors are generated by calling the Solidity functions of interest _addLeaf & getRoot
  • make generate-solidity-test-vectors command to locally re-generate the test files
  • Rust test which reads the test vector as a reference, and compares with the Rust implementation KeccakMmrFrontier32 (currently we're not comparing with the output of MASM, since we independently already have Rust<>MASM compatibility test, so by extension we have Solidity<>MASM compat)
  • for now, no CI job that re-generates the test vectors. If desirable, we can consider adding this later

To be done in a follow-up PR:

  • move miden-testing/agglayer code into miden-agglayer crate. Otherwise, the Rust compat test (located in miden-testing depends on the test vectors which are generated in a different crate (miden-agglayer)

@mmagician mmagician requested a review from Copilot January 19, 2026 15:32

This comment was marked as resolved.

@mmagician mmagician marked this pull request as ready for review January 19, 2026 15:56
Copy link
Copy Markdown
Member

@partylikeits1983 partylikeits1983 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Only comment is to remove console.log()s from tests & to use foundry cheatcode instead of doing string manipulation in solidity :)

Copy link
Copy Markdown
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I reviewed the structure and the Rust tests, but can't comment too much on Solidity code.

Copy link
Copy Markdown
Member

@partylikeits1983 partylikeits1983 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@mmagician mmagician added the agglayer PRs or issues related to AggLayer bridging integration label Jan 21, 2026
@mmagician mmagician requested a review from bobbinth January 22, 2026 15:54
Base automatically changed from andrew-keccak-based-mmr-frontier to agglayer January 23, 2026 09:46
@mmagician mmagician merged commit 66bf679 into agglayer Jan 23, 2026
17 checks passed
@mmagician mmagician deleted the mmagician-solidity-compat branch January 23, 2026 10:15
mmagician added a commit that referenced this pull request Jan 27, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
mmagician added a commit that referenced this pull request Jan 27, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
mmagician added a commit that referenced this pull request Jan 27, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
mmagician added a commit that referenced this pull request Jan 27, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
mmagician added a commit that referenced this pull request Jan 27, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
mmagician added a commit that referenced this pull request Jan 27, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
partylikeits1983 added a commit that referenced this pull request Feb 12, 2026
…2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Mar 9, 2026
…xMiden#2312)

* feat: impl fist frontier version, add (yet buggy) test

* test: fix the test, fix the bug in algorithm

* chore: update changelog

* docs: add docs for the MMR frontier in the masm file

* refactor: update the doc comments, slightly update code

* refactor: update docs and comments, add overflow check, update test

* test: add more leaves

* test: add zero root test

* chore: rename `root` -> `expected_root`

in leaf assertion tests

* chore: lint

* chore: revert to using old dir structure

* feat: generate test vectors with foundry

* feat: use agglayer submodule instead of copying source files

* chore: use generated test vectors in compat tests

* chore: remove the human-readable fn

* chore: split test vectors

into leaf<>root<>count paris; and canonical zeros

* chore: remove unnecessary metadata

* chore: cleanup readme

* changelog

* chore: ignore submodule from typos check

* chore: exclude submodule from toml fmt

* fix: update max leaves constants and comments

* chore: regen errors file

* refactor: use foundry cheatcode (0xMiden#2314)

* chore: use workspace serde dep

* chore: cleanup changelog

---------

Co-authored-by: Andrey Khmuro <akhmuro@gmail.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agglayer PRs or issues related to AggLayer bridging integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants