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

Strategy for evolving RPC endpoints without versioning #101

Open
rklaehn opened this issue Oct 21, 2024 · 1 comment
Open

Strategy for evolving RPC endpoints without versioning #101

rklaehn opened this issue Oct 21, 2024 · 1 comment

Comments

@rklaehn
Copy link
Collaborator

rklaehn commented Oct 21, 2024

Currently, changes in the RPC protocol require either very careful versioning, or you will run into the issue that some RPC methods will just break in a very silent/annoying way over time as you evolve the API. So you have to make sure that the RPC client and server run the exact same RPC schema. This is sometimes somewhat annoying (e.g. iroh and iroh-cli), but sometimes basically impossible (e.g. windows service installed on a remote machine that can't be updated easily).

You could just put a commit hash into the ALPN to make miscommunication impossible. But that has the downside that even something trivial like a docs update breaks the RPC communication between e.g. iroh and iroh-cli. You could also manually increase the ALPN every time you touch the RPC, but even that is a bit of a pain. E.g. you change 1 of 100 rpc methods, but by increasing the ALPN version you make communication for all 99 other rpc methods impossible. You change something about node id, and your untouched blob endpoints stop working...

Ideally you would want to do some sort of versioning per endpoint, so that only the endpoints that you actually touch get broken.

postcard-rpc has an interesting approach that creates a hash for each rpc endpoint. But it is meant for embedded use and therefore uses a u64 hash that could potentially have collisions.

unisonweb has cryptographic hash based versioning for everything, but unfortunately it is a bit of an isolated island.

Ideally you would have a way to version RPC endpoints for something like quic-rpc that uses cryptographic hashes to prevent collisions, yet is more integrated into rust than unison. (I would love to use a tiny subset unison schema, but could not find good docs).

@rklaehn
Copy link
Collaborator Author

rklaehn commented Oct 21, 2024

Here is my attempt at a schema language for this use case: https://github.com/rklaehn/rpc-schema

@n0bot n0bot bot added this to iroh Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant