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

zkvm: return () instead of &mut Program from the closure in Program::build #373

Closed
oleganza opened this issue Oct 31, 2019 · 3 comments · Fixed by #379
Closed

zkvm: return () instead of &mut Program from the closure in Program::build #373

oleganza opened this issue Oct 31, 2019 · 3 comments · Fixed by #379

Comments

@oleganza
Copy link
Contributor

oleganza commented Oct 31, 2019

Here's a real use with an awkward ending line:

let program = zkvm::Program::build(|p| {
    for stored_utxo in spent_utxos.iter() {
        p.push(stored_utxo.contract());
        p.input();
        p.sign_tx();
    }

    let pmnt = payment_receiver.blinded_value();
    p.push(pmnt.qty);
    p.push(pmnt.flv);

    p.cloak(
        spent_utxos.len(),
        maybe_change_receiver_witness.as_ref().map(|_| 2).unwrap_or(1),
    );

    p.push(payment_receiver.predicate());
    p.output(1);

    // TBD: change the API to not require return of the `&mut program` from the closure.
    p
});
@oleganza oleganza changed the title zkvm: use &mut instead of move in Program::build zkvm: return () instead of &mut Program from the closure in Program::build Oct 31, 2019
@dltmd6262
Copy link
Contributor

dltmd6262 commented Nov 6, 2019

Hi, this looks like something I can take up. I'm interested in tackling more issues here, can you decide if this would be a good starting issue for me?

@oleganza
Copy link
Contributor Author

oleganza commented Nov 6, 2019

Sure, this should be a good starting point. Please don’t forget about crates token, account and demo that use this API - would be good to update them in one PR. Thank you!

@dltmd6262
Copy link
Contributor

Great! I'll make sure the tests and builds pass in those crates too.

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 a pull request may close this issue.

2 participants