Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade github.com/iden3/go-iden3-core to v2 and dump self version to v2 #69

Merged
merged 6 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"fmt"
"math/big"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)

// AuthInputs type represent auth.circom private inputs
// Deprecated: use AuthV2Inputs instead
type AuthInputs struct {
BaseConfig

Expand Down Expand Up @@ -83,6 +84,7 @@ func (a AuthInputs) InputsMarshal() ([]byte, error) {
}

// AuthPubSignals auth.circom public signals
// Deprecated: use AuthV2PubSignals instead
type AuthPubSignals struct {
Challenge *big.Int `json:"challenge"`
UserState *merkletree.Hash `json:"userState"`
Expand Down
2 changes: 1 addition & 1 deletion authV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"math/big"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion authV2_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"math/big"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
)
Expand Down
4 changes: 2 additions & 2 deletions authV2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"math/big"
"testing"

it "github.com/iden3/go-circuits/testing"
core "github.com/iden3/go-iden3-core"
it "github.com/iden3/go-circuits/v2/testing"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math/big"
"testing"

it "github.com/iden3/go-circuits/testing"
it "github.com/iden3/go-circuits/v2/testing"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion circuits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/big"
"testing"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/stretchr/testify/assert"
)
Expand Down
4 changes: 3 additions & 1 deletion credentialAtomicQueryMTP.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)

// AtomicQueryMTPInputs ZK private inputs for credentialAtomicQueryMTP.circom
// Deprecated: use AtomicQueryMTPV2Inputs instead
type AtomicQueryMTPInputs struct {
BaseConfig
// auth
Expand Down Expand Up @@ -147,6 +148,7 @@ func (a AtomicQueryMTPInputs) InputsMarshal() ([]byte, error) {
}

// AtomicQueryMTPPubSignals public signals
// Deprecated: use AtomicQueryMTPV2PubSignals instead
type AtomicQueryMTPPubSignals struct {
BaseConfig
UserID *core.ID `json:"userID"`
Expand Down
2 changes: 1 addition & 1 deletion credentialAtomicQueryMTPV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)
Expand Down
3 changes: 1 addition & 2 deletions credentialAtomicQueryMTPV2OnChain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"

core "github.com/iden3/go-iden3-core"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)
Expand Down
4 changes: 2 additions & 2 deletions credentialAtomicQueryMTPV2OnChain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package circuits
import (
"context"
"encoding/json"
"github.com/iden3/go-iden3-crypto/poseidon"
"math/big"
"testing"

it "github.com/iden3/go-circuits/testing"
it "github.com/iden3/go-circuits/v2/testing"
"github.com/iden3/go-iden3-crypto/poseidon"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion credentialAtomicQueryMTPV2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/big"
"testing"

it "github.com/iden3/go-circuits/testing"
it "github.com/iden3/go-circuits/v2/testing"
"github.com/stretchr/testify/require"
)

Expand Down
7 changes: 3 additions & 4 deletions credentialAtomicQueryMTP_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import (
"testing"
"time"

it "github.com/iden3/go-circuits/testing"
it "github.com/iden3/go-circuits/v2/testing"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/poseidon"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/stretchr/testify/require"

core "github.com/iden3/go-iden3-core"
"github.com/iden3/go-merkletree-sql/v2/db/memory"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestAtomicQuery_PrepareInputs(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions credentialAtomicQuerySig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)

// AtomicQuerySigInputs ZK private inputs for credentialAtomicQuerySig.circom
// Deprecated: use AtomicQuerySigV2Inputs instead
type AtomicQuerySigInputs struct {
BaseConfig

Expand Down Expand Up @@ -184,7 +185,8 @@ func (a AtomicQuerySigInputs) InputsMarshal() ([]byte, error) {
return json.Marshal(s)
}

// AtomicQuerySigV2PubSignals public inputs
// AtomicQuerySigPubSignals public inputs
// Deprecated: use AtomicQuerySigV2PubSignals instead
type AtomicQuerySigPubSignals struct {
BaseConfig
UserID *core.ID `json:"userID"`
Expand Down
2 changes: 1 addition & 1 deletion credentialAtomicQuerySigV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion credentialAtomicQuerySigV2OnChain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/iden3/go-iden3-crypto/babyjub"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)
Expand Down
4 changes: 2 additions & 2 deletions credentialAtomicQuerySigV2OnChain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package circuits
import (
"context"
"encoding/json"
"github.com/iden3/go-iden3-crypto/poseidon"
"math/big"
"testing"

it "github.com/iden3/go-circuits/testing"
it "github.com/iden3/go-circuits/v2/testing"
"github.com/iden3/go-iden3-crypto/poseidon"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion credentialAtomicQuerySigV2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"testing"

it "github.com/iden3/go-circuits/testing"
it "github.com/iden3/go-circuits/v2/testing"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions credentialAtomicQuerySig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"
"time"

it "github.com/iden3/go-circuits/testing"
core "github.com/iden3/go-iden3-core"
it "github.com/iden3/go-circuits/v2/testing"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/iden3/go-merkletree-sql/v2/db/memory"
"github.com/stretchr/testify/require"
Expand Down
11 changes: 2 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/iden3/go-circuits
module github.com/iden3/go-circuits/v2

go 1.18

require (
github.com/iden3/go-iden3-core v1.0.2
github.com/iden3/go-iden3-core/v2 v2.0.0
github.com/iden3/go-iden3-crypto v0.0.15
github.com/iden3/go-merkletree-sql/v2 v2.0.4
github.com/pkg/errors v0.9.1
Expand All @@ -19,10 +19,3 @@ require (
golang.org/x/sys v0.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

retract (
// incorrect versions published too early
[v0.12.0, v0.12.1]
v0.11.0
v0.10.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA=
github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI=
github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y=
github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo=
github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA=
github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw=
github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4=
github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E=
github.com/iden3/go-merkletree-sql/v2 v2.0.4 h1:Dp089P3YNX1BE8+T1tKQHWTtnk84Y/Kr7ZAGTqwscoY=
Expand Down
2 changes: 1 addition & 1 deletion stateTransition.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion stateTransition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/big"
"testing"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
11 changes: 8 additions & 3 deletions sybilCredentialAtomicMTP.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package circuits
import (
"encoding/json"
"fmt"
core "github.com/iden3/go-iden3-core"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)

// Deprecated: trusted setup is not done for that circuits. In future releases
// new circuit with sybil support will be added.
type SybilAtomicMTPInputs struct {
BaseConfig

Expand Down Expand Up @@ -148,6 +151,8 @@ func (s SybilAtomicMTPInputs) InputsMarshal() ([]byte, error) {
return json.Marshal(mtpInputs)
}

// Deprecated: trusted setup is not done for that circuits. In future releases
// new circuit with sybil support will be added.
type SybilAtomicMTPPubSignals struct {
BaseConfig

Expand Down
9 changes: 5 additions & 4 deletions sybilCredentialAtomicMTP_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package circuits
import (
"context"
"encoding/json"
it "github.com/iden3/go-circuits/testing"
core "github.com/iden3/go-iden3-core"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"math/big"
"testing"

it "github.com/iden3/go-circuits/v2/testing"
core "github.com/iden3/go-iden3-core/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestSybilMTP_PrepareInputs(t *testing.T) {
Expand Down
6 changes: 5 additions & 1 deletion sybilCredentialAtomicSig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import (
"math/big"
"strconv"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-merkletree-sql/v2"
"github.com/pkg/errors"
)

// Deprecated: trusted setup is not done for that circuits. In future released
// new circuit with sybil support will be added.
type SybilAtomicSigInputs struct {
BaseConfig

Expand Down Expand Up @@ -171,6 +173,8 @@ func (s SybilAtomicSigInputs) InputsMarshal() ([]byte, error) {
return json.Marshal(sigInputs)
}

// Deprecated: trusted setup is not done for that circuits. In future released
// new circuit with sybil support will be added.
type SybilAtomicSigPubSignals struct {
BaseConfig

Expand Down
4 changes: 2 additions & 2 deletions sybilCredentialAtomicSig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"math/big"
"testing"

it "github.com/iden3/go-circuits/testing"
core "github.com/iden3/go-iden3-core"
it "github.com/iden3/go-circuits/v2/testing"
core "github.com/iden3/go-iden3-core/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion testing/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
)

func DefaultUserClaim(t testing.TB, subject core.ID) *core.Claim {
Expand Down
5 changes: 2 additions & 3 deletions testing/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math/big"
"testing"

core "github.com/iden3/go-iden3-core"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-iden3-crypto/poseidon"
"github.com/iden3/go-merkletree-sql/v2"
Expand Down Expand Up @@ -82,8 +82,7 @@ func Generate(ctx context.Context, privKHex string) (*core.ID,

state, _ := poseidon.Hash([]*big.Int{claimsTree.Root().BigInt(), big.NewInt(0), big.NewInt(0)})
// create new identity
identifier, err := core.IdGenesisFromIdenState(core.TypeDefault,
state)
identifier, err := core.NewIDFromIdenState(core.TypeDefault, state)
if err != nil {
return nil, nil, nil, nil, err, nil, nil
}
Expand Down
Loading