relab/hotstuff

Recompiling client protobuf definitions leads to errors

Closed this issue · 7 comments

I deleted the client_gorums.pb.go and client.pb.go files and then tried to regenerate them with the protocol buffers compiler using the following command:

protoc -I=/Users/raphael/.go/pkg/mod/github.com/relab/gorums@v0.2.3-0.20210213125733-f04667f97266:. \
                --go_out=paths=source_relative:. \
                --gorums_out=paths=source_relative:. \
                client/client.proto 

Unfortunately when executing the server I get the following errors:

generating(async): ExecCommand
# github.com/relab/hotstuff/client
client/client_gorums.pb.go:194:42: msg.metadata.MethodID undefined (type *ordering.Metadata has no field or method MethodID)
client/client_gorums.pb.go:1139:44: req.metadata.MethodID undefined (type *ordering.Metadata has no field or method MethodID)
client/client_gorums.pb.go:1323:2: undefined: ClientClient
client/client_gorums.pb.go:1328:19: undefined: NewClientClient

I've tried compiling with different versions of gorums as well (v0.2.2 and v0.2.1) but same result. It's weird because I didn't have those problems a couple weeks ago when I did the same.

The generated client_gorums.pb.go file also seems to be way larger than the one in the git repo when just cloning (~200 lines vs ~1400 lines).

We are currently using the master branch of gorums, which has seen a bunch of changes since the last release.

@meling we should probably do a new release of gorums now.

Yeah. Will try to do it later tonight.

Have tagged a new pre-release (v0.3.0). Let me know if this helps.

I downloaded the gorums-0.3.0 and put it into a sibling directory of the hotstuff directory. I then recompiled with the following command:

protoc -I=../gorums-0.3.0:. \
  --go_out=paths=source_relative:. \
  --gorums_out=paths=source_relative:. \
  client/client.proto

I did not change anything in client.proto and the errors are still the same. For some reason it also generates a correctable (not async).

generating(correctable): ExecCommand
# github.com/relab/hotstuff/client
client/client_gorums.pb.go:194:42: msg.metadata.MethodID undefined (type *ordering.Metadata has no field or method MethodID)
client/client_gorums.pb.go:1139:44: req.metadata.MethodID undefined (type *ordering.Metadata has no field or method MethodID)
client/client_gorums.pb.go:1333:2: undefined: ClientClient
client/client_gorums.pb.go:1338:19: undefined: NewClientClient

I'm willing to accept that I've configured something wrong somewhere but I can't figure out what. Does anyone of you get the same errors when trying to recompile the protobuf definitions in the manner I did?

I think the problem is a mismatch between the gorums version imported by hotstuff and the gorums version installed in the PATH. This commit in gorums changed the numbers for some of the method options, which explains why it is generating a correctable instead of an async QC. I have updated the hotstuff master branch with gorums v0.3.0. I think that should fix your issue.

@meling this might create problems for others too, any thoughts on how to document or handle this?

Sorry for causing problems here. We haven't had many external users so far, so we have favored cleaning up the APIs without worrying too much about compatibility since we are still in pre-release mode. We will help as much as we can to fix things when they break. That said, I'll think about a way to detect incompatible versions between the plugin and the package; they do something like that in the golang-protobuf library. But I'm not sure if their approach translates easily to our case since we haven't made any v1 releases yet.

No problem at all. Thanks for the help. It works now :)
I guess I'm your reality check; an outsider who uses your library in ways it maybe shouldn't be used.