0xMiden / 0xMiden/protocol

AggLayer: Track GER insertion hash chain

Đang mở
#2,707 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
agglayer
Ngôn ngữ chính
Rust
Star
132
Fork
167
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
110

Mô tả

## Description

The Solidity sovereign chain GER manager ([`GlobalExitRootManagerL2SovereignChain.sol`](https://github.com/agglayer/agglayer-contracts/blob/main/contracts/v2/sovereignChains/GlobalExitRootManagerL2SovereignChain.sol)) maintains a running hash chain of all inserted GERs via `insertedGERHashChain`. Each call to `insertGlobalExitRoot()` updates this chain: `insertedGERHashChain = efficientKeccak256(insertedGERHashChain, _newRoot)`. This enables compact proofs of the complete GER insertion sequence. The GER insertion hash chain is something sovereign chains can opt into, not a hard requirement from the base bridge protocol.

The Miden bridge's [`update_ger`](https://github.com/0xMiden/miden-base/blob/next/crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm) procedure stores the GER in the `ger_map` but does not update any chain hash. The bridge does maintain a Claimed Global Index (CGI) chain hash via the `cgi_chain_hash_lo/hi` slots (updated in [`bridge_in::claim`](https://github.com/0xMiden/miden-base/blob/next/crates/miden-agglayer/asm/agglayer/bridge/bridge_in.masm)), but there is no analogous tracking for GER insertions.

## Impact

The bridge cannot generate compact proofs of which GERs have been inserted and in what order. This may affect the ability of the prover to construct validity proofs that include GER state transitions, and makes auditing the GER insertion history more difficult.

## Recommended Action

Maintain a running Keccak-256 hash chain of all inserted GERs, following the same pattern as the existing CGI chain hash (`cgi_chain_hash_lo/hi` slots). Modify `update_ger` to compute `Keccak256(old_chain || GER)` after each insertion and store the result. The procedure will need to be restructured to preserve the original GER values before the Poseidon hash, since the chain hash requires the raw GER.

## References

- [`bridge_config.masm`](https://github.com/0xMiden/miden-base/blob/next/crates/miden-agglayer/asm/agglayer/bridge/bridge_config.masm) (`update_ger`)
- [`bridge.rs`](https://github.com/0xMiden/miden-base/blob/next/crates/miden-agglayer/src/bridge.rs)
- [`GlobalExitRootManagerL2SovereignChain.sol`](https://github.com/agglayer/agglayer-contracts/blob/main/contracts/v2/sovereignChains/GlobalExitRootManagerL2SovereignChain.sol)

## Classification

This feature is part of the sovereign chain extension (`GlobalExitRootManagerL2SovereignChain`), not the base bridge contract. The GER insertion hash chain is something sovereign chains can opt into, not a hard requirement from the base bridge protocol.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.