Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b02943b
feat(encode): implements an codex for column assignment
AlexandreBelling Oct 17, 2024
0bb4624
debug(col): add tests and debug the column assignment
AlexandreBelling Oct 17, 2024
e5c0f76
experiment(encoding): adds a target to encode and decode zkevm assign…
AlexandreBelling Oct 17, 2024
aff0610
add lz4 compression library
gusiri Jan 15, 2025
39ea1c7
add assignment serialization with compression
gusiri Jan 15, 2025
23fc7c4
assign and encode in chunks instead of a file
gusiri Jan 15, 2025
8ae74c6
calculate correct ser size
gusiri Jan 15, 2025
8007727
add num chunks variable
gusiri Jan 15, 2025
90b9cc9
Revert "calculate correct ser size"
gusiri Jan 15, 2025
153d41c
calculate and print the exact size of ser
gusiri Jan 15, 2025
2717c35
add error handling for file write
gusiri Jan 15, 2025
78bb8e0
add deserialization
gusiri Jan 15, 2025
0b5a17b
refactor code
gusiri Jan 15, 2025
d3387aa
add compressChunks
gusiri Jan 15, 2025
39bc9cb
refactor deserialize assignment
gusiri Jan 15, 2025
1cf0ed4
add hashWAssignment to check the hash of input and output
gusiri Jan 15, 2025
14c9420
refactor SerializeAssignment
gusiri Jan 15, 2025
25178cc
use logrus
gusiri Jan 15, 2025
d7fb11c
remove cbor data size info
gusiri Jan 15, 2025
acb05ea
clean up logs
gusiri Jan 15, 2025
747ca8e
clean up logs for serialization
gusiri Jan 15, 2025
87af09d
measure time taken for serialization
gusiri Jan 15, 2025
3127a69
update logs
gusiri Jan 15, 2025
89fc545
fix logs
gusiri Jan 15, 2025
bf8c875
set numChunks to the number of cores
gusiri Jan 15, 2025
a887425
skip profiling
gusiri Jan 15, 2025
0e86246
add compression ratio
gusiri Jan 15, 2025
603ffaa
add a unit test
gusiri Jan 17, 2025
87c0817
Merge branch 'prover/limitless-top-level' into prover/assignment-seri…
gusiri Jan 17, 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
33 changes: 33 additions & 0 deletions prover/backend/execution/prove.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
package execution

import (
"fmt"
"math/rand/v2"
"os"
"runtime"
"strconv"
"time"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/linea-monorepo/prover/circuits"
"github.com/consensys/linea-monorepo/prover/circuits/dummy"
"github.com/consensys/linea-monorepo/prover/circuits/execution"
"github.com/consensys/linea-monorepo/prover/config"
"github.com/consensys/linea-monorepo/prover/protocol/serialization"
public_input "github.com/consensys/linea-monorepo/prover/public-input"
"github.com/consensys/linea-monorepo/prover/utils"
"github.com/consensys/linea-monorepo/prover/utils/profiling"
Expand Down Expand Up @@ -179,6 +187,31 @@ func mustProveAndPass(
logrus.Infof("Prover checks passed")
return "", ""

case config.ProverModeEncodeOnly:

profiling.ProfileTrace("encode-decode-no-circuit", true, false, func() {
filepath := "/tmp/wizard-assignment/blob-" + strconv.Itoa(rand.Int()) + ".bin"

encodeOnlyZkEvm := zkevm.EncodeOnlyZkEvm(traces)
numChunks := runtime.GOMAXPROCS(0)

// Serialize the assignment
encodingDuration := time.Now()
encodeOnlyZkEvm.AssignAndEncodeInChunks(filepath, w.ZkEVM, numChunks)

// Deserialize the assignment
decodingDuration := time.Now()
_, errDec := serialization.DeserializeAssignment(filepath, numChunks)
if errDec != nil {
panic(fmt.Sprintf("Error during deserialization: %v", errDec))
}
fmt.Printf("[Encoding Summary] took %v sec to encode an assignmente and write it into the files \n", time.Since(encodingDuration).Seconds())
fmt.Printf("[Decoding Summary] took %v sec to read the files and decode it into an assignment\n", time.Since(decodingDuration).Seconds())
})

os.Exit(0)
return "", ""

default:
panic("not implemented")
}
Expand Down
2 changes: 1 addition & 1 deletion prover/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ type Execution struct {
WithRequestDir `mapstructure:",squash"`

// ProverMode stores the kind of prover to use.
ProverMode ProverMode `mapstructure:"prover_mode" validate:"required,oneof=dev partial full proofless bench check-only"`
ProverMode ProverMode `mapstructure:"prover_mode" validate:"required,oneof=dev partial full proofless bench check-only encode-only"`

// CanRunFullLarge indicates whether the prover is running on a large machine (and can run full large traces).
CanRunFullLarge bool `mapstructure:"can_run_full_large"`
Expand Down
3 changes: 2 additions & 1 deletion prover/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ const (
// in a context where it is simpler to not have to deal with the setup.
ProverModeBench ProverMode = "bench"
// ProverModeCheckOnly is used to test the constraints of the whole system
ProverModeCheckOnly ProverMode = "check-only"
ProverModeCheckOnly ProverMode = "check-only"
ProverModeEncodeOnly ProverMode = "encode-only"
)
1 change: 1 addition & 0 deletions prover/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ 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
2 changes: 2 additions & 0 deletions prover/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
15 changes: 15 additions & 0 deletions prover/maths/common/smartvectors/windowed.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ func (p *PaddedCircularWindow) Len() int {
return p.totLen
}

// Offset returns the offset of the PCW
func (p *PaddedCircularWindow) Offset() int {
return p.offset
}

// Windows returns the length of the window of the PCQ
func (p *PaddedCircularWindow) Window() []field.Element {
return p.window
}

// PaddingVal returns the value used for padding the window
func (p *PaddedCircularWindow) PaddingVal() field.Element {
return p.paddingVal
}

// Returns a queries position
func (p *PaddedCircularWindow) GetBase(n int) (field.Element, error) {
// Check if the queried index is in the window
Expand Down
Loading