github.com/koko1123/flow-go-1@v0.29.6/cmd/bootstrap/dkg/dkg_test.go (about)

     1  package dkg
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/onflow/flow-go/crypto"
     9  	"github.com/koko1123/flow-go-1/utils/unittest"
    10  )
    11  
    12  func TestRunDKG(t *testing.T) {
    13  	seedLen := crypto.SeedMinLenDKG
    14  	_, err := RunDKG(0, unittest.SeedFixtures(2, seedLen))
    15  	require.EqualError(t, err, "n needs to match the number of seeds (0 != 2)")
    16  
    17  	_, err = RunDKG(3, unittest.SeedFixtures(2, seedLen))
    18  	require.EqualError(t, err, "n needs to match the number of seeds (3 != 2)")
    19  
    20  	data, err := RunDKG(4, unittest.SeedFixtures(4, seedLen))
    21  	require.NoError(t, err)
    22  
    23  	require.Len(t, data.PrivKeyShares, 4)
    24  	require.Len(t, data.PubKeyShares, 4)
    25  }