Closed teddyjfpender closed 5 months ago
I started to implement side-loaded vks a few week ago and actually got quite far already.
I thought since this RFC exists, I will show you the API design that I came up with, in case anybody wants to share his/her thoughts.
So previously, we had one Proof
class that provided the linkage between verification keys of compiled circuits to the usage of them in foreign circuits. After the introductions of sideloaded vks, this can now has to be distinguished between the old, static vks and the new SL-vks.
For this, I extended the old Proof
class with its sideloaded pendant DynamicProof
.
class DynamicProof<Input, Output> extends ProofBase<Input, Output> {
verify(vk: VerificationKey);
verifyIf(vk: VerificationKey, condition: Bool);
}
So as you can see, it implements the same methods as the default class does, but it requires a additional argument for the verfication key, that this proof should be verified with.
An example usage of this inside a ZkProgram could look like:
ZkProgram({
name: "program2",
publicInput: Field,
methods: {
foo: {
privateInputs: [SampleSideloadedProof, VerificationKey],
method(input: Field, proof: SampleSideloadedProof, vk: VerificationKey) {
proof.verify(vk);
proof.publicInput.assertEquals(input, "Public input not matching")
}
}
}
});
Together with @mrmr1993 I am fixing some last issues, and after hearing everyone's thoughts, looking forward to merging this to o1js.
π Proposal Overview
We're excited to propose the introduction of side-loading verification keys in
o1js
smart contracts and provable-programs. This RFC (Request for Comments) aims to improve the developer experience by increasing flexibility and allow for the creation of new, innovative design patterns.π― Why It Matters
Mina developers using
o1js
are limited to static verification keys compiled during their smart contract or provable-program creation, restricting dynamic interactions. By enabling side-loading of these keys, we open a world of possibilities, allowing for more complex, adaptable, and user-friendly applications within the Mina ecosystem.π Highlights of the RFC
o1js
has the potential to significantly improve application development within the Mina ecosystem, presenting broader applications and new design patterns.π£ Seeking Community Input
This proposal is a stepping stone and needs your contributions. Your input is vital to shaping a robust and effective implementation.
π RFC Details
For a comprehensive understanding of the proposal, challenges, and anticipated impact, please refer to the full RFC document.