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 valuesigma
used for the parameternu
when constructing the proofpub 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
 a
DynProofPlan<DoryCommitment>
, which is related to the soecific SQL query is being proven  a
QueryCommitments<DoryCommitment>
, which is a list of all the column commitments involved in the SQL query being proven  a
QueryData<DoryScalar>
, which is reletad to the result of the SQL query being proven
pub struct PublicInput {
expr: DynProofPlan<DoryCommitment>,
commitments: QueryCommitments<DoryCommitment>,
query_data: QueryData<DoryScalar>,
}  a
The proofofsqlverifier
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 generatesampleproof
inside proofofsqlverifier
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.