-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement Buses #8
Conversation
aa257b9
to
bf80f0d
Compare
Here are my answers to the last 3 questions. Also tagging @Al-Kindi-0, @plafer, @paracetamolo in case I missed anything.
I think boundary constraints are either empty or they alway reference public inputs - I can't think of a way to initialize them to something that is just a constant in a meaningful way.
Yes, The way to reference public inputs could be as simple as:
This would resolve to the first value of column Where the And the last value of Where the Note that if
There are pros and cons to each. On the one hand, having all constraints described uniformly in the algebraic graph seems like a good idea. On the other hand, if the algebraic graph can be simplified significantly be making it work only over the base field constraints - this would be a good idea as well. I think the question here is what would be easer to implement initially. We can start there and then improve the code after that (my hunch is putting all constraints into the algebraic graph would probably be that).
I think this would need to be done regardless because once the busses are introduced I see relatively little utility to exposing auxiliary segment constraints to the end users. But this could also be done as a follow-up PR. |
Thank you @bobbinth, it's very clear! It seems the easiest for now is to introduce a small pass before lowering the MIR into the AIR to expand the bus constraints, so we've started implementing this.
A follow-up question on public inputs, currently public inputs can only be fixed-size vectors (x: [12] for a vector of 12 Felts). Or did you have something else in mind with the notation |
The idea here was this would be a table with a fixed number of columns (i.e., 2 columns, in this example) but dynamic number of rows.
Ah yes - good point! We'd have a static equation for "collapsing" each row into a single value, but we'd need to have a dynamic expression to "collapse" all row values into a single value. This dynamic expression cannot go into the algebraic graph and so would need to be kept and processed separately. The approach could be the The codegen for this would need to output the "table collapsing" logic which the verifier would execute to get a single value, and then this value would become the boundary constraint for the bus column (we can do this in a separate PR). |
Sounds good! Here is an updated status checklist for this PR:
In follow-up PRs, we should handle:
|
aefdde8
to
250085f
Compare
Still needs additional checks (e.g. ensure Null only on buses boundaries, and ensure buses boundaries only on Null)
- fixed stack overflow on hash and eq with Singleton - mir comparision utils - buses test
250085f
to
4e89655
Compare
Closed in favor of 0xPolygonMiden#371 |
This PR aims to implement Buses in AirScript, with a design based on the following issue: 0xPolygonMiden#183
It currently relies on this PR being merged: 0xPolygonMiden#359
Current status:
Bus {span, bus_type}
enf <SymbolAccess>.boundary = ScalarExpr
)BusOperation {bus, bus_operator, args}
, which are parsed as ListComprehensions to have an easy access to a selector/multiplicity,similar to how conditional constraints are handled
As a result, the AST can parse, analyse semantically and have constant propagation done for the following tests, ignored as we don't handle them in the MIR: https://github.com/massalabs/air-script/blob/feat-implement-bus/mir/src/tests/buses.rs
We have a few questions:
first
andlast
boundaries? I'm thinking about this comment:# TODO: we still need to figure out how to initialize the bus to non-empty values
here: Permutation check syntax 0xPolygonMiden/air-script#183 (comment)aux
segment and random values from the front-end, should we work on this first?