Skip to content

Draft: Implement Poseidon128 with blst

Danny Willems requested to merge poseidon128 into master

Built on top of !118 (closed)

FIXME: constants are not correct

> dune exec ./benchmark/bench_poseidon128.exe
Estimated testing time 10s (1 benchmarks x 10s). Change using '-quota'.
┌──────────────────────────────────────────────────────────────────────────────────────────┬──────────┬─────────┬────────────┐
│ Name                                                                                     │ Time/Run │ mWd/Run │ Percentage │
├──────────────────────────────────────────────────────────────────────────────────────────┼──────────┼─────────┼────────────┤
│ Benchmark one permutation of Poseidon128 (Orchard parameters) with on an input of 3 elem │  32.94us │  16.00w │    100.00% │
│ ents                                                                                     │          │         │            │
└──────────────────────────────────────────────────────────────────────────────────────────┴──────────┴─────────┴────────────┘

TODO:

  • implementation in C for Poseidon128.
  • binding in OCaml to the primitives (full integration with dune)
  • write tests for it (check the output of mec and bls are consistent) (@ambrona). Regression tests + more tests with mec.
  • bench the C implementation, and compare to the OCaml. The overhead must be low. (@rrtoledo, see dannywillems/ocaml-bls12-381!119 (81ddd5d0) for ideas)

In the future:

  • make the C implementation more generic with Poseidon252 (for test vectors with Dusk)
    • Idea: provide a function to update the constants.
  • binding it
  • write tests for Poseidon252
Edited by Danny Willems

Merge request reports