Provide state roots instead of whole state (#33)

This commit is contained in:
Giacomo Pasini 2024-08-20 19:12:10 +02:00 committed by GitHub
parent 5fd3c299c1
commit ff0afeebd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 9 deletions

View File

@ -165,7 +165,7 @@ pub fn prove_zone_fund_constraint(
let private_inputs = SpendFundsPrivate {
in_zone_funds,
zone_note,
state_witness: out_zone_state.clone(),
state_roots: out_zone_state.state_roots(),
};
let env = risc0_zkvm::ExecutorEnv::builder()

View File

@ -6,6 +6,6 @@ pub struct SpendFundsPrivate {
pub in_zone_funds: cl::PartialTxInputWitness,
/// The zone note that is authorizing the spend
pub zone_note: cl::PartialTxOutputWitness,
/// The state of the zone
pub state_witness: common::StateWitness,
/// Proof of identity of the above note
pub state_roots: common::StateRoots,
}

View File

@ -11,7 +11,7 @@ fn main() {
let SpendFundsPrivate {
in_zone_funds,
zone_note,
state_witness,
state_roots,
} = env::read();
let input_root = in_zone_funds.input_root();
@ -20,11 +20,8 @@ fn main() {
let ptx_root = PtxRoot(merkle::node(input_root, output_root));
// 1) Check the zone note is the correct one
assert_eq!(
in_zone_funds.input.note.state,
state_witness.zone_metadata.id()
);
assert_eq!(zone_note.output.note.state, state_witness.commit().0);
assert_eq!(in_zone_funds.input.note.state, state_roots.zone_id);
assert_eq!(zone_note.output.note.state, state_roots.commit().0);
let nf = in_zone_funds.input.nullifier();