Documentation ¶
Index ¶
- func AllDownStreamBranches(node ifaces.Column) []string
- func DeriveEvaluationPoint(h ifaces.Column, upstream string, ...) (xRes []field.Element)
- func DerivedYRepr(upstream string, currNode ifaces.Column) string
- func GnarkDeriveEvaluationPoint(api frontend.API, h ifaces.Column, upstream string, ...) (xRes []frontend.Variable)
- func GnarkVerifyYConsistency(api frontend.API, h ifaces.Column, upstream string, ...) (y frontend.Variable)
- func NbLeaves(h ifaces.Column) int
- func RootParents(h ifaces.Column) []ifaces.Column
- func Shift(parent ifaces.Column, offset int) ifaces.Column
- func StackOffsets(h ifaces.Column) int
- func VerifyYConsistency(h ifaces.Column, upstream string, ...) (y field.Element)
- type Natural
- func (n Natural) GetColAssignment(run ifaces.Runtime) ifaces.ColAssignment
- func (n Natural) GetColAssignmentAt(run ifaces.Runtime, pos int) field.Element
- func (n Natural) GetColAssignmentGnark(run ifaces.GnarkRuntime) []frontend.Variable
- func (n Natural) GetColAssignmentGnarkAt(run ifaces.GnarkRuntime, pos int) frontend.Variable
- func (n Natural) GetColID() ifaces.ColID
- func (n Natural) IsComposite() bool
- func (n Natural) MustExists()
- func (n Natural) Round() int
- func (n Natural) Size() int
- func (n Natural) Status() Status
- func (n Natural) String() string
- type Shifted
- func (s Shifted) GetColAssignment(run ifaces.Runtime) ifaces.ColAssignment
- func (s Shifted) GetColAssignmentAt(run ifaces.Runtime, pos int) field.Element
- func (s Shifted) GetColAssignmentGnark(run ifaces.GnarkRuntime) []frontend.Variable
- func (s Shifted) GetColAssignmentGnarkAt(run ifaces.GnarkRuntime, pos int) frontend.Variable
- func (s Shifted) GetColID() ifaces.ColID
- func (s Shifted) IsComposite() bool
- func (s Shifted) MustExists()
- func (s Shifted) Round() int
- func (s Shifted) Size() int
- func (s Shifted) String() string
- type Status
- type Store
- func (s *Store) AddToRound(round int, name ifaces.ColID, size int, status Status) ifaces.Column
- func (r *Store) AllHandleCommittedAt(round int) []ifaces.Column
- func (s *Store) AllHandlesAtRound(round int) []ifaces.Column
- func (s *Store) AllHandlesAtRoundUnignored(round int) []ifaces.Column
- func (r *Store) AllKeys() []ifaces.ColID
- func (r *Store) AllKeysAt(round int) []ifaces.ColID
- func (r *Store) AllKeysCommitted() []ifaces.ColID
- func (r *Store) AllKeysCommittedAt(round int) []ifaces.ColID
- func (r *Store) AllKeysIgnored() []ifaces.ColID
- func (r *Store) AllKeysIgnoredAt(round int) []ifaces.ColID
- func (r *Store) AllKeysProof() []ifaces.ColID
- func (r *Store) AllKeysProofAt(round int) []ifaces.ColID
- func (s *Store) AllKeysProofsOrIgnoredButKeptInProverTranscript(round int) []ifaces.ColID
- func (r *Store) AllKeysPublicInput() []ifaces.ColID
- func (r *Store) AllKeysPublicInputAt(round int) []ifaces.ColID
- func (r *Store) AllPrecomputed() []ifaces.ColID
- func (r *Store) AllVerifyingKey() []ifaces.ColID
- func (s *Store) Exists(name ifaces.ColID) bool
- func (s *Store) GetHandle(name ifaces.ColID) ifaces.Column
- func (s *Store) GetSize(n ifaces.ColID) int
- func (s *Store) IgnoreButKeepInProverTranscript(colName ifaces.ColID)
- func (s *Store) IsIgnored(name ifaces.ColID) (ignored bool)
- func (s *Store) IsIgnoredAndNotKeptInTranscript(colName ifaces.ColID) bool
- func (s *Store) MarkAsIgnored(name ifaces.ColID)
- func (s *Store) MustBeInRound(name ifaces.ColID, round int)
- func (s *Store) MustHaveName(name ifaces.ColID)
- func (r *Store) NumRounds() int
- func (r *Store) ReserveFor(newLen int)
- func (s *Store) SetStatus(name ifaces.ColID, status Status)
- func (s *Store) Status(name ifaces.ColID) Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllDownStreamBranches ¶
Returns all subbranches starting from the current node (including the current node). It counts as a list of unique identifiers for the derivation path.
func DeriveEvaluationPoint ¶
func DeriveEvaluationPoint( h ifaces.Column, upstream string, cachedXs collection.Mapping[string, field.Element], x field.Element, ) (xRes []field.Element)
DeriveEvaluationPoint, given a query at point "x" on the current handle, returns the list of "x" values we should query the "leaves" of the current handle to get an equivalent polynomial query only on "Non-Composites" handles. The result is stored in the map `finalXs` which will only contain the "leaves" derived Xs as opposed to the `cachedXs` which computes all intermediate values.
- upstreamBranchRepr string : repr of the upstream-branch
- cachedXs : map reprs of full-branches to already derived evaluation points. Essentially a cache for later uses.
- x is the 'x' value of the univariate query to evaluate
@alex: we should completely refactor this function. As I am trying to retro- engineer it, None of the name or comment in this function make sense to me.
func GnarkDeriveEvaluationPoint ¶
func GnarkDeriveEvaluationPoint( api frontend.API, h ifaces.Column, upstream string, cachedXs collection.Mapping[string, frontend.Variable], x frontend.Variable, ) (xRes []frontend.Variable)
GnarkDeriveEvaluationPoint mirrors DeriveEvaluationPoint but in a gnark circuit
func GnarkVerifyYConsistency ¶
func GnarkVerifyYConsistency( api frontend.API, h ifaces.Column, upstream string, cachedXs collection.Mapping[string, frontend.Variable], finalYs collection.Mapping[string, frontend.Variable], ) (y frontend.Variable)
GnarkVerifyYConsistency does the same as VerifyYConsistency but in a gnark circuit.
func NbLeaves ¶
NbLeaves returns the number of underlying Natural columns for `h`. If `h` is neither an [Interleaved] nor derived from an [Interleaved], the function returns 1.
func RootParents ¶
RootParents returns the underlying base Natural of the current handle. If the provided [Column] `h` is an [Interleaved] or a derivative of an [Interleaved], the function returns the list of all the underlying Natural columns.
func Shift ¶
Shift constructs a Shifted column. The function performs a few checks and normalization before instantiating the column. If the user provides an offset of zero, the function is a no-op and returns the parent column. Since, the shift is cyclic, the offset is normalized. If the column is already a shift then the function fuses the two shifts into a single one for simplification.
func StackOffsets ¶
StackOffset sums all the offsets contained in the handle and return the result
If `h` is an [Interleaved] or derive from an [Interleaved] column, it will expect that the stacked offset of its parent is zero. (i.e, we should always shift an interleave but never interleave a shift. In practice, this does not cause issues as we do not have that in the arithmetization). This restriction is motivated by the fact that the "offset" would not be defined in this situation.
func VerifyYConsistency ¶
func VerifyYConsistency( h ifaces.Column, upstream string, cachedXs collection.Mapping[string, field.Element], finalYs collection.Mapping[string, field.Element], ) (y field.Element)
VerifyYConsistency verifies that the claimed values for y
- upstream is a repr of the branch leading to the current node
- cachedXs is the set of derived Xs computed by `DeriveEvaluationPoint`
- finalYs is the map of the alleged evaluation for which we check the consistency.
@alex: we should completely refactor this function. As I am trying to retro- engineer it, None of the name or comment in this function make sense to me.
Types ¶
type Natural ¶
type Natural struct { // The ID of the column ID ifaces.ColID // contains filtered or unexported fields }
Natural represents a ifaces.Column that has been directly declared in the corresponding github.com/consensys/linea-monorepo/prover/protocol/wizard.CompiledIOP or github.com/consensys/linea-monorepo/prover/protocol/wizard.Builder object. The struct should not be constructed directly and should be constructed from the github.com/consensys/linea-monorepo/prover/protocol/wizard.CompiledIOP
func (Natural) GetColAssignment ¶
func (n Natural) GetColAssignment(run ifaces.Runtime) ifaces.ColAssignment
GetColAssignment implements ifaces.Column
func (Natural) GetColAssignmentAt ¶
GetColAssignmentAt implements ifaces.Column
func (Natural) GetColAssignmentGnark ¶
func (n Natural) GetColAssignmentGnark(run ifaces.GnarkRuntime) []frontend.Variable
GetColAssignmentGnark implements ifaces.Column
func (Natural) GetColAssignmentGnarkAt ¶
GetColAssignmentGnarkAt implements ifaces.Column
func (Natural) GetColID ¶
GetColID implements the ifaces.Column interface and returns the string identifier of the column.
func (Natural) IsComposite ¶
IsComposite implements ifaces.Column, by definition, it is not a composite thus it shall always return true
func (Natural) MustExists ¶
func (n Natural) MustExists()
MustExists validates the construction of the natural handle and implements the ifaces.Column interface.
func (Natural) Round ¶
Round retuns the round of definition of the column. See ifaces.Column as method implements the interface.
func (Natural) Size ¶
Size returns the size of the column, as required by the ifaces.Column interface.
func (Natural) Status ¶
Status returns the status of the column. It is only implemented for Natural and not by the other composite columns.
func (Natural) String ¶
String returns the ID of the column as a string and implements ifaces.Column and github.com/consensys/linea-monorepo/prover/symbolic.Metadata
type Shifted ¶
Shifted represents a column that is obtains by (cyclic)-shifting the parent column by an Offset. This is useful to implement github.com/consensys/linea-monorepo/prover/protocol/query.GlobalConstraint constraints to express the "next" value of a column or the previous value of a column. For instance, say we want enforce that a column is assigned to a Fibonacci sequence: a[i+2] - a[i+1] - a[i] == 0. This can be done using the following constraint:
var ( aNextNext = ifaces.ColumnAsVariable(column.Shift(a, 2)) aNext = ifaces.ColumnAsVariable(column.Shift(a, 1)) a = ifaces.ColumnAsVariable(a) ) expr := aNextNext.Sub(aNext).Sub(a)
The user should not directly instantiate the struct and should instead use the constructor Shift
func (Shifted) GetColAssignment ¶
func (s Shifted) GetColAssignment(run ifaces.Runtime) ifaces.ColAssignment
GetColAssignment implements ifaces.Column. The function resolves the assignment of the parent column and rotates it according to the offset.
func (Shifted) GetColAssignmentAt ¶
GetColAssignmentAt gets a particular entry of the shifted column. The query is delegated to the underlying column and the requested position is shifted according to the offset. This implements the ifaces.Column interface.
func (Shifted) GetColAssignmentGnark ¶
func (s Shifted) GetColAssignmentGnark(run ifaces.GnarkRuntime) []frontend.Variable
GetColAssignmentGnark implements ifaces.Column and works like GetColAssignment.
func (Shifted) GetColAssignmentGnarkAt ¶
GetColAssignmentGnarkAt gets the witness from the parent and performs a shift in the gnark circuit setting. The method implements the ifaces.Column interface.
func (Shifted) GetColID ¶
GetColID implements the ifaces.Column interface and returns the string identifier of the column. The ColID is obtained as SHIFT_<Offset>_<ParentID>.
func (Shifted) IsComposite ¶
IsComposite implements ifaces.Column, by definition, it is not a composite thus it shall always return true
func (Shifted) MustExists ¶
func (s Shifted) MustExists()
MustExists validates the construction of the natural handle and implements the ifaces.Column interface.
func (Shifted) Round ¶
Round retuns the round of definition of the column. See ifaces.Column as method implements the interface.
func (Shifted) Size ¶
Size returns the size of the column, as required by the ifaces.Column interface.
func (Shifted) String ¶
String returns the ID of the column as a string and implements ifaces.Column and github.com/consensys/linea-monorepo/prover/symbolic.Metadata. It returns the same as [GetColID] but as a string (required by Metadata).
type Status ¶
type Status int
Status is a tag that we associate to a github.com/consensys/linea-monorepo/prover/protocol/ifaces.Column. The status carries information about the role of the column in protocol: if it is visible by the verifier, whether the column is assigned at compilation-time or at runtime, etc...
The default value of Status is Ignored which denotes a value that is only accessible to the prover and which should not be subjected to compilation.
The status assigned to a column can be modified during the compilation. In principle, the compilation status should ensure that all columns are either Ignored, Proof or VerifyingKey.
const ( // Ignored denotes a Status indicating that the column should be ignored by // the compiler. The main use-case for this is to indicate that the column // has already been compiled-out. This happens when a [Committed] column is // compiled with the Vortex compiler as the value is then actually committed. // Another case is the splitting compiler, which breaks down a column in // several segments: in that case the broken down column is replaced by the // segments and the rest of the compilation should operate on the segment // and not on the original column anymore. The column is still visible to // the prover and should still be assigned. Ignored Status = iota + 1 // Committed marks that a [github.com/consensys/linea-monorepo/prover/protocol/ifaces.Column] is to be sent to the oracle, // implicitly this is a request for the following steps of the compiler // to ensure that the column will be committed to and constitutes a part // of the witness of the protocol. Committed // Proof indicates that the [github.com/consensys/linea-monorepo/prover/protocol/ifaces.Column] should be sent to the verifier. // The fact that a step of the compiler marks a column as Proof is not a // definitive guarantee that the column will effectively be sent to the // verifier. The best example is self-recursion which converts the Proof // columns created by the Vortex compiler as Committed back. What is sent // to the prover is what is tagged as a proof at the end of the full // compilation process. Proof // Precomputed indicates that the [github.com/consensys/linea-monorepo/prover/protocol/ifaces.Column] is defined offline during // the definition or the compilation phase but should not be visible to the // verifier and this is an indication that the column should be committed // to. An example of such columns are the q_L, q_R, q_M, q_O, q_PI columns // defining a Plonk circuit. These columns are known offline but the // verifier only interacts with a commitment (or has oracle-access) to these // columns. Precomputed // PublicInput denotes that the column is part of the public inputs of the // protocol. Meaning that this is not part of the proof. // // Deprecated: we don't really use this to create public inputs. PublicInput // VerifyingKey indicates the column is defined offline during the definition // of the protocol or the compilation and that the column is directly // available to the verifier. It is preferable to avoid tagging large // columns as VerifyingKey as this increases the load on the verifier. VerifyingKey // VerifierDefined indicates that the column is a special type of column // that does not need to be assigned as it is constructible by the // verifier using data which it already has from other ways. For instance, a // column that is constructed from the parameters of an evaluation query or // a column that is constructed by stitching together random coins that // the verifier sampled through other means. VerifierDefined )
func (Status) MarshalJSON ¶
MarshalJSON implements [json.Marshaler] directly returning the Itoa of the integer.
func (Status) String ¶
String returns a string representation of the status. Useful for logging or for debugging.
func (*Status) UnmarshalJSON ¶
UnmarshalJSON implements [json.Unmarshaler] and directly reuses ParseInt and performing validation : only 0 and 1 are acceptable values.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store registers Natural for structs that can return the infos given a name and it is used by the github.com/consensys/linea-monorepo/prover/protocol/wizard.ProverRuntime and the github.com/consensys/linea-monorepo/prover/protocol/wizard.VerifierRuntime to store the columns. The store keeps tracks of the definition rounds of the columns and offers a handful of methods to resolve all the columns that have a particular status.
func (*Store) AddToRound ¶
AddToRound constructs a Natural, registers it in the Store and returns the column
- name must not be an empty string
- round must be provided
- name must not have been registered already
func (*Store) AllHandleCommittedAt ¶
AllHandleCommittedAt returns the list of all the Committed columns so far at a given round. The returned slice is ordered by order of insertion.
func (*Store) AllHandlesAtRound ¶
Returns all handle stores at a given round
func (*Store) AllHandlesAtRoundUnignored ¶
Returns all handle stores at a given round
func (*Store) AllKeys ¶
Returns the list of all the keys ever. The result is returned in Deterministic order.
func (*Store) AllKeysAt ¶
AllKeysAt returns the list of all keys for a given round. The result follows the insertion order of insertion) (=assignment order)
func (*Store) AllKeysCommitted ¶
AllKeysCommitted returns the list of all the IDs of the all the Committed columns ordered by rounds and then by IDs.
func (*Store) AllKeysCommittedAt ¶
Returns the list of all the ifaces.ColID tagged with the Committed status so far at a given round. The order of the returned slice follows the insertion order.
func (*Store) AllKeysIgnored ¶
Returns the list of all the ignored messages so far
func (*Store) AllKeysIgnoredAt ¶
AllKeysIgnoredAt returns the list of all the Ignored columns ids so far at a given round. The returned slice is ordered by order of insertion.
func (*Store) AllKeysProof ¶
AllKeysProof returns the list of all the Proof column's IDs ordered by round and then by order of insertion.
func (*Store) AllKeysProofAt ¶
AllKeysProofAt returns the list of all the IDs of the[Proof] messages at a given round. The returned list is ordered by order of insertion.
func (*Store) AllKeysProofsOrIgnoredButKeptInProverTranscript ¶
AllKeysProofsOrIgnoredButKeptInProverTranscript returns the list of the columns to be used as part of the FS transcript.
func (*Store) AllKeysPublicInput ¶
AllKeysPublicInput returns the list of the PublicInput column's ID ordered by rounds and then by order ot insertion.
func (*Store) AllKeysPublicInputAt ¶
AllKeysPublicInputAt returns the list of all the prover messages in a given round. The resulting slice is ordered by order of insertion.
func (*Store) AllPrecomputed ¶
Returns the list of all the Precomputed columns' ID. The returned slice is ordered by rounds and then by order of insertion.
func (*Store) AllVerifyingKey ¶
AllVerifyingKey returns the list of all the IDs of the VerifyingKey columns ordered by rounds and then by order of insertion.
func (*Store) GetSize ¶
GetSize returns the stored size of a Natural by its ID. This only works if the requested column is a Natural.
func (*Store) IgnoreButKeepInProverTranscript ¶
IgnoreButKeepInProverTranscript marks a column as ignored but also asks that the column stays included in the FS transcript. This is used as part of full-recursion where the commitments to an inner-proofs should not be sent to the verifier but should still play a part in the FS transcript.
func (*Store) IsIgnored ¶
IsIgnored returns true if the passed column ID relates to a column bearing the Ignored status.
func (*Store) IsIgnoredAndNotKeptInTranscript ¶
IsIgnoredAndNotKeptInTranscript indicates whether the column can be ignored from the transcript and is used during the Fiat-Shamir randomness generation.
func (*Store) MarkAsIgnored ¶
Marks a commitment as ignored, this can happen during a vector slicing operation. Panics, if the name was not registered or if the commitment was already ignored.
func (*Store) MustBeInRound ¶
Panics if the commitment name is not registered or if the round is the wrong one
func (*Store) MustHaveName ¶
Panics if the store does not have the name registered
func (*Store) ReserveFor ¶
Make sure enough rounds are allocated up to the given length No-op if enough rounds have been allocated, otherwise, will reserve as many as necessary.