Skip to content

New Scalar#1285

Merged
nazar-pc merged 6 commits intomainfrom
new-scalar
Mar 23, 2023
Merged

New Scalar#1285
nazar-pc merged 6 commits intomainfrom
new-scalar

Conversation

@nazar-pc
Copy link
Member

This builds on #1281 and #1214 and is a step towards #1282.

We had Kzg that worked with bytes (converting to scalars internally) and subspace-erasure-coding working with scalars (converting to a completely different type internally due to scalar corresponding to a different underlying crypto library).

Since in archiving we'll be dealing with both erasure coding and commitments, it makes sense to use the same scalar for both purposes.

This PR renames existing scalar to ScalarLegacy and introduces new Scalar, which shares some similarities, but has stricter and richer API. With this new scalar type both Kzg and subspace-erasure-coding are refactored to use it with some efficiency gains in the process.

Reviewing commits individually should make the most sense.

There is a bit of isolated and carefully written unsafe that allows us to avoid large re-allocations in performance-sensitive code paths.

Code contributor checklist:

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.

2 participants