Skip to content

State should be atomic to proof generation #18

Description

@freesig

Problem

A user requests a merkle proof that will be based on some version of state X. The state needs to be updated to generate the ZK proof. If the user has a merkle proof @ X then it has to wait for proof(X).
The solution would be to provide an older merkle proof. Say we already have proof(X-5) then we need a version of state at X - 5 in order to generate the merkle proof to go with the zk proof.

Potential Solutions

Prover / Observer node

The prover node is likely not open to the public internet but instead is streaming proofs to an observer node. The observer node would also be streaming Blocks from the proof node or oracle node if they are separate. The observer node needs to sync the Blocks and Proofs so that the State is always at the latest proof.

  • All proofs (ZK, Signature) need to contain the block height and block hash that generated them.
  • Blocks need to wait for the proof at their height / hash before updating state
  • Need to keep around some recent proofs so there's always one available for the current state.
  • Need a way to know which block height / block hash produced the current state

Functional State

Another option is to use a functional data type for state so that only the changed data is cloned when there is multiple copies of the state. This make keeping a few copies of state in memory relatively cheap. A similar thing could be done with a database but it could get complex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions