Skip to content

primefield: add PrimeFieldExt trait - #1809

Merged
tarcieri merged 1 commit into
masterfrom
primefield/prime-field-ext
Jun 16, 2026
Merged

tarcieri merged 1 commit into
masterfrom
primefield/prime-field-ext

Conversation

@tarcieri

Copy link
Copy Markdown
Member

Adds a trait for specifying the endianness of the serialized representation of a field element as a stopgap until zkcrypto/rfcs#4 is accepted.

This uses the ByteOrder enum and replaces the previous FIELD_REPR_IS_BE flag on PrimeCurveParams. It also means Radix16Decomposition now "Just Works" and doesn't need an endianness parameter passed to new.

The primefield::monty_field_element! macro now writes impls for this trait, sourcing the endianness information from the MontyFieldParams.

Adds a trait for specifying the endianness of the serialized
representation of a field element as a stopgap until zkcrypto/rfcs#4 is
accepted.

This uses the `ByteOrder` enum and replaces the previous
`FIELD_REPR_IS_BE` flag on `PrimeCurveParams`. It also means
`Radix16Decomposition` now "Just Works" and doesn't need an endianness
parameter passed to `new`.

The `primefield::monty_field_element!` macro now writes impls for this
trait, sourcing the endianness information from the `MontyFieldParams`.
@tarcieri
tarcieri merged commit 13ce847 into master Jun 16, 2026
165 checks passed
@tarcieri
tarcieri deleted the primefield/prime-field-ext branch June 16, 2026 23:53
@tarcieri tarcieri mentioned this pull request Aug 29, 2026
tarcieri added a commit that referenced this pull request Sep 3, 2026
This release contains a breaking change (#1913) to use `primefield`
traits for determining endianness. The original hope was that the
existing `ff` traits could be used instead (zkcrypto/ff#158), but we
ended up having to ship our own traits (#1809) due to inaction from
upstream.

This is a release blocker for `bignp256` which needs little endian
support, so we're making this change hoping that despite being breaking
it should be compatible with all existing usages. We can re-evaluate if
that winds up not being the case.

The `wnaf` v0.14.0 release will be yanked accordingly to mandate the new
bounds.
tarcieri added a commit that referenced this pull request Sep 3, 2026
This release contains a breaking change (#1913) to use `primefield`
traits for determining endianness. The original hope was that the
existing `ff` traits could be used instead (zkcrypto/ff#158), but we
ended up having to ship our own traits (#1809) due to inaction from
upstream.

This is a release blocker for `bignp256` which needs little endian
support, so we're making this change hoping that despite being breaking
it should be compatible with all existing usages. We can re-evaluate if
that winds up not being the case.

The `wnaf` v0.14.0 release will be yanked accordingly to mandate the new
bounds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant