Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 14 additions & 4 deletions crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ const IS_FAUCET_REGISTERED_FLAG=1
#! Computes hash(GER) = rpo256::merge(GER_UPPER, GER_LOWER) and stores it in a map
#! with value [GER_KNOWN_FLAG, 0, 0, 0] to indicate the GER is known.
#!
#! Panics if the note sender is not the global exit root manager.
#!
#! Inputs: [GER_LOWER[4], GER_UPPER[4], pad(8)]
#! Outputs: [pad(16)]
#!
#! Invocation: call
pub proc update_ger
# assert the note sender is the global exit root manager.
exec.assert_sender_is_ger_manager
# => [GER_LOWER[4], GER_UPPER[4], pad(8)]

# compute hash(GER) = rpo256::merge(GER_UPPER, GER_LOWER)
# inputs: [B, A] => output: hash(A || B)
exec.rpo256::merge
Expand Down Expand Up @@ -98,19 +104,23 @@ end
#! The sentinel value `[1, 0, 0, 0]` distinguishes registered faucets from
#! non-existent entries (SMTs return EMPTY_WORD for missing keys).
#!
#! Panics if the note sender is not the bridge admin.
#!
#! Inputs: [faucet_id_prefix, faucet_id_suffix, pad(14)]
#! Outputs: [pad(16)]
#!
#! Invocation: call
pub proc register_faucet
# assert the note sender is the bridge admin.
exec.assert_sender_is_bridge_admin
# => [faucet_id_prefix, faucet_id_suffix, pad(14)]

# set_map_item expects [slot_id(2), KEY(4), VALUE(4)] and returns [OLD_VALUE(4)].
push.IS_FAUCET_REGISTERED_FLAG
# => [IS_FAUCET_REGISTERED_FLAG, slot_id_prefix, slot_id_suffix, pad(14)]
# => [IS_FAUCET_REGISTERED_FLAG, faucet_id_prefix, faucet_id_suffix, pad(14)]

movdn.7
# => [[slot_id_prefix, slot_id_suffix, 0, 0], [0, 0, 0, IS_FAUCET_REGISTERED_FLAG], pad(9)]
# => [[faucet_id_prefix, faucet_id_suffix, 0, 0], [0, 0, 0, IS_FAUCET_REGISTERED_FLAG], pad(9)]

# Place slot ID on top
push.FAUCET_REGISTRY_SLOT[0..2]
Expand Down Expand Up @@ -161,7 +171,7 @@ end
#! Panics if:
#! - the note sender does not match the bridge admin account ID.
#!
#! Invocation: call
#! Invocation: exec
pub proc assert_sender_is_bridge_admin
# => [pad(16)]

Expand Down Expand Up @@ -191,7 +201,7 @@ end
#! Panics if:
#! - the note sender does not match the GER manager account ID.
#!
#! Invocation: call
#! Invocation: exec
pub proc assert_sender_is_ger_manager
# => [pad(16)]

Expand Down
2 changes: 0 additions & 2 deletions crates/miden-agglayer/asm/components/bridge.masm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# This is a thin wrapper that re-exports bridge-related procedures from the
# agglayer library.

pub use ::miden::agglayer::bridge::bridge_config::assert_sender_is_bridge_admin
pub use ::miden::agglayer::bridge::bridge_config::assert_sender_is_ger_manager
pub use ::miden::agglayer::bridge::bridge_config::register_faucet
pub use ::miden::agglayer::bridge::bridge_config::update_ger
pub use ::miden::agglayer::bridge::bridge_in::verify_leaf_bridge
Expand Down
6 changes: 0 additions & 6 deletions crates/miden-agglayer/asm/note_scripts/CONFIG_AGG_BRIDGE.masm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const ERR_CONFIG_AGG_BRIDGE_TARGET_ACCOUNT_MISMATCH = "CONFIG_AGG_BRIDGE note at
#!
#! Requires that the account exposes:
#! - agglayer::bridge_config::register_faucet procedure.
#! - agglayer::bridge_config::assert_sender_is_bridge_admin procedure.
#!
#! Inputs: [ARGS, pad(12)]
#! Outputs: [pad(16)]
Expand All @@ -40,7 +39,6 @@ const ERR_CONFIG_AGG_BRIDGE_TARGET_ACCOUNT_MISMATCH = "CONFIG_AGG_BRIDGE note at
#!
#! Panics if:
#! - The note attachment target account does not match the consuming bridge account.
#! - The note sender is not the bridge admin.
#! - The note does not contain exactly 2 storage items.
#! - The account does not expose the register_faucet procedure.
#!
Expand All @@ -53,10 +51,6 @@ begin
assert.err=ERR_CONFIG_AGG_BRIDGE_TARGET_ACCOUNT_MISMATCH
# => [pad(16)]

# Ensure the note sender is the bridge admin.
call.bridge_config::assert_sender_is_bridge_admin
# => [pad(16)]

# Load note storage to memory
push.STORAGE_START_PTR exec.active_note::get_storage
# => [num_storage_items, dest_ptr, pad(16)]
Expand Down
6 changes: 0 additions & 6 deletions crates/miden-agglayer/asm/note_scripts/UPDATE_GER.masm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const ERR_UPDATE_GER_TARGET_ACCOUNT_MISMATCH = "UPDATE_GER note attachment targe
#!
#! Requires that the account exposes:
#! - agglayer::bridge_config::update_ger procedure.
#! - agglayer::bridge_config::assert_sender_is_ger_manager procedure.
#!
#! Inputs: [ARGS, pad(12)]
#! Outputs: [pad(16)]
Expand All @@ -38,7 +37,6 @@ const ERR_UPDATE_GER_TARGET_ACCOUNT_MISMATCH = "UPDATE_GER note attachment targe
#! Panics if:
#! - account does not expose update_ger procedure.
#! - target account ID does not match the consuming account ID.
#! - note sender is not the global exit root manager.
#! - number of note storage items is not exactly 8.
begin
dropw
Expand All @@ -49,10 +47,6 @@ begin
assert.err=ERR_UPDATE_GER_TARGET_ACCOUNT_MISMATCH
# => [pad(16)]

# Ensure the note sender is the global exit root manager.
call.bridge_config::assert_sender_is_ger_manager
# => [pad(16)]

# proceed with the GER update logic

push.STORAGE_PTR_GER_LOWER exec.active_note::get_storage
Expand Down