avail icon indicating copy to clipboard operation
avail copied to clipboard

feat: native light client state verification

Open xavierdmello opened this issue 6 months ago • 0 comments

Inside the Vector pallet, instead of verifying a proof of light client logic, we natively implement the logic at a node level. This mirrors SP1 Telepathy's approach. The Rust-based logic built on top of Helios allows for seamless integration with Avail's pallet.

Additionally, this approach dramatically simplifies the operator. Instead of fetching specialized inputs and generating proofs, we simply retrieve inputs for Helios and relay that to the chain.

Modifications

We've optimized storage by directly using the canonical Ethereum consensus state's sync committee hash, eliminating the need for Poseidon hashes.

The updated verification logic is inside the fulfill_call function of pallets/vector/src/lib.rs.

Operator

The new operator is based on SP1 Telepathy's operator. The logic remains the same, with placeholders for reading and writing to Avail using avail-subxt instead of a smart contract on Ethereum.

For reference, I've created a fork of the SP1 Telepathy operator with added comments highlighting the lines that need to be changed: https://github.com/xavierdmello/avail-telepathy-operator

Testing

We've adapted a few tests into tests_new.rs, which replaces the current tests.rs. You can try the new ones by running cargo test test_fulfill inside of ./pallets/vector/. We generated test inputs using SP1 Telepathy (instructions here), which outputs bytes that should be placed inside ./pallets/vector/examples

xavierdmello avatar Aug 13 '24 01:08 xavierdmello