Skip to content

Commit 11cc665

Browse files
committed
Merge branch 'development'
2 parents c20a4cb + f3e2056 commit 11cc665

27 files changed

+572
-213
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ jobs:
361361
- name: Install devnet
362362
run: |
363363
$DEVNET_INSTALL_DIR = "$(git rev-parse --show-toplevel)/starknet_py/tests/e2e/devnet"
364-
cargo install --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --locked --rev 3ad81456092a2da939be1f590855cea2c18ce40c --root $DEVNET_INSTALL_DIR
364+
cargo install --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --locked --rev 7e7dbb5 --root $DEVNET_INSTALL_DIR
365365
366366
# ====================== SETUP PYTHON ====================== #
367367

@@ -515,7 +515,7 @@ jobs:
515515
- name: Install devnet
516516
run: |
517517
$DEVNET_INSTALL_DIR = "$(git rev-parse --show-toplevel)/starknet_py/tests/e2e/devnet"
518-
cargo install --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --locked --rev 3ad81456092a2da939be1f590855cea2c18ce40c --root $DEVNET_INSTALL_DIR
518+
cargo install --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --locked --rev 7e7dbb5 --root $DEVNET_INSTALL_DIR
519519
520520
# ====================== RUN TESTS ====================== #
521521

docs/devnet_utils.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Devnet Utils
2+
============
3+
4+
.. toctree::
5+
6+
devnet_utils/mocking_interaction_with_l1
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Mocking interaction with L1
2+
===========================
3+
4+
Abstract
5+
--------
6+
7+
In order to test interaction with L1 contracts, devnet client provides a way to mock the L1 interaction.
8+
Before taking a look at the examples, please get familiar with the `devnet postman docs <https://0xspaceshard.github.io/starknet-devnet-rs/docs/postman>`_ and messaging mechanism:
9+
10+
- `Writing messaging contracts <https://book.cairo-lang.org/ch16-04-L1-L2-messaging.html>`_
11+
- `Mechanism overview <https://docs.starknet.io/architecture-and-concepts/network-architecture/messaging-mechanism/>`_
12+
- `StarkGate example <https://docs.starknet.io/architecture-and-concepts/network-architecture/messaging-mechanism/>`_
13+
14+
L1 network setup
15+
----------------
16+
17+
First of all you should deploy `messaging contract <https://github.com/0xSpaceShard/starknet-devnet-rs/blob/138120b355c44ae60269167b326d1a267f7af0a8/contracts/l1-l2-messaging/solidity/src/MockStarknetMessaging.sol>`_
18+
on ethereum network or load the existing one.
19+
20+
.. codesnippet:: ../../starknet_py/tests/e2e/docs/devnet_utils/test_l1_integration.py
21+
:language: python
22+
:dedent: 4
23+
24+
25+
L2 -> L1
26+
--------
27+
28+
Deploying L2 interaction contract
29+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
Interaction with L1 is done by sending a message using `send_message_to_l1_syscall` function.
32+
So in order to test it, you need to deploy a contract that has this functionality.
33+
Example contract: `l1_l2.cairo <https://github.com/0xSpaceShard/starknet-devnet-js/blob/5069ec3397f31a408d3df2734ae40d93b42a0f7f/test/data/l1_l2.cairo>`_
34+
35+
.. codesnippet:: ../../starknet_py/tests/e2e/docs/devnet_utils/test_l1_integration.py
36+
:language: python
37+
:dedent: 4
38+
:start-after: docs: messaging-contract-start
39+
:end-before: docs: messaging-contract-end
40+
41+
42+
Consuming message
43+
^^^^^^^^^^^^^^^^^
44+
45+
After deploying the contract, you need to flush the messages to the L1 network.
46+
And then you can consume the message on the L1 network.
47+
48+
.. codesnippet:: ../../starknet_py/tests/e2e/docs/devnet_utils/test_l1_integration.py
49+
:language: python
50+
:dedent: 4
51+
:start-after: docs: flush-1-start
52+
:end-before: docs: flush-1-end
53+
54+
L1 -> L2
55+
--------
56+
57+
Sending mock transactions from L1 to L2 does not require L1 node to be running.
58+
59+
.. codesnippet:: ../../starknet_py/tests/e2e/docs/devnet_utils/test_l1_integration.py
60+
:language: python
61+
:dedent: 4
62+
:start-after: docs: send-l2-start
63+
:end-before: docs: send-l2-end
64+
65+

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Starknet SDK for Python
1919
account_creation
2020
quickstart
2121
guide
22+
devnet_utils
2223
api
2324
development
2425
migration_guide

docs/migration_guide.rst

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
Migration guide
22
===============
33

4+
******************************
5+
0.24.0 Migration guide
6+
******************************
7+
8+
.. currentmodule:: starknet_py.devnet_utils.devnet_client
9+
10+
1. :class:`DevnetClient` has been implemented to interact with additional features of the `starknet-devnet-rs <https://github.com/0xSpaceShard/starknet-devnet-rs>`_
11+
12+
.. currentmodule:: starknet_py.net.signer.ledger_signer
13+
14+
2. :class:`LedgerSigner` has been implemented to enable signing with Ledger hardware wallet
15+
16+
0.24.0 Targeted versions
17+
------------------------
18+
19+
- Starknet - `0.13.1.1 <https://docs.starknet.io/documentation/starknet_versions/version_notes/#version0.13.1.1>`_
20+
- RPC - `0.7.1 <https://github.com/starkware-libs/starknet-specs/releases/tag/v0.7.1>`_
21+
22+
0.24.0 Breaking changes
23+
-----------------------
24+
25+
.. currentmodule:: starknet_py.net.client_models
26+
27+
1. :class:`CompiledContract` and :class:`ContractClass` have been renamed to :class:`DeprecatedCompiledContract` and :class:`DeprecatedContractClass`.
28+
2. :class:`ContractClassSchema` have been renamed to :class:`DeprecatedContractClassSchema`
29+
430
******************************
531
0.23.0 Migration guide
632
******************************
@@ -31,8 +57,6 @@ Version 0.23.0 of **starknet.py** comes with support for `SNIP-12 <https://githu
3157
2. :meth:`Account.verify_message` now accepts parameter ``typed_data`` as both :class:`~starknet_py.utils.typed_data.TypedData` and :class:`~starknet_py.net.models.typed_data.TypedDataDict`
3258
3. :meth:`~starknet_py.net.signer.stark_curve_signer.KeyPair.from_keystore` has been added
3359

34-
3. :class:`CompiledContract`, :class:`ContractClass` and :class:`ContractClassSchema` have been renamed to :class:`DeprecatedCompiledContract`, :class:`DeprecatedContractClass` and :class:`DeprecatedContractClassSchema`
35-
3660
******************************
3761
0.22.0 Migration guide
3862
******************************

0 commit comments

Comments
 (0)