prysm-pulse/crypto/bls/bls_test.go
terence tsao ae2c883aaf
Generate secret key from big number test only (#9816)
* Generate secret key from big number test only

* Gazelle

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-10-25 19:14:19 +00:00

31 lines
858 B
Go

package bls
import (
"testing"
"github.com/prysmaticlabs/prysm/crypto/bls/common"
"github.com/prysmaticlabs/prysm/testing/require"
)
func TestDisallowZeroSecretKeys(t *testing.T) {
t.Run("blst", func(t *testing.T) {
// Blst does a zero check on the key during deserialization.
_, err := SecretKeyFromBytes(common.ZeroSecretKey[:])
require.Equal(t, common.ErrSecretUnmarshal, err)
})
}
func TestDisallowZeroPublicKeys(t *testing.T) {
t.Run("blst", func(t *testing.T) {
_, err := PublicKeyFromBytes(common.InfinitePublicKey[:])
require.Equal(t, common.ErrInfinitePubKey, err)
})
}
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)
})
}