Skip to content

Commit

Permalink
Merge branch 'prover/setup' of github.com:Consensys/linea-monorepo in…
Browse files Browse the repository at this point in the history
…to prover/setup
  • Loading branch information
AlexandreBelling committed Oct 16, 2024
2 parents 04c6942 + 5e98461 commit 06cf469
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
18 changes: 13 additions & 5 deletions prover/circuits/setup_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path"
"strconv"
"time"

"github.com/consensys/gnark-crypto/ecc"
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 10 additions & 2 deletions prover/lib/compressor/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,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 "", errors.New("could not find repo root. Current working directory: " + wd)
}
i += len(repoName)
return wd[:i], nil
Expand Down

0 comments on commit 06cf469

Please sign in to comment.