Skip to content

Commit

Permalink
init backend mock for limitless prover
Browse files Browse the repository at this point in the history
  • Loading branch information
srinathln7 committed Jan 23, 2025
1 parent fb4ee00 commit 1e11ad2
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 6 deletions.
2 changes: 1 addition & 1 deletion prover/backend/execution/craft.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func CraftProverOutput(
l2l1MessageHashes = bridge.L2L1MessageHashes(logs, l2BridgeAddress)
)

// This encodes the block as it will be by the compressor before running
// This encodes the block as it will be used by the compressor before running
// the compression algorithm.
blob.EncodeBlockForCompression(block, execDataBuf)

Expand Down
110 changes: 110 additions & 0 deletions prover/backend/execution/limitless/mock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// THIS FILE IS MEANT ONLY TO BE A PLACEHOLDER AND SERVE AS A MOCK DEFINING THE COMPONENTS REQUIRED
// FOR LIMITLESS PROVER. THERE ARE NO INTERACTIONS WITH THE ACTUAL CRYPTOGRAPHIC COMPONENTS.
// EACH COMPONENTS PREFIX BEGINS WITH 'M' SIGNIFYING MOCK.
// SEE https://app.diagrams.net/#G1U6S4MTrt7lsipc3TZrL4xXjvvVeghc8k#%7B%22pageId%22%3A%2206rcgNj9AqHDneUgptMC%22%7D

package mock

import "github.com/consensys/linea-monorepo/prover/backend/execution"

// Specifies the number of segments
var segments int

// MBootStrapper initializes the prover with the necessary data
type MBootStrapper struct {
}

// MDistMetadata handles metadata about the distribution of module ID/segment ID pairs
type MDistMetadata struct {
// Map from Module ID to Segment ID
ModSegMap map[int]int `json:"modSegMap"`

// Request ID
ReqId string `json:"reqId"`
}

// MSubmoduleGLProver handles global-local proof generation
type MSubmoduleGLProver struct {
}

// MGLReq represents a request to the global-local prover
type MGLReq struct {
ReqId string `json:"reqId"`
ModuleId string `json:"moduleId"`
SegmentId int `json:"segmentId"`
ConflatedExecutionTracesFile string `json:"conflatedExecutionTracesFile"`
}

// Mocked Public Inputs
type MPublicInputs struct {
}

// MGLResp represents a response from the global-local prover
type MGLResp struct {
ModId string `json:"modId"`
SegmentID int `json:"segmentId"`
ModProof string `json:"modProof"`
QueryResult string `json:"queryResult"`
Auxilliary []MPublicInputs `json:"auxilliary"`
}

// initBootstrap initializes the bootstrapping process
func (b MBootStrapper) initBootstrap(req execution.Request) ([]MGLResp, MDistMetadata, error) {

This comment has been minimized.

Copy link
@Soleimani193

Soleimani193 Jan 23, 2025

Contributor

[]MGLReq rather than []MGLRes?

resps := make([]MGLResp, segments)
return resps, MDistMetadata{}, nil
}

// Beacon provides randomness for the proof generation process
type Beacon struct {
}

// MLPPBeaconReq represents a request for LPP beacon data
type MLPPBeaconReq struct {
LPPColumns []string `json:"lppColumns"`
LPPCommitments []string `json:"lppCommitments"`
ModuleID string `json:"moduleId"`
}

// generateRandomness generates randomness for the proof generation process
func (b Beacon) generateRandomness(req MLPPBeaconReq, metadata MDistMetadata) (MLPPRequest, error) {

This comment has been minimized.

Copy link
@Soleimani193

Soleimani193 Jan 23, 2025

Contributor

similarly, a function that takes GLReq and generates LPPBeaconReq.

for naming maybe generateLPPReq rather than generateRandomness?

return MLPPRequest{}, nil
}

// proveGL generates a mock GL proof
func (gl *MSubmoduleGLProver) proveGL(req MGLReq) (MGLResp, error) {
dummyProof := MGLResp{}
return dummyProof, nil
}

// MSubmoduleLPPProver handles LPP proof generation
type MSubmoduleLPPProver struct {
}

// MLPPRequest represents a request for LPP proof data
type MLPPRequest struct {
LPPReq MLPPBeaconReq `json:"lppReq"`
Randomseed string `json:"randomseed"`
}

// MLPPResponse represents a response from the LPP prover
type MLPPResponse struct {
ModuleID string `json:"moduleId"`
SegmentID string `json:"segmentId"`
ModuleProof string `json:"moduleProof"`
QueryPartialResults []string `json:"queryPartialResults"`
}

// proveLPP generates a mock LPP proof
func (lpp *MSubmoduleLPPProver) proveLPP(req MLPPRequest) (MLPPResponse, error) {
dummyproof := MLPPResponse{}
return dummyproof, nil
}

// MExecConglomerator combines various proofs into a final execution proof
type MExecConglomerator struct {
}

// prove combines GL and LPP responses into a final execution proof
func (cong *MExecConglomerator) prove(glresp MGLResp, lppresp MLPPResponse) (execution.Response, error) {

This comment has been minimized.

Copy link
@Soleimani193

Soleimani193 Jan 23, 2025

Contributor

the inputs are slices

return execution.Response{}, nil
}
2 changes: 1 addition & 1 deletion prover/backend/execution/prove.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func mustProveAndPass(
utils.Panic("traces checksum in the setup manifest does not match the one in the config")
}

// TODO: implements the collection of the functional inputs from the prover response
// TODO: implement the collection of the functional inputs from the prover response
return execution.MakeProof(traces, setup, fullZkEvm.WizardIOP, proof, *w.FuncInp), setup.VerifyingKeyDigest()

case config.ProverModeBench:
Expand Down
4 changes: 2 additions & 2 deletions prover/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require (
github.com/iancoleman/strcase v0.3.0
github.com/icza/bitio v1.1.0
github.com/leanovate/gopter v0.2.11
github.com/pierrec/lz4/v4 v4.1.21
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.19.1
github.com/rs/zerolog v1.33.0
Expand All @@ -26,7 +27,7 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.31.0
golang.org/x/net v0.27.0
golang.org/x/net v0.28.0
golang.org/x/sync v0.10.0
golang.org/x/time v0.5.0
)
Expand Down Expand Up @@ -76,7 +77,6 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions prover/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down

0 comments on commit 1e11ad2

Please sign in to comment.