halo2 icon indicating copy to clipboard operation
halo2 copied to clipboard

Improve UX for Poseidon chip

Open str4d opened this issue 2 years ago • 1 comments

One of the 0xPARC participants found the Poseidon chip interface tricky to work with. We should have a look over the API, as well as the wrapper they created around it, and think about how our API can be improved or documented for better usability.

We also should think about how we convey the fact that the Poseidon chip isn't meant to be special, and should just be an implementation choice; the Poseidon gadget is all most people should need to interact with.

str4d avatar Jul 08 '22 16:07 str4d

Hey! I think this was me. For my purposes, I wanted an easy-to-use PoseidonChip implementation that would take in L inputs and produce a single output. A few observations on my end on why this was difficult from a documentation and API perspective.

  • It took me a while to figure out that I wanted to use the Pow5Chip, not anything named Poseidon (thank you @yingtong).
  • While many example circuits use a generic field extension F, all Poseidon related chips assume usage of the Pasta curve.
  • To my understanding, just using the Pow5Chip is not enough to create a reusable PoseidonChip, it must be computed with the Hash halo2_gadget (https://github.com/jtguibas/halo2-merkle-tree/blob/main/src/chips/poseidon.rs#L101-L132).
  • Very little documentation about what the generic type arguments into many of these chips are and what presets are available. Ultimately, it would be very nice if I could just important something like Poseidon2Chip if I want to hash two field elements.

jtguibas avatar Jul 08 '22 17:07 jtguibas