-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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: Add minContextSlot param to ensure consistent responses #25161
Conversation
Adding a new field is not exactly a breaking change IMO but I'm not opposed to using a new struct to address the downstream breakage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea. Just one question about changing deprecated/obsolete endpoints.
Can you update the jsonrpc docs, please?
I agree about adding a field not really being breaking, and I'd prefer not to add new duplicate structs for all for these configs...
I'm trying to think of a cute way to fix the downstream build error anyway. I suppose one way might be to add and release a RpcAccountInfoConfig ctor that we update anchor to before releasing this.
How about we annotate these config structs as non exhaustive so that clients need to explicitly fill remaining fields with |
Never mind, can't fill remaining fields with default values when using non exhaustive structs. But I think my suggestion is a good path to unbreak anchor even without the type attribute. https://internals.rust-lang.org/t/allow-fru-syntax-on-non-exhaustive-structs/12800 |
Downstream anchor fix PR is here: coral-xyz/anchor#1895 |
@CriesofCarrots this is ready for another pass, anchor has been fixed already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, lgtm!
* RPC: Add minContextSlot param to ensure consistent responses * revert changes to deprecated endpoints * update docs (cherry picked from commit 4690956) # Conflicts: # docs/src/developing/clients/jsonrpc-api.md
…#25161) (#25313) * RPC: Add minContextSlot param to ensure consistent responses (#25161) * RPC: Add minContextSlot param to ensure consistent responses * revert changes to deprecated endpoints * update docs (cherry picked from commit 4690956) # Conflicts: # docs/src/developing/clients/jsonrpc-api.md * fix conflicts Co-authored-by: Justin Starry <[email protected]>
…labs#25161) * RPC: Add minContextSlot param to ensure consistent responses * revert changes to deprecated endpoints * update docs
…labs#25161) * RPC: Add minContextSlot param to ensure consistent responses * revert changes to deprecated endpoints * update docs
Problem
When making requests to an RPC tool, it can be challenging to get consistent responses because requests could be handled by nodes which are lagging behind the node for a previously handled request.
Summary of Changes
Added a
minContextSlot
parameter to many RPC API's in order to fail fast and notify the client that the connected RPC client isn't caught up to the slot that was expected. Clients can tell if this parameter was respected by the RPC node by checking theapiVersion
response in the context of the response is >=1.11.0
This PR only adds this feature to the RPC server, it doesn't implement the client changes to make use of this new parameter. That can come later in a separate PR
Fixes #15705