FuelLabs / fuel-core

Rust full node implementation of the Fuel v2 protocol.
Other
58.02k stars 2.78k forks source link

Layer 1 Relayer #52

Closed Voxelot closed 2 years ago

Voxelot commented 2 years ago

Fuel Core needs to communicate with Layer 1 in order to publish blocks and bridge assets.

rakita commented 2 years ago

Most of mechanisms are going to be explained in README that is going to follow the fuel-relayer crate.

For Mock layer1 impl, eth test networks are thing that is used and it is best to leverage.

Expanding on needed work:

Additional thing that is going to be left for future work:

Voxelot commented 2 years ago

What's included in the Initial sync from eth to fuel.?

rakita commented 2 years ago

What's included in the Initial sync from eth to fuel.?

Waiting until Eth client is ready, fething all past events from eth contract and adding them in fuel client, it is needed when doing fuel initial sync. And switching from eth log fetch to filtering log via websocket and ensure that we dont miss any logs.

Voxelot commented 2 years ago

My intention for Mock layer1 impl, was to have a very minimal and simple backend to simulate events from another chain. That way we can test our event handling without being totally coupled to ethereum contracts and interfaces.

rakita commented 2 years ago

I am currently mocking ethers-rs provider/middleware so that i can make unit tests with simulated events.

Voxelot commented 2 years ago

That sounds like a good start. Mainly where I'm coming from is that there should be a core handler for all the events that's chain agnostic / abstract, leaving things like chain finality or specifics around ethers-rs to an adapter. That way we can just rewrite the adapter for eth2 vs celestia or some other L1 bridge we may want to support in the future without a drastic re-write.

adlerjohn commented 2 years ago

Agree with @Voxelot here, because e.g. the notion of re-orgs is an Ethereum-specific thing. Tendermint-based chains like Celestia won't have re-orgs.

rakita commented 2 years ago

I Agree, lets do it for ethereum and when celestia comes we can see what are differences and what can be reused and make abstraction then. And to be fair, current impl is quite abstracted with fuel-core-interfaces.

Voxelot commented 2 years ago

Make sense, unless there's some common abstract implentation needed (which there might not be other than how events get triggered), the interfaces should be sufficient for this need.

Voxelot commented 2 years ago

closing since relayer is already far along, and we should use smaller tasks for additional work.