ZcashFoundation / frost

Rust implementation of FROST (Flexible Round-Optimised Schnorr Threshold signatures) by the Zcash Foundation
https://frost.zfnd.org
Other
133 stars 50 forks source link

Make uses of Copy and Clone consistent in the public API #662

Closed conradoplg closed 3 months ago

conradoplg commented 3 months ago

Currently, all structs that wrap Scalars implement Copy (and possibly a bunch of others). This can be confusing for users because you basically have to know if a struct implements Copy or Clone in order to use it.

For example, if you have a reference to a value v: &T, and want to pass it to a function with argument v: T, you need to pass *v if it's Copy but v.clone() if it's Clone.

There are multiple things we could to do address this:

I'm not sure what the best approach so we need to decide that first.

conradoplg commented 3 months ago

Removing Copy will be a pain:

Here all the Copy types:

We might want to remove Copy just from SigningCommitments and Signature which are structs are are the odd ones out. But I'm not sure if it's worth it.

In the end I'm inclined to not change anything.