Component: light-client
Description
The light-client component is responsible for verifying the state transitions and proofs of the SP1 Helios program. It ensures that the proofs are valid and that the state transitions are executed correctly.
The states of updates and finality updates are provided from external resources, such as the beacon chain. It should be trusted that the inputs are valid and correctly formatted.
Inputs
encoded_inputs (Vec<u8>)
: Input data for the light-client program, which includes the state-transition proofs and the associated data. It will be passed by thesp1_zkvm::io::read_vec
function and decoded into aProofInputs
struct.
Outputs
proof_outputs (ProofOutputs)
: The output of the light-client program, which contains the results of the state transition and the verified proofs. It is later passed as an argument to theupdate
function in the SP1Helios contract.
Expected behavior
Decode the
encoded_inputs
into aProofInputs
struct.Get the initial sync committee, and save it to
prev_sync_committee_hash
.Get the header and head from
finalized_header
of the beacon state.Verify and apply all generic updates.
Verify the finality update.
Check that the new head is not greater than the previous head and that it is a checkpoint slot.
Commit new state root, header, and sync-committee hash.
Verify the storage slots against the contract's storage root.
Generate the
ProofOutputs
with the verified state root and storage slots.