Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zkvm: Protobuf based client/server IPC (risc0#814)
This introduces an API based on `protobuf` messages passed over a TCP connection. The server is launched by the client as a sub-process. The child process intended to be `r0vm` or other compatible binary that executes for the duration of a request and then terminates. In this scenario, the client is the one that binds to the TCP socket on port 0 to allocate a port. This port is passed to `r0vm --port <PORT>` and the 'server' then connects back to the listener. This ensures that ports are unique for each caller in a race-free manner. In this PR, the client/server messages are defined, while the core data types (receipts, segments, etc) are specified as bytes. This means there's an inner encoding that should be largely opaque to clients. There are instances where clients will want to deserialize these bytes (like a `Receipt`). Currently this uses `bincode` but the intention is to move to `protobuf` to allow for a better versioning story. Versioning will be fleshed out in a future PR. Therefore there will be two levels of protobufs, one for the API, and another for the core data types. This design follows best practices: https://protobuf.dev/programming-guides/api/#use-different-messages TODO: * more tests especially around I/O * pluggable implementation for lift & join
- Loading branch information