Repository navigation
feat(specs): update Starknet spec to JSON-RPC v0.9/v0.10 and WS subscriptions - #2341
Conversation
Starknet 0.14.3 nodes (pathfinder v0.23+) serve only JSON-RPC v0.9 and v0.10. Update the STRK and STRKS specs and the provider examples: - add /rpc/v0_10 and /ws/rpc/v0_10; drop /rpc/v0_8 and /ws/rpc/v0_8, including the pending-block-support check that lived there - add starknet_getBlockWithReceipts, starknet_getCompiledCasm, starknet_getMessagesStatus and starknet_getStorageProof - replace pathfinder_subscribe/pathfinder_unsubscribe with the starknet_subscribe* family and starknet_unsubscribe - drop starknet_pendingTransactions, pathfinder_getProof and pathfinder_getTransactionStatus; add pathfinder_lastL1AcceptedBlockHashAndNumber - parse starknet_estimateFee block_id from param index 2 - average_block_time 30000/32000 -> 2000 (mainnet measures ~1.84s) and allowed_block_lag_for_qos_sync -> 5 Split out of #2318. Merge only after #2318 is released and providers have upgraded: older providers accept starknet_subscribe* but drop every notification. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Gives the release with the Starknet v0.9+ subscription support its own protocol version, so ProviderMin/ProviderTarget can require it before the Starknet spec (#2341) goes live. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9
* feat: update starknet spec for Starknet 0.14.3 / JSON-RPC v0.10 Starknet 0.14.3 (and pathfinder v0.23.0, released 2026-07-20) removed JSON-RPC v0.8 and older; nodes now serve v0.9 (root default) and v0.10 (final v0.10.1 spec on the v0_10 routes). Update STRK and STRKS specs accordingly: - add /rpc/v0_10 and /ws/rpc/v0_10 collections (inheritance-only, mirroring the v0_9 pair) - remove the /rpc/v0_8 and /ws/rpc/v0_8 collections (RPC 0.8 removed by Starknet 0.14.3; pathfinder no longer serves these endpoints) - add missing spec methods: starknet_getBlockWithReceipts, starknet_getCompiledCasm, starknet_getMessagesStatus, starknet_getStorageProof - remove starknet_pendingTransactions (dropped from the RPC spec; no served version supports it) - replace the legacy pathfinder_subscribe/pathfinder_unsubscribe WS API (removed in pathfinder 0.18.0) with the spec WS subscription family: starknet_subscribeNewHeads/Events/TransactionStatus/NewTransactions/ NewTransactionReceipts + starknet_unsubscribe, one SUBSCRIBE parse directive per method (solana-style) - pathfinder extension collection: drop pathfinder_getProof and pathfinder_getTransactionStatus (removed in pathfinder 0.17.0, superseded by starknet_getStorageProof/starknet_getTransactionStatus), add pathfinder_lastL1AcceptedBlockHashAndNumber - average_block_time 30000/32000 -> 2000 for Starknet 0.14.x fast blocks (matches base/optimism convention for ~2s chains) Update TestJsonRpcInternalPathsMultipleVersionsStarkNet to the new path set and refresh the starknet provider example configs (v0_9/v0_10). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6w48eT5tW9K8iUNCm7PG * feat: support starknet v0.9+ ws subscription envelope in rpcclient The starknet_subscribe* APIs added to the spec need runtime support the node ws client lacked: - notifications use methods named starknet_subscriptionXxx with params {subscription_id, result}; none of the existing dispatch shapes (ethereum "_subscription" suffix, solana "Notification" suffix, legacy pathfinder top-level result) matched, so they were silently dropped. Add a dedicated predicate and handler keyed by params.subscription_id. - Client.Subscribe rejected the canonical starknet subscribe forms: by-name object params without a tendermint "query" key errored, and omitted params hit "unknown parameters type". Make "query" optional (tendermint-only) and accept nil params. Also apply spec calibration from review: starknet_estimateFee block_id positional index 1 -> 2 (v0.9/v0.10 params are [request, simulation_flags, block_id]) and allowed_block_lag_for_qos_sync -> 5, matching the base/optimism convention for ~2s block chains now that average_block_time is 2000. Adds predicate unit tests and an end-to-end mock-node websocket test covering object params, string subscription ids, envelope delivery and unknown-id drops. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6w48eT5tW9K8iUNCm7PG * fix: order subscription registration before unblocking Subscribe caller handleResponse sent op.resp <- msg before writing op.err and registering the subscription in clientSubs, racing with requestOp.wait which reads op.err immediately after receiving. On an error response the caller could observe a stale nil error and treat a failed subscription as successful. The race was previously unreachable in tests; the new starknet subscription end-to-end test tripped it deterministically under -race. Move all op.err writes and subscription registration before the op.resp send for subscription responses (matching upstream go-ethereum's ordering) while preserving this fork's behavior of returning the raw response message to the caller. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6w48eT5tW9K8iUNCm7PG * chore: move Starknet spec changes to their own PR Restore the STRK/STRKS spec, the Starknet provider examples and the Starknet internal-path test to main. They move to the ofir/starknet-spec-v010 PR, which must merge only after this code is released and providers have upgraded. This PR keeps the rpcclient runtime support. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9 * fix(consumer): match by-name unsubscribe params to subscriptions The consumer only matched an unsubscribe to its subscription when the id came positionally (["0x1"]). starknet.js sends starknet_unsubscribe by name ({"subscription_id": "0x1"}), which got "subscription not found" and left the subscription open until the websocket closed. When the raw params match nothing and they are a single-entry object with a string value, retry with that value. The raw match still runs first, so tendermint (whose id is the whole params object) is unchanged. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9 * fix(rpcclient): reject non-string tendermint query param Subscribe stopped erroring when by-name params carried a "query" that was not a string. That subscription then registered under the response id, while tendermint notifications are routed by query, so they were all dropped silently. Error again when "query" is present but not a string. When "query" is absent (starknet by-name params), the id still comes from the response. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9 * test(rpcclient): use TestComponent_Scenario names for Starknet tests Rename TestIsStarknetNotification and TestStarknetSubscriptionEndToEnd to TestStarknetNotification_Detection and TestStarknetSubscription_EndToEnd, per the repo's test naming convention. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9 * chore: bump protocol TARGET_VERSION to 6.2.9 Gives the release with the Starknet v0.9+ subscription support its own protocol version, so ProviderMin/ProviderTarget can require it before the Starknet spec (#2341) goes live. Claude-Session: https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9 --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ignacio Rodriguez <ignacio.rsg@gmail.com>
PR Summary by QodoUpdate Starknet specs for JSON-RPC v0.9/v0.10 and subscriptions
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
|
Generated by Claude Code |
Description
Closes: N/A
Updates the STRK and STRKS specs for Starknet 0.14.3 nodes (pathfinder v0.23+), which serve only JSON-RPC v0.9 and v0.10. Split out of #2318, which carries the runtime code.
Important
Merge gate. Merge only after:
ProviderTarget/ProviderMinto 6.2.9 upgrades providers that run under lavavisor. The lavap binary itself doesn't enforce the minimum, so check the health monitor for STRK providers still off the target version./rpc/v0_10isn't served until a restart.Until providers upgrade,
starknet_subscribe*on an old provider either errors (by-name or omitted params, which is what starknet.js sends) or succeeds and then delivers no notifications (positional params). Anyone running--use-static-specagainstmainpicks this spec up as soon as it merges.Spec changes (STRK and STRKS)
/rpc/v0_10and/ws/rpc/v0_10. Remove/rpc/v0_8and/ws/rpc/v0_8, along with thepending-block-supportcheck that lived therestarknet_getBlockWithReceipts(20 CU),starknet_getCompiledCasm(100),starknet_getMessagesStatus(10),starknet_getStorageProof(20),pathfinder_lastL1AcceptedBlockHashAndNumber(20)pathfinder_subscribe/pathfinder_unsubscribereplaced bystarknet_subscribeNewHeads,starknet_subscribeEvents,starknet_subscribeTransactionStatus,starknet_subscribeNewTransactions,starknet_subscribeNewTransactionReceipts(1000 CU each) andstarknet_unsubscribe(10)starknet_pendingTransactions,pathfinder_getProof,pathfinder_getTransactionStatusstarknet_estimateFeereadsblock_idfrom param index 2 (was 1)average_block_time30000/32000 → 2000 ms (mainnet measures ~1.84 s per block).allowed_block_lag_for_qos_sync2/1 → 5The provider examples (
config/provider_examples/strk*.ymlandprovider_example_cookbook/starknet_*.yml) now use the v0_9/v0_10 paths.TestJsonRpcInternalPathsMultipleVersionsStarkNetis updated to the new paths.Consumer ↔ provider impact
No wire-format change. Both sides read the spec, so once it's live:
starknet_add*Transaction) get 4 s of extra relay timeout instead of 60 s. Providers already measure the real block time; consumers use the spec value, so this brings them in lineestimateFeeindexTesting
go test ./x/spec/keeper/ -run '^TestSpecs$'(loads and validates every mainnet-1 and testnet-2 spec)go test ./protocol/... ./x/spec/...passes on this branch by itself, without feat(rpcclient): support Starknet v0.9+ websocket subscriptions #2318's codeAuthor Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!in the type prefix if API or client breaking change (removes the v0_8 paths and legacy pathfinder APIs, which upstream nodes no longer serve)mainbranchReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
https://claude.ai/code/session_01NDkG48rHipQHQWQgcAGKM9