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

Separate out generation of protobuf messages and gRPC services #1093

Closed
daviddrysdale opened this issue Jun 5, 2020 · 2 comments
Closed
Labels

Comments

@daviddrysdale
Copy link
Contributor

We currently generate two different things from our .proto files:

  • Rust structs to match protocol buffer message definitions. These are generated by Prost in the standard way.
  • Rust structs, traits and methods that correspond to gRPC service definitions. These are produced by an Oak-specific generator, and the generated code is intended for use inside an Oak Node; in particular, it relies on the existence of the Oak SDK.

For protobufs used in communication with the Runtime, the message definitions are effectively part of the Oak ABI, and so belong in the oak_abi crate.

However, the generated service code is not part of the ABI; it belongs in the SDK and can't be part of oak_abi (because it would induce a dependency cycle oak_abi -> oak -> oak_abi).

So these two types of generated code should be separate. A large fraction of this is covered by #1086, which allows the generation of just the message definitions in a .proto file.

However, it would be nice to tidy up and complete the process – for example, after #1086 the message definitions for the Roughtime service are in two places:

  • oak_abi: message definitions on their own
  • oak: message definitions and gRPC service code.

Ideally the latter would just have the gRPC service code, and would import the message definitions from the former.

@daviddrysdale
Copy link
Contributor Author

One further thing: we actually generate three different chunks of Rust code from our .proto files:

  • structs for messages.
  • Oak-specific code for gRPC services, both client- and server-side.
  • Also: external/host-system code for gRPC services, just for the client-side, as generated normally by tonic-build.

The last of these is needed for clients of Oak Applications that are written in Rust. That certainly includes the trusted_information_retrieval Rust client, but after #1038 will also include all of the integration tests for example applications.

ipetr0v added a commit that referenced this issue Jul 1, 2020
This change moves Protobuf generation function to `oak_utils`.

Fixes #1120
Ref #1093
tiziano88 pushed a commit to tiziano88/oak that referenced this issue Jul 2, 2020
This change moves Protobuf generation function to `oak_utils`.

Fixes project-oak#1120
Ref project-oak#1093
@daviddrysdale
Copy link
Contributor Author

I think this is now done (with #1108 and friends)

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

No branches or pull requests

1 participant