Skip to content
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

New Scalar #1285

Merged
merged 6 commits into from
Mar 23, 2023
Merged

New Scalar #1285

merged 6 commits into from
Mar 23, 2023

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