beamer-bridge / beamer

Beamer - Bridging rollups with L1 inherited security
https://beamerbridge.com
MIT License
45 stars 21 forks source link

Reduce storage on RequestManager #204

Closed fredo closed 1 year ago

fredo commented 2 years ago

During the work in #203 , #201 , #202 , etc I discovered that the contract's logic mainly comes into play when challenge or L1 resolution is triggered.

The main task is to check what was forwarded by the L1 Resolver. In the previous work, information have been more and more encapsulated into a hash defining specific information. Since the L1 resolver can be trusted the RequestManager only needs to look at the correct row in the resolution registry and act based on the submitted address (eligibleClaimer).

The request manager does it by recreating the hash based on the stored information and then use it as the key. The actual plain information are not needed as they are only compared (indirectly by comparing the hash) with what was forwarded to the registry.

We mainly don't need most of the information of requests.

The contracts need to make sure that deposits are paid out to the rightful claimer. The information of a claim cannot be trusted anyway as they are submitted by a claimer. Here the other challengers must step in. In case of L1 resolution the contract only needs to identify the correct entry in the mapping. this is done by the hash. Thus, it is enough to store only the hash in the first place and dump most other information in the contract.

todos

It needs to be sorted out which information can be stored in the hash and which we still need in the contract. For Example, amount needs to stay. Remove all unnecessary information and just store it in the form of the request hash.

istankovic commented 2 years ago

@fredo this one may be relevant to our discussions next week. Also related to #927.

istankovic commented 1 year ago

This can be closed now that the pre-audit contract changes have been done. Further ideas regarding storage reduction should be outlined in new issues.