aszepieniec / stark-anatomy

Tutorial for STARKs with supporting code in python
Apache License 2.0
181 stars 49 forks source link

Random vs independent index folding chart is wrong #16

Closed juan-fence closed 1 year ago

juan-fence commented 1 year ago

When reading index folding section of the chapter 3: FRI (https://aszepieniec.github.io/stark-anatomy/fri#index-folding) I am having a hard time making sense of the chart, the index folding half.

I'd say the bottom two levels should be blue (as the points have been chosen from the blue parts in the malicious hybrid codeword)

Does this make sense?

Thanks for putting this together!

aszepieniec commented 1 year ago

In both cases, the attacker tries to shift from a far-from-low-degree codeword (blue) to a close-to-low-degree codeword (green). The codewords are set by the attacker; the indices are only known after after the codewords are committed to.

The picture on the right shows why the attack fails: there has to be a colinearity check of mismatched colors.

juan-fence commented 1 year ago

Yes, that is what I understood but I still don't follow the chart. image

The way I see it, as the second round of indices is sampling from the bad (blue) part of the hybrid codeword, it should lead to the bottom layer being the bad codeword (blue).

Unless I am not following the chart logic (but I agree with your previous comment), the bottom two layers should be blue too (and are green). I thought the chart tries to convey the following message: "if you start bad (blue) you will end up bad (blue) with the right indices but you may end up green with the random indices". Is this it?

Or I am misunderstanding how you represent your previous comment in a chart?

Thanks for the patience!

aszepieniec commented 1 year ago

You misunderstand my comment. The red arrows do not indicate what is being copied, they indicated what is being checked. The codewords are fixed before the locations of the red arrows are sampled.

juan-fence commented 1 year ago

Ahhh got it.

So in the second step you would be comparing A, and B from blue to C from green (as the prover has now shifted to full green), which wouldn't be in the same line.

Thank you again!