Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send GER inclusion proofs to aggchain prover #204

Merged

Conversation

goran-ethernal
Copy link
Contributor

@goran-ethernal goran-ethernal commented Feb 11, 2025

Description

This PR adds the functionality of sending GlobalExitRoot inclusion proofs to the aggchain prover since it is needed to generate a correct auth proof.

To do this, when aggsender is in AggchainProof mode, we collect injected GERs in L2 by directly calling the L2 contract to collect InsertGlobalExitRoot events in a given block range.

Before calling the aggchain prover to generate the auth proof, aggsender will get the last finalized l1 info tree root. After that, it will get the all injected GERs from the L2 contracts for the block range for which it is building the certificate, and it will generate the inclusion proofs for each injected GER based on the last finalized l1 info tree root.

Also, it will provide the prover with imported bridge exits we are adding to the certificate, but only data in imported bridge exits like:

  • bridge exit
  • token info
  • global index.

After that it will call the aggchain prover so that it can generate the auth proof.

Also, important note is, we now will use the last finalized l1 info tree root in the AggchainProof mode to generate all the inclusion proofs for every claim (imported bridge exit), since this is a prerequesite, since the aggchain prover uses that root to generate the proof.

This PR adds a new field called custom_chain_data to the certfificate. It is a random byte array returned by the aggchain prover, and we need to send it to the agglayer in the certificate.

Fixes # (issue)

Copy link
Collaborator

@arnaubennassar arnaubennassar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember well, the lastgersync only stores the GERs that are "latest" in terms of index, but not necessarily all the injections...

Please review if the logic of this sycner does what you expect.
We may need to heavily change how the syncer works, if this is the case just go ahead and simplify the syncer to "just" index the GERs injections, and we will figure out later how we deal with the birdge service, as this syncer was meant to be used by it originally

@goran-ethernal
Copy link
Contributor Author

If I remember well, the lastgersync only stores the GERs that are "latest" in terms of index, but not necessarily all the injections...

Please review if the logic of this sycner does what you expect. We may need to heavily change how the syncer works, if this is the case just go ahead and simplify the syncer to "just" index the GERs injections, and we will figure out later how we deal with the birdge service, as this syncer was meant to be used by it originally

@arnaubennassar I think we are good here. What the lastGER syncer does is it constantly gets what is the last index it has in its db, then gets what is the last root the l1 info tree has, and gets all the indexes it missed. After that it does sanity check to see if all of the GERs it got are injected on L2.

@goran-ethernal goran-ethernal force-pushed the feat/send-GER-inclusion-proofs-to-prover branch from 444e9b4 to e62fba4 Compare February 12, 2025 08:48
@goran-ethernal goran-ethernal marked this pull request as draft February 12, 2025 09:10
@goran-ethernal goran-ethernal force-pushed the feat/send-GER-inclusion-proofs-to-prover branch 4 times, most recently from 4c1b33c to 67ea09b Compare February 13, 2025 09:10
@goran-ethernal goran-ethernal marked this pull request as ready for review February 13, 2025 11:32
@goran-ethernal goran-ethernal force-pushed the feat/send-GER-inclusion-proofs-to-prover branch from 66f859f to 6f7e97c Compare February 14, 2025 07:24
Base automatically changed from arpit/192 to feat/aggchain-prover February 18, 2025 12:41
@goran-ethernal goran-ethernal force-pushed the feat/send-GER-inclusion-proofs-to-prover branch from 6f7e97c to 0057047 Compare February 18, 2025 13:28
@goran-ethernal goran-ethernal force-pushed the feat/send-GER-inclusion-proofs-to-prover branch from e9a4f75 to 1c9543c Compare February 18, 2025 14:28
Copy link
Contributor

@joanestebanr joanestebanr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments:

  • Make sense to store on DB the L1InfoTreeRoot choosen for proves.. may be it can be extracted from certificate, I'm not sure

@goran-ethernal goran-ethernal force-pushed the feat/send-GER-inclusion-proofs-to-prover branch from 09787ea to e47f778 Compare February 19, 2025 14:53
@goran-ethernal
Copy link
Contributor Author

Some comments:

  • Make sense to store on DB the L1InfoTreeRoot choosen for proves.. may be it can be extracted from certificate, I'm not sure

I mean we could, but we would only use it for resending the InError certificate, and its basically just a call to the l1 info tree sync db. Maybe it is not worth it, since it is already stored in another db. WDYT?

@joanestebanr
Copy link
Contributor

Some comments:

  • Make sense to store on DB the L1InfoTreeRoot choosen for proves.. may be it can be extracted from certificate, I'm not sure

I mean we could, but we would only use it for resending the InError certificate, and its basically just a call to the l1 info tree sync db. Maybe it is not worth it, since it is already stored in another db. WDYT?

In which DB do you mean? I think that for debug can be useful to known the choosen root.. WDYT?

@goran-ethernal
Copy link
Contributor Author

Some comments:

  • Make sense to store on DB the L1InfoTreeRoot choosen for proves.. may be it can be extracted from certificate, I'm not sure

I mean we could, but we would only use it for resending the InError certificate, and its basically just a call to the l1 info tree sync db. Maybe it is not worth it, since it is already stored in another db. WDYT?

In which DB do you mean? I think that for debug can be useful to known the choosen root.. WDYT?

I agree, I will add it.

@goran-ethernal goran-ethernal merged commit fd07ac4 into feat/aggchain-prover Feb 20, 2025
11 checks passed
@goran-ethernal goran-ethernal deleted the feat/send-GER-inclusion-proofs-to-prover branch February 20, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants