-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* air notes and minor mods * trace notes and conversion traits
- Loading branch information
Showing
6 changed files
with
127 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,36 @@ | ||
# Air implementation | ||
Referencing the [starkware C++ implementation](https://github.com/starkware-libs/stone-prover/tree/main/src/starkware/air). | ||
|
||
Progress: | ||
- [x] some things | ||
- [ ] components | ||
- [ ] cpu | ||
- [ ] compile_time_optional - maybe C++ fonkery, perhaps necessary in Rust | ||
- [ ] everything else | ||
Initial migration: | ||
- 9/10 air.h | ||
- 0/10 compile_time_optional* - maybe C++ fonkery, perhaps necessary in Rust | ||
- 2/10 test_utils* | ||
- 9/10 trace.h - ask a human | ||
- 10/10 trace_context.h | ||
- 0/10 trace_test.cc | ||
|
||
|
||
## Air notes | ||
- translating `Air` to a trait, this seems reasonable as `Air` is mostly an ABC | ||
- can't represent the C++ constructor check in trait, which would require modifying struct state (trace_length) | ||
- `CompositionPolynomial` in C++ implementation simply stores a unit struct pointer, I suspect this should be `composition_polynomial::CompositionPolynomial` | ||
|
||
|
||
### Compile Time Optional notes | ||
this looks like optimization territory | ||
|
||
### test_utils | ||
we'll get back to this when implementing tests for the module and stub it out for now | ||
|
||
### Trace notes | ||
`Trace` seems like a struct, no virtual methods. Custom copy constructor, default move constructor, default destructor, default {copy,move} assignment. Weird logic around copy, might be a bug on theirs. This file has a lot of odd boilerplate logic that I might want to talk to a human about. | ||
- mapping `Allocate` to `new` | ||
- Trace constructor - mapping to `From<Vec<Vec<F>>>` | ||
- `CopyFrom` - ths looks to have a minor inefficiency, calling `values.size()` instead of `values.Length()`; | ||
|
||
#### Trace context | ||
this looks like a pretty useless trait, candidate for erasure | ||
|
||
#### Trace test | ||
come back later | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
use std::ops::{Deref, IndexMut, Index}; | ||
|
||
use ark_ff::Field; | ||
|
||
/// A class representing a vector of FieldElement-s of a common field. | ||
/// To create an instance call FieldElementVector::make(). | ||
pub struct FieldElementVector { | ||
// todo | ||
#[derive(Default, Clone)] | ||
pub struct FieldElementVector<F: Field>(pub Vec<F>); | ||
|
||
impl<F: Field> From<Vec<F>> for FieldElementVector<F> { | ||
fn from(value: Vec<F>) -> Self { Self(value) } | ||
} | ||
|
||
impl<F: Field> Deref for FieldElementVector<F> { | ||
type Target = Vec<F>; | ||
|
||
fn deref(&self) -> &Self::Target { &self.0 } | ||
} | ||
|
||
impl<F: Field> Index<usize> for FieldElementVector<F> { | ||
type Output = F; | ||
|
||
fn index(&self, index: usize) -> &Self::Output { &self.0[index] } | ||
} | ||
|
||
impl<F: Field> IndexMut<usize> for FieldElementVector<F> { | ||
fn index_mut(&mut self, index: usize) -> &mut Self::Output { &mut self.0[index] } | ||
} | ||
|
||
impl<F: Field> From<FieldElementVector<F>> for Vec<F> { | ||
fn from(value: FieldElementVector<F>) -> Self { value.0 } | ||
} |