-
Notifications
You must be signed in to change notification settings - Fork 5
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: add MemoryTable struct #35
Conversation
|
||
impl MemoryTableRow { | ||
pub fn new(clk: BaseField, mp: BaseField, mv: BaseField) -> Self { | ||
Self { clk, mp, mv, d: BaseField::zero() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self { clk, mp, mv, d: BaseField::zero() } | |
Self { clk, mp, mv, ..Default::default() } |
/// # Returns | ||
/// A new instance of [`MemoryTable`] with an empty table. | ||
pub const fn new() -> Self { | ||
Self { table: Vec::new() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self { table: Vec::new() } | |
Self::default() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, didn't catch it indeed
We've got the same in instruction/table.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, it requires not having the new method as const (or implement Default as const ?)
pub fn new(clk: BaseField, mp: BaseField, mv: BaseField) -> Self { | ||
Self { clk, mp, mv, d: BaseField::zero() } | ||
} | ||
|
||
pub fn new_dummy(clk: BaseField, mp: BaseField, mv: BaseField) -> Self { | ||
Self { clk, mp, mv, d: BaseField::one() } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here really pedantic but I think that we miss 2 small unit tests:
- To validate that the fields clk, mp, mv, d are properly set up for a row with the
new
function - To validate that the fields clk, mp, mv, d are properly set up for a row with the
new_dummy
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I'll add them
Closes #32
The field
d
representing the flag for dummy rows is private:d
must either be 0 or 1 (as a BaseField), which is enforced by the methodsnew
andnew_dummy
.This field
d
appears useless atm, but it'll make more sense once #33 and #34 are done.