Skip to content

Commit b92feee

Browse files
authored
fix: Add constraint that initial timestamp must be zero (#1467)
1 parent 5ac81ec commit b92feee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/vm/src/system/memory/persistent.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use openvm_circuit_primitives_derive::AlignedBorrow;
99
use openvm_stark_backend::{
1010
config::{StarkGenericConfig, Val},
1111
interaction::{InteractionBuilder, PermutationCheckBus},
12-
p3_air::{Air, BaseAir},
12+
p3_air::{Air, AirBuilder, BaseAir},
1313
p3_field::{FieldAlgebra, PrimeField32},
1414
p3_matrix::{dense::RowMajorMatrix, Matrix},
1515
p3_maybe_rayon::prelude::*,
@@ -79,6 +79,13 @@ impl<const CHUNK: usize, AB: InteractionBuilder> Air<AB> for PersistentBoundaryA
7979
local.expand_direction * local.expand_direction * local.expand_direction,
8080
);
8181

82+
// Constrain that an "initial" row has timestamp zero.
83+
// Since `direction` is constrained to be in {-1, 0, 1}, we can select `direction == 1`
84+
// with the constraint below.
85+
builder
86+
.when(local.expand_direction * (local.expand_direction + AB::F::ONE))
87+
.assert_zero(local.timestamp);
88+
8289
let mut expand_fields = vec![
8390
// direction = 1 => is_final = 0
8491
// direction = -1 => is_final = 1

0 commit comments

Comments
 (0)