... | ... | @@ -233,7 +233,9 @@ cnt: 从1开始,持续自增,直到length, cnt==1是第一行,cnt==length |
|
|
|
|
|
final_rlc_acc:当表格结束时,最后一行的`tag_u8_rlc_acc`、`block_tx_id_u8_rlc_acc`、`value0_u8_rlc_acc`、`value1_u8_rlc_acc`、`value2_u8_rlc_acc`、`value3_u8_rlc_acc`的值即为整个public表的六列原始值的rlc_acc,暂称为final_rlc_acc
|
|
|
|
|
|
challenge: 用来存放 random^5, random^4, random^3, random^2, random
|
|
|
challenge: 用来存放challenge的值
|
|
|
|
|
|
random_vec: 用来存放 random^5, random^4, random^3, random^2, random
|
|
|
|
|
|
concat_rlc_acc: 整个public表中所有数据的rlc_acc, 计算方式为:
|
|
|
|
... | ... | @@ -252,7 +254,7 @@ Hash: `Column<Advice>`类型,只有在length-1和length两行有值,分别 |
|
|
challenge的约束:
|
|
|
|
|
|
```shell
|
|
|
如果cnt==0
|
|
|
如果cnt==1
|
|
|
challenge_cur == challenges_expr.keccak_input()
|
|
|
如果cnt != 0
|
|
|
challenge_cur == challenge_prev * challenges_expr.keccak_input()
|
... | ... | @@ -262,24 +264,30 @@ Hash: `Column<Advice>`类型,只有在length-1和length两行有值,分别 |
|
|
|
|
|
```
|
|
|
每一行都有:
|
|
|
random = random_prev
|
|
|
random^2 = random^2_prev
|
|
|
random^3 = random^3_prev
|
|
|
random^4 = random^4_prev
|
|
|
random^5 = random^5_prev
|
|
|
|
|
|
random^2 = random * random
|
|
|
random^3 = random^2 * random
|
|
|
random^4 = random^3 * random
|
|
|
random^5 = random^4 * random
|
|
|
|
|
|
最后一个有效行(cnt==length-1)
|
|
|
random = challenge (即random值为challenges_expr.keccak_input()^length)
|
|
|
最后一行(cnt==length)
|
|
|
random = challenge(即random值为challenges_expr.keccak_input()^length)
|
|
|
```
|
|
|
|
|
|
2. length
|
|
|
|
|
|
length = length_prev(从cnt=0开始约束)
|
|
|
|
|
|
最后一行,length = cnt+1
|
|
|
最后一行,length = cnt
|
|
|
|
|
|
3. cnt
|
|
|
|
|
|
cnt = cat_prev+1(从cnt=0开始约束)
|
|
|
cnt = cnt_prev+1(从cnt=1开始约束)
|
|
|
|
|
|
最后一个有效行:last_valid_row为length-1
|
|
|
|
... | ... | @@ -297,7 +305,9 @@ Hash: `Column<Advice>`类型,只有在length-1和length两行有值,分别 |
|
|
|
|
|
5. U8和value,以及idx
|
|
|
|
|
|
如果 tag_cur !=nil && tag_cur != TxCalldata && tag_cur != TxLogData,贼有0-15行的u8的值,等于第15行的value的值
|
|
|
如果 `tag_cur !=nil && tag_cur != TxCalldata && tag_cur != TxLogData` 或者 `tag != nil && (tag==TxCalldata || tag_cur == TxLogData) && idx(value2) == 0`
|
|
|
|
|
|
贼有0-15行的u8的值,等于第15行的value的值
|
|
|
|
|
|
```rust
|
|
|
let v1 = value0_u8.Rotation(0);
|
... | ... | @@ -315,7 +325,7 @@ Hash: `Column<Advice>`类型,只有在length-1和length两行有值,分别 |
|
|
let v13 = value0_u8.Rotation(-12) * pow_of_two::<F>(96));
|
|
|
let v14 = value0_u8.Rotation(-13) * pow_of_two::<F>(104));
|
|
|
let v15 = value0_u8.Rotation(-14) * pow_of_two::<F>(112));
|
|
|
let v16 = value0_u8.Rotation(-15) * pow_of_two::<F>(120));
|
|
|
let v16 = value0_u8.Rotation(-15) * pow_of_two::<F>(120));
|
|
|
```
|
|
|
|
|
|
```
|
... | ... | @@ -325,21 +335,15 @@ Hash: `Column<Advice>`类型,只有在length-1和length两行有值,分别 |
|
|
value = value * F::from(256) + byte.expr();
|
|
|
}
|
|
|
value
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
```shell
|
|
|
let v_original = value0.Rotation::cur()
|
|
|
let v_original = value0.Rotation::cur()
|
|
|
```
|
|
|
|
|
|
约束有:` v_final == v_original`
|
|
|
|
|
|
其他五个原始值同理
|
|
|
|
|
|
如果tag != nil && (tag==TxCalldata || tag_cur == TxLogData) 则
|
|
|
|
|
|
`value1 == value1_u8`, `value0_u8 == 0`, `value2_u8 == 0`,` value3_u8 == 0`,` tag_u8 == 0`, ` block_tx_idx == 0`
|
|
|
|
|
|
6. tag和value约束
|
|
|
|
|
|
如果tag_cur !=nil && tag_cur != TxCalldata && tag_cur != TxLogData,则有
|
... | ... | @@ -362,14 +366,21 @@ Hash: `Column<Advice>`类型,只有在length-1和length两行有值,分别 |
|
|
tag.Rotation(-15) == nil
|
|
|
```
|
|
|
|
|
|
如果tag != nil && (tag==TxCalldata || tag_cur == TxLogData) && idx(value0) != 0则
|
|
|
如果tag != nil && (tag==TxCalldata || tag_cur == TxLogData) && idx(value2) != 0则
|
|
|
|
|
|
```shell
|
|
|
value0_cur(idx_cur) == value0_prev+1 (idx_cur+1)
|
|
|
value2_cur(idx_cur) == value2_prev+1 (idx_cur+1)
|
|
|
tag_cur == tag_prev
|
|
|
block_tx_idx_cur == block_tx_idx_prev
|
|
|
value2 == value_prev
|
|
|
value3 == 0 (是否约束, 目前value未填值)
|
|
|
value0 == value0_prev (the value of value0 is log_index or zero)
|
|
|
value1 == 0 (the value of value1 is zero)
|
|
|
value3 == value3_u8
|
|
|
|
|
|
tag_u8 == 0
|
|
|
block_tx_idx == 0
|
|
|
value0_u8 == 0
|
|
|
value1_u8 == 0
|
|
|
value2_u8
|
|
|
```
|
|
|
|
|
|
如果 tag==nil
|
... | ... | @@ -430,7 +441,7 @@ hash_lo_prev = hash_lo_prev.copy_advice(hash_hi_cur); |
|
|
|
|
|
1. 如何判断当前行是最后一行
|
|
|
|
|
|
cnt==length-1是最后一行
|
|
|
cnt != 0 && cnt_next == 0
|
|
|
|
|
|
2. 如何判断表格当前行为第一行
|
|
|
|
... | ... | @@ -440,8 +451,6 @@ hash_lo_prev = hash_lo_prev.copy_advice(hash_hi_cur); |
|
|
|
|
|
idx==0, 即为第一行
|
|
|
|
|
|
问题:是根据idx==0来判断TxCalldata开始的第一行,还是根据TxCalldata开始的第一行来判断idx==0
|
|
|
|
|
|
4. 无效行(0~15行的1~15行)填充0还是和有效行(0~15行中的第0行)一样的值、
|
|
|
|
|
|
填充0
|
... | ... | |