Skip to content

Commit

Permalink
refactor: move utils from std/ to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Aug 23, 2024
1 parent 961a118 commit a111226
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion constraint/bls12-377/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constraint/bls12-381/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constraint/bls24-315/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constraint/bls24-317/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constraint/bn254/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constraint/bw6-633/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constraint/bw6-761/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions constraint/gkr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package constraint

import (
"fmt"
"sort"

"github.com/consensys/gnark-crypto/utils"
"github.com/consensys/gnark/constraint/solver"
"github.com/consensys/gnark/std/utils/algo_utils"
"sort"
"github.com/consensys/gnark/internal/algo_utils"
)

type GkrVariable int // Just an alias to hide implementation details. May be more trouble than worth
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/consensys/gnark-crypto/utils"
"github.com/consensys/gnark/constraint"
hint "github.com/consensys/gnark/constraint/solver"
"github.com/consensys/gnark/std/utils/algo_utils"
"github.com/consensys/gnark/internal/algo_utils"
"hash"
"math/big"
"sync"
Expand Down
5 changes: 3 additions & 2 deletions std/compress/internal/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ package internal_test
import (
"bytes"
"crypto/rand"
"testing"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark/backend"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/frontend/cs/scs"
"github.com/consensys/gnark/std/compress"
"github.com/consensys/gnark/std/compress/internal"
"github.com/consensys/gnark/std/compress/lzss"
test_vector_utils "github.com/consensys/gnark/std/internal/test_vectors_utils"
"github.com/consensys/gnark/std/math/bits"
test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils"
"github.com/consensys/gnark/test"
"github.com/icza/bitio"
"github.com/stretchr/testify/assert"
"testing"
)

func TestRecombineBytes(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions std/compress/internal/plonk/plonk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"crypto/rand"
"encoding/binary"
"errors"
"reflect"
"testing"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark-crypto/ecc/bls12-377/fr"
"github.com/consensys/gnark/backend"
"github.com/consensys/gnark/frontend"
test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils"
test_vector_utils "github.com/consensys/gnark/std/internal/test_vectors_utils"
"github.com/consensys/gnark/test"
"reflect"
"testing"
)

func TestCustomConstraint(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions std/compress/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import (
"crypto/rand"
"errors"
"fmt"
"math/big"
"testing"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark-crypto/ecc/bls12-377/fr"
"github.com/consensys/gnark-crypto/hash"
"github.com/consensys/gnark/backend"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/frontend/cs/scs"
"github.com/consensys/gnark/profile"
test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils"
test_vector_utils "github.com/consensys/gnark/std/internal/test_vectors_utils"
"github.com/consensys/gnark/test"
"github.com/stretchr/testify/assert"
"math/big"
"testing"
)

func TestShiftLeft(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions std/compress/lzss/snark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"github.com/consensys/gnark/frontend/cs/scs"
"os"
"testing"

"github.com/consensys/gnark/frontend/cs/scs"

"github.com/consensys/compress/lzss"
"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark/backend"
"github.com/consensys/gnark/frontend"
test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils"
test_vector_utils "github.com/consensys/gnark/std/internal/test_vectors_utils"
"github.com/consensys/gnark/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion std/compress/lzss/snark_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/consensys/compress/lzss"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/std/compress"
test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils"
test_vector_utils "github.com/consensys/gnark/std/internal/test_vectors_utils"
)

type DecompressionTestCircuit struct {
Expand Down
2 changes: 1 addition & 1 deletion std/gkr/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gkr

import (
"github.com/consensys/gnark/constraint"
"github.com/consensys/gnark/std/utils/algo_utils"
"github.com/consensys/gnark/internal/algo_utils"
)

func frontendVarToInt(a constraint.GkrVariable) int {
Expand Down
13 changes: 7 additions & 6 deletions std/gkr/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ package gkr

import (
"fmt"
"hash"
"math/rand"
"strconv"
"testing"
"time"

bls12377 "github.com/consensys/gnark/constraint/bls12-377"
bls12381 "github.com/consensys/gnark/constraint/bls12-381"
bls24315 "github.com/consensys/gnark/constraint/bls24-315"
bls24317 "github.com/consensys/gnark/constraint/bls24-317"
bw6633 "github.com/consensys/gnark/constraint/bw6-633"
bw6761 "github.com/consensys/gnark/constraint/bw6-761"
"github.com/consensys/gnark/test"
"hash"
"math/rand"
"strconv"
"testing"
"time"

"github.com/consensys/gnark-crypto/kzg"
"github.com/consensys/gnark/backend/plonk"
Expand All @@ -32,7 +33,7 @@ import (
"github.com/consensys/gnark/frontend/cs/scs"
stdHash "github.com/consensys/gnark/std/hash"
"github.com/consensys/gnark/std/hash/mimc"
test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils"
test_vector_utils "github.com/consensys/gnark/std/internal/test_vectors_utils"
"github.com/consensys/gnark/test/unsafekzg"
)

Expand Down
2 changes: 1 addition & 1 deletion std/gkr/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/consensys/gnark/constraint"
"github.com/consensys/gnark/constraint/solver"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/internal/algo_utils"
fiatshamir "github.com/consensys/gnark/std/fiat-shamir"
"github.com/consensys/gnark/std/hash"
"github.com/consensys/gnark/std/utils/algo_utils"
)

type circuitDataForSnark struct {
Expand Down

0 comments on commit a111226

Please sign in to comment.