Skip to content

Compute claimed global index chain hash#2516

Open
Fumuran wants to merge 5 commits intoagglayerfrom
andrew-compute-cgi-chain-hash
Open

Compute claimed global index chain hash#2516
Fumuran wants to merge 5 commits intoagglayerfrom
andrew-compute-cgi-chain-hash

Conversation

@Fumuran
Copy link
Contributor

@Fumuran Fumuran commented Feb 25, 2026

This PR:

  • Modifies the bridge_in.masm file to add the CGI chain hash computation in the verify_leaf_bridge procedure. For now it is more like in a "template" state, since for now it is impossible to compute this value: to do so we need to read the previous CGI hash value, but currently it is not store anywhere (yet).
  • Adds a Solidity contract to generate the data required for the CGI chain hash computation: leaf value, global index, previous (old) CGI chain hash and a new (expected) CGI chain hash. This contract was generated with AI help, but in my layman's opinion this code works correctly, though I still have some questions about it. I beg for the masters of the Solidity @partylikeits1983 and @mmagician to check its correctness. It should be fine, since the test is passing, but nevertheless.
  • Adds a new test to check that the CGI chain hash value computed in the verify_leaf_bridge procedure (or, to be precise, the value, computed using the same algorithm: I can't reuse the compute_cgi_hash_chain procedure itself since it is private and it uses some memory values which are not available during the test) is correct.

We still need to store the computed value in memory, but this approach is blocked until we change the way SWAP note it consumed. Storing the CGI hash will be done in a separate PR.

Part of #2386

@Fumuran Fumuran added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Feb 25, 2026
@Fumuran Fumuran marked this pull request as ready for review February 25, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant