From 7da9357f09a51fb4f75e61616e33a2adffc57302 Mon Sep 17 00:00:00 2001 From: gusiri Date: Tue, 15 Oct 2024 15:21:19 +0000 Subject: [PATCH 1/3] fix: error flag `maxUsableBytes` is not an int --- prover/circuits/setup_manifest.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/prover/circuits/setup_manifest.go b/prover/circuits/setup_manifest.go index 3a71007b7..e5bcad9a6 100644 --- a/prover/circuits/setup_manifest.go +++ b/prover/circuits/setup_manifest.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path" + "strconv" "time" "github.com/consensys/gnark-crypto/ecc" @@ -51,12 +52,19 @@ func (m *SetupManifest) GetInt(key string) (int, error) { return 0, err } - i, ok := v.(int) - if !ok { - return 0, fmt.Errorf("flag `%s` is not an int", key) + switch i := v.(type) { + case int: + return i, nil + case int64: + return int(i), nil + case float64: + return int(i), nil + case string: + // If stored as a string, try to parse it as an int + return strconv.Atoi(i) + default: + return 0, fmt.Errorf("flag `%s` is not an int, got %T", key, v) } - - return i, nil } func (m *SetupManifest) GetString(key string) (string, error) { From 1e58dafc177c8ad11582fc078809106482921a25 Mon Sep 17 00:00:00 2001 From: gusiri Date: Tue, 15 Oct 2024 20:33:12 +0000 Subject: [PATCH 2/3] update GetRepoRootPath to include support for deployment path /opt/linea --- prover/lib/compressor/blob/blob.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/prover/lib/compressor/blob/blob.go b/prover/lib/compressor/blob/blob.go index ba5bd8e27..6e7e41059 100644 --- a/prover/lib/compressor/blob/blob.go +++ b/prover/lib/compressor/blob/blob.go @@ -2,6 +2,7 @@ package blob import ( "errors" + "fmt" "os" "path/filepath" "strings" @@ -34,16 +35,24 @@ func DictionaryChecksum(dict []byte, version uint16) ([]byte, error) { return nil, errors.New("unsupported version") } -// GetRepoRootPath assumes that current working directory is within the repo +// GetRepoRootPath returns the root path of the repository func GetRepoRootPath() (string, error) { + // First, check if the deployment path exists + deploymentPath := "/opt/linea" + if _, err := os.Stat(deploymentPath); err == nil { + return deploymentPath, nil + } + + // If not found, fall back to checking the local development path based on the current directory wd, err := os.Getwd() if err != nil { return "", err } + const repoName = "linea-monorepo" i := strings.LastIndex(wd, repoName) if i == -1 { - return "", errors.New("could not find repo root") + return "", fmt.Errorf("could not find repo root. Current working directory: %s", wd) } i += len(repoName) return wd[:i], nil From 5e98461593035d5942d929cf8555660dae8dfb7a Mon Sep 17 00:00:00 2001 From: gusiri Date: Tue, 15 Oct 2024 20:39:18 +0000 Subject: [PATCH 3/3] use errors.New instead of fmt.Errorf --- prover/lib/compressor/blob/blob.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prover/lib/compressor/blob/blob.go b/prover/lib/compressor/blob/blob.go index 6e7e41059..5f6d7dd96 100644 --- a/prover/lib/compressor/blob/blob.go +++ b/prover/lib/compressor/blob/blob.go @@ -2,7 +2,6 @@ package blob import ( "errors" - "fmt" "os" "path/filepath" "strings" @@ -52,7 +51,7 @@ func GetRepoRootPath() (string, error) { const repoName = "linea-monorepo" i := strings.LastIndex(wd, repoName) if i == -1 { - return "", fmt.Errorf("could not find repo root. Current working directory: %s", wd) + return "", errors.New("could not find repo root. Current working directory: " + wd) } i += len(repoName) return wd[:i], nil