diff --git a/ecdsa/accsigning/messages.go b/ecdsa/accsigning/messages.go index f866d8f..21d8a17 100644 --- a/ecdsa/accsigning/messages.go +++ b/ecdsa/accsigning/messages.go @@ -1,6 +1,5 @@ -// Copyright (c) 2023, Circle Internet Financial, LTD. -// All rights reserved -// +// Copyright (c) 2023, Circle Internet Financial, LTD. +// All rights reserved package accsigning import ( diff --git a/ecdsa/accsigning/round_test.go b/ecdsa/accsigning/round_test.go index 67923c3..41a2afa 100644 --- a/ecdsa/accsigning/round_test.go +++ b/ecdsa/accsigning/round_test.go @@ -6,15 +6,16 @@ package accsigning import ( "fmt" -// "sync" + // "sync" "testing" "github.com/stretchr/testify/assert" "github.com/bnb-chain/tss-lib/common" "github.com/bnb-chain/tss-lib/ecdsa/keygen" -// "github.com/bnb-chain/tss-lib/tss" + // "github.com/bnb-chain/tss-lib/tss" ) + /* * Uncomment test to check individual round * diff --git a/ecdsa/cggplus/messages.go b/ecdsa/cggplus/messages.go index ad5950d..9c2aae2 100644 --- a/ecdsa/cggplus/messages.go +++ b/ecdsa/cggplus/messages.go @@ -1,6 +1,5 @@ -// Copyright (c) 2023, Circle Internet Financial, LTD. -// All rights reserved -// +// Copyright (c) 2023, Circle Internet Financial, LTD. +// All rights reserved package cggplus import ( diff --git a/ecdsa/cggplus/round_test.go b/ecdsa/cggplus/round_test.go index f2924e3..9b1c030 100644 --- a/ecdsa/cggplus/round_test.go +++ b/ecdsa/cggplus/round_test.go @@ -5,129 +5,130 @@ package cggplus import ( -// "github.com/bnb-chain/tss-lib/tss" -// "sync" + // "github.com/bnb-chain/tss-lib/tss" + // "sync" "testing" ) /* * Uncomment test to check individual round * -func TestRound1(t *testing.T) { - params, parties, outCh, _, _, _ := SetupParties(t) - rounds := RunRound1(t, params, parties, outCh) - wg := sync.WaitGroup{} - partyCount := len(parties) - errChs := make(chan *tss.Error, partyCount*partyCount*3) - for _, round := range rounds { - wg.Add(1) - go func(round *round1) { - defer wg.Done() - nextRound := &round2{round} - nextRound.VerifyRound1Messages(errChs) - }(round) + func TestRound1(t *testing.T) { + params, parties, outCh, _, _, _ := SetupParties(t) + rounds := RunRound1(t, params, parties, outCh) + + wg := sync.WaitGroup{} + partyCount := len(parties) + errChs := make(chan *tss.Error, partyCount*partyCount*3) + for _, round := range rounds { + wg.Add(1) + go func(round *round1) { + defer wg.Done() + nextRound := &round2{round} + nextRound.VerifyRound1Messages(errChs) + }(round) + } + wg.Wait() + close(errChs) + AssertNoErrors(t, errChs) } - wg.Wait() - close(errChs) - AssertNoErrors(t, errChs) -} -func TestRound2(t *testing.T) { - params, parties, outCh, _, _, _ := SetupParties(t) - t.Logf("round 1") - round1s := RunRound1(t, params, parties, outCh) - t.Logf("round 2") - totalMessages := len(parties) * len(parties) - round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) + func TestRound2(t *testing.T) { + params, parties, outCh, _, _, _ := SetupParties(t) + t.Logf("round 1") + round1s := RunRound1(t, params, parties, outCh) + t.Logf("round 2") + totalMessages := len(parties) * len(parties) + round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) - wg := sync.WaitGroup{} - partyCount := len(parties) - errChs := make(chan *tss.Error, partyCount*partyCount*partyCount) - for _, round := range round2s { - wg.Add(1) - go func(round *round2) { - defer wg.Done() - nextRound := &round3{round} - nextRound.VerifyRound2Messages(errChs) - }(round) + wg := sync.WaitGroup{} + partyCount := len(parties) + errChs := make(chan *tss.Error, partyCount*partyCount*partyCount) + for _, round := range round2s { + wg.Add(1) + go func(round *round2) { + defer wg.Done() + nextRound := &round3{round} + nextRound.VerifyRound2Messages(errChs) + }(round) + } + wg.Wait() + close(errChs) + AssertNoErrors(t, errChs) } - wg.Wait() - close(errChs) - AssertNoErrors(t, errChs) -} -func TestRound3(t *testing.T) { - params, parties, outCh, _, _, _ := SetupParties(t) - t.Logf("round 1") - round1s := RunRound1(t, params, parties, outCh) - t.Logf("round 2") - totalMessages := len(parties) * len(parties) - round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) - t.Logf("round 3") - round3s := RunRound[*round2, *round3](t, params, parties, round2s, len(parties), outCh) + func TestRound3(t *testing.T) { + params, parties, outCh, _, _, _ := SetupParties(t) + t.Logf("round 1") + round1s := RunRound1(t, params, parties, outCh) + t.Logf("round 2") + totalMessages := len(parties) * len(parties) + round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) + t.Logf("round 3") + round3s := RunRound[*round2, *round3](t, params, parties, round2s, len(parties), outCh) - wg := sync.WaitGroup{} - partyCount := len(parties) - errChs := make(chan *tss.Error, partyCount*partyCount*partyCount) - for _, round := range round3s { - wg.Add(1) - go func(round *round3) { - defer wg.Done() - nextRound := &round4{round} - nextRound.VerifyRound3Messages(errChs) - }(round) + wg := sync.WaitGroup{} + partyCount := len(parties) + errChs := make(chan *tss.Error, partyCount*partyCount*partyCount) + for _, round := range round3s { + wg.Add(1) + go func(round *round3) { + defer wg.Done() + nextRound := &round4{round} + nextRound.VerifyRound3Messages(errChs) + }(round) + } + wg.Wait() + close(errChs) + AssertNoErrors(t, errChs) } - wg.Wait() - close(errChs) - AssertNoErrors(t, errChs) -} -func TestRound4(t *testing.T) { - params, parties, outCh, _, _, _ := SetupParties(t) - t.Logf("round 1") - round1s := RunRound1(t, params, parties, outCh) - t.Logf("round 2") - totalMessages := len(parties) * len(parties) - round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) - t.Logf("round 3") - round3s := RunRound[*round2, *round3](t, params, parties, round2s, len(parties), outCh) - t.Logf("round 4") - _ = RunRound[*round3, *round4](t, params, parties, round3s, len(parties), outCh) + func TestRound4(t *testing.T) { + params, parties, outCh, _, _, _ := SetupParties(t) + t.Logf("round 1") + round1s := RunRound1(t, params, parties, outCh) + t.Logf("round 2") + totalMessages := len(parties) * len(parties) + round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) + t.Logf("round 3") + round3s := RunRound[*round2, *round3](t, params, parties, round2s, len(parties), outCh) + t.Logf("round 4") + _ = RunRound[*round3, *round4](t, params, parties, round3s, len(parties), outCh) - // skip verification; round 4 does not output messages -} + // skip verification; round 4 does not output messages + } -func TestRound5(t *testing.T) { - params, parties, outCh, _, _, _ := SetupParties(t) + func TestRound5(t *testing.T) { + params, parties, outCh, _, _, _ := SetupParties(t) - t.Logf("round 1") - round1s := RunRound1(t, params, parties, outCh) - t.Logf("round 2") - totalMessages := len(parties) * len(parties) - round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) - t.Logf("round 3") - round3s := RunRound[*round2, *round3](t, params, parties, round2s, len(parties), outCh) - t.Logf("round 4") - round4s := RunRound[*round3, *round4](t, params, parties, round3s, len(parties), outCh) - t.Logf("round 5") - round5s := RunRound[*round4, *round5](t, params, parties, round4s, len(parties), outCh) + t.Logf("round 1") + round1s := RunRound1(t, params, parties, outCh) + t.Logf("round 2") + totalMessages := len(parties) * len(parties) + round2s := RunRound[*round1, *round2](t, params, parties, round1s, totalMessages, outCh) + t.Logf("round 3") + round3s := RunRound[*round2, *round3](t, params, parties, round2s, len(parties), outCh) + t.Logf("round 4") + round4s := RunRound[*round3, *round4](t, params, parties, round3s, len(parties), outCh) + t.Logf("round 5") + round5s := RunRound[*round4, *round5](t, params, parties, round4s, len(parties), outCh) - wg := sync.WaitGroup{} - partyCount := len(parties) - errChs := make(chan *tss.Error, partyCount*partyCount*partyCount) - for _, round := range round5s { - wg.Add(1) - go func(round *round5) { - defer wg.Done() - nextRound := &finalization{round} - nextRound.VerifyRound5Messages(errChs) - }(round) + wg := sync.WaitGroup{} + partyCount := len(parties) + errChs := make(chan *tss.Error, partyCount*partyCount*partyCount) + for _, round := range round5s { + wg.Add(1) + go func(round *round5) { + defer wg.Done() + nextRound := &finalization{round} + nextRound.VerifyRound5Messages(errChs) + }(round) + } + wg.Wait() + close(errChs) + AssertNoErrors(t, errChs) } - wg.Wait() - close(errChs) - AssertNoErrors(t, errChs) -} */ func TestRoundFinalization(t *testing.T) { params, parties, outCh, _, _, _ := SetupParties(t)