ensdomains / evmgateway

This repository implements a generic CCIP-Read gateway for fetching state proofs of data on other EVM chains. The intended use is for contracts on L1 to be able to fetch and verify data from contracts on L2 in a read context.
MIT License
128 stars 28 forks source link

Optimism Dispute Game Support #45

Open Chomtana opened 3 months ago

Chomtana commented 3 months ago

An improved approach to #36

In this version, there's no need to split the code into two different files. We first try to find the index using the dispute game. If the dispute game is unavailable, we will fall back to using L2OutputOracle.

The function that needs L2OutputOracle has been replaced with OptimismPortalProxy, which is the core of the OP Stack. OptimismPortalProxy can derive both L2OutputOracle and DisputeGameFactory.

This implementation has been tested and works well.

image

The deployed gateway implementation differs slightly from the one in the repository, with the ENS Tracker part removed and the app variable moved into a local variable that reinitializes on every request.

Chomtana commented 2 months ago

Merged and pushed the new version

Using OPOutputLookup contract I have built at https://github.com/Opti-domains/dispute-game-lookup/blob/main/src/OPOutputLookup.sol to do the calculation and advanced search in a single call. So, the lowest latency one can achieve.

Pending unit test on https://github.com/Opti-domains/dispute-game-lookup

However, it works manual testing: https://app.ens.domains/disputegame.eth?tab=records (On Sepolia testnet)

Chomtana commented 1 month ago

Hi @Arachnid @makoto

Sorry for the delay, I have been busy for these weeks!

Helper contracts and libraries have been merged into the repo and a deployment script to deterministically deploy OPOutputLookup have been added.

Some trick has been implemented to be able to import @eth-optimism/contracts-bedrock into the contracts rather than copying the code.

Current contract and gateway (with app variable moved into a local variable) has been successfully tested on current implementation.

https://app.ens.domains/disputegame.eth?tab=records (Sepolia)

image