mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 20:37:17 +00:00
52 lines
1.3 KiB
Go
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)
|
||
|
})
|
||
|
}
|