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

[TASK] Mixer ProverSetup #92

Closed
Tracked by #77
lazovicff opened this issue Dec 21, 2021 · 0 comments · Fixed by #98
Closed
Tracked by #77

[TASK] Mixer ProverSetup #92

lazovicff opened this issue Dec 21, 2021 · 0 comments · Fixed by #98
Assignees

Comments

@lazovicff
Copy link
Contributor

lazovicff commented Dec 21, 2021

Instead of macros, we should have a ProverSetup struct, like so:

pub struct MixerProverSetup<
	F: PrimeField,
	H: CRHTrait,
	HG: CRHGadget<H, F>,
	LHGT: CRHGadget<P::LeafH, F>,
	HGT: CRHGadget<P::H, F>,
	P: Config,
	const K: usize,
> {
	h3_params: H::Parameters,
	h5_params: H::Parameters,
	leaf_params: <P::LeafH as CRHTrait>::Parameters,
	inner_params: <P::H as CRHTrait>::Parameters,
};

impl MixerProverSetup {
	fn setup_arbitrary_data(...);
	fn setup_leaf(...);
	fn setup_tree_and_root_set(...);
	fn setup_circuit(...) -> (
		MixerCircuit,
		Vec<F> // Public inputs
	);
	fn setup_circuit_with_random_inputs(...);
	fn setup_circuit_with_raw_inputs(...);
	fn setup_proving_and_verifying_key(...);
	fn prove(...);
	fn verify(...); // For testing
}

Inside tests should be used like so:

let params3 = setup_hash_params();
let params5 = setup_hash_params();
let prover_setup = ProverSetup::new(params3, params5, ...);

let relayer = 1;
let recipient = 2;
let fee = 300;
let refund = 200;

let (circuit, public_inputs) = prover_setup.setup_circuit_with_raw_inputs(relayer, recipient, fee, refund);

let proof = prover_setup.prove(circuit);

let res = prover_setup.verify(public_inputs, proof); // Check if proof is valid
@lazovicff lazovicff changed the title Mixer [TASK] Mixer ProverSetup Dec 21, 2021
@lazovicff lazovicff self-assigned this Dec 23, 2021
@lazovicff lazovicff linked a pull request Dec 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant