acceleration-program icon indicating copy to clipboard operation
acceleration-program copied to clipboard

Proposal: Replicating circom-MP-SPDZ to support Lattigo

Open tmors opened this issue 1 year ago • 3 comments
trafficstars

General Grant Proposal

Replicating circom-MP-SPDZ to support Lattigo https://github.com/privacy-scaling-explorations/acceleration-program/issues/54

Project Overview :page_facing_up:

Overview

  1. write documentation for lattigo
  2. replicate circom-MP-SPDZ to support lattigo

Project Details

Team :busts_in_silhouette:

Team members

Team's experience

We have rich experience in cryptographic component development, including OT, PSI, GC, Beaver Triples, etc., and are familiar with golang and MP-SPDZ.

Development Roadmap :nut_and_bolt:

Overview

  • Total Estimated Duration: 10 weeks
  • Total Estimated Working Hours: 150 hr
  • Full-time equivalent (FTE): 0.4
  • Expected Start Date: Aug 16th 2024
  • Expected End Date: Oct 30th 2024

Milestone 1: Understanding Lattigo and Documentation

  • Estimated Duration: 3 weeks
  • FTE: 0.4
  • Estimated delivery date: Sep 8th, 2024
  • Total Estimated Working Hours: 45

Deliverables and Specifications

1a. Documentation
  • A comprehensive tutorial explaining Lattigo's domains, supported operations and data types (and how they are compatible with circom's operations, paying special attention to binary, arithmetic in prime field and ring $2^k$), security parameters, and number of parties supported.
  • Best practices and caveats.
  • Step-by-step guide on executing example scenarios (covering as much the discovered knowledge above as possible for demonstration purpose) with Lattigo.

Milestone 2 : Adaptation of circom-MP-SPDZ to circom-Lattigo

  • Estimated Duration: 7 weeks
  • FTE: 0.4
  • Estimated delivery date: Oct 30th 2024
  • Total Estimated Working Hours: 105

Deliverables and Specifications

2a. Functionality: Generate Circuits for Lattigo from Bristol Circuit

Modify circom-MP-SPDZ code to generate Lattigo circuit output from circom-2-arithc.

2b. Functionality: Generate Inputs for Lattigo from circom-MP-SPDZ Inputs

Modify circom-MP-SPDZ code to generate inputs for Lattigo from the inputs defined in circom-MP-SPDZ.

2c. Functionality: Run the Generated Lattigo Circuits and Inputs

Modify circom-MP-SPDZ code to run Lattigo and get parsed outputs.

Application

Component 2c runs Lattigo with the circuits generated by component 2a with the inputs generated from component 2b.

2d. Testing Guide
  • Proper unit test coverage (e.g. above 90%) for circuit generation, input generation, and circuit execution.
  • Integration tests for example circuits like op_tests, naive_search, two_outputs and nn_circuit_small (notice that you should expect some tricky issues here due to incompatibility between circom front end and Lattigo backend, and also some configurations are needed, see the original circom-MP-SPDZ for reference).
2e. Documentation
  • Inline documentation of the code.
  • Comprehensive documentation covering the entire workflow, from code modification to testing and execution.

tmors avatar Aug 12 '24 09:08 tmors

@mhchia could you review this. Feel free to use discord to discuss more in real time as well. cc @tmors

nooma-42 avatar Aug 13 '24 17:08 nooma-42

@tmors

Could you please make a few adjustments to the milestones?

  1. The Total Estimated Duration is currently 8 weeks (8*40*0.4=128 hours), which is slightly shorter than the 150 hours required. Would you consider extending the duration to 10 weeks (160 hours) or more? This would provide a buffer. The working hours remain the same, but the due date would be adjusted accordingly. Of course, you can still finish earlier once the milestone is completed.

  2. For both milestones, could you add "Total Estimated Working Hours"?

    • Milestone 1: "Total Estimated Working Hours: 45"
    • Milestone 2: "Total Estimated Working Hours: 105"
  3. Could you please use the milestone deliverables and specifications we've provided instead?

Milestone 1:

#### Deliverables and Specifications

##### 1a. Documentation
- A comprehensive tutorial explaining Lattigo's domains, supported operations and data types (and how they are compatible with circom's operations, paying special attention to binary, arithmetic in prime field and ring $2^k$), security parameters, and number of parties supported.
- Best practices and caveats.
- Step-by-step guide on executing example scenarios (covering as much the discovered knowledge above as possible for demonstration purpose) with Lattigo.

Milestone 2:

#### Deliverables and Specifications

##### 2a. Functionality: Generate Circuits for Lattigo from Bristol Circuit
Modify circom-MP-SPDZ code to generate Lattigo circuit output from circom-2-arithc.

##### 2b. Functionality: Generate Inputs for Lattigo from circom-MP-SPDZ Inputs
Modify circom-MP-SPDZ code to generate inputs for Lattigo from the inputs defined in circom-MP-SPDZ.

##### 2c. Functionality: Run the Generated Lattigo Circuits and Inputs
Modify [circom-MP-SPDZ code](https://github.com/namnc/circom-mp-spdz/blob/4b5745c17c500903ccfbae0735370cd33283a0f6/main.py#L284-L314) to run Lattigo and get parsed outputs.

##### Application
Component 2c runs Lattigo with the circuits generated by component 2a with the inputs generated from component 2b.

##### 2d. Testing Guide
- Proper unit test coverage (e.g. above 90%) for circuit generation, input generation, and circuit execution.
- Integration tests for example circuits like `op_tests`, `naive_search`, `two_outputs` and `nn_circuit_small` (notice that you should expect some tricky issues here due to incompatibility between circom front end and Lattigo backend, and also some configurations are needed, see the original circom-MP-SPDZ for reference).

##### 2e. Documentation
- Inline documentation of the code.
- Comprehensive documentation covering the entire workflow, from code modification to testing and execution.

Please let me know if you have any concerns. Thanks!

NOTE: The "Expected Start Date" and "Expected End Date" might be subject to changes since they could be finalized after the grant is confirmed.

mhchia avatar Aug 21 '24 07:08 mhchia

Looks good to us! cc @NOOMA-42

mhchia avatar Aug 23 '24 06:08 mhchia