Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricfung committed Jul 2, 2021
1 parent df3503a commit 9ab8e9f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion signer/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NewNode(ctx context.Context, cancel context.CancelFunc, store store.Storage
}
}
groupId := sha3.Sum256(group)
valid, err := store.CheckGroupIdenity(groupId[:])
valid, err := store.CheckPolyGroup(groupId[:])
if err != nil || !valid {
panic(fmt.Errorf("Group check failed %v %v", valid, err))
}
Expand Down
7 changes: 3 additions & 4 deletions store/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
)

const (
badgerKeyGroupIdentity = "GROUP"

badgerKeyPolyGroup = "POLY#GROUP"
badgerKeyPolyPublic = "POLY#PUBLIC"
badgerKeyPolyShare = "POLY#SHARE"

Expand Down Expand Up @@ -116,9 +115,9 @@ func (bs *BadgerStorage) RotateEphemeralNonce(key, ephemeral []byte, nonce uint6
})
}

func (bs *BadgerStorage) CheckGroupIdenity(group []byte) (bool, error) {
func (bs *BadgerStorage) CheckPolyGroup(group []byte) (bool, error) {
var valid bool
key := []byte(badgerKeyGroupIdentity)
key := []byte(badgerKeyPolyGroup)
err := bs.db.Update(func(txn *badger.Txn) error {
item, err := txn.Get(key)
if err == badger.ErrKeyNotFound {
Expand Down
10 changes: 5 additions & 5 deletions store/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ func TestBadgerNonce(t *testing.T) {
assert.True(res)
}

func TestBadgerGroupIdentity(t *testing.T) {
func TestBadgerPolyGroup(t *testing.T) {
assert := assert.New(t)
bs := testBadgerStore()
defer bs.Close()

valid, err := bs.CheckGroupIdenity([]byte("group"))
valid, err := bs.CheckPolyGroup([]byte("group"))
assert.Nil(err)
assert.True(valid)

valid, err = bs.CheckGroupIdenity([]byte("group"))
valid, err = bs.CheckPolyGroup([]byte("group"))
assert.Nil(err)
assert.True(valid)

valid, err = bs.CheckGroupIdenity([]byte("invalid"))
valid, err = bs.CheckPolyGroup([]byte("invalid"))
assert.Nil(err)
assert.False(valid)

valid, err = bs.CheckGroupIdenity([]byte("group"))
valid, err = bs.CheckPolyGroup([]byte("group"))
assert.Nil(err)
assert.True(valid)
}
Expand Down
3 changes: 1 addition & 2 deletions store/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package store
import "time"

type Storage interface {
CheckGroupIdenity(group []byte) (bool, error)

CheckPolyGroup(group []byte) (bool, error)
ReadPolyPublic() ([]byte, error)
ReadPolyShare() ([]byte, error)
WritePoly(public, share []byte) error
Expand Down
Binary file modified web/workflow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9ab8e9f

Please sign in to comment.