-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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-alt: redefine TransactionFilter #21203
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
56c96a5
to
66a1c18
Compare
9cf9837
to
743b1a0
Compare
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 change!
|
||
#[serde_as] | ||
#[derive(Clone, Debug, JsonSchema, Serialize, Deserialize)] | ||
pub(crate) enum TransactionFilter { |
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.
What is the error that gets returned now if a user uses one of the unsupported filters from the OG filter enum? I suppose it will be rejected at the beginning (before even entering our code) with invalid params and a message like "wrong variant of enum"? Would like to make sure the message is clear.
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.
Yes, something like that -- here's an example:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "Invalid params",
"data": "unknown variant `ToAddress`, expected one of `Checkpoint`, `MoveFunction`, `AffectedObject`, `FromAddress`, `FromAndToAddress`, `FromOrToAddress` at line 1 column 25"
}
}
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.
lgtm
66a1c18
to
242e956
Compare
743b1a0
to
b2b6111
Compare
b2b6111
to
eb6d686
Compare
242e956
to
eb6d686
Compare
Description
Rather than re-using the base JSON-RPC
TransactionFilter
type and having to respond that certain filters are unsupported, define our own compatible type which only contains the variants we do support. This way we will still return an invalid params error if someone tries to use an unsupported filter, but the filters we advertise in the schema will match what we can return a non-error response for.Test plan
Existing tests.
Stack
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.