forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpc: check that "version" is "2.0" in request objects (ethereum#25570)
The JSON-RPC spec requires the "version" field to be exactly "2.0", so we should verify that. This change is not backwards-compatible with sloppy client implementations, but I decided to go ahead with it anyway because the failure will be caught via the returned error.
- Loading branch information
1 parent
4e4a59a
commit 918f02a
Showing
3 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This test checks processing of messages with invalid Version. | ||
|
||
--> {"jsonrpc":"2.0","id":1,"method":"test_echo","params":["x", 3]} | ||
<-- {"jsonrpc":"2.0","id":1,"result":{"String":"x","Int":3,"Args":null}} | ||
|
||
--> {"jsonrpc":"2.1","id":1,"method":"test_echo","params":["x", 3]} | ||
<-- {"jsonrpc":"2.0","id":1,"error":{"code":-32600,"message":"invalid request"}} | ||
|
||
--> {"jsonrpc":"go-ethereum","id":1,"method":"test_echo","params":["x", 3]} | ||
<-- {"jsonrpc":"2.0","id":1,"error":{"code":-32600,"message":"invalid request"}} | ||
|
||
--> {"jsonrpc":1,"id":1,"method":"test_echo","params":["x", 3]} | ||
<-- {"jsonrpc":"2.0","id":1,"error":{"code":-32600,"message":"invalid request"}} | ||
|
||
--> {"jsonrpc":2.0,"id":1,"method":"test_echo","params":["x", 3]} | ||
<-- {"jsonrpc":"2.0","id":1,"error":{"code":-32600,"message":"invalid request"}} | ||
|
||
--> {"id":1,"method":"test_echo","params":["x", 3]} | ||
<-- {"jsonrpc":"2.0","id":1,"error":{"code":-32600,"message":"invalid request"}} |