mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 04:08:01 -05:00
Prover: adds field dict_path in config (#314)
* feat(conf): adds a config field to explicitly set the dictionary path * fix(typo): prover assets path * fix(e2e): specifies an explicit dict path * comment(dict_path): adds a comment stressing to not use the field outside E2E testing context.
This commit is contained in:
@@ -13,6 +13,7 @@ requests_root_dir = "/data/prover/v3/execution"
|
||||
[blob_decompression]
|
||||
prover_mode = "dev"
|
||||
requests_root_dir = "/data/prover/v3/compression"
|
||||
dict_path = "/opt/linea/prover/lib/compressor/compressor_dict.bin"
|
||||
|
||||
[aggregation]
|
||||
prover_mode = "dev"
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
blob_v0 "github.com/consensys/linea-monorepo/prover/lib/compressor/blob/v0"
|
||||
blob_v1 "github.com/consensys/linea-monorepo/prover/lib/compressor/blob/v1"
|
||||
@@ -69,7 +68,7 @@ func Prove(cfg *config.Config, req *Request) (*Response, error) {
|
||||
return nil, fmt.Errorf("unsupported blob version: %v", version)
|
||||
}
|
||||
|
||||
dictPath := filepath.Join(cfg.PathForSetup(string(circuitID)), config.DictionaryFileName)
|
||||
dictPath := cfg.BlobDecompressionDictPath(string(circuitID))
|
||||
|
||||
logrus.Infof("reading the dictionary at %v", dictPath)
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ func Setup(context context.Context, args SetupArgs) error {
|
||||
}
|
||||
if dict != nil {
|
||||
// we save the dictionary to disk
|
||||
dictPath := filepath.Join(cfg.PathForSetup(string(c)), config.DictionaryFileName)
|
||||
dictPath := cfg.BlobDecompressionDictPath(string(c))
|
||||
if err := os.WriteFile(dictPath, dict, 0600); err != nil {
|
||||
return fmt.Errorf("%s failed to write dictionary file: %w", cmdName, err)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@@ -216,6 +217,14 @@ type BlobDecompression struct {
|
||||
|
||||
// ProverMode stores the kind of prover to use.
|
||||
ProverMode ProverMode `mapstructure:"prover_mode" validate:"required,oneof=dev full"`
|
||||
|
||||
// DictPath is an optional parameters allowing the user to specificy explicitly
|
||||
// where to look for the compression dictionary. If the input is not provided
|
||||
// then the dictionary will be fetched in <assets_dir>/<version>/<circuitID>/compression_dict.bin.
|
||||
//
|
||||
// We stress that the feature should not be used in production and should
|
||||
// only be used in E2E testing context.
|
||||
DictPath string `mapstructure:"dict_path"`
|
||||
}
|
||||
|
||||
type Aggregation struct {
|
||||
@@ -270,3 +279,16 @@ type PublicInput struct {
|
||||
L2MsgServiceAddr common.Address // duplicate from Config
|
||||
|
||||
}
|
||||
|
||||
// BlobDecompressionDictPath returns the filepath where to look for the blob
|
||||
// decompression dictionary file. If provided in the config, the function returns
|
||||
// in priority the provided [BlobDecompression.DictPath] or it returns a
|
||||
// prover assets path depending on the provided circuitID.
|
||||
func (cfg *Config) BlobDecompressionDictPath(circuitID string) string {
|
||||
|
||||
if len(cfg.BlobDecompression.DictPath) > 0 {
|
||||
return cfg.BlobDecompression.DictPath
|
||||
}
|
||||
|
||||
return filepath.Join(cfg.PathForSetup(string(circuitID)), DefaultDictionaryFileName)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package config
|
||||
|
||||
const (
|
||||
VerifyingKeyFileName = "verifying_key.bin"
|
||||
CircuitFileName = "circuit.bin"
|
||||
VerifierContractFileName = "Verifier.sol"
|
||||
ManifestFileName = "manifest.json"
|
||||
DictionaryFileName = "compressor_dict.bin"
|
||||
VerifyingKeyFileName = "verifying_key.bin"
|
||||
CircuitFileName = "circuit.bin"
|
||||
VerifierContractFileName = "Verifier.sol"
|
||||
ManifestFileName = "manifest.json"
|
||||
DefaultDictionaryFileName = "compressor_dict.bin"
|
||||
|
||||
RequestsFromSubDir = "requests"
|
||||
RequestsToSubDir = "responses"
|
||||
|
||||
Reference in New Issue
Block a user