Skip to content

Commit 37f2ca6

Browse files
authored
feat(node): update default RPC endpoints to use v10 (#3497)
* docs: update JSON-RPC and WebSocket documentation to show v10 as default + improvements and fixes * feat(node): update default RPC endpoints to use v10 * fix(rpc): update SpecVersion to 0.10.1 in handlers * chore(ci): remove starknet-go-rpcv10 job from deploy-and-test workflow
1 parent b69b825 commit 37f2ca6

6 files changed

Lines changed: 31 additions & 36 deletions

File tree

.github/workflows/deploy-and-test.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,6 @@ jobs:
163163
STARKNET_PUBLIC_KEY: ${{ secrets.TEST_ACCOUNT_PUBLIC_KEY_3 }}
164164
STARKNET_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS_3 }}
165165

166-
starknet-go-rpcv10:
167-
needs: [deploy]
168-
uses: ./.github/workflows/starknet-go-tests.yml
169-
with:
170-
ref: rpcv10-juno-ci
171-
rpc_version: v0_10
172-
secrets:
173-
TEST_RPC_URL: ${{ secrets.RPC_URL }}
174-
TEST_WS_RPC_URL: ${{ secrets.WS_RPC_URL }}
175-
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
176-
STARKNET_PRIVATE_KEY: ${{ secrets.TEST_ACCOUNT_PRIVATE_KEY_3 }}
177-
STARKNET_PUBLIC_KEY: ${{ secrets.TEST_ACCOUNT_PUBLIC_KEY_3 }}
178-
STARKNET_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS_3 }}
179-
180166
golden-tests:
181167
needs: [deploy]
182168
runs-on: ubuntu-latest

docs/docs/json-rpc.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: JSON-RPC Interface
44

55
# JSON-RPC Interface :globe_with_meridians:
66

7-
Interacting with Juno requires sending requests to specific JSON-RPC API methods. Juno supports all of [Starknet's Node API Endpoints](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.8.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) over HTTP and [WebSocket](websocket).
7+
Interacting with Juno requires sending requests to specific JSON-RPC API methods. Juno supports all of [Starknet's Node API Endpoints](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.10.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) over HTTP and [WebSocket](websocket).
88

99
## Enable the JSON-RPC server
1010

@@ -31,7 +31,7 @@ docker run -d \
3131

3232
## Making JSON-RPC requests
3333

34-
You can use any of [Starknet's Node API Endpoints](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.8.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) with Juno. Check the availability of Juno with the `juno_version` method:
34+
You can use any of [Starknet's Node API Endpoints](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.10.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) with Juno. Check the availability of Juno with the `juno_version` method:
3535

3636
```mdx-code-block
3737
import Tabs from "@theme/Tabs";
@@ -54,7 +54,7 @@ import TabItem from "@theme/TabItem";
5454
<TabItem value="curl" label="cURL">
5555

5656
```bash
57-
curl --location 'http://localhost:6060/v0_9' \
57+
curl --location 'http://localhost:6060/' \
5858
--header 'Content-Type: application/json' \
5959
--data '{
6060
"jsonrpc": "2.0",
@@ -70,7 +70,7 @@ curl --location 'http://localhost:6060/v0_9' \
7070
```json
7171
{
7272
"jsonrpc": "2.0",
73-
"result": "v0.11.7",
73+
"result": "v0.16.0",
7474
"id": 1
7575
}
7676
```
@@ -200,9 +200,9 @@ async fn main() {
200200

201201
Juno supports the following Starknet API versions:
202202

203-
- **v0.10.1**: Accessible via endpoints `/v0_10`, `/rpc/v0_10`
203+
- **v0.10.1**: Accessible via endpoints `/v0_10`, `/rpc/v0_10`, or the defaults `/rpc` and `/`
204204
- **v0.9.0**: Accessible via endpoints `/v0_9`, `/rpc/v0_9`
205-
- **v0.8.1**: Accessible via endpoints `/v0_8` or `/rpc/v0_8`, or the default `/`
205+
- **v0.8.1**: Accessible via endpoints `/v0_8`, `/rpc/v0_8`
206206

207207
To use a specific API version, specify the version endpoint in your RPC calls:
208208

docs/docs/websocket.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: WebSocket Interface
44

55
# WebSocket Interface :globe_with_meridians:
66

7-
Juno provides a WebSocket RPC interface that supports all of [Starknet's JSON-RPC API](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.8.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) endpoints and allows you to [subscribe to newly created blocks](#subscribe-to-newly-created-blocks).
7+
Juno provides a WebSocket RPC interface that supports all of [Starknet's JSON-RPC API](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.10.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) endpoints and allows you to [subscribe to newly created blocks](#subscribe-to-newly-created-blocks).
88

99
## Enable the WebSocket server
1010

@@ -31,7 +31,7 @@ docker run -d \
3131

3232
## Making WebSocket requests
3333

34-
You can use any of [Starknet's Node API Endpoints](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.7.0/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) with Juno. Check the availability of Juno with the `juno_version` method:
34+
You can use any of [Starknet's Node API Endpoints](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/v0.10.1/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) with Juno. Check the availability of Juno with the `juno_version` method:
3535

3636
```mdx-code-block
3737
import Tabs from "@theme/Tabs";
@@ -56,7 +56,7 @@ import TabItem from "@theme/TabItem";
5656
```json
5757
{
5858
"jsonrpc": "2.0",
59-
"result": "v0.14.3",
59+
"result": "v0.16.0",
6060
"id": 1
6161
}
6262
```
@@ -269,7 +269,7 @@ You can test your WebSocket connection using tools like [wscat](https://github.c
269269
# wscat
270270
$ wscat -c ws://localhost:6061
271271
> {"jsonrpc": "2.0", "method": "juno_version", "id": 1}
272-
< {"jsonrpc": "2.0", "result": "v0.14.3", "id": 1}
272+
< {"jsonrpc": "2.0", "result": "v0.16.0", "id": 1}
273273

274274
# websocat
275275
$ websocat -v ws://localhost:6061
@@ -278,16 +278,16 @@ $ websocat -v ws://localhost:6061
278278
[INFO websocat::ws_client_peer] get_ws_client_peer
279279
[INFO websocat::ws_client_peer] Connected to ws
280280
{"jsonrpc": "2.0", "method": "juno_version", "id": 1}
281-
{"jsonrpc": "2.0", "result": "v0.14.3", "id": 1}
281+
{"jsonrpc": "2.0", "result": "v0.16.0", "id": 1}
282282
```
283283

284284
## Supported Starknet API versions
285285

286286
Juno supports the following Starknet API versions:
287287

288-
- **v0.10.1**: Accessible via endpoint `/ws/v0_10`
289-
- **v0.9.0**: Accessible via endpoint `/ws/v0_9`
290-
- **v0.8.1**: Accessible via endpoint `/ws/v0_8`
288+
- **v0.10.1**: Accessible via endpoint `/v0_10`, `/ws/v0_10` or the defaults `/ws` and `/`
289+
- **v0.9.0**: Accessible via endpoint `/v0_9`, `/ws/v0_9`
290+
- **v0.8.1**: Accessible via endpoint `/v0_8`, `/ws/v0_8`
291291

292292
To use a specific API version, specify the version endpoint in your WS calls:
293293

@@ -296,9 +296,9 @@ To use a specific API version, specify the version endpoint in your WS calls:
296296

297297
```bash
298298
# wscat
299-
$ wscat -c ws://localhost:6061/ws/v0_9
299+
$ wscat -c ws://localhost:6061/ws/v0_10
300300
> {"jsonrpc": "2.0", "method": "juno_version", "id": 1}
301-
< {"jsonrpc": "2.0", "result": "v0.15.18", "id": 1}
301+
< {"jsonrpc": "2.0", "result": "v0.16.0", "id": 1}
302302
```
303303

304304
</TabItem>
@@ -308,7 +308,7 @@ $ wscat -c ws://localhost:6061/ws/v0_9
308308
# wscat
309309
$ wscat -c ws://localhost:6061/ws/v0_9
310310
> {"jsonrpc": "2.0", "method": "juno_version", "id": 1}
311-
< {"jsonrpc": "2.0", "result": "v0.15.18", "id": 1}
311+
< {"jsonrpc": "2.0", "result": "v0.16.0", "id": 1}
312312
```
313313

314314
</TabItem>
@@ -318,7 +318,7 @@ $ wscat -c ws://localhost:6061/ws/v0_9
318318
# wscat
319319
$ wscat -c ws://localhost:6061/ws/v0_8
320320
> {"jsonrpc": "2.0", "method": "juno_version", "id": 1}
321-
< {"jsonrpc": "2.0", "result": "v0.15.18", "id": 1}
321+
< {"jsonrpc": "2.0", "result": "v0.16.0", "id": 1}
322322
```
323323

324324
</TabItem>

node/node.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,21 @@ func New(cfg *Config, version string, logLevel *utils.LogLevel) (*Node, error) {
403403
return nil, err
404404
}
405405

406+
// All the following endpoints will be available for both HTTP and WS.
407+
// Also, additional WS endpoints will be created in the following format: /ws/<path>
408+
// E.g.:
409+
// /ws + /
410+
// /ws + /rpc
411+
// /ws + /v0_10
412+
// /ws + /rpc/v0_10
406413
rpcServers := map[string]*jsonrpc.Server{
407-
"/": jsonrpcServerV08,
414+
// Default RPC endpoints
415+
"/": jsonrpcServerV10,
416+
"/rpc": jsonrpcServerV10,
417+
408418
pathV10: jsonrpcServerV10,
409419
pathV09: jsonrpcServerV09,
410420
pathV08: jsonrpcServerV08,
411-
"/rpc": jsonrpcServerV08,
412421
"/rpc" + pathV10: jsonrpcServerV10,
413422
"/rpc" + pathV09: jsonrpcServerV09,
414423
"/rpc" + pathV08: jsonrpcServerV08,

rpc/v10/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,5 @@ func (h *Handler) Run(ctx context.Context) error {
181181
}
182182

183183
func (h *Handler) SpecVersion() (string, *jsonrpc.Error) {
184-
return "0.10.0", nil
184+
return "0.10.1", nil
185185
}

rpc/v10/handlers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestSpecVersion(t *testing.T) {
2020
handler := rpcv10.New(nil, nil, nil, nil)
2121
version, rpcErr := handler.SpecVersion()
2222
require.Nil(t, rpcErr)
23-
require.Equal(t, "0.10.0", version)
23+
require.Equal(t, "0.10.1", version)
2424
}
2525

2626
func TestThrottledVMError(t *testing.T) {

0 commit comments

Comments
 (0)