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

Stable coprocessor order #665

Closed
wants to merge 1 commit into from
Closed

Conversation

arthurpaulino
Copy link
Member

Use an IndexMap to stabilize the order of coprocessors in a Lang.

This stable order is needed in order to make LEM code generation for a Lang consistent, regardless of the internal algorithm that HashMap would use.

The IndexMap also comes in handy when we want to efficiently retrieve the index of a coprocessor. This will be useful for the implementation of NIVC.

Comment on lines +133 to +134
// TODO: eliminate this unecessary piece of data
let z_ptr = lurk::z_ptr::ZPtr(ExprTag::Nil, F::ZERO);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a little worse than this comment suggests. As far as I can see, this is adding the wrong data. Now, maybe in the LEM case, this wrong data is unnecessary. But a Lang is not specific to LEM or not-LEM. And consequently, it cannot be correct to construct one this way. This 'scalar ptr' must correspond to the symbol to which the coprocessor is bound. If LEM requires its own variant of Lang, then that would need to be formalized somehow.

This is not just academic. A Lang created as above could lead a non-LEM circuit to producing incorrect proofs. Such a Lang would be toxic and require very special handling. It shouldn't be possible to create such dangerous substances with the Lurk API.

Copy link
Member Author

@arthurpaulino arthurpaulino Sep 13, 2023

Choose a reason for hiding this comment

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

The LEM pipeline indeed doesn't need the cached ZPtr for this.

Would it be okay to have an add_coprocessor_with_zptr and allow the caller to provide the ZPtr? Then LEM would be able to feed it with whatever.

@porcuquine
Copy link
Collaborator

As noted elsewhere, this will likely need to change to be consistent with the (not-quite-complete) parallel work to allow creation of NIVC proofs from lurk-rs. It's not a problem to keep the PR open and work out the details here, but we shouldn't merge it until the details are indeed worked out.

Copy link
Member

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

I agree with the [comments], just putting in Req. changes to make this explicit.

@arthurpaulino arthurpaulino marked this pull request as draft September 13, 2023 12:21
@arthurpaulino
Copy link
Member Author

#670 makes this PR obsolete

@arthurpaulino arthurpaulino deleted the ap/stable-coprocs-order branch September 15, 2023 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants