Skip to content
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

Protobuf messages registration conflicts #106

Closed
lukasz-zimnoch opened this issue Aug 7, 2020 · 4 comments
Closed

Protobuf messages registration conflicts #106

lukasz-zimnoch opened this issue Aug 7, 2020 · 4 comments
Assignees

Comments

@lukasz-zimnoch
Copy link

tss-lib points to the github.com/golang/protobuf v1.3.2 dependency in the go.mod file. However, according to Go modules version selection policy all versions of protobuf >= v1.3.2 and < v2 can be picked if present in the module list.

This can be a problem because tss-lib protobuf messages are registered twice which causes a registration conflict. The first registration occurs in the generated *.pb.go files and then the second registration is performed in messages.go files.

Example for the ecdsa/keygen package:

The github.com/golang/protobuf v1.3.2 doesn't complain but the newer github.com/golang/protobuf v1.4.0 displays a warning:

2020/08/05 14:43:02 WARNING: proto: message KGRound1Message is already registered
A future release will panic on registration conflicts. See:
https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict
@omershlo
Copy link
Contributor

hi @lukasz-zimnoch , thank you for reporting,
can you suggest ways to fix this issue?

@Shadowfiend
Copy link

Thoughts on fixing this by simply removed from messages.go? If the generated pb.go file takes care of registration, the explicit manual registration in messages.go seems like it should be unnecessary. The init function is used in both cases, and both thepb.go file and messages.go are in the same package which means both registrations run at the same time during package initialization. That should mean the messages.go init function is redundant. I believe this should be true even on earlier versions that may not warn on duplicate registration.

@PlamenHristov
Copy link
Contributor

PlamenHristov commented Aug 31, 2021

Hey @omershlo,

We've noticed that when both ecdsa and eddsa are used depending on the intialization order, protobuf can't handle both at runtime because of name clashes.

I've opened a PR to fix that. As a side effect the warnings have been cleared as well.

Let me know what you think.

@yycen
Copy link
Contributor

yycen commented Sep 3, 2021

This PR also fixed the issue.
See go.mod
ecdsa/signing/messages.go
ecdsa/keygen/ecdsa-keygen.pb.go
and other related part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants