From 4c3e8992f31f60975835d548673684e7fbd0ee2c Mon Sep 17 00:00:00 2001 From: "Claude (Opus)" Date: Fri, 22 May 2026 08:37:26 +0000 Subject: [PATCH] refactor(agglayer): promote GER_KNOWN_FLAG to a const word Declare GER_KNOWN_FLAG as a 4-felt word ([1, 0, 0, 0]) and replace the two `push.0.0.0.GER_KNOWN_FLAG` call sites with `push.GER_KNOWN_FLAG`. This mirrors the existing const-word pattern already used elsewhere in the repo (e.g. IS_CLAIMED_FLAG in bridge_in.masm, IS_EXECUTED_FLAG in multisig.masm, ALLOWED_WORD/BLOCKED_WORD in the standards crate). These were the only two manual word constructions of this shape left in the codebase. FAUCET_REGISTERED_FLAG stays a single felt because it is combined with a runtime `is_native` value, so it cannot be promoted to a standalone const word. --- .../asm/agglayer/bridge/bridge_config.masm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm b/crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm index 5a28ba666b..15123668f2 100644 --- a/crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm +++ b/crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm @@ -26,7 +26,7 @@ const TOKEN_REGISTRY_MAP_SLOT = word("agglayer::bridge::token_registry_map") const FAUCET_METADATA_MAP_SLOT = word("agglayer::bridge::faucet_metadata_map") # Flags -const GER_KNOWN_FLAG = 1 +const GER_KNOWN_FLAG = [1, 0, 0, 0] const FAUCET_REGISTERED_FLAG = 1 # Offset in the local memory of the `hash_token_address` procedure @@ -53,7 +53,7 @@ const FAUCET_METADATA_SUBKEY_HASH_HI = 3 # METADATA_HASH_HI[4] #! Updates the Global Exit Root (GER) in the bridge account storage. #! #! Computes hash(GER) = poseidon2::merge(GER_LOWER, GER_UPPER) and stores it in a map with value -#! [GER_KNOWN_FLAG, 0, 0, 0] to indicate the GER is known. +#! GER_KNOWN_FLAG to indicate the GER is known. #! #! Inputs: [GER_LOWER[4], GER_UPPER[4], pad(8)] #! Outputs: [pad(16)] @@ -71,9 +71,9 @@ pub proc update_ger exec.poseidon2::merge # => [GER_HASH, pad(12)] - # prepare VALUE = [GER_KNOWN_FLAG, 0, 0, 0] - push.0.0.0.GER_KNOWN_FLAG - # => [GER_KNOWN_FLAG, 0, 0, 0, GER_HASH, pad(12)] + # prepare VALUE = GER_KNOWN_FLAG + push.GER_KNOWN_FLAG + # => [GER_KNOWN_FLAG, GER_HASH, pad(12)] swapw # => [GER_HASH, VALUE, pad(12)] @@ -111,9 +111,9 @@ pub proc assert_valid_ger exec.active_account::get_map_item # => [VALUE] - # assert the GER is known in storage (VALUE = [GER_KNOWN_FLAG, 0, 0, 0]) - push.0.0.0.GER_KNOWN_FLAG - # => [GER_KNOWN_FLAG, 0, 0, 0, VALUE] + # assert the GER is known in storage (VALUE = GER_KNOWN_FLAG) + push.GER_KNOWN_FLAG + # => [GER_KNOWN_FLAG, VALUE] assert_eqw.err=ERR_GER_NOT_FOUND # => []