prysm-pulse/shared/bls/bls_test.go
Nishant Das 211d9bc0b9
Update BLST And Herumi (#7632)
* fix build from source

* clean up

* update again

* change everything

* workaround for now

* fix versioning

* all passing now

* fix build issues

* clean up

* revert use of MulVerify

* gaz

* stub

* Apply suggestions from code review

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* fix all

* fix test

* todo

* fix stub

* revert back

* make deep source happy

* Update shared/bls/herumi/public_key.go

* Update shared/bls/blst/signature.go

* Update shared/bls/blst/signature_test.go

* imports

* move iface to common, export errors

* rm iface build

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2020-10-30 19:06:33 +00:00

52 lines
1.3 KiB
Go

package bls
import (
"testing"
"github.com/prysmaticlabs/prysm/shared/bls/common"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestDisallowZeroSecretKeys(t *testing.T) {
flags := &featureconfig.Flags{}
t.Run("herumi", func(t *testing.T) {
flags := &featureconfig.Flags{}
reset := featureconfig.InitWithReset(flags)
defer reset()
_, err := SecretKeyFromBytes(common.ZeroSecretKey[:])
require.Equal(t, common.ErrZeroKey, err)
})
t.Run("blst", func(t *testing.T) {
flags.EnableBlst = true
reset := featureconfig.InitWithReset(flags)
defer reset()
_, err := SecretKeyFromBytes(common.ZeroSecretKey[:])
require.Equal(t, common.ErrZeroKey, err)
})
}
func TestDisallowZeroPublicKeys(t *testing.T) {
flags := &featureconfig.Flags{}
t.Run("herumi", func(t *testing.T) {
reset := featureconfig.InitWithReset(flags)
defer reset()
_, err := PublicKeyFromBytes(common.InfinitePublicKey[:])
require.Equal(t, common.ErrInfinitePubKey, err)
})
t.Run("blst", func(t *testing.T) {
flags.EnableBlst = true
reset := featureconfig.InitWithReset(flags)
defer reset()
_, err := PublicKeyFromBytes(common.InfinitePublicKey[:])
require.Equal(t, common.ErrInfinitePubKey, err)
})
}