Skip to content

Commit 1927a4d

Browse files
committed
Merge branch 'development'
2 parents 9cfb21c + b12812e commit 1927a4d

File tree

96 files changed

+2863
-4141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2863
-4141
lines changed

.github/workflows/checks.yml

Lines changed: 46 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: Checks
22

3+
env:
4+
STARKNET_VERSION: "0.13.0"
5+
RPC_SPEC_VERSION: "0.6.0"
6+
DEVNET_SHA: "1bd447d"
7+
38
on:
49
push:
510
branches:
@@ -115,48 +120,6 @@ jobs:
115120
name: contract-artifacts
116121
path: starknet_py/tests/e2e/mock/
117122

118-
# ====================== CAIRO SETUP ====================== #
119-
120-
- name: Install rust
121-
run: |
122-
curl https://sh.rustup.rs -sSf | sh -s -- -y
123-
124-
- name: Clone Cairo1 compiler repository
125-
uses: actions/checkout@v3
126-
with:
127-
repository: starkware-libs/cairo
128-
persist-credentials: false
129-
ref: v2.0.0
130-
path: cairo
131-
132-
- name: Cache rust dependencies
133-
id: cache-rust
134-
uses: actions/cache@v3
135-
with:
136-
path: |
137-
~/.cargo/bin/
138-
~/.cargo/registry/index/
139-
~/.cargo/registry/cache/
140-
~/.cargo/git/db/
141-
target/
142-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
143-
144-
- name: Build compiler
145-
if: steps.cache-rust.outputs.cache-hit != 'true'
146-
working-directory: ./cairo
147-
run: |
148-
cargo build
149-
150-
- name: Build starknet-compile
151-
working-directory: ./cairo
152-
run: |
153-
cargo run --bin starknet-compile -- --version
154-
cargo run --bin starknet-sierra-compile -- --version
155-
156-
- name: Create manifest file
157-
run: |
158-
readlink -f cairo/Cargo.toml >> starknet_py/tests/e2e/manifest-path
159-
160123
# ---------------------------------------------------------- #
161124
# ........................RUN-TESTS......................... #
162125
# ---------------------------------------------------------- #
@@ -171,6 +134,8 @@ jobs:
171134
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
172135
steps:
173136
- uses: actions/checkout@v3
137+
- uses: actions-rust-lang/setup-rust-toolchain@v1
138+
- uses: Swatinem/rust-cache@v2
174139

175140
- name: Download contracts
176141
uses: actions/download-artifact@v3
@@ -206,6 +171,14 @@ jobs:
206171
run: |
207172
poetry install --without py39-dev
208173
174+
# ====================== SETUP DEVNET ====================== #
175+
176+
- name: Install devnet
177+
run: |
178+
cargo install --locked \
179+
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
180+
--rev ${{ env.DEVNET_SHA }}
181+
209182
# ====================== RUN TESTS ====================== #
210183

211184
- name: Check circular imports
@@ -214,10 +187,8 @@ jobs:
214187
215188
- name: Run tests
216189
run: |
217-
poetry run poe test_ci_full_node_v2
218-
poetry run poe test_ci_full_node_v1
219-
poetry run poe test_ci_gateway_v2
220-
poetry run poe test_ci_gateway_v1
190+
poetry run poe test_ci_v2
191+
poetry run poe test_ci_v1
221192
222193
- name: Generate coverage in XML
223194
run: |
@@ -288,8 +259,7 @@ jobs:
288259
289260
- name: Run tests
290261
run: |
291-
poetry run poe test_ci_on_networks_full_node
292-
poetry run poe test_ci_on_networks_gateway
262+
poetry run poe test_ci_on_networks
293263
294264
- name: Generate coverage in XML
295265
run: |
@@ -313,6 +283,8 @@ jobs:
313283
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
314284
steps:
315285
- uses: actions/checkout@v3
286+
- uses: actions-rust-lang/setup-rust-toolchain@v1
287+
- uses: Swatinem/rust-cache@v2
316288

317289
- name: Download contracts
318290
uses: actions/download-artifact@v3
@@ -325,22 +297,10 @@ jobs:
325297
python-version: "3.9"
326298
cache: 'pip'
327299

328-
# ====================== SETUP WSL ====================== #
300+
# ====================== SETUP DEVNET ====================== #
329301

330-
- name: Setup WSL
331-
uses: Vampire/setup-wsl@v2
332-
333-
- name: Setup WSL devnet
334-
shell: wsl-bash {0}
335-
run: |
336-
sudo apt-get -y update
337-
sudo apt install -y wget software-properties-common
338-
sudo add-apt-repository ppa:deadsnakes/ppa
339-
sudo apt install -y python3.9
340-
apt-get install -y python3-pip
341-
sudo apt install -y libgmp3-dev
342-
sudo apt-get install -y git
343-
pip3 install git+https://github.com/0xSpaceShard/starknet-devnet.git@v0.6.2
302+
- name: Install devnet
303+
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}
344304

345305
# ====================== SETUP PYTHON ====================== #
346306

@@ -373,10 +333,8 @@ jobs:
373333
374334
- name: Run tests
375335
run: |
376-
poetry run poe test_ci_full_node_v2
377-
poetry run poe test_ci_full_node_v1
378-
poetry run poe test_ci_gateway_v2
379-
poetry run poe test_ci_gateway_v1
336+
poetry run poe test_ci_v2
337+
poetry run poe test_ci_v1
380338
381339
- name: Generate coverage in XML
382340
run: |
@@ -399,6 +357,8 @@ jobs:
399357
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
400358
steps:
401359
- uses: actions/checkout@v3
360+
- uses: actions-rust-lang/setup-rust-toolchain@v1
361+
- uses: Swatinem/rust-cache@v2
402362

403363
- name: Download contracts
404364
uses: actions/download-artifact@v3
@@ -434,14 +394,20 @@ jobs:
434394
run: |
435395
poetry install --without py39-dev
436396
397+
# ====================== SETUP DEVNET ====================== #
398+
399+
- name: Install devnet
400+
run: |
401+
cargo install --locked \
402+
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
403+
--rev ${{ env.DEVNET_SHA }}
404+
437405
# ====================== RUN TESTS ====================== #
438406

439407
- name: Run tests
440408
run: |
441-
poetry run poe test_ci_docs_full_node_v2
442-
poetry run poe test_ci_docs_full_node_v1
443-
poetry run poe test_ci_docs_gateway_v2
444-
poetry run poe test_ci_docs_gateway_v1
409+
poetry run poe test_ci_docs_v2
410+
poetry run poe test_ci_docs_v1
445411
446412
- name: Generate coverage in XML
447413
run: |
@@ -465,6 +431,8 @@ jobs:
465431
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
466432
steps:
467433
- uses: actions/checkout@v3
434+
- uses: actions-rust-lang/setup-rust-toolchain@v1
435+
- uses: Swatinem/rust-cache@v2
468436

469437
- name: Download contracts
470438
uses: actions/download-artifact@v3
@@ -477,23 +445,6 @@ jobs:
477445
python-version: "3.9"
478446
cache: 'pip'
479447

480-
# ====================== SETUP WSL ====================== #
481-
482-
- name: Setup WSL
483-
uses: Vampire/setup-wsl@v2
484-
485-
- name: Setup WSL devnet
486-
shell: wsl-bash {0}
487-
run: |
488-
sudo apt-get -y update
489-
sudo apt install -y wget software-properties-common
490-
sudo add-apt-repository ppa:deadsnakes/ppa
491-
sudo apt install -y python3.9
492-
apt-get install -y python3-pip
493-
sudo apt install -y libgmp3-dev
494-
sudo apt-get install -y git
495-
pip3 install git+https://github.com/0xSpaceShard/starknet-devnet.git@v0.6.2
496-
497448
# ====================== SETUP PYTHON ====================== #
498449

499450
- name: Install poetry
@@ -517,14 +468,17 @@ jobs:
517468
run: |
518469
poetry install --without py39-dev
519470
471+
# ====================== SETUP DEVNET ====================== #
472+
473+
- name: Install devnet
474+
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}
475+
520476
# ====================== RUN TESTS ====================== #
521477

522478
- name: Run tests
523479
run: |
524-
poetry run poe test_ci_docs_full_node_v2
525-
poetry run poe test_ci_docs_full_node_v1
526-
poetry run poe test_ci_docs_gateway_v2
527-
poetry run poe test_ci_docs_gateway_v1
480+
poetry run poe test_ci_docs_v2
481+
poetry run poe test_ci_docs_v1
528482
529483
- name: Generate coverage in XML
530484
run: |

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ This is the recommended way of using the SDK.
3737

3838
```python
3939
from starknet_py.contract import Contract
40-
from starknet_py.net.gateway_client import GatewayClient
40+
from starknet_py.net.full_node_client import FullNodeClient
4141

4242
contract = await Contract.from_address(
4343
address="0x06689f1bf69af5b8e94e5ab9778c885b37c593d1156234eb423967621f596e73",
44-
client=GatewayClient("testnet"),
44+
client=FullNodeClient(node_url="https://your.node.url"),
4545
)
4646
(value,) = await contract.functions["get_balance"].call()
4747
```
@@ -52,11 +52,11 @@ You can access synchronous world with `_sync` postfix.
5252

5353
```python
5454
from starknet_py.contract import Contract
55-
from starknet_py.net.gateway_client import GatewayClient
55+
from starknet_py.net.full_node_client import FullNodeClient
5656

5757
contract = Contract.from_address_sync(
5858
address="0x06689f1bf69af5b8e94e5ab9778c885b37c593d1156234eb423967621f596e73",
59-
client=GatewayClient("testnet"),
59+
client=FullNodeClient(node_url="https://your.node.url"),
6060
)
6161
(value,) = contract.functions["get_balance"].call_sync()
6262
```

docs/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ API
33
.. toctree::
44

55
api/client
6-
api/gateway_client
76
api/full_node_client
87
api/account
98
api/client_models

docs/api/client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Client
22
======
33

44
Base class for clients interacting with Starknet.
5-
Implemented by :ref:`GatewayClient` and :ref:`FullNodeClient`.
5+
Implemented by :ref:`FullNodeClient`.
66

77
.. py:module:: starknet_py.net.client
88

docs/api/gateway_client.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/api/models.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,25 @@ Module containing base models and functions to operate on them.
1313
:exclude-members: __init__, __new__
1414
:members:
1515

16-
.. autoclass:: DeployAccount
16+
.. autoclass:: DeployAccountV1
1717
:exclude-members: __init__, __new__
1818

19-
.. autoclass:: Declare
19+
.. autoclass:: DeployAccountV3
20+
:exclude-members: __init__, __new__
21+
22+
.. autoclass:: DeclareV1
2023
:exclude-members: __init__, __new__
2124

2225
.. autoclass:: DeclareV2
2326
:exclude-members: __init__, __new__
2427

25-
.. autoclass:: Invoke
28+
.. autoclass:: DeclareV3
29+
:exclude-members: __init__, __new__
30+
31+
.. autoclass:: InvokeV1
32+
:exclude-members: __init__, __new__
33+
34+
.. autoclass:: InvokeV3
2635
:exclude-members: __init__, __new__
2736

2837
.. autoenum:: StarknetChainId

docs/api/transaction_errors.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ Transaction errors
99
.. autoclass:: TransactionRejectedError
1010
:exclude-members: __init__, __new__
1111

12+
.. autoclass:: TransactionRevertedError
13+
:exclude-members: __init__, __new__
14+
1215
.. autoclass:: TransactionNotReceivedError
1316
:exclude-members: __init__, __new__

docs/development.rst

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,23 @@ Make sure running ``poetry run python --version`` returns ``Python 3.9.x``.
1515
Setup
1616
-----
1717

18-
In order to run Cairo1 devnet tests and compile contracts in Cairo1 via poetry command,
19-
you need to create ``manifest-path`` file in ``starknet_py/tests/e2e/`` directory and pass the path in it to Cairo compiler.
20-
An example file - ``manifest-path.template`` is in the same directory. Additional info can be found in `devnet docs <https://0xspaceshard.github.io/starknet-devnet/docs/guide/cairo1-support>`_.
18+
In order to run tests on devnet, you need to install `starknet-devnet-rs <https://github.com/0xSpaceShard/starknet-devnet-rs>`_.
19+
The correct version of devnet to use corresponds to the Starknet and RPC specification that are currently supported by Starknet.py.
20+
Information about the supported version for the latest release can be found in the :doc:`migration guide<migration_guide>`.
21+
22+
To avoid version discrepancies or other related issues, we recommend installing this dependency using the ``cargo install`` command, and specifying a certain commit along with the correct Starknet and RPC versions.
23+
24+
Below is the command you can use to do this, designed for compatibility with the current version of Starknet.py:
25+
26+
.. code-block:: bash
27+
28+
STARKNET_VERSION="0.12.3" RPC_SPEC_VERSION="0.5.1" \
29+
cargo install \
30+
--locked \
31+
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
32+
--rev 78527de
33+
34+
If you choose to install `starknet-devnet-rs <https://github.com/0xSpaceShard/starknet-devnet-rs>`_ using a different method, please make sure to add the executable ``starknet-devnet`` to your ``PATH`` environment variable.
2135

2236
In order to be able to run tests on testnet and integration networks (``starknet_py/tests/e2e/tests_on_networks/``), you must set some environmental variables:
2337

@@ -38,8 +52,6 @@ You can find an example file ``test-variables.env.template`` in the same directo
3852
3953
# Compile contracts
4054
poe compile_contracts
41-
poe compile_contracts_v1
42-
poe compile_contracts_v2
4355
4456
# Make sure everything was installed properly
4557
poe test

0 commit comments

Comments
 (0)