Skip to content

Commit ff2639e

Browse files
Trace API (#1175)
* update gateway trace dataclass * add methods * fix enum fields deserialization * add testnet fixtures * fix fields in FunctionInvocation * add docstrings, hack get_block_traces in fullnode * bump devnet to 0.6.2 * format * fix fields * hack on simulateTransactions block_hash parameter * tests touches * fix tests for 0.6.2 devnet * fix trace api methods * add tests to trace api * fix tests * remove unused import * fix hashes in tests * fix trace api tests * skip invalid 0.12.2 test * format * fix test * fix test again... * change weird formatting * satisfy codecov * review changes * docs update * fix poetry.lock * format * change node urls to envs * set env vars in all test runs * add todo * change some variables to be environmental-dependent * fix CI secret variables * fix docs * add todos * add todo * change flags in simulateTransactions to enum * refactor💀r * add todo * change integration tests directory name, fixtures are lazy * update checks * move trace api devnet tests to full_node_test.py * update docs * update docs tests to not include testnet client * lint :^) * rename X_NODE_URL to X_RPC_URL * change fixture name * turn dict into class in InvokeTransactionTrace * CONTRACT_COMPILED_DIR -> CONTRACTS_COMPILED_V0_DIR * fix duplicate class * update test * rename class * wtf juno * update migration guide * update migration guide * raise warning when manifest-path not found * more info in development docs * change workflow name * info in warning * change comments * change comments * update scripts * docs development update * formatting
1 parent 14c69e8 commit ff2639e

Some content is hidden

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

48 files changed

+1382
-176
lines changed

.github/workflows/checks.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,22 @@ jobs:
227227
uses: codecov/codecov-action@v3
228228

229229
# ---------------------------------------------------------- #
230-
# ..................RUN-TESTS-INTEGRATION................... #
230+
# ..................RUN-TESTS-ON-NETWORKS................... #
231231
# ---------------------------------------------------------- #
232232

233-
run-tests-integration:
234-
name: Tests on integration
233+
run-tests-on-networks:
234+
name: Tests on networks (testnet and integration)
235235
needs: setup-tests
236236
runs-on: ubuntu-latest
237237
strategy:
238238
fail-fast: false
239+
env:
240+
INTEGRATION_RPC_URL: ${{ secrets.INTEGRATION_RPC_URL }}
241+
TESTNET_RPC_URL: ${{ secrets.TESTNET_RPC_URL }}
242+
INTEGRATION_ACCOUNT_PRIVATE_KEY: ${{ secrets.INTEGRATION_ACCOUNT_PRIVATE_KEY }}
243+
INTEGRATION_ACCOUNT_ADDRESS: ${{ secrets.INTEGRATION_ACCOUNT_ADDRESS }}
244+
TESTNET_ACCOUNT_PRIVATE_KEY: ${{ secrets.TESTNET_ACCOUNT_PRIVATE_KEY }}
245+
TESTNET_ACCOUNT_ADDRESS: ${{ secrets.TESTNET_ACCOUNT_ADDRESS }}
239246
steps:
240247
- uses: actions/checkout@v3
241248

@@ -281,8 +288,8 @@ jobs:
281288
282289
- name: Run tests
283290
run: |
284-
poetry run poe test_ci_integration_full_node
285-
poetry run poe test_ci_integration_gateway
291+
poetry run poe test_ci_on_networks_full_node
292+
poetry run poe test_ci_on_networks_gateway
286293
287294
- name: Generate coverage in XML
288295
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,4 @@ cython_debug/
154154

155155
# Cairo1 compiler manifest
156156
/starknet_py/tests/e2e/manifest-path
157+
/starknet_py/tests/e2e/test-variables.env

docs/development.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,31 @@ 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>`_.
21+
22+
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:
23+
24+
- ``INTEGRATION_RPC_URL``
25+
- ``TESTNET_RPC_URL``
26+
- ``INTEGRATION_ACCOUNT_PRIVATE_KEY``
27+
- ``INTEGRATION_ACCOUNT_ADDRESS``
28+
- ``TESTNET_ACCOUNT_PRIVATE_KEY``
29+
- ``TESTNET_ACCOUNT_ADDRESS``
30+
31+
The best way to do that is to create ``test-variables.env`` file in ``starknet_py/tests/e2e/`` directory, so they can be loaded by the ``python-dotenv`` library.
32+
You can find an example file ``test-variables.env.template`` in the same directory with the format of how it should look like.
33+
1834
.. code-block:: bash
1935
2036
# Install dependencies
2137
poetry install
2238
2339
# Compile contracts
2440
poe compile_contracts
41+
poe compile_contracts_v1
42+
poe compile_contracts_v2
2543
2644
# Make sure everything was installed properly
2745
poe test

docs/migration_guide.rst

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,91 @@
11
Migration guide
22
===============
33

4+
**********************
5+
0.18.2 Migration guide
6+
**********************
7+
8+
Version 0.18.2 of **starknet.py** comes with support of `RPC v0.4.0 <https://github.com/starkware-libs/starknet-specs/releases/tag/v0.4.0>`_ Trace API!
9+
10+
0.18.2 Targeted versions
11+
------------------------
12+
13+
- Starknet - `0.12.2 <https://community.starknet.io/t/introducing-p2p-authentication-and-mismatch-resolution-in-v0-12-2/97993>`_
14+
- RPC - `0.4.0 <https://github.com/starkware-libs/starknet-specs/releases/tag/v0.4.0>`_
15+
16+
0.18.2 Breaking changes
17+
-----------------------
18+
19+
.. currentmodule:: starknet_py.net.client
20+
21+
1. :meth:`Client.get_block_traces` has been renamed to :meth:`Client.trace_block_transactions` in order to match RPC specification.
22+
23+
24+
0.18.2 Minor changes
25+
--------------------
26+
27+
1. :meth:`Client.trace_block_transactions` return type has been changed from ``BlockTransactionTraces`` to ``Union[BlockTransactionTraces, List[BlockTransactionTrace]]``.
28+
29+
.. currentmodule:: starknet_py.net.gateway_client
30+
31+
2. ``include_block`` parameter in :meth:`GatewayClient.get_state_update` now works on gateway mainnet.
32+
33+
34+
0.18.2 Development-related changes
35+
----------------------------------
36+
37+
1. In order to be able to run tests, you must set some environmental variables:
38+
39+
- ``INTEGRATION_RPC_URL``
40+
- ``TESTNET_RPC_URL``
41+
- ``INTEGRATION_ACCOUNT_PRIVATE_KEY``
42+
- ``INTEGRATION_ACCOUNT_ADDRESS``
43+
- ``TESTNET_ACCOUNT_PRIVATE_KEY``
44+
- ``TESTNET_ACCOUNT_ADDRESS``
45+
46+
The best way to do that is to create ``test-variables.env`` file in ``starknet_py/tests/e2e/`` directory, so they can be loaded by the ``python-dotenv`` library.
47+
You can find an example file ``test-variables.env.template`` in the same directory with the format of how it should look like.
48+
49+
50+
|
51+
52+
.. raw:: html
53+
54+
<hr>
55+
56+
|
57+
58+
**********************
59+
0.18.1 Migration guide
60+
**********************
61+
62+
.. currentmodule:: starknet_py.net.gateway_client
63+
64+
This version contains a quick fix to :meth:`GatewayClient.get_state_update` method (mainnet wasn't updated to 0.12.2 then).
65+
66+
.. currentmodule:: starknet_py.net.account.account
67+
68+
Additionally, accounts in Cairo1 are now supported! You can pass additional argument ``cairo_version`` to :meth:`Account.sign_invoke_transaction` method.
69+
70+
71+
0.18.1 Minor changes
72+
--------------------
73+
74+
1. Parameter ``include_block`` in :meth:`GatewayClient.get_state_update` doesn't work on mainnet gateway (an error is thrown).
75+
76+
.. currentmodule:: starknet_py.net.account.account
77+
78+
2. :meth:`Account.sign_invoke_transaction` now accepts additional parameter ``cairo_version``, which allows specifying which type of calldata encoding should be used.
79+
80+
|
81+
82+
.. raw:: html
83+
84+
<hr>
85+
86+
|
87+
88+
489
**********************
590
0.18.0 Migration guide
691
**********************

0 commit comments

Comments
 (0)