Skip to content

Create storage helpers for AggLayerBridge#2562

Merged
mmagician merged 9 commits intoagglayerfrom
andrew-agglayer-create-storage-helper
Mar 13, 2026
Merged

Create storage helpers for AggLayerBridge#2562
mmagician merged 9 commits intoagglayerfrom
andrew-agglayer-create-storage-helper

Conversation

@Fumuran
Copy link
Copy Markdown
Contributor

@Fumuran Fumuran commented Mar 5, 2026

This PR adds helper functions to the AggLayerBridge struct to simplify the storage checks and make them more robust.

Namely, this PR:

  • Creates the is_ger_registered helper method in the AggLayerBridge to simplify the GER presence in the storage.
  • Moves the read_local_exit_root procedure from the testing crate to agglayer, making it a method of the AggLayerBridge.

Both this methods got an internal check, whether the provided account is in fact an AggLayerBridge account.

Once this PR is merged, we should remove the is_ger_registered procedure from the miden-client's testing utilities (0xMiden/miden-client#1854).

Closes: #2548

@Fumuran Fumuran added no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority labels Mar 5, 2026
@mmagician mmagician added the agglayer PRs or issues related to AggLayer bridging integration label Mar 6, 2026
@Fumuran Fumuran marked this pull request as ready for review March 6, 2026 11:51
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 good! Once all of Marti's comments are addressed I think its good to merge

Copy link
Copy Markdown
Collaborator

@mmagician mmagician left a comment

Choose a reason for hiding this comment

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

LGTM bar the debug vs. runtime assertion question

@Fumuran Fumuran requested a review from mmagician March 13, 2026 18:37
@mmagician mmagician merged commit 35ae1c4 into agglayer Mar 13, 2026
17 checks passed
@mmagician mmagician deleted the andrew-agglayer-create-storage-helper branch March 13, 2026 18:48
Comment on lines +311 to +322
fn slot_names() -> Vec<&'static StorageSlotName> {
vec![
&*GER_MAP_SLOT_NAME,
&*LET_FRONTIER_SLOT_NAME,
&*LET_ROOT_LO_SLOT_NAME,
&*LET_ROOT_HI_SLOT_NAME,
&*LET_NUM_LEAVES_SLOT_NAME,
&*FAUCET_REGISTRY_SLOT_NAME,
&*BRIDGE_ADMIN_SLOT_NAME,
&*GER_MANAGER_SLOT_NAME,
]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The approach we've taken in the standard components is a bit different from this one: we have a method that returns AccountComponentMetadata (e.g., see here) and then this method is used to build an account component (e.g., here).

A potential improvement on that is to have another method that returns StorageSchema and then use that method in the method that returns AccountComponentMetadata.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IIUC, this only applies to how we build AccountComponentMetadata, right? Currently, we construct it manually:

let metadata = AccountComponentMetadata::new("agglayer::bridge")
    .with_description("Bridge component for AggLayer")
    .with_supports_all_types();

And I think your suggestion is to have a helper on AggLayerBridge to return this:

let metadata = AggLayerBridge::component_metadata();

Did I get your comment correctly?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, exactly!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot implement the suggested change branching off agglayer branch, and make a PR there.

Comment on lines +165 to +168
pub fn is_ger_registered(
ger: ExitRoot,
bridge_account: Account,
) -> Result<bool, AgglayerBridgeError> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As discussed offline, this approach is fine for now - but in production, we'll probably have to re-work this as loading the full account into memory may become prohibitively expensive. The two driving factors of this would be:

  • GER storage map. This currently has un-bounded growth. If we do come up with a strategy to cap the growth somehow, then this may not be as big of an issue.
  • CLAIM note nullifier map (once CLAIM notes are re-oriented toward the bridge account). Here too, if we find a way not to store all note nullifiers in the account, the bridge account size would likely be pretty small.

If the bridge account does grow in size over time, the alternative way to handle these types of methods would be on the client wrapper and to use the StorageReader to read specific information from the database as needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍🏼 I created 0xMiden/miden-client#1899 to track this

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 no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants