Skip to content

Commit

Permalink
Fix an issue where short public key wasn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
pouya-eghbali committed Feb 7, 2024
1 parent d356984 commit 6cd3964
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package constants

var Version = "0.11.2"
var ProtocolVersion = "0.11.2"
var Version = "0.11.3"
var ProtocolVersion = "0.11.3"
7 changes: 6 additions & 1 deletion src/ent/migrate/schema.go

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

16 changes: 15 additions & 1 deletion src/ent/runtime.go

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

7 changes: 3 additions & 4 deletions src/ent/schema/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ type Signer struct {
func (Signer) Fields() []ent.Field {
return []ent.Field{
field.String("name").NotEmpty(),
//field.Bytes("key").MaxLen(96).Unique().NotEmpty(),
field.Bytes("key").MaxLen(96),
field.Bytes("key").MaxLen(96).Unique().NotEmpty(),
field.Bytes("shortkey").MaxLen(96).Unique().NotEmpty(),
field.Int64("points"),
}
Expand All @@ -33,8 +32,8 @@ func (Signer) Edges() []ent.Edge {
// Indexes of the DataSet.
func (Signer) Indexes() []ent.Index {
return []ent.Index{
// index.Fields("key").
// Unique(),
index.Fields("key").
Unique(),
index.Fields("shortkey").
Unique(),
}
Expand Down
8 changes: 3 additions & 5 deletions src/plugins/uniswap/uniswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@ func Start() {
var sk *big.Int
var pk *bls12381.G2Affine
var pkBytes [96]byte
var spk *bls12381.G1Affine
var spkBytes [48]byte

if config.Secrets.InConfig("secretKey") {

Expand All @@ -317,9 +315,6 @@ func Start() {
pk = bls.GetPublicKey(sk)
pkBytes = pk.Bytes()

spk = bls.GetShortPublicKey(sk)
spkBytes = spk.Bytes()

} else {
sk, pk, err = bls.GenerateKeyPair()
pkBytes = pk.Bytes()
Expand All @@ -334,6 +329,9 @@ func Start() {
}
}

spk := bls.GetShortPublicKey(sk)
spkBytes := spk.Bytes()

if err != nil {
panic(err)
}
Expand Down

0 comments on commit 6cd3964

Please sign in to comment.