Documentation ¶
Index ¶
- Constants
- Variables
- func DeriveRandomnessFromPoint(g1 bn254.G1Affine) fr.Element
- func EraseOldK(pk *ProvingKey, vk *VerifyingKey)
- func GkrProofToVec(proof gkrNative.Proof, resBuff []*big.Int)
- func IncreaseCapBools(arr []bool, by int) []bool
- func IncreaseCapInts(arr []int, by int) []int
- func IncreaseCapVariable(arr []frontend.Variable, by int) []frontend.Variable
- func MarkWithSigma(pk *ProvingKey, vk *VerifyingKey)
- func PreInitializePublicParams(pk grothBack.ProvingKey, vk grothBack.VerifyingKey) (ProvingKey, VerifyingKey)
- func SubSlicesPublicParams(r1cs *R1CS, pk *ProvingKey, vk *VerifyingKey)
- func Verify(proof *Proof, vk *VerifyingKey, publicWitness witness.Witness) error
- type Circuit
- type CircuitUsingGkr
- type GkrGadget
- func (g *GkrGadget) Close(cs frontend.API)
- func (g *GkrGadget) GkrProofFromVec(vec []frontend.Variable) gkr.Proof
- func (g *GkrGadget) GkrProverHint() *GkrProverHint
- func (g *GkrGadget) HashHint() *HashHint
- func (g *GkrGadget) InitialRandomnessHint() *InitialRandomnessHint
- func (g *GkrGadget) UpdateHasher(cs frontend.API, state frontend.Variable, msg frontend.Variable) frontend.Variable
- type GkrOption
- type GkrProverHint
- type HashHint
- type InitialRandomnessHint
- type IoStore
- func (io *IoStore) DumpForGkrProver(qPrimeArg []frontend.Variable) []frontend.Variable
- func (io *IoStore) DumpForProverMultiExp() []frontend.Variable
- func (io *IoStore) Index() int
- func (io *IoStore) InputsForVerifier() []polynomial.MultiLin
- func (io *IoStore) OutputsForVerifier() polynomial.MultiLin
- func (io *IoStore) Push(cs frontend.API, inputs []frontend.Variable, output frontend.Variable)
- func (io *IoStore) VarAreConstant() []bool
- func (io *IoStore) VarIds() []int
- type Proof
- type ProvingKey
- type R1CS
- type Solution
- type VerifyingKey
Constants ¶
const DEFAULT_CHUNK_SIZE int = 1024
Default chunkSize used by GKR
const DEFAULT_IO_STORE_ALLOCATION_EPOCH int = 32
const GKR_MIMC_GET_HASH_HINT_ID hint.ID = hint.ID(780000001)
HINTS ID that we are using for GKR
const GKR_MIMC_GET_INITIAL_RANDOMNESS_HINT_ID hint.ID = hint.ID(780000002)
const GKR_MIMC_GKR_PROVER_HINT_ID hint.ID = hint.ID(780000003)
Variables ¶
var DummySetup outerSetupFunc
var Setup outerSetupFunc
The setup and dummy setups are initialized by applying our wrapper
Functions ¶
func DeriveRandomnessFromPoint ¶
Derives the initial randomness from an elliptic curve point
func EraseOldK ¶
func EraseOldK(pk *ProvingKey, vk *VerifyingKey)
func GkrProofToVec ¶
Writes the proof in a res buffer. We assume the res buffer to be allocated a priori
func IncreaseCapBools ¶
Increase the capacity of a slice of boolean
func IncreaseCapInts ¶
Increase the capacity of a slice of integers
func IncreaseCapVariable ¶
Increase the capacity of a slice of frontend variable
func MarkWithSigma ¶
func MarkWithSigma(pk *ProvingKey, vk *VerifyingKey)
Marks the public and private key with a random field element sigma
func PreInitializePublicParams ¶
func PreInitializePublicParams(pk grothBack.ProvingKey, vk grothBack.VerifyingKey) (ProvingKey, VerifyingKey)
Setup then wrap the keys
func SubSlicesPublicParams ¶
func SubSlicesPublicParams(r1cs *R1CS, pk *ProvingKey, vk *VerifyingKey)
Types ¶
type Circuit ¶
type Circuit struct { Gadget GkrGadget InnerCircuit CircuitUsingGkr }
Generic wrapper circuit in which, we can plug any circuit using Gkr. The wrapper holds all the logic for the proving etc...
func WrapCircuitUsingGkr ¶
func WrapCircuitUsingGkr(c CircuitUsingGkr, opts ...GkrOption) Circuit
Wraps the given circuit into a `Circuit` object
type CircuitUsingGkr ¶
Interface to be implemented by any circuit willing to use Gkr
type GkrGadget ¶
type GkrGadget struct { // Pointers to variables that must have been allocated somewhere else InitialRandomness frontend.Variable `gnark:",public"` Circuit circuit.Circuit `gnark:"-"` // contains filtered or unexported fields }
Helper for performing hashes using GKR
func (*GkrGadget) GkrProofFromVec ¶
Reads the proof to obtain the variable equivalent, the gadget is here to provide the dimensions
func (*GkrGadget) GkrProverHint ¶
func (g *GkrGadget) GkrProverHint() *GkrProverHint
Accessor for the hint from the GkrProver
func (*GkrGadget) InitialRandomnessHint ¶
func (g *GkrGadget) InitialRandomnessHint() *InitialRandomnessHint
Accessor for the hint from the InitialRandomnessHint
type GkrProverHint ¶
type GkrProverHint struct {
// contains filtered or unexported fields
}
func (*GkrProverHint) Call ¶
Returns the Hint functions that can help gnark's solver figure out that we need to compute the GkrProof and verify In order to return the fields one after the other, the function is built as a stateful iterator
func (*GkrProverHint) NbOutputs ¶
func (h *GkrProverHint) NbOutputs(_ ecc.ID, nbInput int) int
NbOutputs of the gkr prover hint Returns the number of field elements to represent the
func (*GkrProverHint) String ¶
func (h *GkrProverHint) String() string
String of the gkr prover hint hint
func (*GkrProverHint) UUID ¶
func (h *GkrProverHint) UUID() hint.ID
UUID of the gkr prover hint hint
type HashHint ¶
type HashHint struct {
// contains filtered or unexported fields
}
func (*HashHint) Call ¶
Returns the Hint functions that can help gnark's solver figure out that the output of the GKR should be a hash
type InitialRandomnessHint ¶
type InitialRandomnessHint struct {
// contains filtered or unexported fields
}
func (*InitialRandomnessHint) NbOutputs ¶
func (h *InitialRandomnessHint) NbOutputs(_ ecc.ID, nbInput int) int
NbOutputs of the initial randomness hint
func (*InitialRandomnessHint) String ¶
func (h *InitialRandomnessHint) String() string
String of the initial randomness hint hint
func (*InitialRandomnessHint) UUID ¶
func (h *InitialRandomnessHint) UUID() hint.ID
UUID of the initial randomness hint hint
type IoStore ¶
type IoStore struct {
// contains filtered or unexported fields
}
Stores the inputs and is responsible for the reordering tasks
func NewIoStore ¶
Creates a new ioStore for the given circuit
func (*IoStore) DumpForGkrProver ¶
Returns the io for the prover multiexp Done by concatenating the two into another array The variables are returned in the form of a buffer of interfaces 4 empty entry are appended to the result : they are used by the hint to figure out which res = qPrime || inputs || outputs
func (*IoStore) DumpForProverMultiExp ¶
Returns the io for the prover multiexp Done by concatenating the two into another array
func (*IoStore) InputsForVerifier ¶
func (io *IoStore) InputsForVerifier() []polynomial.MultiLin
Returns the gkr inputs in the correct order to be processed by the verifier
func (*IoStore) OutputsForVerifier ¶
func (io *IoStore) OutputsForVerifier() polynomial.MultiLin
Returns the gkr outputs in the correct order to be processed by the verifier
func (*IoStore) VarAreConstant ¶
Returns all the `isConstant` concatenated in a single vec
type Proof ¶
type Proof struct {
Ar, Krs bn254.G1Affine
Bs bn254.G2Affine
KrsGkrPriv bn254.G1Affine
InitialRandomness fr.Element
}
Extend proof for GKR-enabled SNARK
func ComputeGroth16Proof ¶
func ComputeGroth16Proof(r1cs *cs.R1CS, pk *groth16.ProvingKey, a, b, c, wireValues []fr.Element) (*Proof, error)
Modified SNARK prover: we additionally passes a puncturedVersion of the values
func ComputeProof ¶
Compute the proof
type ProvingKey ¶
type ProvingKey struct {
// contains filtered or unexported fields
}
Wrappers around the proving key
type R1CS ¶
type R1CS struct {
// contains filtered or unexported fields
}
R1CS wraps gnarks r1cs to add its own datas
type VerifyingKey ¶
type VerifyingKey struct {
// contains filtered or unexported fields
}
Wrapper around the verifying key