Spectre, a ZK lightclient developed and operated by Chainsafe Systems, mainly consists of two ZK circuits:
-CommitteeUpdateCircuit
-StepCircuit
For the hackathon I developed a proof of concept on how to re-implement the Spectre lightclient in Risc0 with end to end tests for proof verification on AlignedLayer.
My implementation focuses on:
For the scope of this hackathon I chose to demonstrate how an integration with Aligned is possible for Spectre by implementing one of the two circuits that are necessary to run the full light client.
Due to my modular design choices it is possible to extend this implementation to support all of Spectre's functionality and the StepCircuit. This is however not what I am submitting for the hackathon and it is important to clarify that this proof of concept only has some of Spectre's functionality. The functionality that it has however is fully integrated with AlignedLayer / proofs for the CommitteeUpdateCircuit are verifiable on Aligend.
How the circuit works:
Downgrading Risc0 to 1.0.1 (initially worked with 1.1.2). 1.1.2 is significantly faster and between the two releases serialization issues were fixed. The serialization issues in 1.0.1 forced me to reshape the datastructures used in Chainsafe's Spectre.
Translating the CommitteeUpdateCircuit from Halo2 to Risc0. Halo2 and Halo2-lib in particular abstract away from the core logic and reshape all inputs to field elements which can be tricky to decompose.
Modular design that is easy to extend that runs smoothly both as a service and library, exposing all relevant types and implementations.
Discussion