Skip to content

refactor: Deduplicate Field implementations in ts #4189

@spalladino

Description

@spalladino

We currently have two Fr implementations, one in bb.js and one in Foundation. These are incompatible with each other, since one uses Uint8Arrays to store the field value, and the other bigint. The Fr and Fq in bb.js also differ in this.

Given that the Uint8Array implementation is more efficient, we should ensure both Fr and Fq in bb.js use that, and then remove the implementations in Foundation and just re-export the bb.js ones. Note that this may break avm field arithmetic, that depends on fields being bigints right now, so we'll need to re-convert fields into bigints before running these operations.

More context here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-refactorType: this code needs refactoring

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions