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
34 changes: 25 additions & 9 deletions pkg/frost/signing/roast_runner_engine_frost_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ type fakeInteractiveSigningEngine struct {
commitmentsByMember map[uint16][]byte
shareByMember map[uint16][]byte

mu sync.Mutex
openCalls int
round1Calls int
newPackageCalls int
round2Calls int
aggregateCalls int
abortCalls int
deriveCalls int
lastAggregateShares []nativeFROSTSignatureShare
mu sync.Mutex
openCalls int
round1Calls int
newPackageCalls int
round2Calls int
aggregateCalls int
abortCalls int
deriveCalls int
lastAggregateShares []nativeFROSTSignatureShare
lastNewPackageCommitments []nativeFROSTCommitment
}

func (f *fakeInteractiveSigningEngine) DeriveInteractiveAttemptContext(
Expand Down Expand Up @@ -93,6 +94,20 @@ func (f *fakeInteractiveSigningEngine) abortCallCount() int {
return f.abortCalls
}

func (f *fakeInteractiveSigningEngine) round2CallCount() int {
f.mu.Lock()
defer f.mu.Unlock()
return f.round2Calls
}

// newPackageCommitments returns a copy of the commitments the engine last built a
// signing package over - the chosen t-subset for the coordinator.
func (f *fakeInteractiveSigningEngine) newPackageCommitments() []nativeFROSTCommitment {
f.mu.Lock()
defer f.mu.Unlock()
return append([]nativeFROSTCommitment(nil), f.lastNewPackageCommitments...)
}

func newFakeInteractiveSigningEngine() *fakeInteractiveSigningEngine {
return &fakeInteractiveSigningEngine{
attemptID: "attempt-1",
Expand Down Expand Up @@ -153,6 +168,7 @@ func (f *fakeInteractiveSigningEngine) NewSigningPackage(
) ([]byte, error) {
f.mu.Lock()
f.newPackageCalls++
f.lastNewPackageCommitments = append([]nativeFROSTCommitment(nil), commitments...)
f.mu.Unlock()
return f.signingPackage, nil
}
Expand Down
Loading
Loading