Skip to content

Interchangeability of NonNativeFieldVar and FpVar for FieldVar #99

Open
@weikengchen

Description

@weikengchen

Summary

This issue is to discuss how to make NonNativeFieldVar a drop-in replacement for FieldVar in curve operations.

Problem Definition

One of the reasons that we implemented FieldVar for NonNativeFieldVar is to allow it to be a drop-in replacement of FpVar, so that one doesn't need to build a hierarchy of nonnative primitives.

This, however, is not covered by the current implementation, see:
https://github.com/arkworks-rs/r1cs-std/blob/master/src/groups/curves/short_weierstrass/mod.rs#L44

#[derive(Derivative)]
#[derivative(Debug, Clone)]
#[must_use]
pub struct ProjectiveVar<
    P: SWModelParameters,
    F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
> where
    for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
    ...
}

It would be ideal, though, to lift this restriction. However, we want to make sure that we don't change the existing writing system---it would be highly inconvenient to use

pub struct ProjectiveVar<
    P: SWModelParameters,
    F: FieldVar<P::BaseField, CF>,
    CF: PrimeField,
> 

because it introduces one more param CF.

A possible workaround, though not favorable, is to define GeneralizedProjectVar<P, F, CF> and let Projective<P, F> = GeneralizedProjectVar<P, F, <P::BaseField as Field>::BasePrimeField>. This is not favored since nonnative field is not important to this level.

Proposal

We need to think about what would be the best way to do this.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Metadata

Assignees

No one assigned

    Labels

    D-hardDifficulty: hardP-lowPriority: lowT-designType: discuss API design and/or researchT-trackingType: tracking issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions