Skip to content

Commit 4acdbdb

Browse files
Add changes from rpc 0.8.1 (#1586)
* Move `devnet.yml` to `composite-actions` dir * Format * Rename devnet composite action * Update devnet action path * Add missing `shell` property * Refactor devnet installation action; Add temporary workflow which will create devnet cache * Add inputs to steps using devnet action * Add missing checkout step * Add missing `devnet_sha` input to devnet setup workflow * Fix devnet installation action - use `devnet_sha` input * Trgigger CI * Remove `install_devnet.yml` workflow * Add todo in `checks.yml` * Remove temporary step for showing dirs * Move `parsed_abi_v2` into `test_event_serialization_v2` * Fix formatting * Add echo for displaying contracts v2 directory contents * Fix displaying contents of contracts v2 directory * Temporary change for displaying directory contents * Temporarily list contract v2 directory * Temporarily display owd * Revert "Temporarily display owd" This reverts commit 2ad7fe7. * Include Python 3.9 in `Setup Tests` job * Remove CI changes apart from modified devnet installation * Temporarily display directory with compiled contracts * Fix ls * Fix ls * Unconditionally compile contracts v1 and v2 * Use asdf action * Implement `test_get_transaction_status_with_failure_reason`; Code cleanup * Fix linting; Tests cleanup * Update regex in `test_rejection_reason_in_transaction_receipt` * Skip `test_compute_deploy_account_v3_transaction_hash` * Format * Skip `test_block_with_receipts_latest` * Fix failing docs tests * Fix linting * Remove contracts conditional compilation on CI * Add contracts compilation steps in docs tests * Skip `test_get_transaction_by_block_id`; Add todo * Skip `test_get_transaction_by_block_id`; Add todo * Skip `test_using_full_node_client`; Add todo * Skip `test_get_transaction_by_block_id`; Add todo * Add todos * Add todos in workflow * Update resource bounds params * Minor refactor of resource bounds params usage * Apply code review suggestion * Add `storage_root` field to `ContractLeafData` * Rename `block` to `block_id` param in ws methods * Add `is_reverted` field to `FunctionInvocation` * Add todo * Remove `block_id` param from `starknet_subscribeTransactionStatus` endpoint * Remove `contracts_storage_proof` field from `ContractsProof` * Fix `storage_root` data key * Implement `test_get_messages_status` * Fix `test_latest_resource_bounds_take_precedence` * Fix `test_deploy_prefunded_account` * Remove mocks from full node client * Add `l1_data_gas` to `ExecutionResources` * Update `CommonTransactionV3Fields.compute_resource_bounds_for_fee` * Add `l1_data_gas` to ExecutionResourcesSchema` * Fix `FullNodeClient.estimate_fee` * Fix contract tests * Temporarily skip some tests; Fix other tests * Update devnet sha * Remove code, tests and docs for old txs * Fix lint and typecheck * Fix formatting * Fix lint and typecheck * Remove old txs usages, adjust tests and docs * Fix tests * Remove todos * Remove `test_account_get_balance_eth` * Fix other tests * Skip test * Adjust devnet * Fix skip mark * Remove skip marks; Fix tests * Update ledger app sha * Refactor assertion in test * Restore original `test_ci_v2` * Remove `ResourceBounds.init_with_l1_gas_only` * Add todos * Formatting * Adjust todos and fixmes * Use `argent_account_class_hash` in `test_deploy_account_and_transfer` * Fix `test_deploy_account_and_transfer` * Revert "Fix `test_deploy_account_and_transfer`" This reverts commit d4c2eed. * Revert "Use `argent_account_class_hash` in `test_deploy_account_and_transfer`" This reverts commit 240c8ad. * Skip and add todo for `test_deploy_account_and_transfer` * Update skip message for `test_get_transaction_by_block_id` * Update todo * Remove `--initial-balance` flag for devnet start * Revert "Remove `--initial-balance` flag for devnet start" This reverts commit d9a2091. * Fix models and schemas for `get_storage_proof`; Add tests * Add storage proof response json * Restore values in storage proof response json * Use shorter example response for `get_storage_proof` test * Adjust storage proof tests * Remove helper function * Update migration guide * Update migration guide * Fix linting * Fix formatting * Remove unused imports * Add file with `ContractsStorageKeysSchema` * Fix `test_get_storage_proof` * Remove multipliers from `EstimatedFee.to_resource_bounds` * update todo * Fix and update network tests * Fix devnet client tests * Fix CI * Use asdf action * Restore `Download contracts` step in CI * Temporarily list contracts dir * Update listing dirs * Update listing dirs * Temporary CI change * Display compiled contracts path * Compile contract before running tests in CI * Partially implement `test_get_compiled_casm` * Fix params in `FullNodeClient.get_compiled_casm` * Update dependencies * Restore read api for txs other than v3 * Refactor broadcasted txn schemas * Add todo as skip reason * Add `test_sign_invoke_v3_auto_estimate` * Run `poetry lock` * Restore test values in `test_get_transaction_by_block_id_and_index` * Fix docs * Docstrings formatting * Add todos * Remove old transactions (#1557) * Fix `test_transaction_not_received_max_fee_too_big` * Fix and update network tests (#1563) * Add rust toolchain installation * Add `HintSchema`; Rename fields * Update field names in models * Add tests for `get_compiled_casm` * Move models and schema from executables api to separate files * Add docs * Fix migration guide * Rename file * Fix `test_get_compiled_casm` for devnet * Remove unused import * Add `STARKNET_PY_MARSHMALLOW_UNKNOWN_EXCLUDE` to CI * Change `index_delta_minus_1` to `index_delta_minus1` * Add fixes in executables schemas and models * Use schema with excluding unknown fields for `CasmClassSchema` * Update todos * Support `starknet_getCompiledCasm` (#1514) * Add todos * Add missing websocket API methods; Add tests * Fix formatting * Remove composite action * Format and lint * Add more tests * Further improvements of websocket client * Remove api docs (will be added in subsequent PR) * Run `poetry lock` * Update docstrings * Add `WebsocketClientError` * Fix `pytest_plugins` * Remove unused schemas; Refactor passing block number and block hash params * Remove unused `WSClient` * Add `devnet_ws` fixture * Add `test_new_heads_subscription_block_not_found` * Remove prints * Fix passing block id * Update websocket schemas * Add devnet websocket fixture * Remove `test_new_heads_subscription_block_not_found` * Restructure files; Add new tests * Remove unused model * Add missing docstrings * Update subscription id type to `str` (RPC 0.8.1) * Fix formatting * Remove unused schema * Add `is_connected` property; Add connection test * Little comments cleanup * Add websockets docs; Add code examples * Add api and guide docs files * Remove unneeded file * Rename `reorg_notification_handler` to `on_chain_reorg` * Fix formatting * Trigger CI * Format docstrings of `subscribe_pending_transactions` * Fix docs * Update `transaction_details` param description * Increase sleep time in `test_subscribe_transaction_status` * Fix serialize method in `PendingTransactionsNotificationResultField` * Temporarily disable braavos integration * Fix migration guide * Update docs * Code refactor * Apply code review suggestions * Apply code review suggestions * Change subscription id type to int * Add changes from rpc 0.8.1 * Use sepolia client in `test_account_execute_v3_braavos` * Update migration guide * Update rpc and starknet version in migration guide * Update migration guide * Remove argent changes * Remove account util * Update migration guide
1 parent 7831b93 commit 4acdbdb

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

docs/migration_guide.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ Migration guide
55
0.26.0 Migration guide
66
**********************
77

8-
Version 0.26.0 of **starknet.py** comes with support for RPC 0.8.0!
8+
Version 0.26.0 of **starknet.py** comes with support for RPC 0.8.1!
99

1010
0.26.0 Targeted versions
1111
------------------------
1212

13-
- Starknet - `0.13.4 <https://docs.starknet.io/documentation/starknet_versions/version_notes/#version0.13.4>`_
14-
- RPC - `0.8.0 <https://github.com/starkware-libs/starknet-specs/releases/tag/v0.8.0>`_
13+
- Starknet - `0.13.5 <https://docs.starknet.io/documentation/starknet_versions/version_notes/#version0.13.5>`_
14+
- RPC - `0.8.1 <https://github.com/starkware-libs/starknet-specs/releases/tag/v0.8.1>`_
1515

1616
.. py:currentmodule:: starknet_py.net.full_node_client
1717

starknet_py/net/websockets/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Notification(Generic[T]):
2929
Base class for notification.
3030
"""
3131

32-
subscription_id: int
32+
subscription_id: str
3333
result: T
3434

3535

starknet_py/net/websockets/websocket_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, node_url: str):
6161
self.node_url: str = node_url
6262
self.connection: Optional[ClientConnection] = None
6363
self._listen_task: Optional[asyncio.Task] = None
64-
self._subscriptions: Dict[int, NotificationHandler] = {}
64+
self._subscriptions: Dict[str, NotificationHandler] = {}
6565
self._message_id = 0
6666
self._pending_responses: Dict[int, asyncio.Future] = {}
6767
self._on_chain_reorg: Optional[Callable[[ReorgNotification], Any]] = None
@@ -101,7 +101,7 @@ async def subscribe_new_heads(
101101
handler: Callable[[NewHeadsNotification], Any],
102102
block_hash: Optional[Union[Hash, LatestTag]] = None,
103103
block_number: Optional[Union[int, LatestTag]] = None,
104-
) -> int:
104+
) -> str:
105105
"""
106106
Creates a WebSocket stream which will fire events for new block headers.
107107
@@ -125,7 +125,7 @@ async def subscribe_events(
125125
keys: Optional[List[List[int]]] = None,
126126
block_hash: Optional[Union[Hash, LatestTag]] = None,
127127
block_number: Optional[Union[int, LatestTag]] = None,
128-
) -> int:
128+
) -> str:
129129
"""
130130
Creates a WebSocket stream which will fire events for new Starknet events with applied filters.
131131
@@ -160,7 +160,7 @@ async def subscribe_transaction_status(
160160
self,
161161
handler: Callable[[TransactionStatusNotification], Any],
162162
transaction_hash: int,
163-
) -> int:
163+
) -> str:
164164
"""
165165
Creates a WebSocket stream which at first fires an event with the current known transaction status, followed
166166
by events for every transaction status update.
@@ -181,7 +181,7 @@ async def subscribe_pending_transactions(
181181
handler: Callable[[PendingTransactionsNotification], Any],
182182
transaction_details: Optional[bool] = None,
183183
sender_address: Optional[List[int]] = None,
184-
) -> int:
184+
) -> str:
185185
"""
186186
Creates a WebSocket stream which will fire events when a new pending transaction is added.
187187
While there is no mempool, this notifies of transactions in the pending block.
@@ -226,7 +226,7 @@ def on_chain_reorg(self, handler: Callable[[ReorgNotification], Any]):
226226
"""
227227
self._on_chain_reorg = handler
228228

229-
async def unsubscribe(self, subscription_id: int) -> bool:
229+
async def unsubscribe(self, subscription_id: str) -> bool:
230230
"""
231231
Close a previously opened WebSocket stream, with the corresponding subscription id.
232232
@@ -250,7 +250,7 @@ async def _subscribe(
250250
handler: Callable[[Any], Any],
251251
method: str,
252252
params: Optional[Dict[str, Any]] = None,
253-
) -> int:
253+
) -> str:
254254
""" "
255255
Creates a WebSocket stream which will fire events on a specific action.
256256

starknet_py/tests/e2e/client/websocket_client_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ async def test_subscribe_new_heads_too_many_blocks_back(
105105
async def test_unsubscribe_with_non_existing_id(
106106
websocket_client: WebsocketClient,
107107
):
108-
unsubscribe_result = await websocket_client.unsubscribe(123)
108+
unsubscribe_result = await websocket_client.unsubscribe("123")
109109
assert unsubscribe_result is False

0 commit comments

Comments
 (0)