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)
.map(|next_idx| {
let state_next = meta.query_advice(state[next_idx], Rotation::next());
let expr = (0..WIDTH).fold(-state_next, |acc, idx| {
let state_cur = meta.query_advice(state[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]
});
s_full.clone() * expr
let expr = (0..WIDTH)
.map(|idx| {
let state_cur = meta.query_advice(state[idx], Rotation::cur());
let rc_a = meta.query_fixed(rc_a[idx], Rotation::cur());
pow_5(state_cur + rc_a) * m_reg[next_idx][idx]
})
.reduce(|acc, term| acc + term)
.expect("WIDTH > 0");
s_full.clone() * (expr - state_next)
})
.collect::<Vec<_>>()
});

View File

@ -10831,15 +10831,6 @@ PinnedVerificationKey {
Sum(
Sum(
Sum(
Negated(
Advice {
query_index: 22,
column_index: 6,
rotation: Rotation(
1,
),
},
),
Scaled(
Product(
Product(
@ -10931,6 +10922,97 @@ PinnedVerificationKey {
),
0x0ab5e5b874a68de7b3d59fbdc8c9ead497d7a0ab23850b56323f2486d7e11b63,
),
Scaled(
Product(
Product(
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
0x31916628e58a5abb293f0f0d886c7954240d4a7cbf7357368eca5596e996ab5e,
),
),
Scaled(
Product(
@ -10938,15 +11020,15 @@ PinnedVerificationKey {
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -10954,15 +11036,15 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -10972,15 +11054,15 @@ PinnedVerificationKey {
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -10988,15 +11070,15 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11006,114 +11088,32 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
0x31916628e58a5abb293f0f0d886c7954240d4a7cbf7357368eca5596e996ab5e,
0x07c045d5f5e9e5a6d803952bbb364fdfa0a3b71a5fb1573519d1cf25d8e8345d,
),
),
Scaled(
Product(
Product(
Product(
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
Product(
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
Negated(
Advice {
query_index: 22,
column_index: 6,
rotation: Rotation(
1,
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
0x07c045d5f5e9e5a6d803952bbb364fdfa0a3b71a5fb1573519d1cf25d8e8345d,
},
),
),
),
@ -11176,15 +11176,6 @@ PinnedVerificationKey {
Sum(
Sum(
Sum(
Negated(
Advice {
query_index: 18,
column_index: 7,
rotation: Rotation(
1,
),
},
),
Scaled(
Product(
Product(
@ -11276,6 +11267,97 @@ PinnedVerificationKey {
),
0x233162630ebf9ed7f8e24f66822c2d9f3a0a464048bd770ad049cdc8d085167c,
),
Scaled(
Product(
Product(
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
0x25cae2599892a8b0b36664548d60957d78f8365c85bbab07402270113e047a2e,
),
),
Scaled(
Product(
@ -11283,15 +11365,15 @@ PinnedVerificationKey {
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11299,15 +11381,15 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11317,15 +11399,15 @@ PinnedVerificationKey {
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11333,15 +11415,15 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11351,114 +11433,32 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
0x25cae2599892a8b0b36664548d60957d78f8365c85bbab07402270113e047a2e,
0x22f5b5e1e6081c9774938717989a19579aad3d8262efd83ff84d806f685f747a,
),
),
Scaled(
Product(
Product(
Product(
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
Product(
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
Negated(
Advice {
query_index: 18,
column_index: 7,
rotation: Rotation(
1,
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
0x22f5b5e1e6081c9774938717989a19579aad3d8262efd83ff84d806f685f747a,
},
),
),
),
@ -11521,15 +11521,6 @@ PinnedVerificationKey {
Sum(
Sum(
Sum(
Negated(
Advice {
query_index: 19,
column_index: 8,
rotation: Rotation(
1,
),
},
),
Scaled(
Product(
Product(
@ -11621,6 +11612,97 @@ PinnedVerificationKey {
),
0x2e29dd59c64b1037f333aa91c383346421680eabc56bc15dfee7a9944f84dbe4,
),
Scaled(
Product(
Product(
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
),
Sum(
Advice {
query_index: 7,
column_index: 7,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
rotation: Rotation(
0,
),
},
),
),
0x1d1aab4ec1cd678892d15e7dceef1665cbeaf48b3a0624c3c771effa43263664,
),
),
Scaled(
Product(
@ -11628,15 +11710,15 @@ PinnedVerificationKey {
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11644,15 +11726,15 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11662,15 +11744,15 @@ PinnedVerificationKey {
Product(
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11678,15 +11760,15 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
@ -11696,114 +11778,32 @@ PinnedVerificationKey {
),
Sum(
Advice {
query_index: 7,
column_index: 7,
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 5,
column_index: 6,
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
0x1d1aab4ec1cd678892d15e7dceef1665cbeaf48b3a0624c3c771effa43263664,
0x3bf763086a18936451e0cbead65516b975872c39b59a31f615639415f6e85ef1,
),
),
Scaled(
Product(
Product(
Product(
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
Product(
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
Negated(
Advice {
query_index: 19,
column_index: 8,
rotation: Rotation(
1,
),
Sum(
Advice {
query_index: 8,
column_index: 8,
rotation: Rotation(
0,
),
},
Fixed {
query_index: 6,
column_index: 7,
rotation: Rotation(
0,
),
},
),
),
0x3bf763086a18936451e0cbead65516b975872c39b59a31f615639415f6e85ef1,
},
),
),
),