cargodog / arcturus

A pure rust implementation of Arcturus proofs for confidential transactions.
MIT License
12 stars 2 forks source link

Use num_traits::pow to efficiently compute random mu_k values for prover #27

Open cargodog opened 3 years ago

cargodog commented 3 years ago

As of https://github.com/cargodog/arcturus/pull/26, the prover tediously computes the mu_l exponent for each index l in his proof. This could be optimized in future work to use a more efficient exponentiation algorithm (e.g. square and add), compute each mu_l in a single iterative computation, or both.

As it happens, num_traits::pow exists for just this purpose, and would be the ideal solution to this problem. Unfortunately, curve25519-dalek does not implement the necessary num_traits::identities traits. The ideal solution to this problem, would involve implementing num_traits for curve25519-dalek and submitting a patch upstream.

Alternatively, I could consider wrapping the Scalar type into a local Wscalar type, and implement the traits locally. This is not ideal, but may be quicker than pushing changes upstream.

cargodog commented 3 years ago

I've submitted a PR upstream to implement num_traits::pow and dependent num_traits::identities. If that patch gets accepted, this issue will become trivial to resolve: https://github.com/dalek-cryptography/curve25519-dalek/pull/340