2020-10-30 19:06:33 +00:00
|
|
|
package bls
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-09-15 22:55:11 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/crypto/bls/common"
|
2021-09-23 18:53:46 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
2020-10-30 19:06:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestDisallowZeroSecretKeys(t *testing.T) {
|
|
|
|
t.Run("blst", func(t *testing.T) {
|
2020-11-17 04:12:23 +00:00
|
|
|
// Blst does a zero check on the key during deserialization.
|
2020-10-30 19:06:33 +00:00
|
|
|
_, err := SecretKeyFromBytes(common.ZeroSecretKey[:])
|
2020-11-17 04:12:23 +00:00
|
|
|
require.Equal(t, common.ErrSecretUnmarshal, err)
|
2020-10-30 19:06:33 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestDisallowZeroPublicKeys(t *testing.T) {
|
|
|
|
t.Run("blst", func(t *testing.T) {
|
|
|
|
_, err := PublicKeyFromBytes(common.InfinitePublicKey[:])
|
|
|
|
require.Equal(t, common.ErrInfinitePubKey, err)
|
|
|
|
})
|
|
|
|
}
|
2020-11-17 04:12:23 +00:00
|
|
|
|
|
|
|
func TestDisallowZeroPublicKeys_AggregatePubkeys(t *testing.T) {
|
|
|
|
t.Run("blst", func(t *testing.T) {
|
|
|
|
_, err := AggregatePublicKeys([][]byte{common.InfinitePublicKey[:], common.InfinitePublicKey[:]})
|
|
|
|
require.Equal(t, common.ErrInfinitePubKey, err)
|
|
|
|
})
|
|
|
|
}
|