Refactor StateCircuit + add lexicographic ordering constraints#135
Refactor StateCircuit + add lexicographic ordering constraints#135z2trillion wants to merge 27 commits into
Conversation
0e0d3ba to
754f13c
Compare
|
I noticed the CI testing time become much longer ( due to larger degree of state circuit). I think in testing state circuti, we can use "active rows range" like evm circuit to speed up it? |
|
Fixed column should not be different between different circuit instances so pk/vk can be same.Although current state circuit before this PR also did not meet this requirement, we'd better fix this problem in this PR. |
34eb52f to
340f324
Compare
| // 30 limbs in total -> can fit into two field elements | ||
| #[derive(Clone)] | ||
| pub struct Config<F: Field> { | ||
| diff_1: Column<Advice>, |
There was a problem hiding this comment.
could you rename diff_1 diff_2 more readable? such as diff + tag name or field name
There was a problem hiding this comment.
I can't think of better names for diff_1 and diff_2.
To explain what they are:
We want to show that X > Y, where A0, A1, ..., A29 are the 30 limbs of X and B0, B1, ..., B29 are the 30 limbs of Y, in big endian order. Let
C0 = A0 - B0,
C1 = C0 << 16 + A1 - B1,
C2 = C1 << 16 + A2 - B2,
...
C14 = C13 << 16 + A14 - B14,
and
C15 = A15 - B15,
...
C29 = C28 << 16 + A29 - B29.
X > Y iff one of the following is true:
1. one of C0, ..., C14 is non-zero and fits into 16 bits.
2. all of C0, ..., C14 are 0 and one of C15, ..., C29 is non-zero and fits into 16 bits.
(note that "all of C0, ..., C14 are 0" is equivalent to "C14 is 0")
The (diff_1, diff_2, diff_1_zero, diff_2_is zero) advice columns the constraints on them should be witnesses that prove that either 1. or 2. is true.
diff_2 is constrained to be one of the 15 values C15, ..., C29. The limbs involved are the 13 least significant limbs of the storage key and the 2 limbs of the rw_counter. The limbs involved indiff_1 are the remaining 15 (tag, field_tag, id, address, + 2 most significant limbs of the storage key).
I am open to suggestions for more descriptive names if you can think of any.
f6b97c6 to
eb88bc4
Compare
|
replaced by privacy-ethereum#462 |
No description provided.