Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ecdsa/resharing/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,17 @@ signing:
}
}
}

func TestRejectsPartyInBothCommittees(t *testing.T) {
keys, pIDs, err := keygen.LoadKeygenTestFixtures(testThreshold + 1)
assert.NoError(t, err)
p2pCtx := tss.NewPeerContext(pIDs)
params := tss.NewReSharingParameters(tss.S256(), p2pCtx, p2pCtx, pIDs[0], len(pIDs), testThreshold, len(pIDs), testThreshold)
out := make(chan tss.Message, len(pIDs))
end := make(chan *keygen.LocalPartySaveData, 1)
P := NewLocalParty(params, keys[0], out, end)
tssErr := P.Start()
if assert.NotNil(t, tssErr) {
assert.Contains(t, tssErr.Error(), "both the old and new committees")
}
}
10 changes: 4 additions & 6 deletions ecdsa/resharing/round_1_old_step_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func (round *round1) Start() *tss.Error {
round.resetOK() // resets both round.oldOK and round.newOK
round.allNewOK()

if round.ReSharingParams().IsOldCommittee() && round.ReSharingParams().IsNewCommittee() {
return round.WrapError(errors.New("party is in both the old and new committees; new committee members need distinct party keys"), round.PartyID())
}
if !round.ReSharingParams().IsOldCommittee() {
return nil
}
Expand Down Expand Up @@ -117,12 +120,7 @@ func (round *round1) Update() (bool, *tss.Error) {
}
round.oldOK[j] = true

// save the ecdsa pub received from the old committee
if round.temp.dgRound1Messages[0] == nil {
ret = false
continue
}
r1msg := round.temp.dgRound1Messages[0].Content().(*DGRound1Message)
r1msg := msg.Content().(*DGRound1Message)
candidate, err := r1msg.UnmarshalECDSAPub(round.Params().EC())
if err != nil {
return false, round.WrapError(errors.New("unable to unmarshal the ecdsa pub key"), msg.GetFrom())
Expand Down
14 changes: 14 additions & 0 deletions eddsa/resharing/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,17 @@ signing:
}
}
}

func TestRejectsPartyInBothCommittees(t *testing.T) {
keys, pIDs, err := keygen.LoadKeygenTestFixtures(testThreshold + 1)
assert.NoError(t, err)
p2pCtx := tss.NewPeerContext(pIDs)
params := tss.NewReSharingParameters(tss.Edwards(), p2pCtx, p2pCtx, pIDs[0], len(pIDs), testThreshold, len(pIDs), testThreshold)
out := make(chan tss.Message, len(pIDs))
end := make(chan *keygen.LocalPartySaveData, 1)
P := NewLocalParty(params, keys[0], out, end)
tssErr := P.Start()
if assert.NotNil(t, tssErr) {
assert.Contains(t, tssErr.Error(), "both the old and new committees")
}
}
10 changes: 4 additions & 6 deletions eddsa/resharing/round_1_old_step_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func (round *round1) Start() *tss.Error {
round.resetOK() // resets both round.oldOK and round.newOK
round.allNewOK()

if round.ReSharingParams().IsOldCommittee() && round.ReSharingParams().IsNewCommittee() {
return round.WrapError(errors.New("party is in both the old and new committees; new committee members need distinct party keys"), round.PartyID())
}
if !round.ReSharingParams().IsOldCommittee() {
return nil
}
Expand Down Expand Up @@ -102,12 +105,7 @@ func (round *round1) Update() (bool, *tss.Error) {
}
round.oldOK[j] = true

if round.temp.dgRound1Messages[0] == nil {
ret = false
continue
}
// save the eddsa pub received from the old committee
r1msg := round.temp.dgRound1Messages[0].Content().(*DGRound1Message)
r1msg := msg.Content().(*DGRound1Message)
candidate, err := r1msg.UnmarshalEDDSAPub(round.Params().EC())
if err != nil {
return false, round.WrapError(errors.New("unable to unmarshal the eddsa pub key"), msg.GetFrom())
Expand Down
Loading