Skip to content

Commit

Permalink
refactor: Add call to VmProofIter's drop in verifier
Browse files Browse the repository at this point in the history
This ensures that the VmProofIter ends up in a consistent state.
  • Loading branch information
Sword-Smith committed Sep 23, 2024
1 parent 6fa7a04 commit 04e9d72
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"name": "tasmlib_verifier_stark_verify_dynamic_inner_padded_height_256_fri_exp_4",
"benchmark_result": {
"clock_cycle_count": 195204,
"hash_table_height": 143119,
"u32_table_height": 26331,
"op_stack_table_height": 177162,
"ram_table_height": 289257
"clock_cycle_count": 195215,
"hash_table_height": 143125,
"u32_table_height": 26065,
"op_stack_table_height": 177172,
"ram_table_height": 289262
},
"case": "CommonCase"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"name": "tasmlib_verifier_stark_verify_dynamic_inner_padded_height_512_fri_exp_4",
"benchmark_result": {
"clock_cycle_count": 203274,
"hash_table_height": 150811,
"u32_table_height": 34225,
"op_stack_table_height": 182344,
"ram_table_height": 290444
"clock_cycle_count": 203285,
"hash_table_height": 150817,
"u32_table_height": 33925,
"op_stack_table_height": 182354,
"ram_table_height": 290449
},
"case": "CommonCase"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"name": "tasmlib_verifier_stark_verify_static_inner_padded_height_256_fri_exp_4",
"benchmark_result": {
"clock_cycle_count": 183501,
"hash_table_height": 129073,
"u32_table_height": 24910,
"op_stack_table_height": 169356,
"ram_table_height": 285358
"clock_cycle_count": 183512,
"hash_table_height": 129085,
"u32_table_height": 25825,
"op_stack_table_height": 169366,
"ram_table_height": 285363
},
"case": "CommonCase"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"name": "tasmlib_verifier_stark_verify_static_inner_padded_height_512_fri_exp_4",
"benchmark_result": {
"clock_cycle_count": 191571,
"hash_table_height": 136765,
"u32_table_height": 34281,
"op_stack_table_height": 174538,
"ram_table_height": 286545
"clock_cycle_count": 191582,
"hash_table_height": 136777,
"u32_table_height": 34566,
"op_stack_table_height": 174548,
"ram_table_height": 286550
},
"case": "CommonCase"
}
Expand Down
6 changes: 4 additions & 2 deletions tasm-lib/src/verifier/stark_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use crate::verifier::master_table::verify_table_rows::VerifyTableRows;
use crate::verifier::out_of_domain_points::OodPoint;
use crate::verifier::out_of_domain_points::OutOfDomainPoints;
use crate::verifier::vm_proof_iter::dequeue_next_as::DequeueNextAs;
use crate::verifier::vm_proof_iter::drop::Drop;
use crate::verifier::vm_proof_iter::new::New;

/// Verify a STARK proof.
Expand Down Expand Up @@ -302,6 +303,7 @@ impl BasicSnippet for StarkVerify {
let entrypoint = self.entrypoint();

let proof_to_vm_proof_iter = library.import(Box::new(New));
let drop_vm_proof_iter = library.import(Box::new(Drop));

let ood_curr_row_main_and_aux_value_pointer_alloc =
library.kmalloc(EXTENSION_DEGREE.try_into().unwrap());
Expand Down Expand Up @@ -1039,10 +1041,10 @@ impl BasicSnippet for StarkVerify {
assert
// _ *beqd_ws *p_iter *oodpnts *fri *btrows *odd_brow_next *etrows *ood_erow_nxt *ood_brow_curr *ood_erow_curr *fri_revealed *qseg_elems num_colli

/* Clean up stack */
/* Clean up stack and drop p_iter, ensuring that it ends up in a consistent state */
swap 12
swap 11
pop 1
call {drop_vm_proof_iter}
// _ num_colli *beqd_ws *oodpnts *fri *btrows *odd_brow_next *etrows *ood_erow_nxt *ood_brow_curr *ood_erow_curr *fri_revealed *qseg_elems

/* Sum out-of-domain values */
Expand Down

0 comments on commit 04e9d72

Please sign in to comment.