Skip to content

WaitingFor on not started party causes panic #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nkuba opened this issue Dec 17, 2019 · 2 comments
Closed

WaitingFor on not started party causes panic #82

nkuba opened this issue Dec 17, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@nkuba
Copy link

nkuba commented Dec 17, 2019

I initialized a keygen party but haven't started the process yet. When I call WaitingFor() for this party, I get panic runtime error.

In such a case I would expect WaitingFor() function to return either an error or a list of parties (empty or containing all parties).

Stack trace:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x4407f56]

goroutine 10 [running]:
testing.tRunner.func1(0xc0000fe300)
	/usr/local/Cellar/go/1.13.4/libexec/src/testing/testing.go:874 +0x3a3
panic(0x45aff80, 0x4bef630)
	/usr/local/Cellar/go/1.13.4/libexec/src/runtime/panic.go:679 +0x1b2
github.com/binance-chain/tss-lib/tss.(*BaseParty).WaitingFor(0xc00048f290, 0x0, 0x0, 0x0)
	/Users/(...)/binance-chain/[email protected]/tss/party.go:49 +0x86
github.com/(...)/tss.TestWaitingFor(0xc0000fe300)
	/Users/(...)/tss_test.go:46 +0x329
testing.tRunner(0xc0000fe300, 0x4795300)
	/usr/local/Cellar/go/1.13.4/libexec/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
	/usr/local/Cellar/go/1.13.4/libexec/src/testing/testing.go:960 +0x350

Test:

func TestWaitingFor(t *testing.T) {
	groupPartiesIDs := []*tss.PartyID{
		tss.NewPartyID("party-1", "", big.NewInt(1)),
		tss.NewPartyID("party-2", "", big.NewInt(2)),
		tss.NewPartyID("party-3", "", big.NewInt(3)),
	}

	params := tss.NewParameters(
		tss.NewPeerContext(tss.SortPartyIDs(groupPartiesIDs)),
		groupPartiesIDs[0],
		len(groupPartiesIDs),
		len(groupPartiesIDs)-1,
	)

	tssMessageChan := make(chan tss.Message, len(groupPartiesIDs))
	endChan := make(chan keygen.LocalPartySaveData)

	party := keygen.NewLocalParty(params, tssMessageChan, endChan)

	waitingFor := party.WaitingFor()

	t.Logf("waiting for: %v", waitingFor)
}
@cbarraford
Copy link

I've seen a similar error, same bug, different execution...

PANIC: tss_4nodes_test.go:367: TssTestSuite.TestProcessVerMessage
... Panic: runtime error: invalid memory address or nil pointer dereference (PC=0x1030D31)
/usr/local/go/src/runtime/panic.go:679
  in gopanic
/usr/local/go/src/runtime/panic.go:199
  in panicmem
/usr/local/go/src/runtime/signal_unix.go:394
  in sigpanic
/Users/yb/go/pkg/mod/github.com/binance-chain/[email protected]/tss/party.go:53
  in BaseParty.WrapError
/Users/yb/go/pkg/mod/github.com/binance-chain/[email protected]/ecdsa/keygen/local_party.go:149
  in LocalParty.UpdateFromBytes
tss.go:446
  in Tss.updateLocal
tss.go:630
  in Tss.processVerMsg
tss.go:509
  in Tss.processOneMessage
tss_4nodes_test.go:339
  in TssTestSuite.testVerMsgAndUpdate
tss_4nodes_test.go:390
  in TssTestSuite.TestProcessVerMessage
/usr/local/go/src/reflect/value.go:321
  in Value.Call
/usr/local/go/src/runtime/asm_amd64.s:1357
  in goexit

@notatestuser
Copy link
Contributor

Looks like both of these can happen before the party is started and therefore before a round is set.

The round used to be set in the constructor so this might be a bit of a regression after that change.

@notatestuser notatestuser added the bug Something isn't working label Dec 19, 2019
nkuba added a commit to keep-network/keep-ecdsa that referenced this issue Dec 31, 2019
tss-lib version 1.1.1 fixes bug which caused panic for timeout messages:
bnb-chain/tss-lib#82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants