-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Deduplicate Field implementations in ts #4189
Comments
Tried tackling this one today and it's way trickier than I originally expected (how unexpected in software engineering). The issue is that all the serialization in foundation package expects That's a lot of work (although probably quite straightforward). |
A solution proposed by Alex:
aztec-packages/yarn-project/foundation/src/serialize/buffer_reader.ts Lines 39 to 41 in 52ce25d
|
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. TheFr
andFq
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.
The text was updated successfully, but these errors were encountered: