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

Prover/limitless backend controller #698

Draft
wants to merge 48 commits into
base: prover/limitless-top-level
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1e11ad2
init backend mock for limitless prover
srinathln7 Jan 23, 2025
6ff0acb
adjust mock func.
srinathln7 Jan 23, 2025
d749a6b
init limitless job definition
srinathln7 Jan 28, 2025
7b0706c
init limitless job definitions
srinathln7 Jan 28, 2025
4b1da48
add congolomeration job definition
srinathln7 Jan 29, 2025
3b23278
enable multiple req-resp files for diff. job definitions
srinathln7 Jan 29, 2025
39f7836
refactor limitless prover job defintions
srinathln7 Jan 30, 2025
2597d7d
TestBootstrapSubmodule definition success
srinathln7 Jan 30, 2025
497a5b2
redefine resp outputfile patterns
srinathln7 Jan 31, 2025
722ad2b
limitless prover job definitions with unit tests
srinathln7 Jan 31, 2025
8c30fcb
add all limitless job def. with unit tests (success)
srinathln7 Jan 31, 2025
7d8b1ec
refactor after draft PR feedback
srinathln7 Feb 4, 2025
aa6be76
compile all controller/files except *_test
srinathln7 Feb 4, 2025
e73d6f7
job definition unit tests successful
srinathln7 Feb 4, 2025
278b157
executor test pass
srinathln7 Feb 5, 2025
e9d550d
fs_watcher_test successful
srinathln7 Feb 5, 2025
82a48a5
controller unit tests pass
srinathln7 Feb 5, 2025
548e053
remove 0 idx assumption in fs_watcher_test.go
srinathln7 Feb 5, 2025
96aa669
init limitless job def
srinathln7 Feb 6, 2025
f0de708
limitless prover job definitions and unit tests successful
srinathln7 Feb 6, 2025
ee92346
add limitless prover components to file watcher
srinathln7 Feb 7, 2025
d44226e
define fswatcher for limitless prover
srinathln7 Feb 7, 2025
f398561
change withdraw req struct
srinathln7 Feb 11, 2025
a0ee65d
commit progress
srinathln7 Feb 11, 2025
3396fb1
add resp dirs to job definitions
srinathln7 Feb 11, 2025
cf6d7a4
add limitless fs watcher
srinathln7 Feb 11, 2025
8b4c2c8
init fs_watcher_limitess_test.go
srinathln7 Feb 11, 2025
79c5ee4
commit progress
srinathln7 Feb 12, 2025
7e2b337
refactor multi-input job
srinathln7 Feb 12, 2025
ba67fb2
conglomeration file watcher to be fixed
srinathln7 Feb 12, 2025
761430c
conglomeration individual pass
srinathln7 Feb 12, 2025
d1419fc
limitless file system watcher all tests pass
srinathln7 Feb 12, 2025
576e2da
make executor generic
srinathln7 Feb 14, 2025
e9a4b00
init limitless executor testfiles
srinathln7 Feb 14, 2025
a260942
refactor controller
srinathln7 Feb 14, 2025
21eac81
refactor controller comments
srinathln7 Feb 14, 2025
fff8fb6
add more limitless fw tests
srinathln7 Feb 14, 2025
05e158b
init limitless controller test
srinathln7 Feb 16, 2025
ee60b9d
commit progress in limitless controller testing
srinathln7 Feb 16, 2025
11cdcd4
controller unit tests for bootstrap successful
srinathln7 Feb 17, 2025
6c02a5c
(tests) ctrler all unit test pass
srinathln7 Feb 17, 2025
b15ca48
(feat): limitless ctrler all unit tests pass
srinathln7 Feb 17, 2025
71c6529
(feat): create limitless prover dirs in cmd and unit tests pass for c…
srinathln7 Feb 17, 2025
a74f6b0
add placeholders for default dirs
srinathln7 Feb 18, 2025
4d467b6
init run controller
srinathln7 Feb 18, 2025
dcb9076
commit progress
srinathln7 Feb 19, 2025
f2ae46a
local commit test toml
srinathln7 Feb 19, 2025
7f65783
(feat): enable successful execution proof run using controller
srinathln7 Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions prover/backend/aggregation/craft.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func collectFields(cfg *config.Config, req *Request) (*CollectedFields, error) {
var (
po execution.Response
l2MessageHashes []string
fpath = path.Join(cfg.Execution.DirTo(), execReqFPath)
fpath = path.Join(cfg.Execution.DirTo(0), execReqFPath)
f = files.MustRead(fpath)
)

Expand Down Expand Up @@ -155,7 +155,7 @@ func collectFields(cfg *config.Config, req *Request) (*CollectedFields, error) {

for i, decompReqFPath := range req.DecompressionProofs {
dp := &blobdecompression.Response{}
fpath := path.Join(cfg.BlobDecompression.DirTo(), decompReqFPath)
fpath := path.Join(cfg.BlobDecompression.DirTo(0), decompReqFPath)
f := files.MustRead(fpath)

if err := json.NewDecoder(f).Decode(dp); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prover/backend/blobsubmission/craft_eip4844.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/sha256"
"errors"
"fmt"

"github.com/consensys/linea-monorepo/prover/lib/compressor/blob/encode"

blob "github.com/consensys/linea-monorepo/prover/lib/compressor/blob/v1"
Expand Down Expand Up @@ -171,5 +172,4 @@ func compressedStreamToBlob(compressedStream []byte) (blob kzg4844.Blob, err err
}
}
return blob, nil

}
17 changes: 9 additions & 8 deletions prover/backend/execution/craft.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ func CraftProverOutput(
req *Request,
) Response {

// Split the embedded file contents into a string slice
constraintsVersions := strings.Split(strings.TrimSpace(constraintsVersionsStr), "\n")
/*
// Split the embedded file contents into a string slice
constraintsVersions := strings.Split(strings.TrimSpace(constraintsVersionsStr), "\n")

// Check the arithmetization version used to generate the trace is contained in the prover request
// and fail fast if the constraint version is not supported
if err := checkArithmetizationVersion(req.ConflatedExecutionTracesFile, req.TracesEngineVersion, constraintsVersions); err != nil {
panic(err.Error())
}
// Check the arithmetization version used to generate the trace is contained in the prover request
// and fail fast if the constraint version is not supported
if err := checkArithmetizationVersion(req.ConflatedExecutionTracesFile, req.TracesEngineVersion, constraintsVersions); err != nil {
panic(err.Error())
} */

var (
l2BridgeAddress = cfg.Layer2.MsgSvcContract
Expand Down Expand Up @@ -73,7 +74,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 ideally set in the config. file
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
// Outputs the submodule request for global-local prover for round 0
func (b MBootStrapper) initBootstrap(req execution.Request) (MGLReq, MDistMetadata, error) {
return MGLReq{}, MDistMetadata{}, nil
}

// RandomnessBeacon provides randomness for the proof generation process
type RandomnessBeacon 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 RandomnessBeacon) generateLPPProofReq(req MLPPBeaconReq, metadata MDistMetadata) (MLPPRequest, error) {
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, dmetadata MDistMetadata) (execution.Response, error) {
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
57 changes: 48 additions & 9 deletions prover/cmd/controller/controller/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,57 @@ func cobraControllerRunCmd(c *cobra.Command, args []string) {
}
cfg.Controller.LocalID = fLocalID

// Disable for testing
// cfg.Controller.EnableExecution = true
// cfg.Controller.EnableBlobDecompression = false
// cfg.Controller.EnableAggregation = false
// cfg.Controller.EnableExecBootstrap = false
// cfg.Controller.EnableExecGL = false
// cfg.Controller.EnableExecRndBeacon = false
// cfg.Controller.EnableExecLPP = false
// cfg.Controller.EnableExecConglomeration = false

// TODO @gbotrel @AlexandreBelling check who is responsible for creating the directories
// create the sub directories if they do not exist
dirs := []string{
cfg.Execution.DirDone(),
cfg.Execution.DirFrom(),
cfg.Execution.DirTo(),
cfg.BlobDecompression.DirDone(),
cfg.BlobDecompression.DirFrom(),
cfg.BlobDecompression.DirTo(),
cfg.Aggregation.DirDone(),
cfg.Aggregation.DirFrom(),
cfg.Aggregation.DirTo(),
cfg.Execution.DirDone(0),
cfg.Execution.DirFrom(0),
cfg.Execution.DirTo(0),
cfg.BlobDecompression.DirDone(0),
cfg.BlobDecompression.DirFrom(0),
cfg.BlobDecompression.DirTo(0),
cfg.Aggregation.DirDone(0),
cfg.Aggregation.DirFrom(0),
cfg.Aggregation.DirTo(0),

// Dirs. for Limitless controller
cfg.ExecBootstrap.DirFrom(0),
cfg.ExecBootstrap.DirDone(0),
cfg.ExecBootstrap.DirTo(0),
cfg.ExecBootstrap.DirTo(1),

cfg.ExecGL.DirFrom(0),
cfg.ExecGL.DirDone(0),
cfg.ExecGL.DirTo(0),
cfg.ExecGL.DirTo(1),

cfg.ExecRndBeacon.DirFrom(0),
cfg.ExecRndBeacon.DirFrom(1),
cfg.ExecRndBeacon.DirDone(0),
cfg.ExecRndBeacon.DirDone(1),
cfg.ExecRndBeacon.DirTo(0),

cfg.ExecLPP.DirFrom(0),
cfg.ExecLPP.DirDone(0),
cfg.ExecLPP.DirTo(0),

cfg.ExecConglomeration.DirFrom(0),
cfg.ExecConglomeration.DirFrom(1),
cfg.ExecConglomeration.DirFrom(2),
cfg.ExecConglomeration.DirDone(0),
cfg.ExecConglomeration.DirDone(1),
cfg.ExecConglomeration.DirDone(2),
cfg.ExecConglomeration.DirTo(0),
}

for _, dir := range dirs {
Expand Down
Loading
Loading