-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update and sync-up the recursive verifier #1575
base: main
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,8 @@ where | |
/// \frac{T_i(x) - T_i(g \cdot z)}{x - g \cdot z} \right)} | ||
/// | ||
/// The instruction computes the numerators $\alpha_i \cdot (T_i(x) - T_i(z))$ and | ||
/// $\alpha_i \cdot (T_i(x) - T_i(g \cdot z))$ and stores the values in two accumulators $p$ | ||
/// and $r$, respectively. This instruction is specialized to main trace columns i.e. | ||
/// $\alpha_i \cdot (T_i(x) - T_i(g \cdot z))$ and stores the values in two accumulators $r$ | ||
/// and $p$, respectively. This instruction is specialized to main trace columns i.e. | ||
/// the values $T_i(x)$ are base field elements. | ||
/// | ||
/// The instruction is used in the context of STARK proof verification in order to compute | ||
|
@@ -47,9 +47,9 @@ where | |
/// 1. Ti for i in 0..=7 stands for the the value of the i-th trace polynomial for the current | ||
/// query i.e. T_i(x). | ||
/// 2. (p0, p1) stands for an extension field element accumulating the values for the quotients | ||
/// with common denominator (x - z). | ||
/// 3. (r0, r1) stands for an extension field element accumulating the values for the quotients | ||
/// with common denominator (x - gz). | ||
/// 3. (r0, r1) stands for an extension field element accumulating the values for the quotients | ||
/// with common denominator (x - z). | ||
/// 4. x_addr is the memory address from which we are loading the Ti's using the MSTREAM | ||
/// instruction. | ||
/// 5. z_addr is the memory address to the i-th OOD evaluations at z and gz i.e. T_i(z):= | ||
|
@@ -75,7 +75,7 @@ where | |
// --- compute the updated accumulator values --------------------------------------------- | ||
let v0 = self.stack.get(7); | ||
let tx = QuadFelt::new(v0, ZERO); | ||
let [p_new, r_new] = [p + alpha * (tx - tz), r + alpha * (tx - tgz)]; | ||
let [r_new, p_new] = [r + alpha * (tx - tz), p + alpha * (tx - tgz)]; | ||
|
||
// --- rotate the top 8 elements of the stack --------------------------------------------- | ||
self.stack.set(0, t0); | ||
|
@@ -252,8 +252,8 @@ mod tests { | |
let a1 = a[1]; | ||
let alpha = QuadFelt::new(a0, a1); | ||
|
||
let p_new = p + alpha * (tx - tz); | ||
let r_new = r + alpha * (tx - tgz); | ||
let p_new = p + alpha * (tx - tgz); | ||
let r_new = r + alpha * (tx - tz); | ||
|
||
assert_eq!(p_new.to_base_elements()[1], stack_state[8]); | ||
assert_eq!(p_new.to_base_elements()[0], stack_state[9]); | ||
|
@@ -356,10 +356,10 @@ mod tests { | |
expected.extend_from_slice(&[ZERO, Felt::from(18_u8), Felt::from(10_u8), Felt::from(2_u8)]); | ||
// updated accumulators | ||
expected.extend_from_slice(&[ | ||
r.to_base_elements()[0], | ||
r.to_base_elements()[1], | ||
p.to_base_elements()[0], | ||
p.to_base_elements()[1], | ||
r.to_base_elements()[0], | ||
r.to_base_elements()[1], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines 334 and 335 are still incorrect (i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
]); | ||
// the top 8 stack elements should equal tx since 8 calls to `rcomb_base` implies 8 circular | ||
// shifts of the top 8 elements i.e., the identity map on the top 8 element. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,15 @@ const.TRACE_DOMAIN_GENERATOR_PTR=4294799999 | |
const.PUBLIC_INPUTS_PTR=4294800000 | ||
|
||
# OOD Frames | ||
# (72 + 9 + 8) * 2 * 2 Felt for current and next trace rows and 8 * 2 Felt for constraint composition | ||
# polynomials. Total memory slots required: ((72 + 9 + 8) * 2 * 2 + 8 * 2) / 4 = 93 | ||
# (70 + 7) * 2 * 2 Felt for current and next trace rows and 8 * 2 Felt for constraint composition | ||
# polynomials. Total memory slots required: ((70 + 7) * 2 * 2 + 8 * 2) / 4 = 81 | ||
const.OOD_TRACE_PTR=4294900000 | ||
const.OOD_CONSTRAINT_EVALS_PTR=4294900081 | ||
const.OOD_CONSTRAINT_EVALS_PTR=4294900077 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an assumption in the code that Similar comment applies to all constants in this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason for this is so that we avoid having to update the pointers in between the different steps of computing the random linear combination for the DEEP queries. This is the hottest loop of the recursive verifier and any savings we can make are worth the little extra effort. |
||
|
||
# Current trace row | ||
# 72 Felt for main portion of trace, 9 * 2 Felt for auxiliary portion of trace and 8 * 2 Felt for | ||
# 70 Felt for main portion of trace, 7 * 2 Felt for auxiliary portion of trace and 8 * 2 Felt for | ||
# constraint composition polynomials. Since we store these with the padding to make each of the | ||
# three portions a multiple of 8, the number of slots required is (80 + 24 + 16) / 4 = 30 | ||
# three portions a multiple of 8, the number of slots required is (72 + 16 + 16) / 4 = 26 | ||
const.CURRENT_TRACE_ROW_PTR=4294900100 | ||
|
||
# Random elements | ||
|
@@ -36,7 +36,7 @@ const.AUX_RAND_ELEM_PTR=4294900150 | |
const.COMPOSITION_COEF_PTR=4294900200 | ||
|
||
# We need 2 Felt for each trace column and each of the 8 constraint composition columns. We thus need | ||
# (72 + 9 + 8) * 2 Felt i.e. 44 memory slots. | ||
# (70 + 7 + 8) * 2 Felt i.e. 43 memory slots. | ||
const.DEEP_RAND_CC_PTR=4294903000 | ||
|
||
# FRI | ||
|
@@ -80,7 +80,6 @@ const.GRINDING_FACTOR_PTR=4294903308 | |
|
||
# RPO capacity initialization words | ||
const.ZERO_WORD_PTR=4294903309 | ||
const.ZERO_ZERO_ZERO_ONE_PTR=4294903310 | ||
|
||
# State of RPO-based random coin | ||
const.C_PTR=4294903311 | ||
|
@@ -106,7 +105,7 @@ const.TMP8=4294903322 | |
# | TRACE_DOMAIN_GENERATOR_PTR | 4294799999 | | ||
# | PUBLIC_INPUTS_PTR | 4294800000 | | ||
# | OOD_TRACE_PTR | 4294900000 | | ||
# | OOD_CONSTRAINT_EVALS_PTR | 4294900081 | | ||
# | OOD_CONSTRAINT_EVALS_PTR | 4294900077 | | ||
# | CURRENT_TRACE_ROW_PTR | 4294900100 | | ||
# | AUX_RAND_ELEM_PTR | 4294900150 | | ||
# | COMPOSITION_COEF_PTR | 4294900200 | | ||
|
@@ -238,10 +237,6 @@ export.zero_word | |
push.ZERO_WORD_PTR | ||
end | ||
|
||
export.zero_zero_zero_one_word | ||
push.ZERO_ZERO_ZERO_ONE_PTR | ||
end | ||
|
||
#! Returns the pointer to the capacity word of the random coin. | ||
#! | ||
#! Note: The random coin is implemented using a hash function, this returns the | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we swap the order to
[p_new, r_new]
so that it's consistent with line 73 above?I think the ideal would be to put
r
beforep
on the stack (so that the order is always consistent), but just this small swap is probably fineThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, done!