From 435897e90b872c0c3b03104cf8d53f0e4fbdd7e7 Mon Sep 17 00:00:00 2001 From: FabijanC Date: Thu, 1 Dec 2022 11:29:01 +0100 Subject: [PATCH 1/8] Update to 0.10.3a0; Add FAILED-TESTS.tmp [skip ci] --- poetry.lock | 17 ++++++++++++++--- pyproject.toml | 2 +- test/FAILED-TESTS.tmp | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 test/FAILED-TESTS.tmp diff --git a/poetry.lock b/poetry.lock index 067b374ad..58a22c21e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -127,7 +127,7 @@ python-versions = "~=3.7" [[package]] name = "cairo-lang" -version = "0.10.2" +version = "0.10.3a0" description = "Compiler and runner for the Cairo language" category = "main" optional = false @@ -1210,7 +1210,7 @@ multidict = ">=4.0" [metadata] lock-version = "1.1" python-versions = ">=3.8,<3.10" -content-hash = "5d2e3f6f6d65e388ede8ea362c654ffdacf5ee31637e5ee67c8c386fe50bfede" +content-hash = "bd896ec3b952f0869d3f0656784d017981e42005508b04c3b696de9a13f8266d" [metadata.files] aiohttp = [ @@ -1430,7 +1430,7 @@ cachetools = [ {file = "cachetools-5.2.0.tar.gz", hash = "sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757"}, ] cairo-lang = [ - {file = "cairo-lang-0.10.2.zip", hash = "sha256:4454e6e31dd49491ac4e17c6e0408baa1e7c3d08736cb556d9c7d40c555420c4"}, + {file = "cairo-lang-0.10.3a0.zip", hash = "sha256:432c94135090f799fce8e6cfa763d98a336080e3c2576bdd110c3aa26b004eaf"}, ] certifi = [ {file = "certifi-2022.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"}, @@ -1467,7 +1467,9 @@ crypto-cpp-py = [ {file = "crypto_cpp_py-1.0.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:4166fbe3ea025c3dfdcbf9269323a24c43af3f92880fbd8008891ea6b9489fc2"}, {file = "crypto_cpp_py-1.0.4-cp37-cp37m-win32.whl", hash = "sha256:e78d08225bd20d829f119ba2e00c11b69bf6d2a99b655e56181580290392a010"}, {file = "crypto_cpp_py-1.0.4-cp37-cp37m-win_amd64.whl", hash = "sha256:059e2ba230a22762087032fd508f7e8b5213ea5a18d1b091eb5c796093af9548"}, + {file = "crypto_cpp_py-1.0.4-cp38-cp38-macosx_10_9_arm64.whl", hash = "sha256:080d64ba98246c9bf4dae595241d5feead2695138318a12fdba309a9a4a192de"}, {file = "crypto_cpp_py-1.0.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:afe891d1a28b4d905257b410563fc4b2fc0c4d536c1d8c9b0bdb7c6d18a7f565"}, + {file = "crypto_cpp_py-1.0.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:556ba5000b5c2bdeccf4c2c053c228d471cac77dd84121145a079930bbd5ff3e"}, {file = "crypto_cpp_py-1.0.4-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:02520302ebcfa209bb79cb6a70fadffdd090b73e302142e48e1757bb513f2eca"}, {file = "crypto_cpp_py-1.0.4-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:447af208c5e6ff59a9d44c69806d2e3a71f32ec63b9435d7837fefe258a09f0b"}, {file = "crypto_cpp_py-1.0.4-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:7d128ce933440303706c36eb6f5aa32ee76316138ce17cb12217ad283b030f4f"}, @@ -1481,7 +1483,9 @@ crypto-cpp-py = [ {file = "crypto_cpp_py-1.0.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c94e012a1e591bbe112778ec64576fa5b3dd4856208c0a6ac3c51c5ad62c61d"}, {file = "crypto_cpp_py-1.0.4-cp38-cp38-win32.whl", hash = "sha256:d7a9889203d9e56cb5f7128c3742b7fc62a36cde8dddd71989570f0db6491c5c"}, {file = "crypto_cpp_py-1.0.4-cp38-cp38-win_amd64.whl", hash = "sha256:7573420e603b523cec2e8ce26a11bcbc380987c2b68ce64be0e0068e9c0ff515"}, + {file = "crypto_cpp_py-1.0.4-cp39-cp39-macosx_10_9_arm64.whl", hash = "sha256:fea99dbff0076fb5d02b3e0cdccdf970fba723a2463a122b90958d2b4f4c555b"}, {file = "crypto_cpp_py-1.0.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:31b7a93a34fb444bd8e5540907e83737dcf6ce8d19f770fe1b49c6091cc9a6b9"}, + {file = "crypto_cpp_py-1.0.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5172dd0239ad6cc2b070ba6f04f4749c00e4ebe98b8f890c7a38e091f4e01686"}, {file = "crypto_cpp_py-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:a3f4ac6852b5919508cc0218c5ae166afdbff64aa63bf6dfc8602761879706a5"}, {file = "crypto_cpp_py-1.0.4-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:0bad6955111f68e49e6b053171a8ed998a6e8a706464c72c1728497b9e4ebd4c"}, {file = "crypto_cpp_py-1.0.4-cp39-cp39-macosx_12_0_x86_64.whl", hash = "sha256:88ca995b5a28d5f8e775bd3efa0a6e995decc76866c6fa548df5637729d23c09"}, @@ -2181,6 +2185,13 @@ PyYAML = [ {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, + {file = "PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358"}, + {file = "PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782"}, + {file = "PyYAML-6.0-cp311-cp311-win32.whl", hash = "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7"}, + {file = "PyYAML-6.0-cp311-cp311-win_amd64.whl", hash = "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf"}, {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, diff --git a/pyproject.toml b/pyproject.toml index 64ba66094..3fdc24d26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ keywords = ["starknet", "cairo", "testnet", "local", "server"] python = ">=3.8,<3.10" Flask = {extras = ["async"], version = "~2.0.3"} flask-cors = "~3.0.10" -cairo-lang = "0.10.2" +cairo-lang = "0.10.3a0" Werkzeug = "~2.0.3" cloudpickle = "~2.1.0" crypto-cpp-py = "~1.0.4" diff --git a/test/FAILED-TESTS.tmp b/test/FAILED-TESTS.tmp new file mode 100644 index 000000000..8c6d5feee --- /dev/null +++ b/test/FAILED-TESTS.tmp @@ -0,0 +1,36 @@ +FAILED test/test_deploy.py::test_deploy[starknet_wrapper_args0-] - AssertionError +FAILED test/test_deploy.py::test_deploy[starknet_wrapper_args1-0x1] - AssertionError +FAILED test/test_deploy.py::test_predeclared_oz_account - AssertionError: assert 296247268998499681...5814256755745091338 == 644524626798311930...3129661358671901889 +FAILED test/test_block_number.py::test_block_number_incremented[run_devnet_in_background0] - AssertionError: assert '0x565c5f0c15...341fa9512f1ae' == '0x4b366dbf92...b9ebbcb9240df' +FAILED test/test_declare.py::test_declare_max_fee_too_low - AssertionError +FAILED test/test_block_number.py::test_block_number_incremented[run_devnet_in_background1] - AssertionError: assert '0x565c5f0c15...341fa9512f1ae' == '0x4b366dbf92...b9ebbcb9240df' +FAILED test/test_deploy.py::test_deploy_account - AssertionError: +FAILED test/test_declare.py::test_declare_happy_path - AssertionError +FAILED test/test_deploy.py::test_deploy_through_deployer_constructor - AssertionError +FAILED test/test_estimate_fee.py::test_simulate_transaction - AssertionError: assert {'function_in...ignature': []} == {'function_in...ignature': []} +FAILED test/test_deploy.py::test_deploy_with_udc - AssertionError +FAILED test/test_estimate_fee.py::test_estimate_fee_bulk - assert 500 == 200 +FAILED test/test_fork_feeder_gateway.py::test_contract_responses - AssertionError: assert 283432316360500571...0139776884597238156 == 189943316242194658...5517185361206070561 +FAILED test/test_fork_feeder_gateway.py::test_declare_and_get_class_by_hash - AssertionError: assert 224262536298235428...2975788412939422729 == 333186133272853803...5739661274098342090 +FAILED test/test_transaction_trace.py::test_deploy_transaction_trace - AssertionError: assert {'call_type':...96a4c09', ...} == {'call_type':...91298ca', ...} +FAILED test/test_general_workflow.py::test_general_workflow[run_devnet_in_background0-] - AssertionError: +FAILED test/test_transaction_trace.py::test_invoke_transaction_hash - AssertionError: assert {'call_type':...5375977', ...} == {'call_type':...5375977', ...} +FAILED test/test_account.py::test_events - AssertionError: +FAILED test/test_general_workflow.py::test_general_workflow[run_devnet_in_background1-0x1] - AssertionError: +FAILED test/rpc/test_rpc_misc.py::test_get_state_update - AssertionError +FAILED test/rpc/test_rpc_transactions.py::test_get_transaction_by_hash_deploy_account - KeyError: 'block_number' +FAILED test/test_state_update.py::test_declaration_and_deployment - AssertionError +FAILED test/test_fork.py::test_deploy_account - AssertionError: +FAILED test/test_fork.py::test_deploy_with_udc - AssertionError +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background0-input_data0-expected_data0] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_transactions.py::test_get_deploy_account_transaction_receipt - KeyError: 'block_number' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background1-input_data1-expected_data1] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background2-input_data2-expected_data2] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background3-input_data3-expected_data3] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_transactions.py::test_add_deploy_account_transaction - KeyError: 'result' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background4-input_data4-expected_data4] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background5-input_data5-expected_data5] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background7-input_data7-expected_data7] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background8-input_data8-expected_data8] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background9-input_data9-expected_data9] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' +FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background10-input_data10-expected_data10] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' \ No newline at end of file From 63e58c750fcc9152fe6320310502713c9f307390 Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 10:16:30 +0100 Subject: [PATCH 2/8] Replace 0.10.3a0 with 0.10.3 [skip ci] --- poetry.lock | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 58a22c21e..785edf824 100644 --- a/poetry.lock +++ b/poetry.lock @@ -127,7 +127,7 @@ python-versions = "~=3.7" [[package]] name = "cairo-lang" -version = "0.10.3a0" +version = "0.10.3" description = "Compiler and runner for the Cairo language" category = "main" optional = false @@ -1210,7 +1210,7 @@ multidict = ">=4.0" [metadata] lock-version = "1.1" python-versions = ">=3.8,<3.10" -content-hash = "bd896ec3b952f0869d3f0656784d017981e42005508b04c3b696de9a13f8266d" +content-hash = "42f002ca22c20461ab5dde4668c39a54f4991b42225fe899f35eb0d0831d19fe" [metadata.files] aiohttp = [ @@ -1430,7 +1430,7 @@ cachetools = [ {file = "cachetools-5.2.0.tar.gz", hash = "sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757"}, ] cairo-lang = [ - {file = "cairo-lang-0.10.3a0.zip", hash = "sha256:432c94135090f799fce8e6cfa763d98a336080e3c2576bdd110c3aa26b004eaf"}, + {file = "cairo-lang-0.10.3.zip", hash = "sha256:3093946334590f199d99471912049c182cec1f90d4ad02029f460a0de3a27502"}, ] certifi = [ {file = "certifi-2022.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"}, diff --git a/pyproject.toml b/pyproject.toml index 3fdc24d26..64ff6b94b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ keywords = ["starknet", "cairo", "testnet", "local", "server"] python = ">=3.8,<3.10" Flask = {extras = ["async"], version = "~2.0.3"} flask-cors = "~3.0.10" -cairo-lang = "0.10.3a0" +cairo-lang = "0.10.3" Werkzeug = "~2.0.3" cloudpickle = "~2.1.0" crypto-cpp-py = "~1.0.4" From 7b55a77bd8ac1951ed872ede31c4cef441a0585e Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 13:38:15 +0100 Subject: [PATCH 3/8] Fix failing tests; refactor estimate_fee_bulk testing --- starknet_devnet/constants.py | 2 +- test/FAILED-TESTS.tmp | 36 ----------- test/account.py | 31 ++++++++++ test/expected/deploy_function_invocation.json | 4 +- test/expected/invoke_function_invocation.json | 6 +- test/expected/invoke_receipt.json | 2 +- .../invoke_receipt_account_event.json | 4 +- test/expected/invoke_receipt_event.json | 4 +- test/rpc/test_data/get_events.py | 2 +- test/sample_tx_objects.py | 62 ------------------- test/shared.py | 7 ++- test/test_block_number.py | 2 +- test/test_deploy.py | 2 +- test/test_estimate_fee.py | 39 ++++++++++-- test/test_fork_feeder_gateway.py | 2 +- test/util.py | 5 +- 16 files changed, 87 insertions(+), 123 deletions(-) delete mode 100644 test/FAILED-TESTS.tmp delete mode 100644 test/sample_tx_objects.py diff --git a/starknet_devnet/constants.py b/starknet_devnet/constants.py index 16ea0755c..bb3591857 100644 --- a/starknet_devnet/constants.py +++ b/starknet_devnet/constants.py @@ -30,7 +30,7 @@ # account used by StarkNet CLI OZ_ACCOUNT_CLASS_HASH = ( - 0x68CB33B3AB73EE34D2084CFCB7D07B24DB48095AD0907C10B6FDB7B0E91EF0A + 0x6F500F527355DFDB8093C7FE46E6F73C96A867392B49FA4157A757538928539 ) LEGACY_RPC_TX_VERSION = 0 diff --git a/test/FAILED-TESTS.tmp b/test/FAILED-TESTS.tmp deleted file mode 100644 index 8c6d5feee..000000000 --- a/test/FAILED-TESTS.tmp +++ /dev/null @@ -1,36 +0,0 @@ -FAILED test/test_deploy.py::test_deploy[starknet_wrapper_args0-] - AssertionError -FAILED test/test_deploy.py::test_deploy[starknet_wrapper_args1-0x1] - AssertionError -FAILED test/test_deploy.py::test_predeclared_oz_account - AssertionError: assert 296247268998499681...5814256755745091338 == 644524626798311930...3129661358671901889 -FAILED test/test_block_number.py::test_block_number_incremented[run_devnet_in_background0] - AssertionError: assert '0x565c5f0c15...341fa9512f1ae' == '0x4b366dbf92...b9ebbcb9240df' -FAILED test/test_declare.py::test_declare_max_fee_too_low - AssertionError -FAILED test/test_block_number.py::test_block_number_incremented[run_devnet_in_background1] - AssertionError: assert '0x565c5f0c15...341fa9512f1ae' == '0x4b366dbf92...b9ebbcb9240df' -FAILED test/test_deploy.py::test_deploy_account - AssertionError: -FAILED test/test_declare.py::test_declare_happy_path - AssertionError -FAILED test/test_deploy.py::test_deploy_through_deployer_constructor - AssertionError -FAILED test/test_estimate_fee.py::test_simulate_transaction - AssertionError: assert {'function_in...ignature': []} == {'function_in...ignature': []} -FAILED test/test_deploy.py::test_deploy_with_udc - AssertionError -FAILED test/test_estimate_fee.py::test_estimate_fee_bulk - assert 500 == 200 -FAILED test/test_fork_feeder_gateway.py::test_contract_responses - AssertionError: assert 283432316360500571...0139776884597238156 == 189943316242194658...5517185361206070561 -FAILED test/test_fork_feeder_gateway.py::test_declare_and_get_class_by_hash - AssertionError: assert 224262536298235428...2975788412939422729 == 333186133272853803...5739661274098342090 -FAILED test/test_transaction_trace.py::test_deploy_transaction_trace - AssertionError: assert {'call_type':...96a4c09', ...} == {'call_type':...91298ca', ...} -FAILED test/test_general_workflow.py::test_general_workflow[run_devnet_in_background0-] - AssertionError: -FAILED test/test_transaction_trace.py::test_invoke_transaction_hash - AssertionError: assert {'call_type':...5375977', ...} == {'call_type':...5375977', ...} -FAILED test/test_account.py::test_events - AssertionError: -FAILED test/test_general_workflow.py::test_general_workflow[run_devnet_in_background1-0x1] - AssertionError: -FAILED test/rpc/test_rpc_misc.py::test_get_state_update - AssertionError -FAILED test/rpc/test_rpc_transactions.py::test_get_transaction_by_hash_deploy_account - KeyError: 'block_number' -FAILED test/test_state_update.py::test_declaration_and_deployment - AssertionError -FAILED test/test_fork.py::test_deploy_account - AssertionError: -FAILED test/test_fork.py::test_deploy_with_udc - AssertionError -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background0-input_data0-expected_data0] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_transactions.py::test_get_deploy_account_transaction_receipt - KeyError: 'block_number' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background1-input_data1-expected_data1] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background2-input_data2-expected_data2] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background3-input_data3-expected_data3] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_transactions.py::test_add_deploy_account_transaction - KeyError: 'result' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background4-input_data4-expected_data4] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background5-input_data5-expected_data5] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background7-input_data7-expected_data7] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background8-input_data8-expected_data8] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background9-input_data9-expected_data9] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' -FAILED test/rpc/test_rpc_misc.py::test_get_events[run_devnet_in_background10-input_data10-expected_data10] - AssertionError: assert '[14836974641...000000000, 0]' == '[14836974641...000000000, 0]' \ No newline at end of file diff --git a/test/account.py b/test/account.py index 6d4145104..1b01b34d8 100644 --- a/test/account.py +++ b/test/account.py @@ -150,6 +150,37 @@ def _get_transaction_hash( ) +def get_estimate_fee_request_dict( + calls: List[AccountCall], + account_address: str, + private_key: str, + nonce: int = None, +): + """Create a mock tx to request fee estimation of an invoke""" + if nonce is None: + nonce = get_nonce(account_address) + + max_fee = 0 + signature, execute_calldata = _get_execute_args( + calls=calls, + account_address=account_address, + private_key=private_key, + nonce=nonce, + max_fee=max_fee, + version=QUERY_VERSION, + ) + + return { + "contract_address": account_address, + "max_fee": hex(max_fee), + "calldata": [str(element) for element in execute_calldata], + "version": hex(QUERY_VERSION), + "nonce": hex(nonce), + "signature": signature, + "type": "INVOKE_FUNCTION", + } + + def get_estimated_fee( calls: List[AccountCall], account_address: str, diff --git a/test/expected/deploy_function_invocation.json b/test/expected/deploy_function_invocation.json index 5a2e72949..3b52e657b 100644 --- a/test/expected/deploy_function_invocation.json +++ b/test/expected/deploy_function_invocation.json @@ -2,8 +2,8 @@ "call_type": "CALL", "calldata": ["0x0"], "caller_address": "0x0", - "class_hash": "0x75dc4457c66bfb3808c67a918047b8f0973ea8b876056b72e99f651b91298ca", - "contract_address": "0x333c17a58a5e9d3e8f745d354fee89f83196e8fd0ded1c9766c24425276093f", + "class_hash": "0x4f547ede68edfeb9403f63a1042bc13424b5a29bad2a828a4f6883bc96a4c09", + "contract_address": "0x5536cba44460628d54b12be790b8d1f3827ace5a40f39149d57d6fa04fe9d", "entry_point_type": "CONSTRUCTOR", "events": [], "execution_resources": { diff --git a/test/expected/invoke_function_invocation.json b/test/expected/invoke_function_invocation.json index c2e5fb42a..e35a42edc 100644 --- a/test/expected/invoke_function_invocation.json +++ b/test/expected/invoke_function_invocation.json @@ -13,7 +13,7 @@ "events": [], "calldata": [ "0x1", - "0x333c17a58a5e9d3e8f745d354fee89f83196e8fd0ded1c9766c24425276093f", + "0x5536cba44460628d54b12be790b8d1f3827ace5a40f39149d57d6fa04fe9d", "0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320", "0x0", "0x2", @@ -34,7 +34,7 @@ }, "messages": [], "call_type": "CALL", - "class_hash": "0x75dc4457c66bfb3808c67a918047b8f0973ea8b876056b72e99f651b91298ca", + "class_hash": "0x4f547ede68edfeb9403f63a1042bc13424b5a29bad2a828a4f6883bc96a4c09", "result": [], "events": [], "calldata": [ @@ -44,7 +44,7 @@ "caller_address": "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", "entry_point_type": "EXTERNAL", "selector": "0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320", - "contract_address": "0x333c17a58a5e9d3e8f745d354fee89f83196e8fd0ded1c9766c24425276093f", + "contract_address": "0x5536cba44460628d54b12be790b8d1f3827ace5a40f39149d57d6fa04fe9d", "internal_calls": [] } ] diff --git a/test/expected/invoke_receipt.json b/test/expected/invoke_receipt.json index 9bf683073..001e41375 100644 --- a/test/expected/invoke_receipt.json +++ b/test/expected/invoke_receipt.json @@ -6,7 +6,7 @@ { "data": [ "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", - "0x416017615e785233a2ec6b6a16058eef596a40171b2517add5167bd5ba1ab88", + "0x3711666a3506c99c9d78c4d4013409a87a962b7a0880a1c24af9fe193dafc01", "0x16010bdfe1800", "0x0" ], diff --git a/test/expected/invoke_receipt_account_event.json b/test/expected/invoke_receipt_account_event.json index 3e9f78c9f..5cc305352 100644 --- a/test/expected/invoke_receipt_account_event.json +++ b/test/expected/invoke_receipt_account_event.json @@ -5,7 +5,7 @@ "0x0", "0xa" ], - "from_address": "0x1fbcb39359c1d204c9fa13318451c208026c01b77513d4eac72b13798184372", + "from_address": "0x72db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119", "keys": [ "0x3db3da4221c078e78bd987e54e1cc24570d89a7002cefa33e548d6c72c73f9d" ] @@ -13,7 +13,7 @@ { "data": [ "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", - "0x416017615e785233a2ec6b6a16058eef596a40171b2517add5167bd5ba1ab88", + "0x3711666a3506c99c9d78c4d4013409a87a962b7a0880a1c24af9fe193dafc01", "0x5a5c900900", "0x0" ], diff --git a/test/expected/invoke_receipt_event.json b/test/expected/invoke_receipt_event.json index 0f0437460..28288b5c1 100644 --- a/test/expected/invoke_receipt_event.json +++ b/test/expected/invoke_receipt_event.json @@ -5,7 +5,7 @@ "0x0", "0xa" ], - "from_address": "0x1fbcb39359c1d204c9fa13318451c208026c01b77513d4eac72b13798184372", + "from_address": "0x72db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119", "keys": [ "0x3db3da4221c078e78bd987e54e1cc24570d89a7002cefa33e548d6c72c73f9d" ] @@ -13,7 +13,7 @@ { "data": [ "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", - "0x416017615e785233a2ec6b6a16058eef596a40171b2517add5167bd5ba1ab88", + "0x3711666a3506c99c9d78c4d4013409a87a962b7a0880a1c24af9fe193dafc01", "0x160f992a32800", "0x0" ], diff --git a/test/rpc/test_data/get_events.py b/test/rpc/test_data/get_events.py index ae471f269..799e713a7 100644 --- a/test/rpc/test_data/get_events.py +++ b/test/rpc/test_data/get_events.py @@ -90,7 +90,7 @@ INCREASE_BALANCE_BY_0_EVENT = [0, 0] INCREASE_BALANCE_BY_1_EVENT = [0, 1] EVENT_FEE_ADDRESS = ( - 1848132115085043480193496279185058626650378119257763769763822937432943340424 + 1556746869602934183907209817909870193193832701883543897870108478262537288705 ) FEE_CHARGING_IN_BLOCK_2_EVENT = [ int(PREDEPLOYED_ACCOUNT_ADDRESS, 16), diff --git a/test/sample_tx_objects.py b/test/sample_tx_objects.py deleted file mode 100644 index 6c9eab37e..000000000 --- a/test/sample_tx_objects.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Contains sample tx objects created with: - initial_balance = "10" - deploy_info = deploy(contract=CONTRACT_PATH, inputs=[initial_balance], salt="0x42") - contract_address = deploy_info["address"] - - get_estimated_fee( - calls=[(contract_address, "increase_balance", [0, 0])], - account_address=PREDEPLOYED_ACCOUNT_ADDRESS, - private_key=PREDEPLOYED_ACCOUNT_PRIVATE_KEY, - ) - get_estimated_fee( - calls=[(contract_address, "increase_balance", [10, 20])], - account_address=PREDEPLOYED_ACCOUNT_ADDRESS, - private_key=PREDEPLOYED_ACCOUNT_PRIVATE_KEY, - nonce=1 - ) -""" - -TX_DICT1 = { - "contract_address": "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", - "max_fee": "0x0", - "calldata": [ - "1", - "1899433162421946587614251337844985054247944657949259912835517185361206070561", - "1530486729947006463063166157847785599120665941190480211966374137237989315360", - "0", - "2", - "2", - "0", - "0", - ], - "version": "0x100000000000000000000000000000001", - "nonce": "0x0", - "signature": [ - "3174996110485379956944934596703052164206842524356023427475484042061844533395", - "17577146695708340226702412773352693706935620568901342811436914942566987841", - ], - "type": "INVOKE_FUNCTION", -} - -TX_DICT2 = { - "max_fee": "0x0", - "signature": [ - "2392843069849124933012063680022083930445422419478594435201358295535133395926", - "1905143518502940252114978183829346881587323602689293951107361008135757778913", - ], - "calldata": [ - "1", - "1899433162421946587614251337844985054247944657949259912835517185361206070561", - "1530486729947006463063166157847785599120665941190480211966374137237989315360", - "0", - "2", - "2", - "10", - "20", - ], - "version": "0x100000000000000000000000000000001", - "contract_address": "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", - "nonce": "0x1", - "type": "INVOKE_FUNCTION", -} diff --git a/test/shared.py b/test/shared.py index 548ad6aa5..85caa5e3a 100644 --- a/test/shared.py +++ b/test/shared.py @@ -28,20 +28,21 @@ "916907772491729262376534102982219947830828984996257231353398618781993312401" ) +# TODO remove SIGNATURE = [ "1225578735933442828068102633747590437426782890965066746429241472187377583468", "3568809569741913715045370357918125425757114920266578211811626257903121825123", ] EXPECTED_SALTY_DEPLOY_ADDRESS = ( - "0x01fbcb39359c1d204c9fa13318451c208026c01b77513d4eac72b13798184372" + "0x072db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119" ) EXPECTED_SALTY_DEPLOY_HASH = ( - "0x799357c54a299cfdc53cf56951cd6f80f8881bdf7fc1d220b92c0af45bf1302" + "0x5db3829a149ab82c9a27e6a32f135cdd061e3939894f95398ab2571e4310b40" ) EXPECTED_CLASS_HASH = ( - "0x75dc4457c66bfb3808c67a918047b8f0973ea8b876056b72e99f651b91298ca" + "0x4f547ede68edfeb9403f63a1042bc13424b5a29bad2a828a4f6883bc96a4c09" ) NONEXISTENT_TX_HASH = "0x1" diff --git a/test/test_block_number.py b/test/test_block_number.py index 84c673664..7602b2670 100644 --- a/test/test_block_number.py +++ b/test/test_block_number.py @@ -26,7 +26,7 @@ def my_get_block_number(address: str): ) -EXPECTED_TX_HASH = "0x4b366dbf9260f983daa608139943a8baa059668ef2df07b1f7b9ebbcb9240df" +EXPECTED_TX_HASH = "0x565c5f0c1561da745a8a929d6cab60f0e07e5dacd755d01817341fa9512f1ae" @pytest.mark.usefixtures("run_devnet_in_background") diff --git a/test/test_deploy.py b/test/test_deploy.py index 08ef3212d..1342b5fe4 100644 --- a/test/test_deploy.py +++ b/test/test_deploy.py @@ -118,7 +118,7 @@ async def test_deploy(starknet_wrapper_args, expected_block_hash): assert_hex_equal( hex(tx_hash), - "0x51961575e7a34772bc3f9aac0a25aaadde8545df5cf484403c728aa9d85a4b7", + "0x58e5f41a48e756d686c1b028292d548859f71bb2763d7bbe584c50f9dc36068", ) assert contract_address == expected_contract_address diff --git a/test/test_estimate_fee.py b/test/test_estimate_fee.py index a5166e6ab..682c88ed5 100644 --- a/test/test_estimate_fee.py +++ b/test/test_estimate_fee.py @@ -14,8 +14,7 @@ from starknet_devnet.constants import DEFAULT_GAS_PRICE -from .account import get_nonce -from .sample_tx_objects import TX_DICT1, TX_DICT2 +from .account import get_estimate_fee_request_dict, get_nonce from .settings import APP_URL from .shared import ( ABI_PATH, @@ -26,6 +25,7 @@ L1L2_CONTRACT_PATH, PREDEPLOY_ACCOUNT_CLI_ARGS, PREDEPLOYED_ACCOUNT_ADDRESS, + PREDEPLOYED_ACCOUNT_PRIVATE_KEY, ) from .util import ( call, @@ -233,7 +233,21 @@ def test_estimate_fee_bulk_invalid(): """Test estimating fee in a bulk when one tx is invalid""" # skip deployment to cause failure - tx_dicts = [TX_DICT1, TX_DICT2] + invalid_address = "0x123" + tx_dicts = [ + get_estimate_fee_request_dict( + calls=[(invalid_address, "increase_balance", [0, 0])], + account_address=PREDEPLOYED_ACCOUNT_ADDRESS, + private_key=PREDEPLOYED_ACCOUNT_PRIVATE_KEY, + nonce=0, + ), + get_estimate_fee_request_dict( + calls=[(invalid_address, "increase_balance", [10, 20])], + account_address=PREDEPLOYED_ACCOUNT_ADDRESS, + private_key=PREDEPLOYED_ACCOUNT_PRIVATE_KEY, + nonce=1, + ), + ] txs = AccountTransaction.Schema().load(tx_dicts, many=True) resp = _send_estimate_fee_bulk_request(txs) @@ -248,13 +262,28 @@ def test_estimate_fee_bulk(): # contract must be deployed for fee estimation to be possible initial_balance = "10" deploy_info = deploy(contract=CONTRACT_PATH, inputs=[initial_balance], salt="0x42") + contract_address = deploy_info["address"] + + tx_dicts = [ + get_estimate_fee_request_dict( + calls=[(contract_address, "increase_balance", [0, 0])], + account_address=PREDEPLOYED_ACCOUNT_ADDRESS, + private_key=PREDEPLOYED_ACCOUNT_PRIVATE_KEY, + nonce=0, + ), + get_estimate_fee_request_dict( + calls=[(contract_address, "increase_balance", [10, 20])], + account_address=PREDEPLOYED_ACCOUNT_ADDRESS, + private_key=PREDEPLOYED_ACCOUNT_PRIVATE_KEY, + nonce=1, + ), + ] - tx_dicts = [TX_DICT1, TX_DICT2] # two invokes # assert that loading can be done (i.e. object is structured correctly) txs = AccountTransaction.Schema().load(tx_dicts, many=True) resp = _send_estimate_fee_bulk_request(txs) - assert resp.status_code == 200 + assert resp.status_code == 200, resp.json() fee_estimation_infos = FeeEstimationInfo.Schema().load(resp.json(), many=True) # assert correct structure of response diff --git a/test/test_fork_feeder_gateway.py b/test/test_fork_feeder_gateway.py index 354a73f90..951cd0210 100644 --- a/test/test_fork_feeder_gateway.py +++ b/test/test_fork_feeder_gateway.py @@ -51,7 +51,7 @@ DEPLOYMENT_INPUT = "10" EXPECTED_DEPLOYMENT_ADDRESS = ( - "0x04330a83b05203b480bfd3fc3e11bd2b45bfeb187b8db954ee3ce2ecc9e44d21" + "0x06442b891d63377cc12bd4b7ca4ecd9d6e4cb7eece8aa4051d64c4fe4dcaa98c" ) EXPECTED_INVOKE_HASH = ( "0x51b501687e77d5433c7fc00b3a6dd25c2f6edf95f506dd9cba2251a4ce9ed43" diff --git a/test/util.py b/test/util.py index f8148b7c4..d23aa848e 100644 --- a/test/util.py +++ b/test/util.py @@ -615,8 +615,9 @@ def assert_salty_deploy( deploy_info = deploy(contract_path, inputs=inputs, salt=salt) assert_tx_status(deploy_info["tx_hash"], expected_status) - assert_equal(deploy_info["address"], expected_address) - assert_equal(deploy_info["tx_hash"], expected_tx_hash) + assert_equal( + deploy_info, {"address": expected_address, "tx_hash": expected_tx_hash} + ) def assert_failing_deploy(contract_path): From 2fc565772f54a71bc8648724fd7110bd07635491 Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 13:38:27 +0100 Subject: [PATCH 4/8] Remove unused signature constant --- test/shared.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/shared.py b/test/shared.py index 85caa5e3a..9cbb91e10 100644 --- a/test/shared.py +++ b/test/shared.py @@ -28,12 +28,6 @@ "916907772491729262376534102982219947830828984996257231353398618781993312401" ) -# TODO remove -SIGNATURE = [ - "1225578735933442828068102633747590437426782890965066746429241472187377583468", - "3568809569741913715045370357918125425757114920266578211811626257903121825123", -] - EXPECTED_SALTY_DEPLOY_ADDRESS = ( "0x072db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119" ) From d76e4969de033e9053b1e2b0bb30678564d9fa8d Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 14:32:34 +0100 Subject: [PATCH 5/8] Support TESTNET2 as chain_id; improve docs --- page/docs/guide/fork.md | 13 +++++++++++++ page/docs/guide/run.md | 2 +- test/test_chain_id_cli_params.py | 10 ++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/page/docs/guide/fork.md b/page/docs/guide/fork.md index b87886a99..b2d31131e 100644 --- a/page/docs/guide/fork.md +++ b/page/docs/guide/fork.md @@ -18,12 +18,24 @@ All calls will first try Devnet's state and then fall back to the forking block. If you are forking another Devnet instance, keep in mind that it doesn't support polling specific blocks, but will always fall back to the currently latest block. +## Chain ID + +Devnet defaults to using the `TESTNET` chain ID (the one corresponding to Alpha Goerli). If you want Devnet to use another chain ID, you can provide it using: + +``` +starknet-devnet --chain-id [MAINNET | TESTNET | TESTNET2] +``` + +where `MAINNET` refers to Alpha Mainnet and `TESTNET` refers to Alpha Goerli 2. + ## Get fork status + ``` GET /fork_status ``` Response when in fork mode: + ``` { "url": "https://alpha4.starknet.io", @@ -32,6 +44,7 @@ Response when in fork mode: ``` Response when not in fork mode: + ``` {} ``` diff --git a/page/docs/guide/run.md b/page/docs/guide/run.md index 908fb9b21..33eb038b8 100644 --- a/page/docs/guide/run.md +++ b/page/docs/guide/run.md @@ -44,7 +44,7 @@ optional arguments: --fork-block FORK_BLOCK Specify the block number where the --fork-network is forked; defaults to latest --chain_id CHAIN_ID - Specify the chain id as string: ['MAINNET', 'TESTNET'] + Specify the chain id as string: {MAINNET, TESTNET, TESTNET2} ``` You can run `starknet-devnet` in a separate shell, or you can run it in background with `starknet-devnet &`. diff --git a/test/test_chain_id_cli_params.py b/test/test_chain_id_cli_params.py index a3d200087..950858db0 100644 --- a/test/test_chain_id_cli_params.py +++ b/test/test_chain_id_cli_params.py @@ -66,14 +66,8 @@ def test_chain_id_invalid(chain_id): @pytest.mark.parametrize( "run_devnet_in_background, chain_id", [ - ( - [*PREDEPLOY_ACCOUNT_CLI_ARGS, "--chain-id", StarknetChainId.TESTNET.name], - StarknetChainId.TESTNET, - ), - ( - [*PREDEPLOY_ACCOUNT_CLI_ARGS, "--chain-id", StarknetChainId.MAINNET.name], - StarknetChainId.MAINNET, - ), + ([*PREDEPLOY_ACCOUNT_CLI_ARGS, "--chain_id", chain_id.name], chain_id) + for chain_id in StarknetChainId ], indirect=True, ) From 7470a798cfdf532af3bccbd1936240858422b3a1 Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 14:47:41 +0100 Subject: [PATCH 6/8] Add script for checking if contracts are compiled with latest compiler --- scripts/check_starknet_artifacts_version.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/check_starknet_artifacts_version.sh diff --git a/scripts/check_starknet_artifacts_version.sh b/scripts/check_starknet_artifacts_version.sh new file mode 100755 index 000000000..3a668d90e --- /dev/null +++ b/scripts/check_starknet_artifacts_version.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eu +set -o pipefail + +echo "Checking if starknet contracts are compiled using the latest compiler..." + +COMPILED=$(jq -r ".program.compiler_version" test/artifacts/contracts/cairo/contract.cairo/contract.json) +INSTALLED=$(poetry run starknet-compile --version | sed -rn "s/^starknet-compile (.*)$/\1/p") + +if [ "$COMPILED" != "$INSTALLED" ]; then + echo "Error: Compiled with version: $COMPILED, installed version: $INSTALLED" + exit 1 +fi From d88cd68f4f409643e6b8c49266413fd59ef90a62 Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 15:17:19 +0100 Subject: [PATCH 7/8] Fix expected values --- page/docs/guide/run.md | 4 ++-- scripts/check_starknet_artifacts_version.sh | 3 +++ scripts/test.sh | 4 +++- starknet_devnet/devnet_config.py | 2 +- test/expected/deploy_function_invocation.json | 4 ++-- test/expected/invoke_function_invocation.json | 6 +++--- test/expected/invoke_receipt_account_event.json | 2 +- test/expected/invoke_receipt_event.json | 2 +- test/shared.py | 6 +++--- test/test_block_number.py | 2 +- test/test_chain_id_cli_params.py | 4 ++-- test/test_deploy.py | 2 +- test/test_fork_feeder_gateway.py | 2 +- 13 files changed, 24 insertions(+), 19 deletions(-) diff --git a/page/docs/guide/run.md b/page/docs/guide/run.md index 33eb038b8..8915c0e3b 100644 --- a/page/docs/guide/run.md +++ b/page/docs/guide/run.md @@ -10,7 +10,7 @@ Installing the package adds the `starknet-devnet` command. usage: starknet-devnet [-h] [-v] [--host HOST] [--port PORT] [--load-path LOAD_PATH] [--dump-path DUMP_PATH] [--dump-on DUMP_ON] [--lite-mode] [--accounts ACCOUNTS] [--initial-balance INITIAL_BALANCE] [--seed SEED] [--hide-predeployed-accounts] [--start-time START_TIME] [--gas-price GAS_PRICE] [--timeout TIMEOUT] [--account-class ACCOUNT_CLASS] [--fork-network FORK_NETWORK] [--fork-block FORK_BLOCK] - [--chain_id CHAIN_ID] + [--chain-id CHAIN_ID] Run a local instance of StarkNet Devnet @@ -43,7 +43,7 @@ optional arguments: Specify the network to fork: can be a URL (e.g. https://alpha-mainnet.starknet.io) or network name (valid names: alpha-goerli, alpha-goerli2, alpha-mainnet) --fork-block FORK_BLOCK Specify the block number where the --fork-network is forked; defaults to latest - --chain_id CHAIN_ID + --chain-id CHAIN_ID Specify the chain id as string: {MAINNET, TESTNET, TESTNET2} ``` diff --git a/scripts/check_starknet_artifacts_version.sh b/scripts/check_starknet_artifacts_version.sh index 3a668d90e..dee064ee4 100755 --- a/scripts/check_starknet_artifacts_version.sh +++ b/scripts/check_starknet_artifacts_version.sh @@ -5,8 +5,11 @@ set -o pipefail echo "Checking if starknet contracts are compiled using the latest compiler..." +# Use contract.cairo to test COMPILED=$(jq -r ".program.compiler_version" test/artifacts/contracts/cairo/contract.cairo/contract.json) +echo "Compiled with: $COMPILED" INSTALLED=$(poetry run starknet-compile --version | sed -rn "s/^starknet-compile (.*)$/\1/p") +echo "Installed: $INSTALLED" if [ "$COMPILED" != "$INSTALLED" ]; then echo "Error: Compiled with version: $COMPILED, installed version: $INSTALLED" diff --git a/scripts/test.sh b/scripts/test.sh index b78b0a74d..ae81e9882 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,5 +1,7 @@ #!/bin/bash -set -e +set -eu + +./scripts/check_starknet_artifacts_version.sh CMD="poetry run pytest -n auto --dist loadscope -v ${1:-test/}" echo $CMD diff --git a/starknet_devnet/devnet_config.py b/starknet_devnet/devnet_config.py index 6e4c17d7c..a65b47761 100644 --- a/starknet_devnet/devnet_config.py +++ b/starknet_devnet/devnet_config.py @@ -74,7 +74,7 @@ def _chain_id(chain_id: str): chain_id = StarknetChainId[chain_id] except KeyError: sys.exit( - f"Error: The value of --chain_id must be in {{{CHAIN_IDS}}}, got: {chain_id}" + f"Error: The value of --chain-id must be in {{{CHAIN_IDS}}}, got: {chain_id}" ) return chain_id diff --git a/test/expected/deploy_function_invocation.json b/test/expected/deploy_function_invocation.json index 3b52e657b..78a36673d 100644 --- a/test/expected/deploy_function_invocation.json +++ b/test/expected/deploy_function_invocation.json @@ -2,8 +2,8 @@ "call_type": "CALL", "calldata": ["0x0"], "caller_address": "0x0", - "class_hash": "0x4f547ede68edfeb9403f63a1042bc13424b5a29bad2a828a4f6883bc96a4c09", - "contract_address": "0x5536cba44460628d54b12be790b8d1f3827ace5a40f39149d57d6fa04fe9d", + "class_hash": "0x71df7c871d389943e24aaaf85d41594266d12f2f9b580a9f92ba4a0bf763d67", + "contract_address": "0x6f47c70cfad7e0865af23e60e596e4926d557bc3fc26ce96a234d55bfb04857", "entry_point_type": "CONSTRUCTOR", "events": [], "execution_resources": { diff --git a/test/expected/invoke_function_invocation.json b/test/expected/invoke_function_invocation.json index e35a42edc..8f442cb43 100644 --- a/test/expected/invoke_function_invocation.json +++ b/test/expected/invoke_function_invocation.json @@ -13,7 +13,7 @@ "events": [], "calldata": [ "0x1", - "0x5536cba44460628d54b12be790b8d1f3827ace5a40f39149d57d6fa04fe9d", + "0x6f47c70cfad7e0865af23e60e596e4926d557bc3fc26ce96a234d55bfb04857", "0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320", "0x0", "0x2", @@ -34,7 +34,7 @@ }, "messages": [], "call_type": "CALL", - "class_hash": "0x4f547ede68edfeb9403f63a1042bc13424b5a29bad2a828a4f6883bc96a4c09", + "class_hash": "0x71df7c871d389943e24aaaf85d41594266d12f2f9b580a9f92ba4a0bf763d67", "result": [], "events": [], "calldata": [ @@ -44,7 +44,7 @@ "caller_address": "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a", "entry_point_type": "EXTERNAL", "selector": "0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320", - "contract_address": "0x5536cba44460628d54b12be790b8d1f3827ace5a40f39149d57d6fa04fe9d", + "contract_address": "0x6f47c70cfad7e0865af23e60e596e4926d557bc3fc26ce96a234d55bfb04857", "internal_calls": [] } ] diff --git a/test/expected/invoke_receipt_account_event.json b/test/expected/invoke_receipt_account_event.json index 5cc305352..e1acfd957 100644 --- a/test/expected/invoke_receipt_account_event.json +++ b/test/expected/invoke_receipt_account_event.json @@ -5,7 +5,7 @@ "0x0", "0xa" ], - "from_address": "0x72db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119", + "from_address": "0x5b5c8722ce893e19fc813996e610f0699fbe9b6c685ce175e60d7cbdbb87fa1", "keys": [ "0x3db3da4221c078e78bd987e54e1cc24570d89a7002cefa33e548d6c72c73f9d" ] diff --git a/test/expected/invoke_receipt_event.json b/test/expected/invoke_receipt_event.json index 28288b5c1..6e1d6e17c 100644 --- a/test/expected/invoke_receipt_event.json +++ b/test/expected/invoke_receipt_event.json @@ -5,7 +5,7 @@ "0x0", "0xa" ], - "from_address": "0x72db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119", + "from_address": "0x5b5c8722ce893e19fc813996e610f0699fbe9b6c685ce175e60d7cbdbb87fa1", "keys": [ "0x3db3da4221c078e78bd987e54e1cc24570d89a7002cefa33e548d6c72c73f9d" ] diff --git a/test/shared.py b/test/shared.py index 9cbb91e10..a88aff7a8 100644 --- a/test/shared.py +++ b/test/shared.py @@ -29,14 +29,14 @@ ) EXPECTED_SALTY_DEPLOY_ADDRESS = ( - "0x072db98d364f15c7971de4e19b8b225b25a31f9e9aa3d0084009466208c6a119" + "0x05b5c8722ce893e19fc813996e610f0699fbe9b6c685ce175e60d7cbdbb87fa1" ) EXPECTED_SALTY_DEPLOY_HASH = ( - "0x5db3829a149ab82c9a27e6a32f135cdd061e3939894f95398ab2571e4310b40" + "0x2e750343e63dc7ddf543c196c54018b4e5989acd413e6acafdae62ef2c3146d" ) EXPECTED_CLASS_HASH = ( - "0x4f547ede68edfeb9403f63a1042bc13424b5a29bad2a828a4f6883bc96a4c09" + "0x71df7c871d389943e24aaaf85d41594266d12f2f9b580a9f92ba4a0bf763d67" ) NONEXISTENT_TX_HASH = "0x1" diff --git a/test/test_block_number.py b/test/test_block_number.py index 7602b2670..3d9a93257 100644 --- a/test/test_block_number.py +++ b/test/test_block_number.py @@ -26,7 +26,7 @@ def my_get_block_number(address: str): ) -EXPECTED_TX_HASH = "0x565c5f0c1561da745a8a929d6cab60f0e07e5dacd755d01817341fa9512f1ae" +EXPECTED_TX_HASH = "0x2a80a6c3878fb0b68b2da38b4a488276c014d955d1bf17933aefab6cb722121" @pytest.mark.usefixtures("run_devnet_in_background") diff --git a/test/test_chain_id_cli_params.py b/test/test_chain_id_cli_params.py index 950858db0..afa7940af 100644 --- a/test/test_chain_id_cli_params.py +++ b/test/test_chain_id_cli_params.py @@ -56,7 +56,7 @@ def test_chain_id_invalid(chain_id): stdout=subprocess.PIPE, ) assert ( - f"Error: The value of --chain_id must be in {{{CHAIN_IDS}}}, got:" + f"Error: The value of --chain-id must be in {{{CHAIN_IDS}}}, got:" in read_stream(proc.stderr) ) assert proc.returncode == 1 @@ -66,7 +66,7 @@ def test_chain_id_invalid(chain_id): @pytest.mark.parametrize( "run_devnet_in_background, chain_id", [ - ([*PREDEPLOY_ACCOUNT_CLI_ARGS, "--chain_id", chain_id.name], chain_id) + ([*PREDEPLOY_ACCOUNT_CLI_ARGS, "--chain-id", chain_id.name], chain_id) for chain_id in StarknetChainId ], indirect=True, diff --git a/test/test_deploy.py b/test/test_deploy.py index 1342b5fe4..75a9aaea8 100644 --- a/test/test_deploy.py +++ b/test/test_deploy.py @@ -118,7 +118,7 @@ async def test_deploy(starknet_wrapper_args, expected_block_hash): assert_hex_equal( hex(tx_hash), - "0x58e5f41a48e756d686c1b028292d548859f71bb2763d7bbe584c50f9dc36068", + "0x29c0f6e2321da26dd143dc772740526416294e9300634ec646cb525c3eb9c5e", ) assert contract_address == expected_contract_address diff --git a/test/test_fork_feeder_gateway.py b/test/test_fork_feeder_gateway.py index 951cd0210..4137bea36 100644 --- a/test/test_fork_feeder_gateway.py +++ b/test/test_fork_feeder_gateway.py @@ -51,7 +51,7 @@ DEPLOYMENT_INPUT = "10" EXPECTED_DEPLOYMENT_ADDRESS = ( - "0x06442b891d63377cc12bd4b7ca4ecd9d6e4cb7eece8aa4051d64c4fe4dcaa98c" + "0x0737ae2bc29753c32794143d098d87f2f96bdcbb9acd83969318522af90e4ebe" ) EXPECTED_INVOKE_HASH = ( "0x51b501687e77d5433c7fc00b3a6dd25c2f6edf95f506dd9cba2251a4ce9ed43" From 5aec841a40ec83c5fd1dba0d612ef94f65f157e4 Mon Sep 17 00:00:00 2001 From: FabijanC Date: Mon, 5 Dec 2022 15:38:24 +0100 Subject: [PATCH 8/8] Fix fork.md [skip ci] --- page/docs/guide/fork.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/page/docs/guide/fork.md b/page/docs/guide/fork.md index b2d31131e..d88314ded 100644 --- a/page/docs/guide/fork.md +++ b/page/docs/guide/fork.md @@ -26,7 +26,7 @@ Devnet defaults to using the `TESTNET` chain ID (the one corresponding to Alpha starknet-devnet --chain-id [MAINNET | TESTNET | TESTNET2] ``` -where `MAINNET` refers to Alpha Mainnet and `TESTNET` refers to Alpha Goerli 2. +where `MAINNET` refers to Alpha Mainnet, `TESTNET` refers to Alpha Goerli and `TESTNET2` refers to Alpha Goerli2. ## Get fork status