poseidon::pow5: Undo circuit change.

Co-authored-by: str4d <jack@electriccoin.co>
This commit is contained in:
therealyingtong 2021-11-23 15:38:55 -05:00
parent 79123629da
commit 9bb29018ac
2 changed files with 366 additions and 363 deletions

View File

@ -95,12 +95,15 @@ impl<F: FieldExt, const WIDTH: usize, const RATE: usize> Pow5Chip<F, WIDTH, RATE
(0..WIDTH) (0..WIDTH)
.map(|next_idx| { .map(|next_idx| {
let state_next = meta.query_advice(state[next_idx], Rotation::next()); let state_next = meta.query_advice(state[next_idx], Rotation::next());
let expr = (0..WIDTH).fold(-state_next, |acc, idx| { let expr = (0..WIDTH)
.map(|idx| {
let state_cur = meta.query_advice(state[idx], Rotation::cur()); let state_cur = meta.query_advice(state[idx], Rotation::cur());
let rc_a = meta.query_fixed(rc_a[idx], Rotation::cur()); let rc_a = meta.query_fixed(rc_a[idx], Rotation::cur());
acc + pow_5(state_cur + rc_a) * m_reg[next_idx][idx] pow_5(state_cur + rc_a) * m_reg[next_idx][idx]
}); })
s_full.clone() * expr .reduce(|acc, term| acc + term)
.expect("WIDTH > 0");
s_full.clone() * (expr - state_next)
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
}); });

View File

@ -10831,15 +10831,6 @@ PinnedVerificationKey {
Sum( Sum(
Sum( Sum(
Sum( Sum(
Negated(
Advice {
query_index: 22,
column_index: 6,
rotation: Rotation(
1,
),
},
),
Scaled( Scaled(
Product( Product(
Product( Product(
@ -10931,7 +10922,6 @@ PinnedVerificationKey {
), ),
0x0ab5e5b874a68de7b3d59fbdc8c9ead497d7a0ab23850b56323f2486d7e11b63, 0x0ab5e5b874a68de7b3d59fbdc8c9ead497d7a0ab23850b56323f2486d7e11b63,
), ),
),
Scaled( Scaled(
Product( Product(
Product( Product(
@ -11116,6 +11106,16 @@ PinnedVerificationKey {
0x07c045d5f5e9e5a6d803952bbb364fdfa0a3b71a5fb1573519d1cf25d8e8345d, 0x07c045d5f5e9e5a6d803952bbb364fdfa0a3b71a5fb1573519d1cf25d8e8345d,
), ),
), ),
Negated(
Advice {
query_index: 22,
column_index: 6,
rotation: Rotation(
1,
),
},
),
),
), ),
Product( Product(
Product( Product(
@ -11176,15 +11176,6 @@ PinnedVerificationKey {
Sum( Sum(
Sum( Sum(
Sum( Sum(
Negated(
Advice {
query_index: 18,
column_index: 7,
rotation: Rotation(
1,
),
},
),
Scaled( Scaled(
Product( Product(
Product( Product(
@ -11276,7 +11267,6 @@ PinnedVerificationKey {
), ),
0x233162630ebf9ed7f8e24f66822c2d9f3a0a464048bd770ad049cdc8d085167c, 0x233162630ebf9ed7f8e24f66822c2d9f3a0a464048bd770ad049cdc8d085167c,
), ),
),
Scaled( Scaled(
Product( Product(
Product( Product(
@ -11461,6 +11451,16 @@ PinnedVerificationKey {
0x22f5b5e1e6081c9774938717989a19579aad3d8262efd83ff84d806f685f747a, 0x22f5b5e1e6081c9774938717989a19579aad3d8262efd83ff84d806f685f747a,
), ),
), ),
Negated(
Advice {
query_index: 18,
column_index: 7,
rotation: Rotation(
1,
),
},
),
),
), ),
Product( Product(
Product( Product(
@ -11521,15 +11521,6 @@ PinnedVerificationKey {
Sum( Sum(
Sum( Sum(
Sum( Sum(
Negated(
Advice {
query_index: 19,
column_index: 8,
rotation: Rotation(
1,
),
},
),
Scaled( Scaled(
Product( Product(
Product( Product(
@ -11621,7 +11612,6 @@ PinnedVerificationKey {
), ),
0x2e29dd59c64b1037f333aa91c383346421680eabc56bc15dfee7a9944f84dbe4, 0x2e29dd59c64b1037f333aa91c383346421680eabc56bc15dfee7a9944f84dbe4,
), ),
),
Scaled( Scaled(
Product( Product(
Product( Product(
@ -11806,6 +11796,16 @@ PinnedVerificationKey {
0x3bf763086a18936451e0cbead65516b975872c39b59a31f615639415f6e85ef1, 0x3bf763086a18936451e0cbead65516b975872c39b59a31f615639415f6e85ef1,
), ),
), ),
Negated(
Advice {
query_index: 19,
column_index: 8,
rotation: Rotation(
1,
),
},
),
),
), ),
Product( Product(
Product( Product(