Description
If we think from an algebraic eyes, it would be very nice to enforce typing over F_q
for some q
, meaning that the type will be FieldElement<q>
, then q
can be use to choose the size of the underlying array and generate arithmetic that work on that field specifically (and then using specialization we could provide efficient implementation for common fields).
This allows you to easily separate variables from different fields and makes field conversions very explicit and obvious, which should increase resilience in complex algorithms that do convert between fields (ie in a MPC protocol where you use Paillier encryption over a field element in an EC group, when you convert between the fields you'll realize you probably need to attach some range proof and dlog proof).
Would love to hear any thoughts on this :)