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

provide open reconstruct circuit interface from witness stream #135

Closed
mdj33 opened this issue Sep 7, 2021 · 3 comments
Closed

provide open reconstruct circuit interface from witness stream #135

mdj33 opened this issue Sep 7, 2021 · 3 comments
Assignees
Milestone

Comments

@mdj33
Copy link

mdj33 commented Sep 7, 2021

hi,
seems project not provide the interface to reconstruct parameters from witness stream against to WriteFullTo and WritePublicTo interface.
func WritePublicTo(w io.Writer, curveID ecc.ID, publicWitness frontend.Circuit) (int64, error) {

just like the FromPublicAssignment, but it is internal interface.

		if err := w.FromPublicAssignment(publicWitness); err != nil {
			return err
		}

for example:

type Circuit struct {
 	    X frontend.Variable
	    Y frontend.Variable `gnark:",public"`
 	    Z frontend.Variable `gnark:",public"`
 	}

public witness stream like "`0000000200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000189"

we hope a open interface to construct the Circuit's specific Y and Z variable from the stream.

@gbotrel
Copy link
Collaborator

gbotrel commented Sep 7, 2021

Hello, current implementation forces the user to use groth16.ReadAndProve (resp plonk.ReadAndProve) that parses the witness. (see https://docs.gnark.consensys.net/en/latest/HowTo/serialize/#ordering )

Is that sufficient for your use case?

@mdj33
Copy link
Author

mdj33 commented Sep 8, 2021

hi gbotrel,
thanks for your response. it is not sufficient for our case only to readAndProve or readAndVerify. some times, in smart contract, we also are care the public inputs to verify or record. so it is necessary to parse the public input to its original struct.
now I just work around it by implemented LimitReadFrom() locally and reflect my circuit to assign them :)

@gbotrel gbotrel self-assigned this Sep 15, 2021
@gbotrel gbotrel added this to the v0.6.0 milestone Sep 15, 2021
@gbotrel
Copy link
Collaborator

gbotrel commented Sep 20, 2021

@mdj33 latest commit on develop introduces witness.ReadPublicFrom and witness.ReadFullFrom which assign values to a provided witness (as big.Int values) from a io.Reader.

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

No branches or pull requests

2 participants