Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update starknet-devnet #1239

Merged
merged 31 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5806f96
Add minimal changes to run starknet-devnet-rs locally
ddoktorski Dec 11, 2023
4436fc0
Fix or skip failing tests
ddoktorski Dec 11, 2023
80a72c5
Add devnet dependency to github workflow
ddoktorski Dec 11, 2023
dfee25d
Remove logic for `--cairo-compiler-manifest flag`
ddoktorski Dec 12, 2023
016f306
Add `DEVNET_PATH`
ddoktorski Dec 12, 2023
9448616
Install devnet from source
ddoktorski Dec 13, 2023
12dffba
Add devnet rs to windows tests
ddoktorski Dec 13, 2023
896a2e4
Update devnet fixture
ddoktorski Dec 14, 2023
1f6c9f4
Add devnet setup to all required jobs
ddoktorski Dec 14, 2023
6185526
Fix failing tests due to empty params dict
ddoktorski Dec 15, 2023
d2b5829
Temp fix for faling declare v2 in docs tests
ddoktorski Dec 15, 2023
3798ee8
Make some fields required in client_models according to rpc spec
ddoktorski Dec 15, 2023
e2cdbe9
Remove `status` field from `TransactionReceipt`
ddoktorski Dec 15, 2023
3c989b1
Unskip tests
ddoktorski Dec 15, 2023
1abc71a
Update TODO comments
ddoktorski Dec 15, 2023
b882401
Update development guide
ddoktorski Dec 15, 2023
5a0631e
Update migration guide
ddoktorski Dec 18, 2023
abae2ad
Fix docs build
ddoktorski Dec 18, 2023
fbbdd58
Fix failing tests on network
ddoktorski Dec 18, 2023
4c6d0be
Skip test with invalid signature
ddoktorski Dec 19, 2023
6e0dc40
Add devnet installation command to development guide
ddoktorski Dec 19, 2023
ff2d0af
Pass empty array to payload when params is none
ddoktorski Dec 20, 2023
9a5ed5a
Skip interaction tests only for v1 dir contracts
ddoktorski Dec 20, 2023
b9f9bf8
Reduce sleep time for devnet start
ddoktorski Dec 20, 2023
ce14aa3
Add skipif for test in docs
ddoktorski Dec 20, 2023
305359c
Add more info to development section
ddoktorski Dec 27, 2023
0d5d3f0
Use `get_transaction_status` in `wait_for_tx`
ddoktorski Dec 27, 2023
2cbb99d
Add `TransactionRejectedError` to docs
ddoktorski Dec 27, 2023
d1587fa
Return `tx_receipt` if not reverted
ddoktorski Dec 29, 2023
bd801ff
Fix lint
ddoktorski Dec 29, 2023
805dccc
Make field `type` required in `TransactionReceipt`
ddoktorski Dec 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 37 additions & 74 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Checks

env:
STARKNET_VERSION: "0.12.3"
RPC_SPEC_VERSION: "0.5.1"
DEVNET_SHA: "78527de"

ddoktorski marked this conversation as resolved.
Show resolved Hide resolved
on:
push:
branches:
Expand Down Expand Up @@ -115,48 +120,6 @@ jobs:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/

# ====================== CAIRO SETUP ====================== #

- name: Install rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y

- name: Clone Cairo1 compiler repository
uses: actions/checkout@v3
with:
repository: starkware-libs/cairo
persist-credentials: false
ref: v2.0.0
path: cairo

- name: Cache rust dependencies
id: cache-rust
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build compiler
if: steps.cache-rust.outputs.cache-hit != 'true'
working-directory: ./cairo
run: |
cargo build

- name: Build starknet-compile
working-directory: ./cairo
run: |
cargo run --bin starknet-compile -- --version
cargo run --bin starknet-sierra-compile -- --version

- name: Create manifest file
run: |
readlink -f cairo/Cargo.toml >> starknet_py/tests/e2e/manifest-path

# ---------------------------------------------------------- #
# ........................RUN-TESTS......................... #
# ---------------------------------------------------------- #
Expand All @@ -171,6 +134,8 @@ jobs:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2

- name: Download contracts
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -206,6 +171,14 @@ jobs:
run: |
poetry install --without py39-dev

# ====================== SETUP DEVNET ====================== #

- name: Install devnet
run: |
cargo install --locked \
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
--rev ${{ env.DEVNET_SHA }}
ddoktorski marked this conversation as resolved.
Show resolved Hide resolved

# ====================== RUN TESTS ====================== #

- name: Check circular imports
Expand Down Expand Up @@ -310,6 +283,8 @@ jobs:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2

- name: Download contracts
uses: actions/download-artifact@v3
Expand All @@ -322,22 +297,10 @@ jobs:
python-version: "3.9"
cache: 'pip'

# ====================== SETUP WSL ====================== #
# ====================== SETUP DEVNET ====================== #

- name: Setup WSL
uses: Vampire/setup-wsl@v2

- name: Setup WSL devnet
shell: wsl-bash {0}
run: |
sudo apt-get -y update
sudo apt install -y wget software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install -y python3.9
apt-get install -y python3-pip
sudo apt install -y libgmp3-dev
sudo apt-get install -y git
pip3 install git+https://github.com/0xSpaceShard/[email protected]
- name: Install devnet
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}

# ====================== SETUP PYTHON ====================== #

Expand Down Expand Up @@ -394,6 +357,8 @@ jobs:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2

- name: Download contracts
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -429,6 +394,14 @@ jobs:
run: |
poetry install --without py39-dev

# ====================== SETUP DEVNET ====================== #

- name: Install devnet
run: |
cargo install --locked \
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
--rev ${{ env.DEVNET_SHA }}

# ====================== RUN TESTS ====================== #

- name: Run tests
Expand Down Expand Up @@ -458,6 +431,8 @@ jobs:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2

- name: Download contracts
uses: actions/download-artifact@v3
Expand All @@ -470,23 +445,6 @@ jobs:
python-version: "3.9"
cache: 'pip'

# ====================== SETUP WSL ====================== #

- name: Setup WSL
uses: Vampire/setup-wsl@v2

- name: Setup WSL devnet
shell: wsl-bash {0}
run: |
sudo apt-get -y update
sudo apt install -y wget software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install -y python3.9
apt-get install -y python3-pip
sudo apt install -y libgmp3-dev
sudo apt-get install -y git
pip3 install git+https://github.com/0xSpaceShard/[email protected]

# ====================== SETUP PYTHON ====================== #

- name: Install poetry
Expand All @@ -510,6 +468,11 @@ jobs:
run: |
poetry install --without py39-dev

# ====================== SETUP DEVNET ====================== #

- name: Install devnet
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}

# ====================== RUN TESTS ====================== #

- name: Run tests
Expand Down
3 changes: 3 additions & 0 deletions docs/api/transaction_errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ Transaction errors
.. autoclass:: TransactionRejectedError
:exclude-members: __init__, __new__

.. autoclass:: TransactionRevertedError
:exclude-members: __init__, __new__

.. autoclass:: TransactionNotReceivedError
:exclude-members: __init__, __new__
22 changes: 17 additions & 5 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@ Make sure running ``poetry run python --version`` returns ``Python 3.9.x``.
Setup
-----

In order to run Cairo1 devnet tests and compile contracts in Cairo1 via poetry command,
you need to create ``manifest-path`` file in ``starknet_py/tests/e2e/`` directory and pass the path in it to Cairo compiler.
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>`_.
In order to run tests on devnet, you need to install `starknet-devnet-rs <https://github.com/0xSpaceShard/starknet-devnet-rs>`_.
The correct version of devnet to use corresponds to the Starknet and RPC specification that are currently supported by Starknet.py.
Information about the supported version for the latest release can be found in the :doc:`migration guide<migration_guide>`.

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.

Below is the command you can use to do this, designed for compatibility with the current version of Starknet.py:
ddoktorski marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: bash

STARKNET_VERSION="0.12.3" RPC_SPEC_VERSION="0.5.1" \
cargo install \
--locked \
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
--rev 78527de

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.

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:

Expand All @@ -38,8 +52,6 @@ You can find an example file ``test-variables.env.template`` in the same directo

# Compile contracts
poe compile_contracts
poe compile_contracts_v1
poe compile_contracts_v2

# Make sure everything was installed properly
poe test
Expand Down
3 changes: 3 additions & 0 deletions docs/migration_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ Migration guide
1. :class:`GatewayClient` all related classes and fields have been removed.
2. Client ``net`` property has been removed.
3. :class:`TransactionReceipt` field ``execution_resources`` has been changed from ``dict`` to :class:`ExecutionResources`.
4. :class:`TransactionReceipt` fields ``status`` and ``rejection_reason`` have been removed.
5. :class:`TransactionStatus`, :class:`TransactionExecutionStatus` and :class:`TransactionFinalityStatus` have been changed to have the same structure as in RPC specification.

0.19.0 Minor changes
--------------------

1. :class:`L1HandlerTransaction` field ``nonce`` is now required.
2. :class:`TransactionReceipt` fields ``finality_status``, ``execution_status`` and ``execution_resources`` are now required.

**********************
0.18.3 Migration guide
Expand Down
Loading