Closed xiangxiecrypto closed 5 months ago
Great, thanks! Will review soon.
Excited to see it all come together! 🔥
I have some requests which should simplify things quite a bit.
- For MPCOT, I believe we can eliminate a lot of duplication by encapsulating the different LPN types (regular/uniform). Instead of having two types you can add an argument to the constructor and handle it behind the API. The core types can remain separate but the IO wrapper can be unified.
Yep, we can simplify mpcot to just one type.
- The
check
andfinalize
methods should not be exposed in the public API. When callingextend
the user should just provide the number of OTs they want and you handle the entire process for them. Additionally,extend
should not return the OTs, it should buffer them internally because it is used during the preprocessing phase. This buffering should be performed in the core crate, the same as how we do it for KOS.
Maybe we can keep spcot and mpcot internal apis, since they are only called by ferret. In this case, we do not need to keep all the output in internal states, it is much easier to be integrated by ferret.
As to finalize
, I meant to explicitly close the extension procedure of ferret. In KOS, the state will automatically turn to Complete
after the check procedure (if I understand correctly). While in ferret, it will always allow us to extend, unless we manually turn it off with finalize
.
For example, here is what the public API could look like:
impl<RandomCOT> Sender<RandomCot> { pub fn new(lpn_type: LpnType, rcot: RandomCOT) -> Self { .. } pub async fn setup<Ctx: Context>(&mut self, ctx: &mut Ctx) -> Result<(), SenderError> { .. } /// Preprocesses `count` OTs. pub async fn extend<Ctx: Context>(&mut self, ctx: &mut Ctx, count: usize) -> Result<(), SenderError> { .. } }
This applies to SPCOT, MPCOT and Ferret
Maybe we can keep spcot and mpcot internal apis, since they are only called by ferret. In this case, we do not need to keep all the output in internal states, it is much easier to be integrated by ferret.
Yes, we can keep SPCOT and MPCOT private for now to simplify things.
As to finalize, I meant to explicitly close the extension procedure of ferret. In KOS, the state will automatically turn to Complete after the check procedure (if I understand correctly). While in ferret, it will always allow us to extend, unless we manually turn it off with finalize.
Ok, I see the intent now. I'm not sure if that is necessary though. For KOS we only do this because the consistency check is leaky and we did not see any proofs that leakage of Delta is bounded when running multiple extensions. For Ferret, my understanding is that extension can be performed indefinitely, is that correct?
Note that in the Ferret implementation, we need two random COTs. One for MPCOT (SPCOT), which can be IKNP-type (KOS) Random COTs. The other one is for the setup in Ferret, which will be Ferret with smaller parameters.
All the parameters will be chosen when the lpn estimator is done.