coinbase / kryptology

Apache License 2.0
847 stars 123 forks source link

PublicShares in DKG result #65

Open mvrshvl opened 2 years ago

mvrshvl commented 2 years ago

Hello, dear developers. I hope you are well-doing. I'm using Kryptology functions in my research and it works well. I'm really enjoy your product.

I ran into a problem while using DKG results. The PublicShares returned after round 4 does not match the PublicShare generated from the ShamirShare. https://github.com/coinbase/kryptology/blob/60eddc570c2690d99728c5e2bdfb80e436340193/pkg/tecdsa/gg20/participant/dkg_round4.go#L21

    field := curves.NewField(curve.Params().N)
    share1 := v1.NewShamirShare(1, dkgR4Out[1].SigningKeyShare.Bytes(), field)

    publicShare1, err := curves.NewScalarBaseMult(curve, share1.Value.BigInt())
    require.NoError(t, err)

    ok := reflect.DeepEqual(publicShare1, dkgR4Out[1].PublicShares[0]) // ok = false

I assume they should be equal, otherwise round3(GG20) will return an error "e != eHat". https://github.com/coinbase/kryptology/blob/60eddc570c2690d99728c5e2bdfb80e436340193/pkg/tecdsa/gg20/participant/round3.go#L105

How should I use the PublicShares returned from the DKG to create a Signer object?

To reproduce, run a test that passes the result of DKG to gg20.

https://github.com/youricorocks/kryptology/blob/5f8afd0811a0e40dac543e9959a2998b20a9861c/pkg/tecdsa/gg20/participant/dkg_rounds_test.go#L900