Spectre-R&D

Spectre-R&D

"Spectre" (Chainsafe's ZK-Lightclient) proofs X AlignedLayer

Spectre-R&D

Spectre-R&D

"Spectre" (Chainsafe's ZK-Lightclient) proofs X AlignedLayer

The problem Spectre-R&D solves

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:

  • integration of AlignedLayer infrastructure
  • modular design that is easily extendable
  • a Risc0 implementation of Spectre's CommitteeUpdateCircuit
  • real world test data

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:

  1. The 512 public keys and expected root of the merkle tree are loaded from the test data
  2. The merkle tree with the 512 keys as leafs is hashed using sha256
  3. It is asserted / constrained that the computed merkle root matches the expected merkle root
  4. The merkle root will be committed to the journal upon successful verification.

Challenges I ran into

  1. 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.

  2. 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.

  3. Modular design that is easy to extend that runs smoothly both as a service and library, exposing all relevant types and implementations.

Technologies used

Discussion