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

Better column query in MPT macros #8

Draft
wants to merge 1 commit into
base: mpt-refactor
Choose a base branch
from

Conversation

leolara
Copy link

@leolara leolara commented Mar 1, 2023

No description provided.

Comment on lines +461 to +465
/// Enables column query without knowing the Column type
pub trait Querier<F: Field> {
/// Query a column at a relative position
fn query(self, meta: &mut VirtualCells<F>, at: Rotation) -> Expression<F>;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Makes the API similar to what privacy-scaling-explorations/halo2#154.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I left a comment, I think the expr method name is confusing and perhaps cur would be better for the method name.

Comment on lines +1158 to +1184
#[allow(unused_macros)]
macro_rules! cur {
($column:expr) => {{
$column.query($meta, Rotation::cur())
}};
}

#[allow(unused_macros)]
macro_rules! next {
($column:expr) => {{
$column.query($meta, Rotation::next())
}};
}

#[allow(unused_macros)]
macro_rules! prev {
($column:expr) => {{
$column.query($meta, Rotation::prev())
}};
}

#[allow(unused_macros)]
macro_rules! query {
($column:expr, $rot:expr) => {{
$column.query($meta, Rotation($rot as i32))
}};
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the meta dependency is gone for querying cells, do you still think we need these macro's or just using the Querier syntax directly also works for you?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that column.cur() would work without the meta? In that case the macros would be unnecessary I believe.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@miha-stopar
Copy link

@Brechtpd Is it ok if I review some more before I merge? There's been quite a lot of changes since I last reviewed, so I would like to spend some more time on it to properly understand :). In fact, I started rewriting the specs (pretty much everything needs to be rewritten) and would like to do it in parallel.

But if you need some features from master I can just merge it to my branch (to enable sync) and review later? Might be even better this way?

For the witness generator - no worries, I can implement prepare_witness functionality there.

@Brechtpd
Copy link
Owner

Brechtpd commented Apr 4, 2023

@Brechtpd Is it ok if I review some more before I merge? There's been quite a lot of changes since I last reviewed, so I would like to spend some more time on it to properly understand :). In fact, I started rewriting the specs (pretty much everything needs to be rewritten) and would like to do it in parallel.

Of course, no problem.

But if you need some features from master I can just merge it to my branch (to enable sync) and review later? Might be even better this way?

Ah yes, that also works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants