-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: Introduce a proof-of-concept field Writer for writing to "native field" as well as "foreign field" transcripts #340
Conversation
0e57337
to
38d39de
Compare
Amazing work! Can't wait to use this throughout. How easily can we adapt this to write to a |
74c05bf
to
7e8000a
Compare
7e8000a
to
8d0895b
Compare
Thanks @huitseeker ! It's nice how easy you made it to serialize to a bytes buffer by reusing the I’m realizing though that this may lead to a slightly less optimal verifier, if the latter is not restricted to only field elements (e.g. in Solidity). With our current stack, the Solidity verifier has to run two interactive protocols to verify an NIVC proof.
For the latter, we'll want to modify the "serialization" strategy to match the verification environment.
What I was thinking originally is that we could get away with having a different implementation of I hope this extra context helps, but I’m also fine with focusing on the Poseidon use-case for now if this is becoming too complex! |
- Created `src/transcript.rs` with concepts and traits for field operations. - Defined a new `Limbable` trait for encoding translation between fields. - Implemented `FieldWriter` and `FieldWritable` traits for respectively writing and producing field elements. - Presented `FieldWritableExt` extension trait to accommodate different target field types. - Added `FieldEncodingWriter` structure, a translating field writer. - Integrated `smallvec` library with `const_generics` feature to implement it efficiently. - Added tests for the `src/transcript.rs` module and its functionalities.
- Introduced a new `FieldEquippedWriter` struct in `transcript.rs` for efficient handling of "native" fields for digests. - Implemented the ability to perform conversions from a writer, write field elements, and flush the writer using the new `FieldEquippedWriter` struct. - Renamed the function `it_works` with `test_limbing_works` to improve test naming conventions. - Implemented a new test, `test_keccak_works`, that verifies the Keccak256 hash of field elements implementation via `FieldEquippedWriter`.
8d0895b
to
3f516aa
Compare
The problem
We wanted a proof-of-concept of a set of traits that allow, for each concrete type:
We're working with the following restrictions:
What's in this PR?
A PoC suite of traits explaining how structs can have a "serialization" to their "native" notion of field element, the transcripts can have a "native" notion of field element they accept, and how we can have a generic struct apply a systematic conversion between those two notions in order to define a general way to absorb the structs into the transcripts.
When the "native" fields on each end (struct and transcript) match, the conversion resolves to something trivial. That conversion is then made accessible to any struct that has defined its "native serialization" by way of an extension trait.
In Detail
src/transcript.rs
with concepts and traits for field operations.Limbable
trait for encoding translation between fields.FieldWriter
andFieldWritable
traits for respectively writing and producing field elements.FieldWritableExt
extension trait to accommodate different target field types.FieldEncodingWriter
structure, a translating field writer.smallvec
library withconst_generics
feature to implement it efficiently.src/transcript.rs
module and its functionalities.