Skip to main content

Space and Time Proof of Sql Verifier

settlementProofOfSqlPallet

Statement hash components

  • context: keccak256(b"proofofsql")
  • vk: keccak256(vk.encode())
  • pubs: keccak256(pubs)

Verifier implementation

Proof verification is performed by the verifyProof method, whose signature is

fn verify_proof(
vk: &Self::Vk,
proof: &Self::Proof,
pubs: &Self::Pubs,
) -> Result<(), VerifyError>

Self::Vk, Self::Proof, andSelf::Pubs are raw byte vectors, and are the result of the serialization of the following data structures:

  • Vk: it contains a VerifierSetup and the actual value sigma used for the parameter nu when constructing the proof

    pub struct VerificationKey {
    setup: VerifierSetup,
    sigma: usize,
    }

  • Proof: it's just a wrapper around a VerifiableQueryResult<DoryEvaluationProof>

    pub struct Proof {
    proof: VerifiableQueryResult<DoryEvaluationProof>,
    }
  • Pubs: it contains

    pub struct PublicInput {
    expr: DynProofPlan<DoryCommitment>,
    commitments: QueryCommitments<DoryCommitment>,
    query_data: QueryData<DoryScalar>,
    }

The proof-of-sql-verifier library offers method for correctly serializing these data structures, using the functions VerificationKey::to_bytes(), Proof::to_bytes(), and PublicInput::try_to_bytes().

For a practical example of how to get all the verification key, proof, and public input, please see the source code of the example binary generate-sample-proof inside proof-of-sql-verifier crate.

Result

The verify_proof method returns Ok(()) if verification is successful, otherwise it returns an error, indicating either unsuccessful proof verification or invalid input data.