Description
The Solidity sovereign chain GER manager (GlobalExitRootManagerL2SovereignChain.sol) rejects duplicate GER insertions: insertGlobalExitRoot() checks if (globalExitRootMap[_newRoot] != 0) revert GlobalExitRootAlreadySet() before writing. This prevents wasted gas and catches integration bugs where the same GER is submitted twice. The GlobalExitRootAlreadySet check is something sovereign chains enforce, not a hard requirement from the base bridge protocol.
The Miden bridge's update_ger procedure calls native_account::set_map_item which returns the old value, but this old value is dropped without inspection (line 70: dropw). Writing [1, 0, 0, 0] over an existing [1, 0, 0, 0] is idempotent and produces no error.
Impact
Functionally harmless since the write is idempotent. However, it wastes computational resources (the transaction executes successfully but achieves nothing) and could mask bugs in the Integration Service that cause duplicate GER submissions. If the GER insertion hash chain (issue 009) is implemented, duplicate insertions would also corrupt the chain hash by including the same GER twice.
Recommended Action
In update_ger, after calling set_map_item, check the returned old value and panic if the GER was already set (old value non-zero) instead of silently dropping it. If the GER insertion hash chain (issue 009) is also implemented, the duplicate check must happen before the chain hash update to avoid corrupting it.
References
Classification
This validation is part of the sovereign chain extension (GlobalExitRootManagerL2SovereignChain), not the base bridge contract. The GlobalExitRootAlreadySet check is something sovereign chains enforce, not a hard requirement from the base bridge protocol.
Description
The Solidity sovereign chain GER manager (
GlobalExitRootManagerL2SovereignChain.sol) rejects duplicate GER insertions:insertGlobalExitRoot()checksif (globalExitRootMap[_newRoot] != 0) revert GlobalExitRootAlreadySet()before writing. This prevents wasted gas and catches integration bugs where the same GER is submitted twice. TheGlobalExitRootAlreadySetcheck is something sovereign chains enforce, not a hard requirement from the base bridge protocol.The Miden bridge's
update_gerprocedure callsnative_account::set_map_itemwhich returns the old value, but this old value is dropped without inspection (line 70:dropw). Writing[1, 0, 0, 0]over an existing[1, 0, 0, 0]is idempotent and produces no error.Impact
Functionally harmless since the write is idempotent. However, it wastes computational resources (the transaction executes successfully but achieves nothing) and could mask bugs in the Integration Service that cause duplicate GER submissions. If the GER insertion hash chain (issue 009) is implemented, duplicate insertions would also corrupt the chain hash by including the same GER twice.
Recommended Action
In
update_ger, after callingset_map_item, check the returned old value and panic if the GER was already set (old value non-zero) instead of silently dropping it. If the GER insertion hash chain (issue 009) is also implemented, the duplicate check must happen before the chain hash update to avoid corrupting it.References
bridge_config.masm(update_ger)GlobalExitRootManagerL2SovereignChain.solClassification
This validation is part of the sovereign chain extension (
GlobalExitRootManagerL2SovereignChain), not the base bridge contract. TheGlobalExitRootAlreadySetcheck is something sovereign chains enforce, not a hard requirement from the base bridge protocol.