Accepted
At present, we manage the Protocol Buffers schema files ("protos") that define
our wire-level data formats within the Tendermint repository itself (see the
proto
directory). Recently, we have been making use of Buf,
both locally and in CI, in order to generate Go stubs, and lint and check
.proto
files for breaking changes.
The version of Buf used at the time of this decision was v1beta1
, and it was
discussed in #7975 and in weekly calls as to whether we should upgrade to
v1
and harmonize our approach with that used by the Cosmos SDK. The team
managing the Cosmos SDK was primarily interested in having our protos versioned
and easily accessible from the Buf registry.
The three main sets of stakeholders for the .proto
files and their needs, as
currently understood, are as follows.
.proto
files..proto
files, specifically projects that want to
interoperate with Tendermint and need to generate code for their own
programming language, want to be able to access these files in a reliable and
efficient way.There was also discussion surrounding the notion of automated documentation
generation and hosting, but it is not clear at this time whether this would be
that valuable to any of our stakeholders. What will, of course, be valuable at
minimum would be better documentation (in comments) of the .proto
files
themselves.
master
)..proto
linting:
.proto
formatting:
.proto
files in a versioned, reliable manner:
.proto
files they need. This requires no effort from the Tendermint Core team and
will continue to be an option for consumers. The drawback of this approach
is that it requires manual coding/scripting to implement and is brittle in
the face of bigger changes..proto
files to Buf's registry on every release. This is
by far the most seamless for consumers of our .proto
files, but requires
the dependency on Buf. This has the additional benefit that the Buf
registry will automatically generate and host
documentation for these protos..zip
file
containing our .proto
files.Prototool was not considered as it appears deprecated, and the ecosystem seems to be converging on Buf at this time.
The more tools we have in our build/CI processes, the more complex and fragile repository/CI management becomes, and the longer it takes to onboard new team members. Maintainability is a core concern here.
One of the primary considerations regarding the usage of Buf is whether, for example, access to its registry will eventually become a paid-for/subscription-based service and whether this is valuable enough for us and the ecosystem to pay for such a service. At this time, it appears as though Buf will never charge for hosting open source projects' protos.
Another consideration was Buf's sustainability as a project - what happens when their resources run out? Will there be a strong and broad enough open source community to continue maintaining it?
Local usage of Buf (i.e. not in CI) can be accomplished in two ways:
Local installation of Buf requires developers to manually keep their toolchains
up-to-date. The Docker option comes with a number of complexities, including
how the file system permissions of code generated by a Docker container differ
between platforms (e.g. on Linux, Buf-generated code ends up being owned by
root
).
The trouble with the Docker-based approach is that we make use of the
gogoprotobuf plugin for protoc
. Continuing to use the Docker-based approach
to using Buf will mean that we will have to continue building our own custom
Docker image with embedded gogoprotobuf.
Along these lines, we could eventually consider coming up with a Nix- or redo-based approach to developer tooling to ensure tooling consistency across the team and for anyone who wants to be able to contribute to Tendermint.
.proto
files will only
happen when performing minor/patch releases.We currently aim to:
v1
to facilitate linting, breakage checking and uploading to
the Buf registry..proto
file formatting. Format
checking should be considered a requirement for accepting PRs.Makefile
to primarily facilitate
local Protobuf stub generation, linting, formatting and breaking change
checking. More specifically:
protoc
directly..proto
files for breaking changes.