dedis / protobuf

Reflection-based Protocol Buffers for Go
GNU General Public License v2.0
76 stars 15 forks source link

GenerateProtobufDefinition fails on interface #71

Open tharvik opened 4 years ago

tharvik commented 4 years ago

I'm trying to find how onet.Roster is serialized by protobuf. Sadly, when encountering an interface, such as kyber.Point, it fails.

protobuf.GenerateProtobufDefinition(os.Stdout, []interface{}{
            new(onet.Roster),
}, nil, nil)

It would be nice to support it, such as using the Any prototype defined in proto3, or simply a reserved with a comment.

jeffallen commented 4 years ago

In onet/network/encoding.go, there are a series of protobuf.RegisterInterface calls that set up protobuf to handle this correctly; at least for decoding.

But yes, I agree that GenerateProtobufDefinition doesn't do this right.