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

RPC Argument Evolution #1808

Open
norgor opened this issue Sep 17, 2023 · 2 comments
Open

RPC Argument Evolution #1808

norgor opened this issue Sep 17, 2023 · 2 comments

Comments

@norgor
Copy link

norgor commented Sep 17, 2023

I was wondering how the evolution of RPC arguments can be done, as I could not find any documentation on it. Specifically, can method arguments be changed to a struct (or the reverse), while ensuring backwards compatibility?

E.g. changing

interface Greeter @0xf702ad8db05c5167 {
    greet @0 (name :Text) -> (greeting :Text);
}

to

struct GreetArgs {
    name @0 :Text;
}
struct Greeting {
    greeting @0 :Text;
}
interface Greeter @0xf702ad8db05c5167 {
    greet @0 GreetArgs -> Greeting;
}
@kentonv
Copy link
Member

kentonv commented Sep 17, 2023

Yes. A parenthesized parameter or result list is just an anonymous struct -- is encoded exactly the same as a struct containing the each parameter as a field, numbered in the order they appear in the list. You can swap this out for an actual struct type as shown in your example.

I guess the docs don't actually cover the syntax to specify a single struct type as the params or results. I'll leave this issue open for documenting that, and the compatibility properties of it.

@norgor
Copy link
Author

norgor commented Sep 18, 2023

Thanks a lot for the quick response!

If you feel this should be in the documentation, I would be glad to contribute. Otherwise, I think this issue can be closed.

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

No branches or pull requests

2 participants