zkmove / halo2-verifier.move

A set of tooling of halo2 circuits verification in Move environments
Apache License 2.0
16 stars 4 forks source link

workaround for compile error using enumerate_ref #71

Closed luxebeng closed 3 months ago

luxebeng commented 3 months ago

There is a compile error for the latest branch which related to enumerate_ref, and it's replaced by a workaround.

error: cannot pass `|(&_, &crypto_algebra::Element<bn254_algebra::Fr>)|` to a function which expects argument of type `|(u64, &crypto_algebra::Element<bn254_algebra::Fr>)|`
┌─ /Users/benliu/work/zkmove/halo2-verifier.move/packages/verifier/sources/shplonk.move:237:44
│
237 │               vector::enumerate_ref(&points, |k, x_k| {
│ ╭────────────────────────────────────────────^
238 │ │                 if (k != j) {
239 │ │                     vector::push_back(&mut denom, bn254_utils::invert(&crypto_algebra::sub(x_j, x_k)));
240 │ │                 };
241 │ │             });
│ ╰─────────────^

error: cannot pass `|(&_, &crypto_algebra::Element<bn254_algebra::Fr>)|` to a function which expects argument of type `|(u64, &crypto_algebra::Element<bn254_algebra::Fr>)|`
┌─ /Users/benliu/work/zkmove/halo2-verifier.move/packages/verifier/sources/shplonk.move:234:40
│
234 │           vector::enumerate_ref(&points, |j, x_j| {
│ ╭────────────────────────────────────────^
235 │ │             let denom = vector::empty();
236 │ │
237 │ │             vector::enumerate_ref(&points, |k, x_k| {
· │
243 │ │             vector::push_back(&mut denoms, denom);
244 │ │         });
│ ╰─────────^