Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action for KZG test; fix bool to F #25

Merged
merged 2 commits into from
May 13, 2022

Conversation

ed255
Copy link
Member

@ed255 ed255 commented Apr 29, 2022

When testing with the kzg feature, I encountered an error when rust tries to convert a bool to F. I just fixed it by converting the bool into u64 (as FieldExt implements From<u64> via ff::PrimeField).

$ cargo test check --no-default-features --features kzg
   Compiling maingate v0.1.0 (/home/dev/git/zkevm/halo2wrong/maingate)
error[E0277]: the trait bound `F: From<bool>` is not satisfied
   --> maingate/src/instructions.rs:983:68
    |
983 |             let sign = (value & BigUint::one() != BigUint::zero()).into();
    |                                                                    ^^^^ the trait `From<bool>` is not implemented for `F`
    |
    = note: required because of the requirements on the impl of `Into<F>` for `bool`
help: consider further restricting this bound
    |
176 | pub trait MainGateInstructions<F: FieldExt + std::convert::From<bool>, const WIDTH: usize>: Chip<F> {
    |                                            ++++++++++++++++++++++++++

For more information about this error, try `rustc --explain E0277`.
error: could not compile `maingate` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

I've also fixed a small build error that was happening with the zcash feature enabled.
I've also added a github action to build and test with the kzg feature.
And finally I've bumped the appliedzkp/halo2 dependency to match the one used in the zkevm-circuits; let me know if that's OK or if there's any problem with it!

Copy link
Contributor

@davidnevadoc davidnevadoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
It'd be great to have this merged asap :)

- Fix bool to F
- Fix build error on ecdsa test with `zcash` feature enabled
- Bump `appliedzkp/halo2` dependency to match
  `appliedzkp/zkevm-circuits` project.
@ed255
Copy link
Member Author

ed255 commented May 9, 2022

I've updated the halo2 dependency to v2022_05_06 and now the transcript subcrate doesn't build :(
This happens after halo2 36ddecc274e13c121d7545649f24464e16c4b51e. With ae2aa5bce0e7b28e206808c0760764bbc650f817, which is the previous halo2 commit, the transcript subcrate builds correctly.

@ed255
Copy link
Member Author

ed255 commented May 9, 2022

If I change the pairing dependency in poseidon to use tag = "v0.1.1", then it works. I don't know what's the best way to resolve this problem.

I understand that currently we're re-exporting the pairing via halo2 so that we get the same pairing version everywhere (by importing the re-exported pairing from halo2). But this can't be done in poseidon because it would introduce a cyclic dependency. The other option I see is always make sure that the pairing re-exported in halo2 matches exactly the one used in poseidon. In this case we'd need poseidon to have:
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256", "tag" = "v0.1.1"}.

@kilic what do you think about this?

@ed255
Copy link
Member Author

ed255 commented May 9, 2022

I've opened a PR in poseidon to resolve this (at least for now) by using the same tag for pairing as our halo2 repository.

kilic
kilic previously approved these changes May 13, 2022
Copy link
Collaborator

@kilic kilic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kilic kilic dismissed their stale review May 13, 2022 16:42

failing ci. try to rerun?

@kilic kilic merged commit 92b9689 into privacy-scaling-explorations:master May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants