axelarnetwork / tofn

A threshold cryptography library in Rust
Apache License 2.0
107 stars 22 forks source link

Bundle Round type params into a trait #176

Open ggutoski opened 2 years ago

ggutoski commented 2 years ago

Haven't thought this through at all, but we could declare a trait

trait RoundParams {
  type FinalOutput;
  type ShareId;
  type PartyId;
  const MAX_MSG_IN_LEN: usize;
  // etc
}

and then replace all instances of <F, K, P, const MAX_MSG_IN_LEN: usize> with <P: RoundParams> and then refer to P::FinalOutput instead of F, etc. That's nice because we can change the type parameters at only one place and reduce boilerplate.

_Originally posted by @ggutoski in https://github.com/axelarnetwork/tofn/pull/174#discussion_r720864768_