From 5d731ea49be2d2f7274085741133de102ece16e3 Mon Sep 17 00:00:00 2001 From: stefano Date: Sat, 30 Mar 2024 18:56:23 +0000 Subject: [PATCH 01/70] add workflow --- .github/workflows/CODEOWNERS | 2 + .github/workflows/build-upload.yml | 118 +++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 .github/workflows/CODEOWNERS create mode 100644 .github/workflows/build-upload.yml diff --git a/.github/workflows/CODEOWNERS b/.github/workflows/CODEOWNERS new file mode 100644 index 0000000..0c44970 --- /dev/null +++ b/.github/workflows/CODEOWNERS @@ -0,0 +1,2 @@ +# Default owners +* @ex10ded diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml new file mode 100644 index 0000000..53f70a5 --- /dev/null +++ b/.github/workflows/build-upload.yml @@ -0,0 +1,118 @@ +name: Test & Release + +on: + workflow_dispatch: + +env: + PYTHON_VERSION: "3.7" + +jobs: + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + architecture: x64 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + - name: Build wheels - x86_64 + uses: messense/maturin-action@v1 + with: + target: x86_64 + args: --release --out dist --sdist + maturin-version: "v0.13.0" + - name: Install built wheel - x86_64 + run: | + pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall + pip install pytest + pytest -v + - name: Build wheels - universal2 + uses: messense/maturin-action@v1 + with: + args: --release --universal2 --out dist + maturin-version: "v0.13.0" + - name: Install built wheel - universal2 + run: | + pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall + pip install pytest + pytest -v + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist + + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + architecture: x64 + - name: Build wheels + uses: messense/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: auto + args: --release --out dist + maturin-version: "v0.13.0" + - name: Install built wheel + if: matrix.target == 'x86_64' + run: | + pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall + pip install pytest + pytest -v + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist + + linux-cross: + runs-on: ubuntu-latest + strategy: + matrix: + target: [aarch64] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + - name: Build wheels + uses: messense/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: auto + args: --release --out dist + maturin-version: "v0.13.0" + - uses: uraimo/run-on-arch-action@v2.0.5 + if: matrix.target != 'ppc64' + name: Install built wheel + with: + arch: ${{ matrix.target }} + distro: ubuntu20.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip + run: | + pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall + pip install pytest + pytest -v + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist + From 65b89fddd3c2132063f7bac9ac146009b7d46ba8 Mon Sep 17 00:00:00 2001 From: stefano Date: Sat, 30 Mar 2024 19:01:45 +0000 Subject: [PATCH 02/70] trim build workflow --- .github/workflows/build-upload.yml | 155 +++++++++++++++-------------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml index 53f70a5..6d6d708 100644 --- a/.github/workflows/build-upload.yml +++ b/.github/workflows/build-upload.yml @@ -5,48 +5,49 @@ on: env: PYTHON_VERSION: "3.7" + PACKAGE_NAME: "fast_stark_crypto" jobs: - macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - architecture: x64 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - default: true - - name: Build wheels - x86_64 - uses: messense/maturin-action@v1 - with: - target: x86_64 - args: --release --out dist --sdist - maturin-version: "v0.13.0" - - name: Install built wheel - x86_64 - run: | - pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall - pip install pytest - pytest -v - - name: Build wheels - universal2 - uses: messense/maturin-action@v1 - with: - args: --release --universal2 --out dist - maturin-version: "v0.13.0" - - name: Install built wheel - universal2 - run: | - pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall - pip install pytest - pytest -v - - name: Upload wheels - uses: actions/upload-artifact@v2 - with: - name: wheels - path: dist + # macos: + # runs-on: macos-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # architecture: x64 + # - name: Install Rust toolchain + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # profile: minimal + # default: true + # - name: Build wheels - x86_64 + # uses: messense/maturin-action@v1 + # with: + # target: x86_64 + # args: --release --out dist --sdist + # maturin-version: "v0.13.0" + # - name: Install built wheel - x86_64 + # run: | + # pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall + # pip install pytest + # pytest -v + # - name: Build wheels - universal2 + # uses: messense/maturin-action@v1 + # with: + # args: --release --universal2 --out dist + # maturin-version: "v0.13.0" + # - name: Install built wheel - universal2 + # run: | + # pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall + # pip install pytest + # pytest -v + # - name: Upload wheels + # uses: actions/upload-artifact@v2 + # with: + # name: wheels + # path: dist linux: runs-on: ubuntu-latest @@ -78,41 +79,41 @@ jobs: name: wheels path: dist - linux-cross: - runs-on: ubuntu-latest - strategy: - matrix: - target: [aarch64] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Build wheels - uses: messense/maturin-action@v1 - with: - target: ${{ matrix.target }} - manylinux: auto - args: --release --out dist - maturin-version: "v0.13.0" - - uses: uraimo/run-on-arch-action@v2.0.5 - if: matrix.target != 'ppc64' - name: Install built wheel - with: - arch: ${{ matrix.target }} - distro: ubuntu20.04 - githubToken: ${{ github.token }} - install: | - apt-get update - apt-get install -y --no-install-recommends python3 python3-pip - pip3 install -U pip - run: | - pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall - pip install pytest - pytest -v - - name: Upload wheels - uses: actions/upload-artifact@v2 - with: - name: wheels - path: dist + # linux-cross: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # target: [aarch64] + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Build wheels + # uses: messense/maturin-action@v1 + # with: + # target: ${{ matrix.target }} + # manylinux: auto + # args: --release --out dist + # maturin-version: "v0.13.0" + # - uses: uraimo/run-on-arch-action@v2.0.5 + # if: matrix.target != 'ppc64' + # name: Install built wheel + # with: + # arch: ${{ matrix.target }} + # distro: ubuntu20.04 + # githubToken: ${{ github.token }} + # install: | + # apt-get update + # apt-get install -y --no-install-recommends python3 python3-pip + # pip3 install -U pip + # run: | + # pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall + # pip install pytest + # pytest -v + # - name: Upload wheels + # uses: actions/upload-artifact@v2 + # with: + # name: wheels + # path: dist From 346d8b7d7895272e59838577fdcd9a250262e31c Mon Sep 17 00:00:00 2001 From: stefano Date: Sat, 30 Mar 2024 19:08:21 +0000 Subject: [PATCH 03/70] upgrade to maturin maintained action --- .github/workflows/build-upload.yml | 17 +++++++---------- .gitignore | 4 +++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml index 6d6d708..6b7ec62 100644 --- a/.github/workflows/build-upload.yml +++ b/.github/workflows/build-upload.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: env: - PYTHON_VERSION: "3.7" + PYTHON_VERSION: "3.9" PACKAGE_NAME: "fast_stark_crypto" jobs: @@ -61,18 +61,15 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} architecture: x64 - name: Build wheels - uses: messense/maturin-action@v1 - with: - target: ${{ matrix.target }} - manylinux: auto - args: --release --out dist - maturin-version: "v0.13.0" + run: | + docker run --rm --entrypoint=bash -v $(pwd):/io ghcr.io/pyo3/maturin -c 'for PYBIN in /opt/python/cp3*/bin; do ${PYBIN}/pip install maturin && "${PYBIN}/maturin" build --out dist -i "${PYBIN}/python" --release --manylinux 2014 ; done' + - name: Install built wheel if: matrix.target == 'x86_64' run: | - pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall - pip install pytest - pytest -v + pip${{ env.PYTHON_VERSION }} install --upgrade pip + pip${{ env.PYTHON_VERSION }} install ${{env.PACKAGE_NAME}} --no-index --find-links dist --force-reinstall + python -c "import ${{env.PACKAGE_NAME}} " - name: Upload wheels uses: actions/upload-artifact@v2 with: diff --git a/.gitignore b/.gitignore index e5d8c63..e0ac9a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ target *.so -*.pyc \ No newline at end of file +*.pyc +*.whl +*.tar.* \ No newline at end of file From 8f2a10f65456918c79449c5b6d051b0bd93cf3ad Mon Sep 17 00:00:00 2001 From: stefano Date: Sun, 31 Mar 2024 07:32:22 +0000 Subject: [PATCH 04/70] add publish step --- .github/workflows/build-upload.yml | 56 ++++++++++-------------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml index 6b7ec62..2492cdf 100644 --- a/.github/workflows/build-upload.yml +++ b/.github/workflows/build-upload.yml @@ -76,41 +76,21 @@ jobs: name: wheels path: dist - # linux-cross: - # runs-on: ubuntu-latest - # strategy: - # matrix: - # target: [aarch64] - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: ${{ env.PYTHON_VERSION }} - # - name: Build wheels - # uses: messense/maturin-action@v1 - # with: - # target: ${{ matrix.target }} - # manylinux: auto - # args: --release --out dist - # maturin-version: "v0.13.0" - # - uses: uraimo/run-on-arch-action@v2.0.5 - # if: matrix.target != 'ppc64' - # name: Install built wheel - # with: - # arch: ${{ matrix.target }} - # distro: ubuntu20.04 - # githubToken: ${{ github.token }} - # install: | - # apt-get update - # apt-get install -y --no-install-recommends python3 python3-pip - # pip3 install -U pip - # run: | - # pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall - # pip install pytest - # pytest -v - # - name: Upload wheels - # uses: actions/upload-artifact@v2 - # with: - # name: wheels - # path: dist - + release: + name: Release + runs-on: ubuntu-latest + needs: [ linux ] + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + pip install --upgrade twine + twine upload --skip-existing * \ No newline at end of file From c8d6766c7e2f54297338988c0bd145a1ae7bb27e Mon Sep 17 00:00:00 2001 From: stefano Date: Sun, 31 Mar 2024 09:05:14 +0000 Subject: [PATCH 05/70] add arm build --- .github/workflows/build-upload.yml | 25 ++++++++++++++++++++++++- LICENSE | 21 +++++++++++++++++++++ README.md | 16 ++++++++++++++++ pyproject.toml | 2 +- 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml index 2492cdf..aa9d5be 100644 --- a/.github/workflows/build-upload.yml +++ b/.github/workflows/build-upload.yml @@ -76,10 +76,33 @@ jobs: name: wheels path: dist + linux-cross: + runs-on: ubuntu-latest + strategy: + matrix: + target: [aarch64] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: auto + args: --release --out dist -i 3.9 3.10 3.11 3.12 + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + release: name: Release runs-on: ubuntu-latest - needs: [ linux ] + needs: [ linux, linux-cross ] steps: - uses: actions/download-artifact@v3 with: diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b32ac97 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2024] [x10] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fedcad4 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Stark Crypto Wrapper + +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) + +## Description + +The Stark Crypto Wrapper is a powerful library that provides a convenient interface for working with cryptographic operations in your applications. It abstracts away the complexities of low-level cryptographic algorithms and provides a simple and intuitive API for developers. + +## Features + +- **Hashing**: Generate secure hash values for data integrity verification. +- **Digital Signatures**: Sign and verify data using digital signatures for authentication and integrity. + +## Installation + +TODO \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index efedc4c..303fc97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ features = ["pyo3/extension-module"] [tool.poetry] name = "fast-stark-crypto" -version = "0.0.1" +version = "0.0.2" description = "wrapped starkware rust crypto functions" authors = ["x10"] license = "MIT" From c6a89c514c6dc58ff3602258d109f985648a931a Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 30 Sep 2024 12:11:22 +0100 Subject: [PATCH 06/70] add support for creating signable messages for transfers and limit orders --- Cargo.lock | 110 +++++++++++++++++++++++++- Cargo.toml | 1 + src/lib.rs | 205 ++++++++++++++++++++++++++++++++++++++++-------- src/messages.rs | 92 ++++++++++++++++++++++ 4 files changed, 376 insertions(+), 32 deletions(-) create mode 100644 src/messages.rs diff --git a/Cargo.lock b/Cargo.lock index e42f6fc..ee0a870 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,18 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "ark-ff" version = "0.4.2" @@ -14,7 +26,7 @@ dependencies = [ "ark-std", "derivative", "digest", - "itertools", + "itertools 0.10.5", "num-bigint", "num-traits", "paste", @@ -171,6 +183,7 @@ name = "fast-stark-crypto" version = "0.1.0" dependencies = [ "cc", + "malachite", "pyo3", "pyo3-build-config", "starknet-crypto", @@ -199,6 +212,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + [[package]] name = "heck" version = "0.4.1" @@ -235,6 +257,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.67" @@ -250,6 +281,12 @@ version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "lock_api" version = "0.4.11" @@ -266,6 +303,51 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "malachite" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5616515d632967cd329b6f6db96be9a03ea0b3a49cdbc45b0016803dad8a77b7" +dependencies = [ + "malachite-base", + "malachite-nz", + "malachite-q", +] + +[[package]] +name = "malachite-base" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46059721011b0458b7bd6d9179be5d0b60294281c23320c207adceaecc54d13b" +dependencies = [ + "hashbrown", + "itertools 0.11.0", + "libm", + "ryu", +] + +[[package]] +name = "malachite-nz" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1503b27e825cabd1c3d0ff1e95a39fb2ec9eab6fd3da6cfa41aec7091d273e78" +dependencies = [ + "itertools 0.11.0", + "libm", + "malachite-base", +] + +[[package]] +name = "malachite-q" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a475503a70a3679dbe3b9b230a23622516742528ba614a7b2490f180ea9cb514" +dependencies = [ + "itertools 0.11.0", + "malachite-base", + "malachite-nz", +] + [[package]] name = "memoffset" version = "0.9.0" @@ -479,6 +561,12 @@ dependencies = [ "semver", ] +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + [[package]] name = "scopeguard" version = "1.2.0" @@ -735,6 +823,26 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index 998728e..e68c74d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ name = "fast_stark_crypto" crate-type = ["cdylib"] [dependencies] +malachite = "0.4.16" pyo3 = "0.20.2" starknet-crypto = "0.6.1" diff --git a/src/lib.rs b/src/lib.rs index 5b8d2e8..056c1e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,15 +1,24 @@ +use malachite::{strings::ToLowerHexString, Integer}; use pyo3::prelude::*; use starknet_crypto::{ + get_public_key as fetch_public_key, pedersen_hash, sign, verify as verify_signature, FieldElement, - pedersen_hash, - sign, - verify as verify_signature, - get_public_key as fetch_public_key, }; +mod messages; + // Converts a hexadecimal string to a FieldElement fn str_to_field_element(hex_str: &str) -> Result { - FieldElement::from_hex_be(hex_str).map_err(|e| format!("Failed to convert hex string to FieldElement: {}", e)) + FieldElement::from_hex_be(hex_str).map_err(|e| { + format!( + "Failed to convert hex string {} to FieldElement: {}", + hex_str, e + ) + }) +} + +fn int_to_field_element(int: &Integer) -> Result { + str_to_field_element(&int.to_lower_hex_string()) } #[pyfunction] @@ -25,49 +34,56 @@ fn rs_get_public_key(py: Python, private_key_hex: String) -> PyResult { fn rs_compute_pedersen_hash(py: Python, left_hex: String, right_hex: String) -> PyResult { py.allow_threads(move || { str_to_field_element(&left_hex) - .and_then(|left| str_to_field_element(&right_hex) - .map_err(|e| e.into()) - .and_then(|right| Ok(pedersen_hash(&left, &right).to_string())) - ) + .and_then(|left| { + str_to_field_element(&right_hex) + .map_err(|e| e.into()) + .and_then(|right| Ok(pedersen_hash(&left, &right).to_string())) + }) .map_err(PyErr::new::) }) } #[pyfunction] -fn rs_sign_message(py: Python, priv_key_hex: String, msg_hash_hex: String, k_hex: String) -> PyResult<(String, String)> { +fn rs_sign_message( + py: Python, + priv_key_hex: String, + msg_hash_hex: String, + k_hex: String, +) -> PyResult<(String, String)> { py.allow_threads(move || { str_to_field_element(&priv_key_hex) - .and_then(|priv_key| - str_to_field_element(&msg_hash_hex) - .and_then(|msg_hash| - str_to_field_element(&k_hex) - .and_then(|k| { + .and_then(|priv_key| { + str_to_field_element(&msg_hash_hex).and_then(|msg_hash| { + str_to_field_element(&k_hex).and_then(|k| { sign(&priv_key, &msg_hash, &k) .map(|signature| (signature.r.to_string(), signature.s.to_string())) - .map_err(|e| - format!("Signing operation failed: {}", e) - ) + .map_err(|e| format!("Signing operation failed: {}", e)) }) - ) - ) + }) + }) .map_err(PyErr::new::) }) } #[pyfunction] -fn rs_verify_signature(py: Python, public_key_hex: String, msg_hash_hex: String, r_hex: String, s_hex: String) -> PyResult { +fn rs_verify_signature( + py: Python, + public_key_hex: String, + msg_hash_hex: String, + r_hex: String, + s_hex: String, +) -> PyResult { py.allow_threads(move || { str_to_field_element(&public_key_hex) - .and_then(|public_key| - str_to_field_element(&msg_hash_hex) - .and_then(|msg_hash| - str_to_field_element(&r_hex) - .and_then(|r| - str_to_field_element(&s_hex) - .and_then(|s| Ok(verify_signature(&public_key, &msg_hash, &r, &s).unwrap())) - ) - ) - ) + .and_then(|public_key| { + str_to_field_element(&msg_hash_hex).and_then(|msg_hash| { + str_to_field_element(&r_hex).and_then(|r| { + str_to_field_element(&s_hex).and_then(|s| { + Ok(verify_signature(&public_key, &msg_hash, &r, &s).unwrap()) + }) + }) + }) + }) .map_err(PyErr::new::) }) } @@ -80,3 +96,130 @@ fn fast_stark_crypto(py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_verify_signature, m)?)?; Ok(()) } + +#[cfg(test)] +mod tests { + //all test values are generated from python-sdk starkware implementation + use malachite::{num::conversion::traits::FromStringBase, Integer}; + use messages::{get_limit_order_msg, get_transfer_msg}; + + use super::*; + + fn wrapped_pedersen(left: &Integer, right: &Integer) -> Integer { + let hashed_value = pedersen_hash( + &int_to_field_element(left).unwrap(), + &int_to_field_element(right).unwrap(), + ); + Integer::from_string_base(16, &hashed_value.to_lower_hex_string()).unwrap() + } + + #[test] + fn test_get_limit_order_msg_buy() { + let amount_collateral = Integer::from_string_base(10, "2485778700").unwrap(); + let amount_fee = Integer::from_string_base(10, "1328036591").unwrap(); + let amount_synthetic = Integer::from_string_base(10, "1143395141").unwrap(); + let asset_id_collateral = Integer::from_string_base(16, "a1545ed8").unwrap(); + let asset_id_synthetic = Integer::from_string_base(16, "d78f244").unwrap(); + let expiration_timestamp = 1; + let is_buying_synthetic = true; + let nonce = 237283943; + let position_id = 711957234; + + let result = get_limit_order_msg( + &asset_id_synthetic, + &asset_id_collateral, + is_buying_synthetic, + &asset_id_collateral, + &amount_synthetic, + &amount_collateral, + &amount_fee, + nonce, + position_id, + expiration_timestamp, + wrapped_pedersen, + ); + + let expected_hash = Integer::from_string_base( + 16, + "63375cebdc56aad66f9df01c375cbaf6552c237bdd4a22f9c8eeb0cb151f38d", + ) + .unwrap(); + assert!(result == expected_hash); + } + + #[test] + fn test_get_limit_order_msg_sell() { + let amount_collateral = Integer::from_string_base(10, "1779339390").unwrap(); + let amount_fee = Integer::from_string_base(10, "2423504933").unwrap(); + let amount_synthetic = Integer::from_string_base(10, "918775584").unwrap(); + let asset_id_collateral = Integer::from_string_base(16, "c50a1245").unwrap(); + let asset_id_synthetic = Integer::from_string_base(16, "f5fc50c3").unwrap(); + let expiration_timestamp = 1; + let is_buying_synthetic = false; + let nonce = 2908915741; + let position_id = 1643977314; + + let result = get_limit_order_msg( + &asset_id_synthetic, + &asset_id_collateral, + is_buying_synthetic, + &asset_id_collateral, + &amount_synthetic, + &amount_collateral, + &amount_fee, + nonce, + position_id, + expiration_timestamp, + wrapped_pedersen, + ); + + let expected_hash = Integer::from_string_base( + 16, + "4bd1a1c31b8248c8368af2f0bc0cca455b1a003fa051f84af297cff2e2bc411", + ) + .unwrap(); + + assert!(result == expected_hash); + } + + #[test] + fn test_get_transfer_msg() { + let amount = Integer::from_string_base(10, "1000000").unwrap(); + + let asset_id = Integer::from_string_base( + 16, + "35596841893e0d17079c27b2d72db1694f26a1932a7429144b439ba0807d29c", + ) + .unwrap(); + + let receiver_public_key = Integer::from_string_base( + 16, + "4e8f8d6d2dde51fdfc1717582318a437f1d81de4657a93d74c33c9793d12be3", + ) + .unwrap(); + + let expiration_timestamp = 1712135815; + let nonce = 1; + let sender_position_id = 4; + let receiver_position_id = 3; + + let result = get_transfer_msg( + &asset_id, + &receiver_public_key, + sender_position_id, + receiver_position_id, + nonce, + &amount, + expiration_timestamp, + wrapped_pedersen, + ); + + let expected_hash = Integer::from_string_base( + 16, + "4f7f3014abc11ddcd5406932441b220640906921faaf566e728a6a75aa7ab06", + ) + .unwrap(); + + assert!(result == expected_hash); + } +} diff --git a/src/messages.rs b/src/messages.rs new file mode 100644 index 0000000..7d0653d --- /dev/null +++ b/src/messages.rs @@ -0,0 +1,92 @@ +use malachite::num::basic::traits::Zero; + +use malachite::integer::Integer; + +const OP_LIMIT_ORDER_WITH_FEES: u64 = 3; +const OP_TRANSFER: u64 = 4; +const OP_CONDITIONAL_TRANSFER: u64 = 5; +const OP_WITHDRAWAL_TO_ADDRESS: u64 = 7; + +pub fn get_limit_order_msg( + asset_id_synthetic: &Integer, + asset_id_collateral: &Integer, + is_buying_synthetic: bool, + asset_id_fee: &Integer, + amount_synthetic: &Integer, + amount_collateral: &Integer, + max_amount_fee: &Integer, + nonce: u64, + position_id: u64, + expiration_timestamp: u64, + hash_function: fn(&Integer, &Integer) -> Integer, +) -> Integer { + let (asset_id_sell, asset_id_buy, amount_sell, amount_buy, nonce) = if is_buying_synthetic { + ( + asset_id_collateral, + asset_id_synthetic, + amount_collateral, + amount_synthetic, + Integer::from(nonce), + ) + } else { + ( + asset_id_synthetic, + asset_id_collateral, + amount_synthetic, + amount_collateral, + Integer::from(nonce), + ) + }; + + let a = hash_function(asset_id_sell, asset_id_buy); + let b = hash_function(&a, asset_id_fee); + + let mut w4_packed = amount_sell.clone(); + w4_packed = (w4_packed << (64)) + amount_buy; + w4_packed = (w4_packed << (64)) + max_amount_fee; + w4_packed = (w4_packed << (32)) + &nonce; + + let c = hash_function(&b, &w4_packed); + + let mut w5_packed: Integer = + (Integer::ZERO << (10)) + Integer::from(OP_LIMIT_ORDER_WITH_FEES); + + w5_packed = (w5_packed << (64)) + Integer::from(position_id); + w5_packed = (w5_packed << (64)) + Integer::from(position_id); + w5_packed = (w5_packed << (64)) + Integer::from(position_id); + w5_packed = (w5_packed << (32)) + Integer::from(expiration_timestamp); + w5_packed = w5_packed << (17); + + hash_function(&c, &w5_packed) +} + +pub fn get_transfer_msg( + asset_id: &Integer, + receiver_public_key: &Integer, + sender_position_id: u64, + receiver_position_id: u64, + nonce: u64, + amount: &Integer, + expiration_timestamp: u64, + hash_function: fn(&Integer, &Integer) -> Integer, +) -> Integer { + + let mut packed_message0 = Integer::ZERO << 64; + packed_message0 = (packed_message0 + Integer::from(sender_position_id)) << 64; + packed_message0 = (packed_message0 + Integer::from(receiver_position_id)) << 64; + packed_message0 = (packed_message0 + Integer::from(sender_position_id)) << 32; + packed_message0 = packed_message0 + Integer::from(nonce); + + let mut packed_message1 = Integer::ZERO << 10; + packed_message1 = (packed_message1 + Integer::from(OP_TRANSFER)) << 64; + packed_message1 = (packed_message1 + amount) << 64; + packed_message1 = (packed_message1 + Integer::ZERO) << 32; + packed_message1 = (packed_message1 + Integer::from(expiration_timestamp)) << 81; + + let a = hash_function(asset_id, &Integer::ZERO); + let b = hash_function(&a, receiver_public_key); + let c = hash_function(&b, &packed_message0); + let d = hash_function(&c, &packed_message1); + + d +} From ea03d6d81df0838980a0be3378657ac92eb052d6 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 10:43:21 +0000 Subject: [PATCH 07/70] Add support for starknet orders --- .github/workflows/CI.yml | 235 +++ .github/workflows/build-upload.yml | 80 +- Cargo.lock | 2187 +++++++++++++++++++++++++--- Cargo.toml | 3 +- python/fast_stark_crypto/lib.py | 37 + src/lib.rs | 250 ++-- src/starknet_messages.rs | 163 +++ 7 files changed, 2593 insertions(+), 362 deletions(-) create mode 100644 .github/workflows/CI.yml create mode 100644 src/starknet_messages.rs diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..d170b43 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,235 @@ +name: CI + +on: + # push: + # branches: + # - main + # tags: + # - '*' + # pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: aarch64 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + shell: bash + run: | + set -e + python3 -m venv .venv + source .venv/bin/activate + pip install fast-stark-crypto --find-links dist --force-reinstall + pip install pytest + pytest + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'aarch64') }} + uses: uraimo/run-on-arch-action@v2 + with: + arch: ${{ matrix.platform.target }} + distro: ubuntu22.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip pytest + run: | + set -e + pip3 install fast-stark-crypto --find-links dist --force-reinstall + pytest + + musllinux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: aarch64 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + manylinux: musllinux_1_2 + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-musllinux-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + uses: addnab/docker-run-action@v3 + with: + image: alpine:latest + options: -v ${{ github.workspace }}:/io -w /io + run: | + set -e + apk add py3-pip py3-virtualenv + python3 -m virtualenv .venv + source .venv/bin/activate + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install pytest + pytest + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'aarch64') }} + uses: uraimo/run-on-arch-action@v2 + with: + arch: ${{ matrix.platform.target }} + distro: alpine_latest + githubToken: ${{ github.token }} + install: | + apk add py3-virtualenv + run: | + set -e + python3 -m virtualenv .venv + source .venv/bin/activate + pip install pytest + pip install fast-stark-crypto --find-links dist --force-reinstall + pytest + + + windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + architecture: ${{ matrix.platform.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist + - name: pytest + shell: bash + run: | + set -e + python3 -m venv .venv + source .venv/Scripts/activate + pip install fast-stark-crypto --find-links dist --force-reinstall + pip install pytest + pytest + + macos: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: macos-14 + target: aarch64 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist + - name: pytest + run: | + set -e + python3 -m venv .venv + source .venv/bin/activate + pip install fast-stark-crypto --find-links dist --force-reinstall + pip install pytest + pytest + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist + + # release: + # name: Release + # runs-on: ubuntu-latest + # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + # needs: [linux, musllinux, windows, macos, sdist] + # permissions: + # # Use to sign the release artifacts + # id-token: write + # # Used to upload release artifacts + # contents: write + # # Used to generate artifact attestation + # attestations: write + # steps: + # - uses: actions/download-artifact@v4 + # - name: Generate artifact attestation + # uses: actions/attest-build-provenance@v2 + # with: + # subject-path: 'wheels-*/*' + # - name: Publish to PyPI + # if: ${{ startsWith(github.ref, 'refs/tags/') }} + # uses: PyO3/maturin-action@v1 + # env: + # MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + # with: + # command: upload + # args: --non-interactive --skip-existing wheels-*/* diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml index aa9d5be..ebca0cc 100644 --- a/.github/workflows/build-upload.yml +++ b/.github/workflows/build-upload.yml @@ -8,46 +8,46 @@ env: PACKAGE_NAME: "fast_stark_crypto" jobs: - # macos: - # runs-on: macos-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: ${{ env.PYTHON_VERSION }} - # architecture: x64 - # - name: Install Rust toolchain - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # profile: minimal - # default: true - # - name: Build wheels - x86_64 - # uses: messense/maturin-action@v1 - # with: - # target: x86_64 - # args: --release --out dist --sdist - # maturin-version: "v0.13.0" - # - name: Install built wheel - x86_64 - # run: | - # pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall - # pip install pytest - # pytest -v - # - name: Build wheels - universal2 - # uses: messense/maturin-action@v1 - # with: - # args: --release --universal2 --out dist - # maturin-version: "v0.13.0" - # - name: Install built wheel - universal2 - # run: | - # pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall - # pip install pytest - # pytest -v - # - name: Upload wheels - # uses: actions/upload-artifact@v2 - # with: - # name: wheels - # path: dist + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + architecture: x64 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + - name: Build wheels - x86_64 + uses: messense/maturin-action@v1 + with: + target: x86_64 + args: --release --out dist --sdist + maturin-version: "v0.13.0" + - name: Install built wheel - x86_64 + run: | + pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall + pip install pytest + pytest -v + - name: Build wheels - universal2 + uses: messense/maturin-action@v1 + with: + args: --release --universal2 --out dist + maturin-version: "v0.13.0" + - name: Install built wheel - universal2 + run: | + pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall + pip install pytest + pytest -v + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist linux: runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index ee0a870..e226da5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,32 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] [[package]] name = "ahash" @@ -15,74 +41,80 @@ dependencies = [ ] [[package]] -name = "ark-ff" -version = "0.4.2" +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "derivative", - "digest", - "itertools 0.10.5", - "num-bigint", - "num-traits", - "paste", - "rustc_version", - "zeroize", + "libc", ] [[package]] -name = "ark-ff-asm" -version = "0.4.2" +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ + "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] -name = "ark-ff-macros" -version = "0.4.2" +name = "auto_impl" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" dependencies = [ - "num-bigint", - "num-traits", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] -name = "ark-serialize" -version = "0.4.2" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-std", - "digest", - "num-bigint", -] +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "ark-std" -version = "0.4.0" +name = "backtrace" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ - "num-traits", - "rand", + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] -name = "autocfg" -version = "1.1.0" +name = "base64" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -90,6 +122,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -105,13 +149,31 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byte-slice-cast" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + [[package]] name = "cc" -version = "1.0.83" +version = "1.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -120,6 +182,65 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "const_format" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.12" @@ -129,6 +250,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -151,14 +287,57 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", - "syn 1.0.109", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", + "serde", ] [[package]] @@ -172,12 +351,87 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest", + "hex", + "hmac", + "pbkdf2", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + [[package]] name = "fast-stark-crypto" version = "0.1.0" @@ -186,7 +440,96 @@ dependencies = [ "malachite", "pyo3", "pyo3-build-config", - "starknet-crypto", + "starknet", + "starknet-crypto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "flate2" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", ] [[package]] @@ -212,6 +555,37 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.9.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.5" @@ -221,6 +595,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + [[package]] name = "heck" version = "0.4.1" @@ -243,58 +623,408 @@ dependencies = [ ] [[package]] -name = "indoc" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" - -[[package]] -name = "itertools" -version = "0.10.5" +name = "http" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "either", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "itertools" -version = "0.11.0" +name = "http-body" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "either", + "bytes", + "http", + "pin-project-lite", ] [[package]] -name = "js-sys" -version = "0.3.67" +name = "httparse" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] -name = "libc" -version = "0.2.152" +name = "httpdate" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] -name = "libm" -version = "0.2.8" +name = "hyper" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] [[package]] -name = "lock_api" -version = "0.4.11" +name = "hyper-rustls" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ - "autocfg", - "scopeguard", + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", + "serde", +] + +[[package]] +name = "indoc" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lambdaworks-crypto" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbc2a4da0d9e52ccfe6306801a112e81a8fc0c76aa3e4449fefeda7fef72bb34" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1bd2632acbd9957afc5aeec07ad39f078ae38656654043bf16e046fa2730e23" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", ] [[package]] @@ -320,8 +1050,8 @@ version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46059721011b0458b7bd6d9179be5d0b60294281c23320c207adceaecc54d13b" dependencies = [ - "hashbrown", - "itertools 0.11.0", + "hashbrown 0.14.5", + "itertools", "libm", "ryu", ] @@ -332,7 +1062,7 @@ version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1503b27e825cabd1c3d0ff1e95a39fb2ec9eab6fd3da6cfa41aec7091d273e78" dependencies = [ - "itertools 0.11.0", + "itertools", "libm", "malachite-base", ] @@ -343,11 +1073,17 @@ version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a475503a70a3679dbe3b9b230a23622516742528ba614a7b2490f180ea9cb514" dependencies = [ - "itertools 0.11.0", + "itertools", "malachite-base", "malachite-nz", ] +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + [[package]] name = "memoffset" version = "0.9.0" @@ -357,6 +1093,32 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -368,6 +1130,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" @@ -380,19 +1148,56 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "parity-scale-codec" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "const_format", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "rustversion", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -413,14 +1218,41 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", ] [[package]] -name = "paste" -version = "1.0.14" +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -428,11 +1260,33 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +dependencies = [ + "toml_edit", +] + [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] @@ -483,7 +1337,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -495,24 +1349,31 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] -name = "rand" -version = "0.8.5" +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", "rand_chacha", "rand_core", ] @@ -532,155 +1393,759 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "redox_syscall" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags", +] + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.9.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "size-of" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4e36eca171fddeda53901b0a436573b3f2391eaa9189d439b2bd8ea8cebd7e3" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" + +[[package]] +name = "socket2" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "starknet" +version = "0.14.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "starknet-accounts", + "starknet-contract", + "starknet-core", + "starknet-core-derive", + "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-macros", + "starknet-providers", + "starknet-signers", +] + +[[package]] +name = "starknet-accounts" +version = "0.13.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "async-trait", + "auto_impl", + "starknet-core", + "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-providers", + "starknet-signers", + "thiserror", +] + +[[package]] +name = "starknet-contract" +version = "0.13.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "serde", + "serde_json", + "serde_with", + "starknet-accounts", + "starknet-core", + "starknet-providers", + "thiserror", +] + +[[package]] +name = "starknet-core" +version = "0.13.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "foldhash", + "hex", + "indexmap 2.9.0", + "num-traits", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with", + "sha3", + "starknet-core-derive", + "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-types-core", +] + +[[package]] +name = "starknet-core-derive" +version = "0.1.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039a3bad70806b494c9e6b21c5238a6c8a373d66a26071859deb0ccca6f93634" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-curve 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.4" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-curve 0.5.1 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-curve" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcde6bd74269b8161948190ace6cf069ef20ac6e79cd2ba09b320efa7500b6de" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-curve" +version = "0.5.1" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-macros" +version = "0.2.2" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "starknet-core", + "syn", +] + +[[package]] +name = "starknet-providers" +version = "0.13.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "async-trait", + "auto_impl", + "ethereum-types", + "flate2", + "getrandom", + "log", + "reqwest", + "serde", + "serde_json", + "serde_with", + "starknet-core", + "thiserror", + "url", +] + +[[package]] +name = "starknet-signers" +version = "0.11.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +dependencies = [ + "async-trait", + "auto_impl", + "crypto-bigint", + "eth-keystore", + "getrandom", + "rand", + "starknet-core", + "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "thiserror", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4037bcb26ce7c508448d221e570d075196fd4f6912ae6380981098937af9522a" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", + "size-of", + "zeroize", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "bitflags", + "thiserror-impl", ] [[package]] -name = "rfc6979" -version = "0.4.0" +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "hmac", - "subtle", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "rustc_version" -version = "0.4.0" +name = "time" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ - "semver", + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", ] [[package]] -name = "ryu" -version = "1.0.18" +name = "time-core" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] -name = "scopeguard" -version = "1.2.0" +name = "time-macros" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +dependencies = [ + "num-conv", + "time-core", +] [[package]] -name = "semver" -version = "1.0.21" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] [[package]] -name = "sha2" -version = "0.10.8" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "displaydoc", + "zerovec", ] [[package]] -name = "smallvec" -version = "1.13.1" +name = "tokio" +version = "1.44.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.52.0", +] [[package]] -name = "starknet-crypto" -version = "0.6.1" +name = "tokio-rustls" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c03f5ac70f9b067f48db7d2d70bdf18ee0f731e8192b6cfa679136becfcdb0" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "crypto-bigint", - "hex", - "hmac", - "num-bigint", - "num-integer", - "num-traits", - "rfc6979", - "sha2", - "starknet-crypto-codegen", - "starknet-curve", - "starknet-ff", - "zeroize", + "rustls", + "tokio", ] [[package]] -name = "starknet-crypto-codegen" -version = "0.3.2" +name = "tokio-util" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af6527b845423542c8a16e060ea1bc43f67229848e7cd4c4d80be994a84220ce" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ - "starknet-curve", - "starknet-ff", - "syn 2.0.48", + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", ] [[package]] -name = "starknet-curve" -version = "0.4.0" +name = "toml_datetime" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68a0d87ae56572abf83ddbfd44259a7c90dbeeee1629a1ffe223e7f9a8f3052" -dependencies = [ - "starknet-ff", -] +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] -name = "starknet-ff" -version = "0.3.6" +name = "toml_edit" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "067419451efdea1ee968df8438369960c167e0e905c05b84afd074f50e1d6f3d" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ - "ark-ff", - "crypto-bigint", - "getrandom", - "hex", + "indexmap 2.9.0", + "toml_datetime", + "winnow", ] [[package]] -name = "subtle" -version = "2.5.0" +name = "tower-service" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] -name = "syn" -version = "1.0.109" +name = "tracing" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "pin-project-lite", + "tracing-core", ] [[package]] -name = "syn" -version = "2.0.48" +name = "tracing-core" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "once_cell", ] [[package]] -name = "target-lexicon" -version = "0.12.13" +name = "try-lock" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" @@ -688,24 +2153,90 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "unindent" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -733,10 +2264,22 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.90" @@ -755,7 +2298,7 @@ checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -766,19 +2309,128 @@ version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +[[package]] +name = "web-sys" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + +[[package]] +name = "windows-core" +version = "0.61.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -787,42 +2439,154 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -840,25 +2604,54 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ - "zeroize_derive", + "yoke", + "zerofrom", + "zerovec-derive", ] [[package]] -name = "zeroize_derive" -version = "1.4.2" +name = "zerovec-derive" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index e68c74d..c0f6b0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,8 @@ crate-type = ["cdylib"] [dependencies] malachite = "0.4.16" pyo3 = "0.20.2" -starknet-crypto = "0.6.1" +starknet = { git = "https://github.com/xJonathanLEI/starknet-rs" } +starknet-crypto = "0.7.4" [build-dependencies] cc = { version = "1" } diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index a98f0e4..48e7e16 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -3,6 +3,7 @@ rs_compute_pedersen_hash, rs_sign_message, rs_verify_signature, + rs_get_order_msg, ) @@ -21,3 +22,39 @@ def sign(private_key: int, msg_hash: int, k: int) -> tuple[int, int]: def verify(public_key: int, msg_hash: int, r: int, s: int) -> bool: return rs_verify_signature(hex(public_key), hex(msg_hash), hex(r), hex(s)) + + +def get_order_msg_hash( + position_id: int, + base_asset_id: int, + base_amount: int, + quote_asset_id: int, + quote_amount: int, + fee_asset_id: int, + fee_amount: int, + expiration: int, + salt: int, + user_public_key: int, + domain_name: str, + domain_version: str, + domain_chain_id: str, + domain_revision: str, +) -> int: + return int( + rs_get_order_msg( + str(position_id), + hex(base_asset_id), + str(base_amount), + hex(quote_asset_id), + str(quote_amount), + hex(fee_asset_id), + str(fee_amount), + str(expiration), + str(salt), + hex(user_public_key), + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ) + ) diff --git a/src/lib.rs b/src/lib.rs index 056c1e5..982c2a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,15 +1,17 @@ -use malachite::{strings::ToLowerHexString, Integer}; +use malachite::{num::conversion::traits::FromStringBase, strings::ToLowerHexString, Integer}; use pyo3::prelude::*; +use pyo3::types::PyModule; use starknet_crypto::{ - get_public_key as fetch_public_key, pedersen_hash, sign, verify as verify_signature, - FieldElement, + get_public_key as fetch_public_key, pedersen_hash, sign, verify as verify_signature, Felt, }; +use starknet_messages::{AssetId, OffChainMessage, Order, PositionId, StarknetDomain, Timestamp}; mod messages; +mod starknet_messages; // Converts a hexadecimal string to a FieldElement -fn str_to_field_element(hex_str: &str) -> Result { - FieldElement::from_hex_be(hex_str).map_err(|e| { +fn str_to_field_element(hex_str: &str) -> Result { + Felt::from_hex(hex_str).map_err(|e| { format!( "Failed to convert hex string {} to FieldElement: {}", hex_str, e @@ -17,7 +19,7 @@ fn str_to_field_element(hex_str: &str) -> Result { }) } -fn int_to_field_element(int: &Integer) -> Result { +fn int_to_field_element(int: &Integer) -> Result { str_to_field_element(&int.to_lower_hex_string()) } @@ -88,138 +90,138 @@ fn rs_verify_signature( }) } +#[pyfunction] +fn rs_get_order_msg( + py: Python, + position_id: String, + base_asset_id_hex: String, + base_amount: String, + quote_asset_id_hex: String, + quote_amount: String, + fee_asset_id_hex: String, + fee_amount: String, + expiration: String, + salt: String, + user_public_key_hex: String, + + domain_name: String, + domain_version: String, + domain_chain_id: String, + domain_revision: String, +) -> PyResult { + py.allow_threads(move || { + //hex fields + let base_asset_id = Felt::from_hex(&base_asset_id_hex).unwrap(); + let quote_asset_id = Felt::from_hex("e_asset_id_hex).unwrap(); + let fee_asset_id = Felt::from_hex(&fee_asset_id_hex).unwrap(); + let user_key = Felt::from_hex(&user_public_key_hex).unwrap(); + + //decimal fields + let position_id = u32::from_str_radix(&position_id, 10).unwrap(); + let base_amount = i64::from_str_radix(&base_amount, 10).unwrap(); + let quote_amount = i64::from_str_radix("e_amount, 10).unwrap(); + let fee_amount = u64::from_str_radix(&fee_amount, 10).unwrap(); + let expiration = u64::from_str_radix(&expiration, 10).unwrap(); + let salt = u64::from_str_radix(&salt, 10).unwrap(); + + let order = Order { + position_id: PositionId { value: position_id }, + base_asset_id: AssetId { + value: base_asset_id, + }, + base_amount: base_amount, + quote_asset_id: AssetId { + value: quote_asset_id, + }, + quote_amount: quote_amount, + fee_asset_id: AssetId { + value: fee_asset_id, + }, + fee_amount: fee_amount, + expiration: Timestamp { + seconds: expiration, + }, + salt: salt.try_into().unwrap(), + }; + let domain = StarknetDomain { + name: domain_name, + version: domain_version, + chain_id: domain_chain_id, + revision: domain_revision, + }; + let message = order.message_hash(&domain, user_key).unwrap(); + Ok(message.to_hex_string()) + }) +} + #[pymodule] fn fast_stark_crypto(py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_get_public_key, m)?)?; m.add_function(wrap_pyfunction!(rs_compute_pedersen_hash, m)?)?; m.add_function(wrap_pyfunction!(rs_sign_message, m)?)?; m.add_function(wrap_pyfunction!(rs_verify_signature, m)?)?; + m.add_function(wrap_pyfunction!(rs_get_order_msg, m)?)?; Ok(()) } #[cfg(test)] mod tests { - //all test values are generated from python-sdk starkware implementation - use malachite::{num::conversion::traits::FromStringBase, Integer}; - use messages::{get_limit_order_msg, get_transfer_msg}; - - use super::*; - - fn wrapped_pedersen(left: &Integer, right: &Integer) -> Integer { - let hashed_value = pedersen_hash( - &int_to_field_element(left).unwrap(), - &int_to_field_element(right).unwrap(), - ); - Integer::from_string_base(16, &hashed_value.to_lower_hex_string()).unwrap() - } - - #[test] - fn test_get_limit_order_msg_buy() { - let amount_collateral = Integer::from_string_base(10, "2485778700").unwrap(); - let amount_fee = Integer::from_string_base(10, "1328036591").unwrap(); - let amount_synthetic = Integer::from_string_base(10, "1143395141").unwrap(); - let asset_id_collateral = Integer::from_string_base(16, "a1545ed8").unwrap(); - let asset_id_synthetic = Integer::from_string_base(16, "d78f244").unwrap(); - let expiration_timestamp = 1; - let is_buying_synthetic = true; - let nonce = 237283943; - let position_id = 711957234; - - let result = get_limit_order_msg( - &asset_id_synthetic, - &asset_id_collateral, - is_buying_synthetic, - &asset_id_collateral, - &amount_synthetic, - &amount_collateral, - &amount_fee, - nonce, - position_id, - expiration_timestamp, - wrapped_pedersen, - ); - - let expected_hash = Integer::from_string_base( - 16, - "63375cebdc56aad66f9df01c375cbaf6552c237bdd4a22f9c8eeb0cb151f38d", - ) - .unwrap(); - assert!(result == expected_hash); - } - #[test] - fn test_get_limit_order_msg_sell() { - let amount_collateral = Integer::from_string_base(10, "1779339390").unwrap(); - let amount_fee = Integer::from_string_base(10, "2423504933").unwrap(); - let amount_synthetic = Integer::from_string_base(10, "918775584").unwrap(); - let asset_id_collateral = Integer::from_string_base(16, "c50a1245").unwrap(); - let asset_id_synthetic = Integer::from_string_base(16, "f5fc50c3").unwrap(); - let expiration_timestamp = 1; - let is_buying_synthetic = false; - let nonce = 2908915741; - let position_id = 1643977314; - - let result = get_limit_order_msg( - &asset_id_synthetic, - &asset_id_collateral, - is_buying_synthetic, - &asset_id_collateral, - &amount_synthetic, - &amount_collateral, - &amount_fee, - nonce, - position_id, - expiration_timestamp, - wrapped_pedersen, - ); - - let expected_hash = Integer::from_string_base( - 16, - "4bd1a1c31b8248c8368af2f0bc0cca455b1a003fa051f84af297cff2e2bc411", - ) - .unwrap(); + use pyo3::types::PyTuple; - assert!(result == expected_hash); - } + use super::*; #[test] - fn test_get_transfer_msg() { - let amount = Integer::from_string_base(10, "1000000").unwrap(); - - let asset_id = Integer::from_string_base( - 16, - "35596841893e0d17079c27b2d72db1694f26a1932a7429144b439ba0807d29c", - ) - .unwrap(); - - let receiver_public_key = Integer::from_string_base( - 16, - "4e8f8d6d2dde51fdfc1717582318a437f1d81de4657a93d74c33c9793d12be3", - ) - .unwrap(); - - let expiration_timestamp = 1712135815; - let nonce = 1; - let sender_position_id = 4; - let receiver_position_id = 3; - - let result = get_transfer_msg( - &asset_id, - &receiver_public_key, - sender_position_id, - receiver_position_id, - nonce, - &amount, - expiration_timestamp, - wrapped_pedersen, - ); - - let expected_hash = Integer::from_string_base( - 16, - "4f7f3014abc11ddcd5406932441b220640906921faaf566e728a6a75aa7ab06", - ) - .unwrap(); - - assert!(result == expected_hash); + fn test_rs_get_order_msg() { + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { + let module = PyModule::new(py, "fast_stark_crypto").unwrap(); + fast_stark_crypto(py, module).unwrap(); + let position_id = "100".to_string(); + let base_asset_id = "0x2".to_string(); + let base_amount = "100".to_string(); + let quote_asset_id = "0x1".to_string(); + let quote_amount = "-156".to_string(); + let fee_asset_id = "0x1".to_string(); + let fee_amount = "74".to_string(); + let expiration = "100".to_string(); + let salt = "123".to_string(); + let user_public_key = + "0x5d05989e9302dcebc74e241001e3e3ac3f4402ccf2f8e6f74b034b07ad6a904".to_string(); + let domain_name = "Perpetuals".to_string(); + let domain_version = "v0".to_string(); + let domain_chain_id = "SN_SEPOLIA".to_string(); + let domain_revision = "1".to_string(); + let result: String = module + .getattr("rs_get_order_msg") + .unwrap() + .call1(PyTuple::new( + py, + [ + position_id, + base_asset_id, + base_amount, + quote_asset_id, + quote_amount, + fee_asset_id, + fee_amount, + expiration, + salt, + user_public_key, + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ], + )) + .unwrap() + .extract() + .unwrap(); + + assert_eq!( + result, + "0x62428944e2c935c4c6662ec0328abfcab44dd6455cb48845c78d18f0ea0450b" + ); + }); } } diff --git a/src/starknet_messages.rs b/src/starknet_messages.rs new file mode 100644 index 0000000..a6d0cfe --- /dev/null +++ b/src/starknet_messages.rs @@ -0,0 +1,163 @@ +use starknet::core::utils::cairo_short_string_to_felt; + +use starknet::macros::selector; +use starknet_crypto::Felt; +use starknet_crypto::PoseidonHasher; + +use std::sync::LazyLock; + +static MESSAGE_FELT: LazyLock = + LazyLock::new(|| cairo_short_string_to_felt("StarkNet Message").unwrap()); + +pub(crate) trait Hashable { + const SELECTOR: Felt; + fn hash(&self) -> Felt; +} + +pub(crate) trait OffChainMessage: Hashable { + fn message_hash(&self, stark_domain: &StarknetDomain, public_key: Felt) -> Option { + let mut hasher = PoseidonHasher::new(); + hasher.update(*MESSAGE_FELT); + hasher.update(stark_domain.hash()); + hasher.update(public_key); + hasher.update(self.hash()); + Some(hasher.finalize()) + } +} + +pub(crate) struct StarknetDomain { + pub name: String, + pub version: String, + pub chain_id: String, + pub revision: String, +} + +impl Hashable for StarknetDomain { + const SELECTOR: Felt = selector!("\"StarknetDomain\"(\"name\":\"shortstring\",\"version\":\"shortstring\",\"chainId\":\"shortstring\",\"revision\":\"shortstring\")"); + fn hash(&self) -> Felt { + let mut hasher = PoseidonHasher::new(); + hasher.update(Self::SELECTOR); + hasher.update(cairo_short_string_to_felt(&self.name).unwrap()); + hasher.update(cairo_short_string_to_felt(&self.version).unwrap()); + hasher.update(cairo_short_string_to_felt(&self.chain_id).unwrap()); + hasher.update(cairo_short_string_to_felt(&self.revision).unwrap()); + let hash = hasher.finalize(); + return hash; + } +} + +pub struct AssetId { + pub value: Felt, +} +pub struct PositionId { + pub value: u32, +} + +pub struct AssetAmount { + pub asset_id: AssetId, + pub amount: i64, +} + +pub struct Timestamp { + pub seconds: u64, +} + +pub struct Order { + pub position_id: PositionId, + pub base_asset_id: AssetId, + pub base_amount: i64, + pub quote_asset_id: AssetId, + pub quote_amount: i64, + pub fee_asset_id: AssetId, + pub fee_amount: u64, + pub expiration: Timestamp, + pub salt: Felt, +} + +impl Hashable for Order { + const SELECTOR: Felt = selector!("\"Order\"(\"position_id\":\"felt\",\"base_asset_id\":\"AssetId\",\"base_amount\":\"i64\",\"quote_asset_id\":\"AssetId\",\"quote_amount\":\"i64\",\"fee_asset_id\":\"AssetId\",\"fee_amount\":\"u64\",\"expiration\":\"Timestamp\",\"salt\":\"felt\")\"PositionId\"(\"value\":\"u32\")\"AssetId\"(\"value\":\"felt\")\"Timestamp\"(\"seconds\":\"u64\")"); + fn hash(&self) -> Felt { + let mut hasher = PoseidonHasher::new(); + hasher.update(Self::SELECTOR); + hasher.update(self.position_id.value.into()); + hasher.update(self.base_asset_id.value.into()); + hasher.update(self.base_amount.into()); + hasher.update(self.quote_asset_id.value.into()); + hasher.update(self.quote_amount.into()); + hasher.update(self.fee_asset_id.value.into()); + hasher.update(self.fee_amount.into()); + hasher.update(self.expiration.seconds.into()); + hasher.update(self.salt.into()); + hasher.finalize() + } +} +impl OffChainMessage for Order {} + +pub(crate) static SEPOLIA_DOMAIN: LazyLock = LazyLock::new(|| StarknetDomain { + name: "Perpetuals".to_string(), + version: "v0".to_string(), + chain_id: "SN_SEPOLIA".to_string(), + revision: "1".to_string(), +}); + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_hash_sepolia_domain() { + let hash = SEPOLIA_DOMAIN.hash(); + assert_ne!( + hash, + Felt::default(), + "Hash should not be the default value" + ); + } + + #[test] + fn test_hash_order() { + assert_eq!( + Order::SELECTOR, + Felt::from_hex("0x36da8d51815527cabfaa9c982f564c80fa7429616739306036f1f9b608dd112") + .unwrap() + ); + let order = Order { + position_id: PositionId { value: 100 }, + base_asset_id: AssetId { + value: Felt::from(2), + }, + base_amount: 100, + quote_asset_id: AssetId { + value: Felt::from(1), + }, + quote_amount: -156, + fee_asset_id: AssetId { + value: Felt::from(1), + }, + fee_amount: 74, + expiration: Timestamp { seconds: 100 }, + salt: Felt::from(123), + }; + let struct_hash = order.hash(); + assert_eq!( + struct_hash, + Felt::from_dec_str( + "1665831471058010006487271218593798151006210932872528562786901713678061931056" + ) + .unwrap(), + ); + + let user_key = Felt::from_dec_str( + "2629686405885377265612250192330550814166101744721025672593857097107510831364", + ) + .unwrap(); + + let hash = order.message_hash(&SEPOLIA_DOMAIN, user_key).unwrap(); + let expected_hash = Felt::from_dec_str( + "2777763653990294626488311476018476273780272220813327677173452477333361411339", + ) + .unwrap(); + println!("{}", expected_hash.to_hex_string()); + assert_eq!(hash, expected_hash); + } +} From 58d69d160e8ccee742000c245f032a77f8b5bcab Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 11:01:15 +0000 Subject: [PATCH 08/70] add tests --- .gitignore | 4 +++- python/fast_stark_crypto/lib.py | 3 ++- tests/test_order_msg_rust_integration.py | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/test_order_msg_rust_integration.py diff --git a/.gitignore b/.gitignore index e0ac9a6..893476f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ target *.so *.pyc *.whl -*.tar.* \ No newline at end of file +*.tar.* + +venv \ No newline at end of file diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index 48e7e16..8b279ce 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -56,5 +56,6 @@ def get_order_msg_hash( domain_version, domain_chain_id, domain_revision, - ) + ), + 16, ) diff --git a/tests/test_order_msg_rust_integration.py b/tests/test_order_msg_rust_integration.py new file mode 100644 index 0000000..958a422 --- /dev/null +++ b/tests/test_order_msg_rust_integration.py @@ -0,0 +1,22 @@ +import fast_stark_crypto + + +def test_well_known_order_hash(): + hash_from_rust = fast_stark_crypto.get_order_msg_hash( + position_id=100, + base_asset_id=2, + base_amount=100, + quote_asset_id=1, + quote_amount=-156, + fee_asset_id=1, + fee_amount=74, + expiration=100, + salt=123, + user_public_key=int("0x5d05989e9302dcebc74e241001e3e3ac3f4402ccf2f8e6f74b034b07ad6a904", 16), + domain_name="Perpetuals", + domain_version="v0", + domain_chain_id="SN_SEPOLIA", + domain_revision="1", + ) + + assert hash_from_rust == int("0x62428944e2c935c4c6662ec0328abfcab44dd6455cb48845c78d18f0ea0450b", 16) From 7fcccbe2ffb6797c36b23d403a9c3b22f55baa01 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 11:06:02 +0000 Subject: [PATCH 09/70] fix arm glibc build --- .github/workflows/CI.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d170b43..2e69448 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -50,21 +50,21 @@ jobs: pip install fast-stark-crypto --find-links dist --force-reinstall pip install pytest pytest - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'aarch64') }} - uses: uraimo/run-on-arch-action@v2 - with: - arch: ${{ matrix.platform.target }} - distro: ubuntu22.04 - githubToken: ${{ github.token }} - install: | - apt-get update - apt-get install -y --no-install-recommends python3 python3-pip - pip3 install -U pip pytest - run: | - set -e - pip3 install fast-stark-crypto --find-links dist --force-reinstall - pytest + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'aarch64') }} + uses: uraimo/run-on-arch-action@v2 + with: + arch: ${{ matrix.platform.target }} + distro: ubuntu22.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip pytest + run: | + set -e + pip3 install fast-stark-crypto --find-links dist --force-reinstall + pytest musllinux: runs-on: ${{ matrix.platform.runner }} From b8544de684dced6878b468ccf7a8770e60d694e9 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 11:15:51 +0000 Subject: [PATCH 10/70] try updating many linux for aarch64 builds --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2e69448..0de4ee3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,7 +34,7 @@ jobs: target: ${{ matrix.platform.target }} args: --release --out dist --find-interpreter sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: auto + manylinux: manylinux2014 - name: Upload wheels uses: actions/upload-artifact@v4 with: From 3210f20d07d2d1bb1d2fc97f038cd823e16bf5e4 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 11:20:44 +0000 Subject: [PATCH 11/70] upgrade manylinux some more --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0de4ee3..52c405a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,7 +34,7 @@ jobs: target: ${{ matrix.platform.target }} args: --release --out dist --find-interpreter sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: manylinux2014 + manylinux: manylinux_2_34 - name: Upload wheels uses: actions/upload-artifact@v4 with: From bb7128e24212145138d16c01c0534b32c116d72d Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 11:30:18 +0000 Subject: [PATCH 12/70] more ci fixes --- .github/workflows/CI.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 52c405a..e49df69 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,8 +20,10 @@ jobs: platform: - runner: ubuntu-22.04 target: x86_64 + manylinux: auto - runner: ubuntu-22.04 target: aarch64 + manylinux: "2_24" steps: - uses: actions/checkout@v4 @@ -32,9 +34,9 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: manylinux_2_34 + manylinux: ${{ matrix.platform.manylinux }} - name: Upload wheels uses: actions/upload-artifact@v4 with: @@ -143,7 +145,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist -i 3.9 3.10 3.11 3.12 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels uses: actions/upload-artifact@v4 From 3b62cc45392914c99cce3729b3bf7ab9268504cc Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 12:14:51 +0000 Subject: [PATCH 13/70] add key generation --- .github/workflows/CI.yml | 2 +- .vscode/settings.json | 7 + Cargo.lock | 121 +----------------- Cargo.toml | 4 +- pyproject.toml | 2 +- python/fast_stark_crypto/lib.py | 8 ++ src/lib.rs | 71 +++++++++- src/messages.rs | 92 ------------- tests/test_key_generation_rust_integration.py | 10 ++ 9 files changed, 102 insertions(+), 215 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 src/messages.rs create mode 100644 tests/test_key_generation_rust_integration.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e49df69..74fdccf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -145,7 +145,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.9 3.10 3.11 3.12 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels uses: actions/upload-artifact@v4 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9b38853 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e226da5..f0e89e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,18 +28,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -362,12 +350,6 @@ dependencies = [ "syn", ] -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - [[package]] name = "encoding_rs" version = "0.8.35" @@ -437,9 +419,11 @@ name = "fast-stark-crypto" version = "0.1.0" dependencies = [ "cc", - "malachite", + "hex", + "num-bigint", "pyo3", "pyo3-build-config", + "sha2", "starknet", "starknet-crypto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -586,15 +570,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.15.2" @@ -944,15 +919,6 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.15" @@ -1005,12 +971,6 @@ version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - [[package]] name = "litemap" version = "0.7.5" @@ -1033,51 +993,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "malachite" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5616515d632967cd329b6f6db96be9a03ea0b3a49cdbc45b0016803dad8a77b7" -dependencies = [ - "malachite-base", - "malachite-nz", - "malachite-q", -] - -[[package]] -name = "malachite-base" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46059721011b0458b7bd6d9179be5d0b60294281c23320c207adceaecc54d13b" -dependencies = [ - "hashbrown 0.14.5", - "itertools", - "libm", - "ryu", -] - -[[package]] -name = "malachite-nz" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1503b27e825cabd1c3d0ff1e95a39fb2ec9eab6fd3da6cfa41aec7091d273e78" -dependencies = [ - "itertools", - "libm", - "malachite-base", -] - -[[package]] -name = "malachite-q" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a475503a70a3679dbe3b9b230a23622516742528ba614a7b2490f180ea9cb514" -dependencies = [ - "itertools", - "malachite-base", - "malachite-nz", -] - [[package]] name = "memchr" version = "2.7.4" @@ -1121,11 +1036,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -1138,11 +1052,10 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] @@ -2587,26 +2500,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "zerofrom" version = "0.1.6" diff --git a/Cargo.toml b/Cargo.toml index c0f6b0b..ca6327e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,12 @@ name = "fast_stark_crypto" crate-type = ["cdylib"] [dependencies] -malachite = "0.4.16" pyo3 = "0.20.2" starknet = { git = "https://github.com/xJonathanLEI/starknet-rs" } starknet-crypto = "0.7.4" +num-bigint = "0.4.6" +hex = "0.4.3" +sha2 = "0.10.8" [build-dependencies] cc = { version = "1" } diff --git a/pyproject.toml b/pyproject.toml index 303fc97..deb2fc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ features = ["pyo3/extension-module"] [tool.poetry] name = "fast-stark-crypto" -version = "0.0.2" +version = "starknet-0.0.1" description = "wrapped starkware rust crypto functions" authors = ["x10"] license = "MIT" diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index 8b279ce..ef2a387 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -4,6 +4,7 @@ rs_sign_message, rs_verify_signature, rs_get_order_msg, + rs_generate_keypair_from_eth_signature, ) @@ -24,6 +25,13 @@ def verify(public_key: int, msg_hash: int, r: int, s: int) -> bool: return rs_verify_signature(hex(public_key), hex(msg_hash), hex(r), hex(s)) +def generate_keypair_from_eth_signature( + eth_signature: str, +) -> tuple[int, int]: + (priv, pub) = rs_generate_keypair_from_eth_signature(eth_signature) + return (int(priv, 16), int(pub, 16)) + + def get_order_msg_hash( position_id: int, base_asset_id: int, diff --git a/src/lib.rs b/src/lib.rs index 982c2a7..245504e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -use malachite::{num::conversion::traits::FromStringBase, strings::ToLowerHexString, Integer}; use pyo3::prelude::*; use pyo3::types::PyModule; use starknet_crypto::{ @@ -6,9 +5,57 @@ use starknet_crypto::{ }; use starknet_messages::{AssetId, OffChainMessage, Order, PositionId, StarknetDomain, Timestamp}; -mod messages; +use hex; +use num_bigint::BigUint; +use sha2::{Digest, Sha256}; +use std::str::FromStr; + mod starknet_messages; +fn grind_key(key_seed: BigUint) -> BigUint { + let two_256 = BigUint::from_str( + "115792089237316195423570985008687907853269984665640564039457584007913129639936", + ) + .unwrap(); + let key_value_limit = BigUint::from_str( + "3618502788666131213697322783095070105526743751716087489154079457884512865583", + ) + .unwrap(); + + let max_allowed_value = two_256.clone() - (two_256.clone() % (&key_value_limit)); + let mut index = BigUint::ZERO; + loop { + let hash_input = { + let mut input = Vec::new(); + input.extend_from_slice(&key_seed.to_bytes_be()); + input.extend_from_slice(&index.to_bytes_be()); + input + }; + let hash_result = Sha256::digest(&hash_input); + let hash = hash_result.as_slice(); + let key = BigUint::from_bytes_be(&hash); + + if key < max_allowed_value { + return key % (&key_value_limit); + } + + index += BigUint::from_str("1").unwrap(); + } +} + +fn get_private_key_from_eth_signature(signature: &str) -> Result { + let eth_sig_truncated = signature.trim_start_matches("0x"); + if eth_sig_truncated.len() < 64 { + return Err("Invalid signature length".to_string()); + } + let r = ð_sig_truncated[..64]; + let r_bytes = hex::decode(r).map_err(|e| format!("Failed to decode r as hex: {:?}", e))?; + let r_int = BigUint::from_bytes_be(&r_bytes); + + let ground_key = grind_key(r_int); + return Ok(Felt::from_hex(&ground_key.to_str_radix(16)).unwrap()); +} + // Converts a hexadecimal string to a FieldElement fn str_to_field_element(hex_str: &str) -> Result { Felt::from_hex(hex_str).map_err(|e| { @@ -19,10 +66,6 @@ fn str_to_field_element(hex_str: &str) -> Result { }) } -fn int_to_field_element(int: &Integer) -> Result { - str_to_field_element(&int.to_lower_hex_string()) -} - #[pyfunction] fn rs_get_public_key(py: Python, private_key_hex: String) -> PyResult { py.allow_threads(move || { @@ -154,6 +197,21 @@ fn rs_get_order_msg( }) } +#[pyfunction] +fn rs_generate_keypair_from_eth_signature( + py: Python, + signature: String, +) -> PyResult<(String, String)> { + return get_private_key_from_eth_signature(&signature) + .and_then(|private_key| { + let public_key = fetch_public_key(&private_key); + let private_key_hex = private_key.to_hex_string(); + let public_key_hex = public_key.to_hex_string(); + Ok((private_key_hex, public_key_hex)) + }) + .map_err(PyErr::new::); +} + #[pymodule] fn fast_stark_crypto(py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_get_public_key, m)?)?; @@ -161,6 +219,7 @@ fn fast_stark_crypto(py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_sign_message, m)?)?; m.add_function(wrap_pyfunction!(rs_verify_signature, m)?)?; m.add_function(wrap_pyfunction!(rs_get_order_msg, m)?)?; + m.add_function(wrap_pyfunction!(rs_generate_keypair_from_eth_signature, m)?)?; Ok(()) } diff --git a/src/messages.rs b/src/messages.rs deleted file mode 100644 index 7d0653d..0000000 --- a/src/messages.rs +++ /dev/null @@ -1,92 +0,0 @@ -use malachite::num::basic::traits::Zero; - -use malachite::integer::Integer; - -const OP_LIMIT_ORDER_WITH_FEES: u64 = 3; -const OP_TRANSFER: u64 = 4; -const OP_CONDITIONAL_TRANSFER: u64 = 5; -const OP_WITHDRAWAL_TO_ADDRESS: u64 = 7; - -pub fn get_limit_order_msg( - asset_id_synthetic: &Integer, - asset_id_collateral: &Integer, - is_buying_synthetic: bool, - asset_id_fee: &Integer, - amount_synthetic: &Integer, - amount_collateral: &Integer, - max_amount_fee: &Integer, - nonce: u64, - position_id: u64, - expiration_timestamp: u64, - hash_function: fn(&Integer, &Integer) -> Integer, -) -> Integer { - let (asset_id_sell, asset_id_buy, amount_sell, amount_buy, nonce) = if is_buying_synthetic { - ( - asset_id_collateral, - asset_id_synthetic, - amount_collateral, - amount_synthetic, - Integer::from(nonce), - ) - } else { - ( - asset_id_synthetic, - asset_id_collateral, - amount_synthetic, - amount_collateral, - Integer::from(nonce), - ) - }; - - let a = hash_function(asset_id_sell, asset_id_buy); - let b = hash_function(&a, asset_id_fee); - - let mut w4_packed = amount_sell.clone(); - w4_packed = (w4_packed << (64)) + amount_buy; - w4_packed = (w4_packed << (64)) + max_amount_fee; - w4_packed = (w4_packed << (32)) + &nonce; - - let c = hash_function(&b, &w4_packed); - - let mut w5_packed: Integer = - (Integer::ZERO << (10)) + Integer::from(OP_LIMIT_ORDER_WITH_FEES); - - w5_packed = (w5_packed << (64)) + Integer::from(position_id); - w5_packed = (w5_packed << (64)) + Integer::from(position_id); - w5_packed = (w5_packed << (64)) + Integer::from(position_id); - w5_packed = (w5_packed << (32)) + Integer::from(expiration_timestamp); - w5_packed = w5_packed << (17); - - hash_function(&c, &w5_packed) -} - -pub fn get_transfer_msg( - asset_id: &Integer, - receiver_public_key: &Integer, - sender_position_id: u64, - receiver_position_id: u64, - nonce: u64, - amount: &Integer, - expiration_timestamp: u64, - hash_function: fn(&Integer, &Integer) -> Integer, -) -> Integer { - - let mut packed_message0 = Integer::ZERO << 64; - packed_message0 = (packed_message0 + Integer::from(sender_position_id)) << 64; - packed_message0 = (packed_message0 + Integer::from(receiver_position_id)) << 64; - packed_message0 = (packed_message0 + Integer::from(sender_position_id)) << 32; - packed_message0 = packed_message0 + Integer::from(nonce); - - let mut packed_message1 = Integer::ZERO << 10; - packed_message1 = (packed_message1 + Integer::from(OP_TRANSFER)) << 64; - packed_message1 = (packed_message1 + amount) << 64; - packed_message1 = (packed_message1 + Integer::ZERO) << 32; - packed_message1 = (packed_message1 + Integer::from(expiration_timestamp)) << 81; - - let a = hash_function(asset_id, &Integer::ZERO); - let b = hash_function(&a, receiver_public_key); - let c = hash_function(&b, &packed_message0); - let d = hash_function(&c, &packed_message1); - - d -} diff --git a/tests/test_key_generation_rust_integration.py b/tests/test_key_generation_rust_integration.py new file mode 100644 index 0000000..0813f01 --- /dev/null +++ b/tests/test_key_generation_rust_integration.py @@ -0,0 +1,10 @@ +import fast_stark_crypto + + +def test_well_known_keypair_generation(): + (priv, pub) = fast_stark_crypto.generate_keypair_from_eth_signature( + eth_signature="0x9ef64d5936681edf44b4a7ad713f3bc24065d4039562af03fccf6a08d6996eab367df11439169b417b6a6d8ce81d409edb022597ce193916757c7d5d9cbf97301c" + ) + + assert priv == int("0x7dbb2c8651cc40e1d0d60b45eb52039f317a8aa82798bda52eee272136c0c44", 16) + assert pub == int("0x78298687996aff29a0bbcb994e1305db082d084f85ec38bb78c41e6787740ec", 16) From c0c4b11fe319ade079ec596eea4cef8764d423a4 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 12:16:42 +0000 Subject: [PATCH 14/70] add release step to pipeline --- .github/workflows/CI.yml | 47 ++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 74fdccf..7c8904e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -209,29 +209,24 @@ jobs: name: wheels-sdist path: dist - # release: - # name: Release - # runs-on: ubuntu-latest - # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - # needs: [linux, musllinux, windows, macos, sdist] - # permissions: - # # Use to sign the release artifacts - # id-token: write - # # Used to upload release artifacts - # contents: write - # # Used to generate artifact attestation - # attestations: write - # steps: - # - uses: actions/download-artifact@v4 - # - name: Generate artifact attestation - # uses: actions/attest-build-provenance@v2 - # with: - # subject-path: 'wheels-*/*' - # - name: Publish to PyPI - # if: ${{ startsWith(github.ref, 'refs/tags/') }} - # uses: PyO3/maturin-action@v1 - # env: - # MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - # with: - # command: upload - # args: --non-interactive --skip-existing wheels-*/* + release: + name: Release + runs-on: ubuntu-latest + needs: [linux, musllinux, windows, macos, sdist] + permissions: + id-token: write + contents: write + attestations: write + steps: + - uses: actions/download-artifact@v4 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-path: 'wheels-*/*' + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing wheels-*/* From 872a6516b850937ee69ff7e395263c4533700de9 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 13:06:46 +0000 Subject: [PATCH 15/70] add starknet classifier --- Cargo.lock | 2 +- Cargo.toml | 2 +- pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0e89e9..531cf50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -415,7 +415,7 @@ dependencies = [ ] [[package]] -name = "fast-stark-crypto" +name = "fast-stark-crypto-starknet" version = "0.1.0" dependencies = [ "cc", diff --git a/Cargo.toml b/Cargo.toml index ca6327e..4d4532c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fast-stark-crypto" +name = "fast-stark-crypto-starknet" version = "0.1.0" edition = "2021" diff --git a/pyproject.toml b/pyproject.toml index deb2fc8..523c102 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ python-source = "python" features = ["pyo3/extension-module"] [tool.poetry] -name = "fast-stark-crypto" -version = "starknet-0.0.1" +name = "fast-stark-crypto-starknet" +version = "0.1.0" description = "wrapped starkware rust crypto functions" authors = ["x10"] license = "MIT" From 24403ca2dbf0a0c7c4afcfd14a25dda7005d01ef Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 13:57:02 +0000 Subject: [PATCH 16/70] set version --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- pyproject.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 531cf50..be0c67a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -415,8 +415,8 @@ dependencies = [ ] [[package]] -name = "fast-stark-crypto-starknet" -version = "0.1.0" +name = "fast-stark-crypto" +version = "0.1.0-starknet" dependencies = [ "cc", "hex", diff --git a/Cargo.toml b/Cargo.toml index 4d4532c..fda17a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "fast-stark-crypto-starknet" -version = "0.1.0" +name = "fast-stark-crypto" +version = "0.1.0-starknet" edition = "2021" [lib] diff --git a/pyproject.toml b/pyproject.toml index 523c102..fec06a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ python-source = "python" features = ["pyo3/extension-module"] [tool.poetry] -name = "fast-stark-crypto-starknet" -version = "0.1.0" +name = "fast-stark-crypto" +version = "0.1.0-starknet" description = "wrapped starkware rust crypto functions" authors = ["x10"] license = "MIT" From e41f9949231729ee5b0cdd8c65d54a63645b30ed Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 14:05:21 +0000 Subject: [PATCH 17/70] use correct SemVer naming --- Cargo.lock | 2 +- Cargo.toml | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be0c67a..dc82fb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.1.0-starknet" +version = "0.0.1-prerelease+starknet" dependencies = [ "cc", "hex", diff --git a/Cargo.toml b/Cargo.toml index fda17a9..66115eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.1.0-starknet" +version = "0.0.1-prerelease+starknet" edition = "2021" [lib] diff --git a/pyproject.toml b/pyproject.toml index fec06a2..57b26b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ features = ["pyo3/extension-module"] [tool.poetry] name = "fast-stark-crypto" -version = "0.1.0-starknet" +version = "0.0.1-prerelease+starknet" description = "wrapped starkware rust crypto functions" authors = ["x10"] license = "MIT" From 94684003d1db48c953758ed7ac02adf61b6bfcd2 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 14:13:34 +0000 Subject: [PATCH 18/70] use pep440 compatible version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dc82fb8..7bdad68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.0.1-prerelease+starknet" +version = "0.3.0-alpha" dependencies = [ "cc", "hex", diff --git a/Cargo.toml b/Cargo.toml index 66115eb..70dba3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.0.1-prerelease+starknet" +version = "0.3.0-alpha" edition = "2021" [lib] From 1353ba003b826583a5c0b7fc0fc3eec2afdfd41e Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 16:04:49 +0000 Subject: [PATCH 19/70] add PR build --- .github/workflows/PR.yml | 39 ++++++++++++++++++++++++ tests/test_order_msg_rust_integration.py | 27 ++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/PR.yml diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml new file mode 100644 index 0000000..afb6d5e --- /dev/null +++ b/.github/workflows/PR.yml @@ -0,0 +1,39 @@ +name: CI + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + manylinux: auto + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + manylinux: ${{ matrix.platform.manylinux }} + - name: pytest + shell: bash + run: | + set -e + python3 -m venv .venv + source .venv/bin/activate + pip install fast-stark-crypto --find-links dist --force-reinstall + pip install pytest + pytest \ No newline at end of file diff --git a/tests/test_order_msg_rust_integration.py b/tests/test_order_msg_rust_integration.py index 958a422..4d02c30 100644 --- a/tests/test_order_msg_rust_integration.py +++ b/tests/test_order_msg_rust_integration.py @@ -20,3 +20,30 @@ def test_well_known_order_hash(): ) assert hash_from_rust == int("0x62428944e2c935c4c6662ec0328abfcab44dd6455cb48845c78d18f0ea0450b", 16) + + +def test_sdk_buy_order_value(): + synth_id = "0x4254432d3600000000000000000000" + collateral_id = "0x31857064564ed0ff978e687456963cba09c2c6985d8f9300a1de4962fafa054" + fee_id = collateral_id + fee_amount = 21723 + base_amount = 1000 + collateral_amount = -43445117 + hash_from_rust = fast_stark_crypto.get_order_msg_hash( + position_id=10002, + base_asset_id=int(synth_id, 16), + base_amount=base_amount, + quote_asset_id=int(collateral_id, 16), + quote_amount=collateral_amount, + fee_asset_id=int(fee_id, 16), + fee_amount=fee_amount, + expiration=1706836137, + salt=1473459052, + user_public_key=int("0x61c5e7e8339b7d56f197f54ea91b776776690e3232313de0f2ecbd0ef76f466", 16), + domain_name="Perpetuals", + domain_version="v0", + domain_chain_id="SN_SEPOLIA", + domain_revision="1", + ) + + assert hash_from_rust == int("654658124396932115680058168732265986796695452956187015498175725004749638680") From 8075518c2a4313eed70e7ac6aef7343726fe73dc Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 16:09:20 +0000 Subject: [PATCH 20/70] reduce interpreters build during PR --- .github/workflows/PR.yml | 2 +- .github/workflows/build-upload.yml | 119 ----------------------------- 2 files changed, 1 insertion(+), 120 deletions(-) delete mode 100644 .github/workflows/build-upload.yml diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index afb6d5e..4b53512 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -26,7 +26,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist -i 3.10 manylinux: ${{ matrix.platform.manylinux }} - name: pytest shell: bash diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml deleted file mode 100644 index ebca0cc..0000000 --- a/.github/workflows/build-upload.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Test & Release - -on: - workflow_dispatch: - -env: - PYTHON_VERSION: "3.9" - PACKAGE_NAME: "fast_stark_crypto" - -jobs: - macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - architecture: x64 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - default: true - - name: Build wheels - x86_64 - uses: messense/maturin-action@v1 - with: - target: x86_64 - args: --release --out dist --sdist - maturin-version: "v0.13.0" - - name: Install built wheel - x86_64 - run: | - pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall - pip install pytest - pytest -v - - name: Build wheels - universal2 - uses: messense/maturin-action@v1 - with: - args: --release --universal2 --out dist - maturin-version: "v0.13.0" - - name: Install built wheel - universal2 - run: | - pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall - pip install pytest - pytest -v - - name: Upload wheels - uses: actions/upload-artifact@v2 - with: - name: wheels - path: dist - - linux: - runs-on: ubuntu-latest - strategy: - matrix: - target: [x86_64] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - architecture: x64 - - name: Build wheels - run: | - docker run --rm --entrypoint=bash -v $(pwd):/io ghcr.io/pyo3/maturin -c 'for PYBIN in /opt/python/cp3*/bin; do ${PYBIN}/pip install maturin && "${PYBIN}/maturin" build --out dist -i "${PYBIN}/python" --release --manylinux 2014 ; done' - - - name: Install built wheel - if: matrix.target == 'x86_64' - run: | - pip${{ env.PYTHON_VERSION }} install --upgrade pip - pip${{ env.PYTHON_VERSION }} install ${{env.PACKAGE_NAME}} --no-index --find-links dist --force-reinstall - python -c "import ${{env.PACKAGE_NAME}} " - - name: Upload wheels - uses: actions/upload-artifact@v2 - with: - name: wheels - path: dist - - linux-cross: - runs-on: ubuntu-latest - strategy: - matrix: - target: [aarch64] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - manylinux: auto - args: --release --out dist -i 3.9 3.10 3.11 3.12 - - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - - release: - name: Release - runs-on: ubuntu-latest - needs: [ linux, linux-cross ] - steps: - - uses: actions/download-artifact@v3 - with: - name: wheels - - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Publish to PyPI - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - pip install --upgrade twine - twine upload --skip-existing * \ No newline at end of file From 622de648c4f340002cb5221f8f803413f71d9db5 Mon Sep 17 00:00:00 2001 From: stefano Date: Mon, 14 Apr 2025 16:10:24 +0000 Subject: [PATCH 21/70] add auto cancel on new push --- .github/workflows/PR.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 4b53512..81ea684 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -3,6 +3,9 @@ name: CI on: pull_request: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: contents: read From aecf7da6060e7be7d438897edddda2445bcf2ac1 Mon Sep 17 00:00:00 2001 From: stefano Date: Tue, 15 Apr 2025 09:18:02 +0000 Subject: [PATCH 22/70] depend on global lib --- .github/workflows/PR.yml | 5 +- .gitmodules | 3 + Cargo.lock | 24 +++++- Cargo.toml | 6 +- rust-crypto-lib-base | 1 + src/lib.rs | 65 +++------------- src/starknet_messages.rs | 163 --------------------------------------- 7 files changed, 42 insertions(+), 225 deletions(-) create mode 100644 .gitmodules create mode 160000 rust-crypto-lib-base delete mode 100644 src/starknet_messages.rs diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 81ea684..87805e1 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -21,7 +21,10 @@ jobs: manylinux: auto steps: - - uses: actions/checkout@v4 + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' - uses: actions/setup-python@v5 with: python-version: 3.x diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..334e2b2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "rust-crypto-lib-base"] + path = rust-crypto-lib-base + url = git@github.com:x10xchange/rust-crypto-lib-base.git diff --git a/Cargo.lock b/Cargo.lock index 7bdad68..1adcdd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -419,12 +419,9 @@ name = "fast-stark-crypto" version = "0.3.0-alpha" dependencies = [ "cc", - "hex", - "num-bigint", "pyo3", "pyo3-build-config", - "sha2", - "starknet", + "rust-crypto-lib-base", "starknet-crypto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -965,6 +962,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.171" @@ -1394,6 +1397,19 @@ dependencies = [ "rustc-hex", ] +[[package]] +name = "rust-crypto-lib-base" +version = "0.1.0" +dependencies = [ + "hex", + "lazy_static", + "num-bigint", + "serde_json", + "sha2", + "starknet", + "starknet-crypto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.24" diff --git a/Cargo.toml b/Cargo.toml index 70dba3b..1352eed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,9 @@ crate-type = ["cdylib"] [dependencies] pyo3 = "0.20.2" -starknet = { git = "https://github.com/xJonathanLEI/starknet-rs" } +rust-crypto-lib-base = { path = "./rust-crypto-lib-base" } starknet-crypto = "0.7.4" -num-bigint = "0.4.6" -hex = "0.4.3" -sha2 = "0.10.8" + [build-dependencies] cc = { version = "1" } diff --git a/rust-crypto-lib-base b/rust-crypto-lib-base new file mode 160000 index 0000000..3d86642 --- /dev/null +++ b/rust-crypto-lib-base @@ -0,0 +1 @@ +Subproject commit 3d86642cc3473712c223f91ee75278f9ff5ad3a7 diff --git a/src/lib.rs b/src/lib.rs index 245504e..50c7661 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,60 +1,19 @@ use pyo3::prelude::*; use pyo3::types::PyModule; -use starknet_crypto::{ - get_public_key as fetch_public_key, pedersen_hash, sign, verify as verify_signature, Felt, -}; -use starknet_messages::{AssetId, OffChainMessage, Order, PositionId, StarknetDomain, Timestamp}; -use hex; -use num_bigint::BigUint; -use sha2::{Digest, Sha256}; -use std::str::FromStr; +use rust_crypto_lib_base::get_private_key_from_eth_signature; +use rust_crypto_lib_base::starknet_messages::Order; +use rust_crypto_lib_base::starknet_messages::PositionId; +use rust_crypto_lib_base::starknet_messages::AssetId; +use rust_crypto_lib_base::starknet_messages::StarknetDomain; +use rust_crypto_lib_base::starknet_messages::Timestamp; +use rust_crypto_lib_base::starknet_messages::OffChainMessage; +use starknet_crypto::sign; +use starknet_crypto::Felt; +use starknet_crypto::pedersen_hash; +use starknet_crypto::get_public_key as fetch_public_key; +use starknet_crypto::verify as verify_signature; -mod starknet_messages; - -fn grind_key(key_seed: BigUint) -> BigUint { - let two_256 = BigUint::from_str( - "115792089237316195423570985008687907853269984665640564039457584007913129639936", - ) - .unwrap(); - let key_value_limit = BigUint::from_str( - "3618502788666131213697322783095070105526743751716087489154079457884512865583", - ) - .unwrap(); - - let max_allowed_value = two_256.clone() - (two_256.clone() % (&key_value_limit)); - let mut index = BigUint::ZERO; - loop { - let hash_input = { - let mut input = Vec::new(); - input.extend_from_slice(&key_seed.to_bytes_be()); - input.extend_from_slice(&index.to_bytes_be()); - input - }; - let hash_result = Sha256::digest(&hash_input); - let hash = hash_result.as_slice(); - let key = BigUint::from_bytes_be(&hash); - - if key < max_allowed_value { - return key % (&key_value_limit); - } - - index += BigUint::from_str("1").unwrap(); - } -} - -fn get_private_key_from_eth_signature(signature: &str) -> Result { - let eth_sig_truncated = signature.trim_start_matches("0x"); - if eth_sig_truncated.len() < 64 { - return Err("Invalid signature length".to_string()); - } - let r = ð_sig_truncated[..64]; - let r_bytes = hex::decode(r).map_err(|e| format!("Failed to decode r as hex: {:?}", e))?; - let r_int = BigUint::from_bytes_be(&r_bytes); - - let ground_key = grind_key(r_int); - return Ok(Felt::from_hex(&ground_key.to_str_radix(16)).unwrap()); -} // Converts a hexadecimal string to a FieldElement fn str_to_field_element(hex_str: &str) -> Result { diff --git a/src/starknet_messages.rs b/src/starknet_messages.rs deleted file mode 100644 index a6d0cfe..0000000 --- a/src/starknet_messages.rs +++ /dev/null @@ -1,163 +0,0 @@ -use starknet::core::utils::cairo_short_string_to_felt; - -use starknet::macros::selector; -use starknet_crypto::Felt; -use starknet_crypto::PoseidonHasher; - -use std::sync::LazyLock; - -static MESSAGE_FELT: LazyLock = - LazyLock::new(|| cairo_short_string_to_felt("StarkNet Message").unwrap()); - -pub(crate) trait Hashable { - const SELECTOR: Felt; - fn hash(&self) -> Felt; -} - -pub(crate) trait OffChainMessage: Hashable { - fn message_hash(&self, stark_domain: &StarknetDomain, public_key: Felt) -> Option { - let mut hasher = PoseidonHasher::new(); - hasher.update(*MESSAGE_FELT); - hasher.update(stark_domain.hash()); - hasher.update(public_key); - hasher.update(self.hash()); - Some(hasher.finalize()) - } -} - -pub(crate) struct StarknetDomain { - pub name: String, - pub version: String, - pub chain_id: String, - pub revision: String, -} - -impl Hashable for StarknetDomain { - const SELECTOR: Felt = selector!("\"StarknetDomain\"(\"name\":\"shortstring\",\"version\":\"shortstring\",\"chainId\":\"shortstring\",\"revision\":\"shortstring\")"); - fn hash(&self) -> Felt { - let mut hasher = PoseidonHasher::new(); - hasher.update(Self::SELECTOR); - hasher.update(cairo_short_string_to_felt(&self.name).unwrap()); - hasher.update(cairo_short_string_to_felt(&self.version).unwrap()); - hasher.update(cairo_short_string_to_felt(&self.chain_id).unwrap()); - hasher.update(cairo_short_string_to_felt(&self.revision).unwrap()); - let hash = hasher.finalize(); - return hash; - } -} - -pub struct AssetId { - pub value: Felt, -} -pub struct PositionId { - pub value: u32, -} - -pub struct AssetAmount { - pub asset_id: AssetId, - pub amount: i64, -} - -pub struct Timestamp { - pub seconds: u64, -} - -pub struct Order { - pub position_id: PositionId, - pub base_asset_id: AssetId, - pub base_amount: i64, - pub quote_asset_id: AssetId, - pub quote_amount: i64, - pub fee_asset_id: AssetId, - pub fee_amount: u64, - pub expiration: Timestamp, - pub salt: Felt, -} - -impl Hashable for Order { - const SELECTOR: Felt = selector!("\"Order\"(\"position_id\":\"felt\",\"base_asset_id\":\"AssetId\",\"base_amount\":\"i64\",\"quote_asset_id\":\"AssetId\",\"quote_amount\":\"i64\",\"fee_asset_id\":\"AssetId\",\"fee_amount\":\"u64\",\"expiration\":\"Timestamp\",\"salt\":\"felt\")\"PositionId\"(\"value\":\"u32\")\"AssetId\"(\"value\":\"felt\")\"Timestamp\"(\"seconds\":\"u64\")"); - fn hash(&self) -> Felt { - let mut hasher = PoseidonHasher::new(); - hasher.update(Self::SELECTOR); - hasher.update(self.position_id.value.into()); - hasher.update(self.base_asset_id.value.into()); - hasher.update(self.base_amount.into()); - hasher.update(self.quote_asset_id.value.into()); - hasher.update(self.quote_amount.into()); - hasher.update(self.fee_asset_id.value.into()); - hasher.update(self.fee_amount.into()); - hasher.update(self.expiration.seconds.into()); - hasher.update(self.salt.into()); - hasher.finalize() - } -} -impl OffChainMessage for Order {} - -pub(crate) static SEPOLIA_DOMAIN: LazyLock = LazyLock::new(|| StarknetDomain { - name: "Perpetuals".to_string(), - version: "v0".to_string(), - chain_id: "SN_SEPOLIA".to_string(), - revision: "1".to_string(), -}); - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_hash_sepolia_domain() { - let hash = SEPOLIA_DOMAIN.hash(); - assert_ne!( - hash, - Felt::default(), - "Hash should not be the default value" - ); - } - - #[test] - fn test_hash_order() { - assert_eq!( - Order::SELECTOR, - Felt::from_hex("0x36da8d51815527cabfaa9c982f564c80fa7429616739306036f1f9b608dd112") - .unwrap() - ); - let order = Order { - position_id: PositionId { value: 100 }, - base_asset_id: AssetId { - value: Felt::from(2), - }, - base_amount: 100, - quote_asset_id: AssetId { - value: Felt::from(1), - }, - quote_amount: -156, - fee_asset_id: AssetId { - value: Felt::from(1), - }, - fee_amount: 74, - expiration: Timestamp { seconds: 100 }, - salt: Felt::from(123), - }; - let struct_hash = order.hash(); - assert_eq!( - struct_hash, - Felt::from_dec_str( - "1665831471058010006487271218593798151006210932872528562786901713678061931056" - ) - .unwrap(), - ); - - let user_key = Felt::from_dec_str( - "2629686405885377265612250192330550814166101744721025672593857097107510831364", - ) - .unwrap(); - - let hash = order.message_hash(&SEPOLIA_DOMAIN, user_key).unwrap(); - let expected_hash = Felt::from_dec_str( - "2777763653990294626488311476018476273780272220813327677173452477333361411339", - ) - .unwrap(); - println!("{}", expected_hash.to_hex_string()); - assert_eq!(hash, expected_hash); - } -} From 6f725af18ebf1eb7b32c828cee80c9138b05dd8c Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 13:24:03 +0000 Subject: [PATCH 23/70] add trusted publish --- .github/workflows/CI.yml | 29 ++++++++++++++++++----------- Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7c8904e..c8b15c2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,7 +26,10 @@ jobs: manylinux: "2_24" steps: - - uses: actions/checkout@v4 + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' - uses: actions/setup-python@v5 with: python-version: 3.x @@ -79,7 +82,10 @@ jobs: target: aarch64 steps: - - uses: actions/checkout@v4 + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' - uses: actions/setup-python@v5 with: python-version: 3.x @@ -136,7 +142,10 @@ jobs: target: x64 steps: - - uses: actions/checkout@v4 + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' - uses: actions/setup-python@v5 with: python-version: 3.x @@ -197,7 +206,10 @@ jobs: sdist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' - name: Build sdist uses: PyO3/maturin-action@v1 with: @@ -223,10 +235,5 @@ jobs: uses: actions/attest-build-provenance@v2 with: subject-path: 'wheels-*/*' - - name: Publish to PyPI - uses: PyO3/maturin-action@v1 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/* + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/Cargo.lock b/Cargo.lock index 1adcdd7..a96551b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.0-alpha" +version = "0.3.1-alpha" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 1352eed..f1be321 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.0-alpha" +version = "0.3.1-alpha" edition = "2021" [lib] From df88c7e3fe794f1e35436b31b616016242d63ee8 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 13:29:27 +0000 Subject: [PATCH 24/70] rename pipelines --- .github/workflows/CI.yml | 2 +- .github/workflows/PR.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c8b15c2..c83d904 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,4 +1,4 @@ -name: CI +name: Build, Test, and Release on: # push: diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 87805e1..541f931 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -1,4 +1,4 @@ -name: CI +name: PR (checks) on: pull_request: From 5cdc4a860d2678c50c5107f5d2f7139e1afb4e0d Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 15:16:48 +0000 Subject: [PATCH 25/70] add transfer message hashing --- .github/workflows/CI.yml | 5 +- python/fast_stark_crypto/lib.py | 32 ++++++ rust-crypto-lib-base | 2 +- src/lib.rs | 115 +++++++++++++++++++- tests/test_transfer_msg_rust_integration.py | 19 ++++ 5 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 tests/test_transfer_msg_rust_integration.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c83d904..6b41ec9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -179,7 +179,10 @@ jobs: - runner: macos-14 target: aarch64 steps: - - uses: actions/checkout@v4 + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' - uses: actions/setup-python@v5 with: python-version: 3.x diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index ef2a387..0b0a247 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -4,6 +4,7 @@ rs_sign_message, rs_verify_signature, rs_get_order_msg, + rs_get_transfer_msg, rs_generate_keypair_from_eth_signature, ) @@ -67,3 +68,34 @@ def get_order_msg_hash( ), 16, ) + + +def get_transfer_msg_hash( + recipient_position_id: int, + sender_position_id: int, + collateral_id: int, + amount: int, + expiration: int, + salt: int, + user_public_key: int, + domain_name: str, + domain_version: str, + domain_chain_id: str, + domain_revision: str, +) -> int: + return int( + rs_get_transfer_msg( + str(recipient_position_id), + str(sender_position_id), + hex(collateral_id), + str(amount), + str(expiration), + str(salt), + hex(user_public_key), + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ), + 16, + ) \ No newline at end of file diff --git a/rust-crypto-lib-base b/rust-crypto-lib-base index 3d86642..75eb254 160000 --- a/rust-crypto-lib-base +++ b/rust-crypto-lib-base @@ -1 +1 @@ -Subproject commit 3d86642cc3473712c223f91ee75278f9ff5ad3a7 +Subproject commit 75eb25427764e2cae01d95c89ba0b5addceaa596 diff --git a/src/lib.rs b/src/lib.rs index 50c7661..288b3e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,18 +2,18 @@ use pyo3::prelude::*; use pyo3::types::PyModule; use rust_crypto_lib_base::get_private_key_from_eth_signature; +use rust_crypto_lib_base::starknet_messages::AssetId; +use rust_crypto_lib_base::starknet_messages::OffChainMessage; use rust_crypto_lib_base::starknet_messages::Order; use rust_crypto_lib_base::starknet_messages::PositionId; -use rust_crypto_lib_base::starknet_messages::AssetId; use rust_crypto_lib_base::starknet_messages::StarknetDomain; use rust_crypto_lib_base::starknet_messages::Timestamp; -use rust_crypto_lib_base::starknet_messages::OffChainMessage; -use starknet_crypto::sign; -use starknet_crypto::Felt; -use starknet_crypto::pedersen_hash; +use rust_crypto_lib_base::starknet_messages::TransferArgs; use starknet_crypto::get_public_key as fetch_public_key; +use starknet_crypto::pedersen_hash; +use starknet_crypto::sign; use starknet_crypto::verify as verify_signature; - +use starknet_crypto::Felt; // Converts a hexadecimal string to a FieldElement fn str_to_field_element(hex_str: &str) -> Result { @@ -92,6 +92,57 @@ fn rs_verify_signature( }) } +#[pyfunction] +fn rs_get_transfer_msg( + py: Python, + recipient_position_id: String, + sender_position_id: String, + collateral_id_hex: String, + amount: String, + expiration: String, + salt: String, + user_public_key_hex: String, + + domain_name: String, + domain_version: String, + domain_chain_id: String, + domain_revision: String, +) -> PyResult { + py.allow_threads(move || { + // hex fields + let collateral_id = Felt::from_hex(&collateral_id_hex).unwrap(); + let user_key = Felt::from_hex(&user_public_key_hex).unwrap(); + + // decimal fields + let recipient = u32::from_str_radix(&recipient_position_id, 10).unwrap(); + let position_id = u32::from_str_radix(&sender_position_id, 10).unwrap(); + let amount = u64::from_str_radix(&amount, 10).unwrap(); + let expiration = u64::from_str_radix(&expiration, 10).unwrap(); + let salt = Felt::from_hex(&salt).unwrap(); + + let transfer_args = TransferArgs { + recipient: PositionId { value: recipient }, + position_id: PositionId { value: position_id }, + collateral_id: AssetId { + value: collateral_id, + }, + amount, + expiration: Timestamp { + seconds: expiration, + }, + salt, + }; + let domain = StarknetDomain { + name: domain_name, + version: domain_version, + chain_id: domain_chain_id, + revision: domain_revision, + }; + let message = transfer_args.message_hash(&domain, user_key).unwrap(); + Ok(message.to_hex_string()) + }) +} + #[pyfunction] fn rs_get_order_msg( py: Python, @@ -178,6 +229,7 @@ fn fast_stark_crypto(py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_sign_message, m)?)?; m.add_function(wrap_pyfunction!(rs_verify_signature, m)?)?; m.add_function(wrap_pyfunction!(rs_get_order_msg, m)?)?; + m.add_function(wrap_pyfunction!(rs_get_transfer_msg, m)?)?; m.add_function(wrap_pyfunction!(rs_generate_keypair_from_eth_signature, m)?)?; Ok(()) } @@ -242,4 +294,55 @@ mod tests { ); }); } + + #[test] + fn test_rs_get_transfer_msg() { + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { + let module = PyModule::new(py, "fast_stark_crypto").unwrap(); + fast_stark_crypto(py, module).unwrap(); + + let recipient_position_id = "1".to_string(); + let sender_position_id = "2".to_string(); + let collateral_id_hex = "0x3".to_string(); + let amount = "4".to_string(); + let expiration = "5".to_string(); + let salt = "6".to_string(); + let user_public_key_hex = "0x5d05989e9302dcebc74e241001e3e3ac3f4402ccf2f8e6f74b034b07ad6a904".to_string(); + + let domain_name = "Perpetuals".to_string(); + let domain_version = "v0".to_string(); + let domain_chain_id = "SN_SEPOLIA".to_string(); + let domain_revision = "1".to_string(); + + let result: String = module + .getattr("rs_get_transfer_msg") + .unwrap() + .call1(PyTuple::new( + py, + [ + recipient_position_id, + sender_position_id, + collateral_id_hex, + amount, + expiration, + salt, + user_public_key_hex, + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ], + )) + .unwrap() + .extract() + .unwrap(); + + assert_eq!( + result, + "0x7aa1685adb674d8d350526dfa3011ab9d126c5844b8dbe343e2765d680311d5", + "Hashes do not match for TransferArgs" + ); + }); + } } diff --git a/tests/test_transfer_msg_rust_integration.py b/tests/test_transfer_msg_rust_integration.py new file mode 100644 index 0000000..fd0b3c5 --- /dev/null +++ b/tests/test_transfer_msg_rust_integration.py @@ -0,0 +1,19 @@ +import fast_stark_crypto + + +def test_well_known_transfer_hash(): + expected_hash = int("3466709383481810859947861276094399756712395853968834582933311835633294184917") + actual_hash = fast_stark_crypto.get_transfer_msg_hash( + recipient_position_id=1, + sender_position_id=2, + collateral_id=3, + amount=4, + expiration=5, + salt=6, + user_public_key=int("2629686405885377265612250192330550814166101744721025672593857097107510831364"), + domain_name="Perpetuals", + domain_version="v0", + domain_chain_id="SN_SEPOLIA", + domain_revision="1", + ) + assert actual_hash == expected_hash, "Hashes do not match for get_transfer_msg_hash" From 77ff2d79e10d6468ca07403dc526dfb6913a7d99 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 15:31:41 +0000 Subject: [PATCH 26/70] force local install in CI --- .github/workflows/CI.yml | 12 ++++++------ src/lib.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6b41ec9..7d62667 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -52,7 +52,7 @@ jobs: set -e python3 -m venv .venv source .venv/bin/activate - pip install fast-stark-crypto --find-links dist --force-reinstall + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall pip install pytest pytest - name: pytest @@ -68,7 +68,7 @@ jobs: pip3 install -U pip pytest run: | set -e - pip3 install fast-stark-crypto --find-links dist --force-reinstall + pip3 install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest musllinux: @@ -112,7 +112,7 @@ jobs: apk add py3-pip py3-virtualenv python3 -m virtualenv .venv source .venv/bin/activate - pip install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall pip install pytest pytest - name: pytest @@ -129,7 +129,7 @@ jobs: python3 -m virtualenv .venv source .venv/bin/activate pip install pytest - pip install fast-stark-crypto --find-links dist --force-reinstall + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest @@ -167,7 +167,7 @@ jobs: set -e python3 -m venv .venv source .venv/Scripts/activate - pip install fast-stark-crypto --find-links dist --force-reinstall + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall pip install pytest pytest @@ -202,7 +202,7 @@ jobs: set -e python3 -m venv .venv source .venv/bin/activate - pip install fast-stark-crypto --find-links dist --force-reinstall + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall pip install pytest pytest diff --git a/src/lib.rs b/src/lib.rs index 288b3e7..a5de05e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -209,7 +209,7 @@ fn rs_get_order_msg( #[pyfunction] fn rs_generate_keypair_from_eth_signature( - py: Python, + _py: Python, signature: String, ) -> PyResult<(String, String)> { return get_private_key_from_eth_signature(&signature) @@ -223,7 +223,7 @@ fn rs_generate_keypair_from_eth_signature( } #[pymodule] -fn fast_stark_crypto(py: Python<'_>, m: &PyModule) -> PyResult<()> { +fn fast_stark_crypto(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_get_public_key, m)?)?; m.add_function(wrap_pyfunction!(rs_compute_pedersen_hash, m)?)?; m.add_function(wrap_pyfunction!(rs_sign_message, m)?)?; From 40c7efea52b2ba7ce7d6fafb4c1bd2ee23cef51d Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 15:49:04 +0000 Subject: [PATCH 27/70] add dist folder to download artifact step --- .github/workflows/CI.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7d62667..0f44f31 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -234,9 +234,14 @@ jobs: attestations: write steps: - uses: actions/download-artifact@v4 + with: + path: dist/ - name: Generate artifact attestation uses: actions/attest-build-provenance@v2 with: - subject-path: 'wheels-*/*' + subject-path: 'dist/wheels-*/*' - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + From 6bf2945575deb15c7b37d6b5b0154c6c54f86c1b Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 16:06:15 +0000 Subject: [PATCH 28/70] try manually copying to dist folder --- .github/workflows/CI.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0f44f31..620c996 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -234,12 +234,14 @@ jobs: attestations: write steps: - uses: actions/download-artifact@v4 - with: - path: dist/ - name: Generate artifact attestation uses: actions/attest-build-provenance@v2 with: - subject-path: 'dist/wheels-*/*' + subject-path: 'wheels-*/*' + - run: | + set -e + mkdir dist + cp wheels-*/* dist/ - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: From 70f86a753f6df9365c0b0fd48d0644534410b609 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 16:10:01 +0000 Subject: [PATCH 29/70] add no-index to PR pipeline --- .github/workflows/PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 541f931..97c5ea2 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -40,6 +40,6 @@ jobs: set -e python3 -m venv .venv source .venv/bin/activate - pip install fast-stark-crypto --find-links dist --force-reinstall + pip install fast-stark-crypto --find-links dist --no-index --force-reinstall pip install pytest pytest \ No newline at end of file From 2ae6759344f68fffd1cefefc84446da500a6095c Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 16 Apr 2025 16:19:53 +0000 Subject: [PATCH 30/70] do not specify an interpreter for PR build --- .github/workflows/PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 97c5ea2..97aabb5 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -32,7 +32,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.10 + args: --release --out dist manylinux: ${{ matrix.platform.manylinux }} - name: pytest shell: bash From 3c70c1291505f0117acc021bd89ce5eba24bda0c Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 17 Apr 2025 07:53:58 +0000 Subject: [PATCH 31/70] fix bug when reading salt as hex for transfer payload --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a96551b..a4b334c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.1-alpha" +version = "0.3.2-alpha" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index f1be321..2548584 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.1-alpha" +version = "0.3.2-alpha" edition = "2021" [lib] diff --git a/src/lib.rs b/src/lib.rs index a5de05e..2af7719 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -118,7 +118,7 @@ fn rs_get_transfer_msg( let position_id = u32::from_str_radix(&sender_position_id, 10).unwrap(); let amount = u64::from_str_radix(&amount, 10).unwrap(); let expiration = u64::from_str_radix(&expiration, 10).unwrap(); - let salt = Felt::from_hex(&salt).unwrap(); + let salt = Felt::from_dec_str(&salt).unwrap(); let transfer_args = TransferArgs { recipient: PositionId { value: recipient }, @@ -308,7 +308,8 @@ mod tests { let amount = "4".to_string(); let expiration = "5".to_string(); let salt = "6".to_string(); - let user_public_key_hex = "0x5d05989e9302dcebc74e241001e3e3ac3f4402ccf2f8e6f74b034b07ad6a904".to_string(); + let user_public_key_hex = + "0x5d05989e9302dcebc74e241001e3e3ac3f4402ccf2f8e6f74b034b07ad6a904".to_string(); let domain_name = "Perpetuals".to_string(); let domain_version = "v0".to_string(); @@ -339,8 +340,7 @@ mod tests { .unwrap(); assert_eq!( - result, - "0x7aa1685adb674d8d350526dfa3011ab9d126c5844b8dbe343e2765d680311d5", + result, "0x7aa1685adb674d8d350526dfa3011ab9d126c5844b8dbe343e2765d680311d5", "Hashes do not match for TransferArgs" ); }); From 4ae397977505e6b553634b6f5175442931369709 Mon Sep 17 00:00:00 2001 From: stefano Date: Tue, 6 May 2025 17:09:58 +0100 Subject: [PATCH 32/70] update to latest version of base rust lib --- rust-crypto-lib-base | 2 +- src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-crypto-lib-base b/rust-crypto-lib-base index 75eb254..9da3e61 160000 --- a/rust-crypto-lib-base +++ b/rust-crypto-lib-base @@ -1 +1 @@ -Subproject commit 75eb25427764e2cae01d95c89ba0b5addceaa596 +Subproject commit 9da3e61a6e1e9d8192e561f48deccc955835ccb4 diff --git a/src/lib.rs b/src/lib.rs index 2af7719..19841aa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,7 +136,7 @@ fn rs_get_transfer_msg( name: domain_name, version: domain_version, chain_id: domain_chain_id, - revision: domain_revision, + revision: u32::from_str_radix(&domain_revision, 10).unwrap(), }; let message = transfer_args.message_hash(&domain, user_key).unwrap(); Ok(message.to_hex_string()) @@ -200,7 +200,7 @@ fn rs_get_order_msg( name: domain_name, version: domain_version, chain_id: domain_chain_id, - revision: domain_revision, + revision: u32::from_str_radix(&domain_revision, 10).unwrap(), }; let message = order.message_hash(&domain, user_key).unwrap(); Ok(message.to_hex_string()) @@ -290,7 +290,7 @@ mod tests { assert_eq!( result, - "0x62428944e2c935c4c6662ec0328abfcab44dd6455cb48845c78d18f0ea0450b" + "0x4de4c009e0d0c5a70a7da0e2039fb2b99f376d53496f89d9f437e736add6b48" ); }); } @@ -340,7 +340,7 @@ mod tests { .unwrap(); assert_eq!( - result, "0x7aa1685adb674d8d350526dfa3011ab9d126c5844b8dbe343e2765d680311d5", + result, "0x56c7b21d13b79a33d7700dda20e22246c25e89818249504148174f527fc3f8f", "Hashes do not match for TransferArgs" ); }); From 41987ff2cc18fb8278aef3486ceebb5af67e8359 Mon Sep 17 00:00:00 2001 From: stefano Date: Tue, 6 May 2025 17:29:12 +0100 Subject: [PATCH 33/70] fix publishing pipeline --- Cargo.lock | 2 +- Cargo.toml | 2 +- poetry.lock | 432 ++++++++++++++++++ pyproject.toml | 2 +- tests/test_key_generation_rust_integration.py | 2 +- tests/test_order_msg_rust_integration.py | 8 +- tests/test_transfer_msg_rust_integration.py | 4 +- 7 files changed, 442 insertions(+), 10 deletions(-) create mode 100644 poetry.lock diff --git a/Cargo.lock b/Cargo.lock index a4b334c..50203f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.2-alpha" +version = "0.3.3-alpha" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 2548584..618c55a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.2-alpha" +version = "0.3.3-alpha" edition = "2021" [lib] diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..adfccb7 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,432 @@ +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. + +[[package]] +name = "cachetools" +version = "5.5.2" +description = "Extensible memoizing collections and decorators" +optional = false +python-versions = ">=3.7" +groups = ["dev"] +files = [ + {file = "cachetools-5.5.2-py3-none-any.whl", hash = "sha256:d26a22bcc62eb95c3beabd9f1ee5e820d3d2704fe2967cbe350e20c8ffcd3f0a"}, + {file = "cachetools-5.5.2.tar.gz", hash = "sha256:1a661caa9175d26759571b2e19580f9d6393969e5dfca11fdb1f947a23e640d4"}, +] + +[[package]] +name = "chardet" +version = "5.2.0" +description = "Universal encoding detector for Python 3" +optional = false +python-versions = ">=3.7" +groups = ["dev"] +files = [ + {file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"}, + {file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["dev"] +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "distlib" +version = "0.3.9" +description = "Distribution utilities" +optional = false +python-versions = "*" +groups = ["dev"] +files = [ + {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, + {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +groups = ["dev"] +markers = "python_version < \"3.11\"" +files = [ + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "filelock" +version = "3.18.0" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de"}, + {file = "filelock-3.18.0.tar.gz", hash = "sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2"}, +] + +[package.extras] +docs = ["furo (>=2024.8.6)", "sphinx (>=8.1.3)", "sphinx-autodoc-typehints (>=3)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.6.10)", "diff-cover (>=9.2.1)", "pytest (>=8.3.4)", "pytest-asyncio (>=0.25.2)", "pytest-cov (>=6)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.28.1)"] +typing = ["typing-extensions (>=4.12.2) ; python_version < \"3.11\""] + +[[package]] +name = "iniconfig" +version = "2.1.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, + {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, +] + +[[package]] +name = "maturin" +version = "1.8.3" +description = "Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages" +optional = false +python-versions = ">=3.7" +groups = ["dev"] +files = [ + {file = "maturin-1.8.3-py3-none-linux_armv6l.whl", hash = "sha256:fa27466b627150123729b2e611f9f9cfade84d24385d72c6877f78c30de30e89"}, + {file = "maturin-1.8.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:583404d20d7f1d9c8f3c18dcab9014faacabbed6be02da80062c06cd0e279554"}, + {file = "maturin-1.8.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:f9ffdac53dfe0089cf19b597410bc552eb34c856ddb41482b243a695e8b549d3"}, + {file = "maturin-1.8.3-py3-none-manylinux_2_12_i686.manylinux2010_i686.musllinux_1_1_i686.whl", hash = "sha256:7949a4a17637341f84e88f4cbf0c155998780bbb7a145ed735725b907881c0ae"}, + {file = "maturin-1.8.3-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:11564fac7486313b7baf3aa4e82c20e1b20364aad3fde2ccbc4c07693c0b7e16"}, + {file = "maturin-1.8.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:8555d8701cdba6c19c4705a22ce4d2a1814efd792f55dc5873262ff903317540"}, + {file = "maturin-1.8.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_1_armv7l.whl", hash = "sha256:5b2a513468c1c9b4d1728d4b6d3d044b7c183985ef819c9ef15e373b70d99c7d"}, + {file = "maturin-1.8.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le.whl", hash = "sha256:2fe8fdff420cfccde127bbc3d8e40835163dcebb6d28c49fffd9aaf1e6ec1090"}, + {file = "maturin-1.8.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:22cd8b6dc490fee99a62590f914f0c04ddad1dd6dbd5c7e933b3f882b1bd78c2"}, + {file = "maturin-1.8.3-py3-none-win32.whl", hash = "sha256:2427924546c9d1079b1c0c6c5c1d380e1b8187baba4e6342cca81597a0f3d697"}, + {file = "maturin-1.8.3-py3-none-win_amd64.whl", hash = "sha256:85f2b882d8235c1c1cb0a38d382ccd5b3ba0674d99cb548d49df9342cc688e36"}, + {file = "maturin-1.8.3-py3-none-win_arm64.whl", hash = "sha256:33939aabf9a06a8a14ca6c399d32616c7e574fcca8d4ff6dcd984441051f32fb"}, + {file = "maturin-1.8.3.tar.gz", hash = "sha256:304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc0152e1e12"}, +] + +[package.dependencies] +tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0\""} + +[package.extras] +patchelf = ["patchelf"] +zig = ["ziglang (>=0.10.0,<0.13.0)"] + +[[package]] +name = "mypy" +version = "1.15.0" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "mypy-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:979e4e1a006511dacf628e36fadfecbcc0160a8af6ca7dad2f5025529e082c13"}, + {file = "mypy-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c4bb0e1bd29f7d34efcccd71cf733580191e9a264a2202b0239da95984c5b559"}, + {file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be68172e9fd9ad8fb876c6389f16d1c1b5f100ffa779f77b1fb2176fcc9ab95b"}, + {file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7be1e46525adfa0d97681432ee9fcd61a3964c2446795714699a998d193f1a3"}, + {file = "mypy-1.15.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:2e2c2e6d3593f6451b18588848e66260ff62ccca522dd231cd4dd59b0160668b"}, + {file = "mypy-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:6983aae8b2f653e098edb77f893f7b6aca69f6cffb19b2cc7443f23cce5f4828"}, + {file = "mypy-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2922d42e16d6de288022e5ca321cd0618b238cfc5570e0263e5ba0a77dbef56f"}, + {file = "mypy-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2ee2d57e01a7c35de00f4634ba1bbf015185b219e4dc5909e281016df43f5ee5"}, + {file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:973500e0774b85d9689715feeffcc980193086551110fd678ebe1f4342fb7c5e"}, + {file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a95fb17c13e29d2d5195869262f8125dfdb5c134dc8d9a9d0aecf7525b10c2c"}, + {file = "mypy-1.15.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1905f494bfd7d85a23a88c5d97840888a7bd516545fc5aaedff0267e0bb54e2f"}, + {file = "mypy-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:c9817fa23833ff189db061e6d2eff49b2f3b6ed9856b4a0a73046e41932d744f"}, + {file = "mypy-1.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:aea39e0583d05124836ea645f412e88a5c7d0fd77a6d694b60d9b6b2d9f184fd"}, + {file = "mypy-1.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2f2147ab812b75e5b5499b01ade1f4a81489a147c01585cda36019102538615f"}, + {file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce436f4c6d218a070048ed6a44c0bbb10cd2cc5e272b29e7845f6a2f57ee4464"}, + {file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8023ff13985661b50a5928fc7a5ca15f3d1affb41e5f0a9952cb68ef090b31ee"}, + {file = "mypy-1.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1124a18bc11a6a62887e3e137f37f53fbae476dc36c185d549d4f837a2a6a14e"}, + {file = "mypy-1.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:171a9ca9a40cd1843abeca0e405bc1940cd9b305eaeea2dda769ba096932bb22"}, + {file = "mypy-1.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:93faf3fdb04768d44bf28693293f3904bbb555d076b781ad2530214ee53e3445"}, + {file = "mypy-1.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:811aeccadfb730024c5d3e326b2fbe9249bb7413553f15499a4050f7c30e801d"}, + {file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98b7b9b9aedb65fe628c62a6dc57f6d5088ef2dfca37903a7d9ee374d03acca5"}, + {file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43a7682e24b4f576d93072216bf56eeff70d9140241f9edec0c104d0c515036"}, + {file = "mypy-1.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:baefc32840a9f00babd83251560e0ae1573e2f9d1b067719479bfb0e987c6357"}, + {file = "mypy-1.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b9378e2c00146c44793c98b8d5a61039a048e31f429fb0eb546d93f4b000bedf"}, + {file = "mypy-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e601a7fa172c2131bff456bb3ee08a88360760d0d2f8cbd7a75a65497e2df078"}, + {file = "mypy-1.15.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:712e962a6357634fef20412699a3655c610110e01cdaa6180acec7fc9f8513ba"}, + {file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f95579473af29ab73a10bada2f9722856792a36ec5af5399b653aa28360290a5"}, + {file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f8722560a14cde92fdb1e31597760dc35f9f5524cce17836c0d22841830fd5b"}, + {file = "mypy-1.15.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:1fbb8da62dc352133d7d7ca90ed2fb0e9d42bb1a32724c287d3c76c58cbaa9c2"}, + {file = "mypy-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:d10d994b41fb3497719bbf866f227b3489048ea4bbbb5015357db306249f7980"}, + {file = "mypy-1.15.0-py3-none-any.whl", hash = "sha256:5469affef548bd1895d86d3bf10ce2b44e33d86923c29e4d675b3e323437ea3e"}, + {file = "mypy-1.15.0.tar.gz", hash = "sha256:404534629d51d3efea5c800ee7c42b72a6554d6c400e6a79eafe15d11341fd43"}, +] + +[package.dependencies] +mypy_extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing_extensions = ">=4.6.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +faster-cache = ["orjson"] +install-types = ["pip"] +mypyc = ["setuptools (>=50)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.1.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, +] + +[[package]] +name = "packaging" +version = "25.0" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, + {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, +] + +[[package]] +name = "platformdirs" +version = "4.3.7" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "platformdirs-4.3.7-py3-none-any.whl", hash = "sha256:a03875334331946f13c549dbd8f4bac7a13a50a895a0eb1e8c6a8ace80d40a94"}, + {file = "platformdirs-4.3.7.tar.gz", hash = "sha256:eb437d586b6a0986388f0d6f74aa0cde27b48d0e3d66843640bfb6bdcdb6e351"}, +] + +[package.extras] +docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.1.3)", "sphinx-autodoc-typehints (>=3)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.4)", "pytest-cov (>=6)", "pytest-mock (>=3.14)"] +type = ["mypy (>=1.14.1)"] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pyproject-api" +version = "1.9.0" +description = "API to interact with the python pyproject.toml based projects" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "pyproject_api-1.9.0-py3-none-any.whl", hash = "sha256:326df9d68dea22d9d98b5243c46e3ca3161b07a1b9b18e213d1e24fd0e605766"}, + {file = "pyproject_api-1.9.0.tar.gz", hash = "sha256:7e8a9854b2dfb49454fae421cb86af43efbb2b2454e5646ffb7623540321ae6e"}, +] + +[package.dependencies] +packaging = ">=24.2" +tomli = {version = ">=2.2.1", markers = "python_version < \"3.11\""} + +[package.extras] +docs = ["furo (>=2024.8.6)", "sphinx-autodoc-typehints (>=3)"] +testing = ["covdefaults (>=2.3)", "pytest (>=8.3.4)", "pytest-cov (>=6)", "pytest-mock (>=3.14)", "setuptools (>=75.8)"] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +groups = ["dev"] +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "ruff" +version = "0.1.15" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +groups = ["dev"] +files = [ + {file = "ruff-0.1.15-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:5fe8d54df166ecc24106db7dd6a68d44852d14eb0729ea4672bb4d96c320b7df"}, + {file = "ruff-0.1.15-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6f0bfbb53c4b4de117ac4d6ddfd33aa5fc31beeaa21d23c45c6dd249faf9126f"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e0d432aec35bfc0d800d4f70eba26e23a352386be3a6cf157083d18f6f5881c8"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9405fa9ac0e97f35aaddf185a1be194a589424b8713e3b97b762336ec79ff807"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c66ec24fe36841636e814b8f90f572a8c0cb0e54d8b5c2d0e300d28a0d7bffec"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:6f8ad828f01e8dd32cc58bc28375150171d198491fc901f6f98d2a39ba8e3ff5"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86811954eec63e9ea162af0ffa9f8d09088bab51b7438e8b6488b9401863c25e"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fd4025ac5e87d9b80e1f300207eb2fd099ff8200fa2320d7dc066a3f4622dc6b"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b17b93c02cdb6aeb696effecea1095ac93f3884a49a554a9afa76bb125c114c1"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ddb87643be40f034e97e97f5bc2ef7ce39de20e34608f3f829db727a93fb82c5"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:abf4822129ed3a5ce54383d5f0e964e7fef74a41e48eb1dfad404151efc130a2"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6c629cf64bacfd136c07c78ac10a54578ec9d1bd2a9d395efbee0935868bf852"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1bab866aafb53da39c2cadfb8e1c4550ac5340bb40300083eb8967ba25481447"}, + {file = "ruff-0.1.15-py3-none-win32.whl", hash = "sha256:2417e1cb6e2068389b07e6fa74c306b2810fe3ee3476d5b8a96616633f40d14f"}, + {file = "ruff-0.1.15-py3-none-win_amd64.whl", hash = "sha256:3837ac73d869efc4182d9036b1405ef4c73d9b1f88da2413875e34e0d6919587"}, + {file = "ruff-0.1.15-py3-none-win_arm64.whl", hash = "sha256:9a933dfb1c14ec7a33cceb1e49ec4a16b51ce3c20fd42663198746efc0427360"}, + {file = "ruff-0.1.15.tar.gz", hash = "sha256:f6dfa8c1b21c913c326919056c390966648b680966febcb796cc9d1aaab8564e"}, +] + +[[package]] +name = "tomli" +version = "2.2.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +markers = "python_version < \"3.11\"" +files = [ + {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, + {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, + {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, + {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, + {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, + {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, + {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, + {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, + {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, +] + +[[package]] +name = "tox" +version = "4.25.0" +description = "tox is a generic virtualenv management and test command line tool" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "tox-4.25.0-py3-none-any.whl", hash = "sha256:4dfdc7ba2cc6fdc6688dde1b21e7b46ff6c41795fb54586c91a3533317b5255c"}, + {file = "tox-4.25.0.tar.gz", hash = "sha256:dd67f030317b80722cf52b246ff42aafd3ed27ddf331c415612d084304cf5e52"}, +] + +[package.dependencies] +cachetools = ">=5.5.1" +chardet = ">=5.2" +colorama = ">=0.4.6" +filelock = ">=3.16.1" +packaging = ">=24.2" +platformdirs = ">=4.3.6" +pluggy = ">=1.5" +pyproject-api = ">=1.8" +tomli = {version = ">=2.2.1", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.12.2", markers = "python_version < \"3.11\""} +virtualenv = ">=20.29.1" + +[package.extras] +test = ["devpi-process (>=1.0.2)", "pytest (>=8.3.4)", "pytest-mock (>=3.14)"] + +[[package]] +name = "typing-extensions" +version = "4.13.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c"}, + {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"}, +] + +[[package]] +name = "virtualenv" +version = "20.31.1" +description = "Virtual Python Environment builder" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "virtualenv-20.31.1-py3-none-any.whl", hash = "sha256:f448cd2f1604c831afb9ea238021060be2c0edbcad8eb0a4e8b4e14ff11a5482"}, + {file = "virtualenv-20.31.1.tar.gz", hash = "sha256:65442939608aeebb9284cd30baca5865fcd9f12b58bb740a24b220030df46d26"}, +] + +[package.dependencies] +distlib = ">=0.3.7,<1" +filelock = ">=3.12.2,<4" +platformdirs = ">=3.9.1,<5" + +[package.extras] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8) ; platform_python_implementation == \"PyPy\" or platform_python_implementation == \"GraalVM\" or platform_python_implementation == \"CPython\" and sys_platform == \"win32\" and python_version >= \"3.13\"", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10) ; platform_python_implementation == \"CPython\""] + +[[package]] +name = "ziglang" +version = "0.11.0" +description = "Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software." +optional = false +python-versions = "~=3.5" +groups = ["dev"] +files = [ + {file = "ziglang-0.11.0-py3-none-macosx_10_9_x86_64.whl", hash = "sha256:bd046eeab97ad51048575768f6dae10468b3a4449f4467ed61dae621faf6ee55"}, + {file = "ziglang-0.11.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:038b95cac9adef0c6dce9b72bdad895a0e4e0654c77c4a8f84fe79d2909a366e"}, + {file = "ziglang-0.11.0-py3-none-manylinux_2_12_i686.manylinux2010_i686.musllinux_1_1_i686.whl", hash = "sha256:4f848c8cca520cb12357cfa3d303bf1149a30566f4c1e5999284dbdf921cc2b8"}, + {file = "ziglang-0.11.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:45e8116428267e20529b9ee43a7e7364791c1a092845d2143b248a1dbf6760b0"}, + {file = "ziglang-0.11.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:d6372bada34714a5395539cc4d76e9cc6062739cee5ce9949a250f7c525ceb94"}, + {file = "ziglang-0.11.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_1_armv7l.whl", hash = "sha256:5fe81f91fd872fc32ed0f82807df6c680a82cbea56a9f24f818e9da299049022"}, + {file = "ziglang-0.11.0-py3-none-win32.whl", hash = "sha256:97ac4312a358d2a4ba2c153fdb1827caf6bc158501a468ebd6a554b50edee42e"}, + {file = "ziglang-0.11.0-py3-none-win_amd64.whl", hash = "sha256:a7edc7020e7ffbbb3af3a40c17a9bda65d5a65132ff933e153ffa80d8f5ad731"}, +] + +[metadata] +lock-version = "2.1" +python-versions = "^3.9" +content-hash = "d3d6701db2fbb71b520f38c63bb7f7c9a8cbcea69ef320ee0bdf145a2f84ed73" diff --git a/pyproject.toml b/pyproject.toml index 57b26b8..efedc4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ features = ["pyo3/extension-module"] [tool.poetry] name = "fast-stark-crypto" -version = "0.0.1-prerelease+starknet" +version = "0.0.1" description = "wrapped starkware rust crypto functions" authors = ["x10"] license = "MIT" diff --git a/tests/test_key_generation_rust_integration.py b/tests/test_key_generation_rust_integration.py index 0813f01..d7900c5 100644 --- a/tests/test_key_generation_rust_integration.py +++ b/tests/test_key_generation_rust_integration.py @@ -1,7 +1,7 @@ import fast_stark_crypto -def test_well_known_keypair_generation(): +def test_well_known_keypair_generation() -> None: (priv, pub) = fast_stark_crypto.generate_keypair_from_eth_signature( eth_signature="0x9ef64d5936681edf44b4a7ad713f3bc24065d4039562af03fccf6a08d6996eab367df11439169b417b6a6d8ce81d409edb022597ce193916757c7d5d9cbf97301c" ) diff --git a/tests/test_order_msg_rust_integration.py b/tests/test_order_msg_rust_integration.py index 4d02c30..27da767 100644 --- a/tests/test_order_msg_rust_integration.py +++ b/tests/test_order_msg_rust_integration.py @@ -1,7 +1,7 @@ import fast_stark_crypto -def test_well_known_order_hash(): +def test_well_known_order_hash() -> None: hash_from_rust = fast_stark_crypto.get_order_msg_hash( position_id=100, base_asset_id=2, @@ -19,10 +19,10 @@ def test_well_known_order_hash(): domain_revision="1", ) - assert hash_from_rust == int("0x62428944e2c935c4c6662ec0328abfcab44dd6455cb48845c78d18f0ea0450b", 16) + assert hash_from_rust == int("0x4de4c009e0d0c5a70a7da0e2039fb2b99f376d53496f89d9f437e736add6b48", 16) -def test_sdk_buy_order_value(): +def test_sdk_buy_order_value() -> None: synth_id = "0x4254432d3600000000000000000000" collateral_id = "0x31857064564ed0ff978e687456963cba09c2c6985d8f9300a1de4962fafa054" fee_id = collateral_id @@ -46,4 +46,4 @@ def test_sdk_buy_order_value(): domain_revision="1", ) - assert hash_from_rust == int("654658124396932115680058168732265986796695452956187015498175725004749638680") + assert hash_from_rust == int("0x58454e78c25644cbcab59444736d573f169fb0996dafe1900a05e2ac50567f0", 16) diff --git a/tests/test_transfer_msg_rust_integration.py b/tests/test_transfer_msg_rust_integration.py index fd0b3c5..071cdba 100644 --- a/tests/test_transfer_msg_rust_integration.py +++ b/tests/test_transfer_msg_rust_integration.py @@ -1,8 +1,8 @@ import fast_stark_crypto -def test_well_known_transfer_hash(): - expected_hash = int("3466709383481810859947861276094399756712395853968834582933311835633294184917") +def test_well_known_transfer_hash() -> None: + expected_hash = int("2453233552426028319905576552240018623512915507691922332978444357299842334607") actual_hash = fast_stark_crypto.get_transfer_msg_hash( recipient_position_id=1, sender_position_id=2, From 7acdbd8561e1150dc15efeb3ac78c9075e3466da Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 7 May 2025 11:45:09 +0100 Subject: [PATCH 34/70] expose k-less sign method directly --- Cargo.lock | 2 +- Cargo.toml | 2 +- python/fast_stark_crypto/lib.py | 10 ++++------ src/lib.rs | 11 ++++------- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50203f0..fb9b825 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.3-alpha" +version = "0.3.4-alpha" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 618c55a..8073941 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.3-alpha" +version = "0.3.4-alpha" edition = "2021" [lib] diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index 0b0a247..7722113 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -16,15 +16,13 @@ def get_public_key(private_key: int) -> int: def pedersen_hash(first: int, second: int) -> int: return int(rs_compute_pedersen_hash(hex(first), hex(second))) - -def sign(private_key: int, msg_hash: int, k: int) -> tuple[int, int]: - (r, s) = rs_sign_message(hex(private_key), hex(msg_hash), hex(k)) +def sign(private_key: int, msg_hash: int) -> tuple[int, int]: + (r, s) = rs_sign_message(hex(private_key), hex(msg_hash)) return (int(r), int(s)) def verify(public_key: int, msg_hash: int, r: int, s: int) -> bool: - return rs_verify_signature(hex(public_key), hex(msg_hash), hex(r), hex(s)) - + return bool(rs_verify_signature(hex(public_key), hex(msg_hash), hex(r), hex(s)) == True) def generate_keypair_from_eth_signature( eth_signature: str, @@ -98,4 +96,4 @@ def get_transfer_msg_hash( domain_revision, ), 16, - ) \ No newline at end of file + ) diff --git a/src/lib.rs b/src/lib.rs index 19841aa..3e7eb16 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ use pyo3::prelude::*; use pyo3::types::PyModule; use rust_crypto_lib_base::get_private_key_from_eth_signature; +use rust_crypto_lib_base::sign_message; use rust_crypto_lib_base::starknet_messages::AssetId; use rust_crypto_lib_base::starknet_messages::OffChainMessage; use rust_crypto_lib_base::starknet_messages::Order; @@ -11,7 +12,6 @@ use rust_crypto_lib_base::starknet_messages::Timestamp; use rust_crypto_lib_base::starknet_messages::TransferArgs; use starknet_crypto::get_public_key as fetch_public_key; use starknet_crypto::pedersen_hash; -use starknet_crypto::sign; use starknet_crypto::verify as verify_signature; use starknet_crypto::Felt; @@ -52,17 +52,14 @@ fn rs_sign_message( py: Python, priv_key_hex: String, msg_hash_hex: String, - k_hex: String, ) -> PyResult<(String, String)> { py.allow_threads(move || { str_to_field_element(&priv_key_hex) .and_then(|priv_key| { str_to_field_element(&msg_hash_hex).and_then(|msg_hash| { - str_to_field_element(&k_hex).and_then(|k| { - sign(&priv_key, &msg_hash, &k) - .map(|signature| (signature.r.to_string(), signature.s.to_string())) - .map_err(|e| format!("Signing operation failed: {}", e)) - }) + sign_message(&msg_hash, &priv_key) + .map(|signature| (signature.r.to_string(), signature.s.to_string())) + .map_err(|e| format!("Signing operation failed: {}", e)) }) }) .map_err(PyErr::new::) From c2330322d2440816abfcf337f0a64bdc76a4b8aa Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 30 Jul 2025 11:15:58 +0100 Subject: [PATCH 35/70] add withdrawal message --- Cargo.lock | 2 +- Cargo.toml | 2 +- rust-crypto-lib-base | 2 +- src/lib.rs | 119 ++++++++++++++++++++++++++++++++++++------- 4 files changed, 104 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb9b825..2b16f45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.4-alpha" +version = "0.3.5-alpha" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 8073941..b5fa6d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.4-alpha" +version = "0.3.5-alpha" edition = "2021" [lib] diff --git a/rust-crypto-lib-base b/rust-crypto-lib-base index 9da3e61..2bd93e6 160000 --- a/rust-crypto-lib-base +++ b/rust-crypto-lib-base @@ -1 +1 @@ -Subproject commit 9da3e61a6e1e9d8192e561f48deccc955835ccb4 +Subproject commit 2bd93e67ec4bc8cf0dbf70b9d431a363bdd7739e diff --git a/src/lib.rs b/src/lib.rs index 3e7eb16..afc5605 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,9 @@ use pyo3::prelude::*; use pyo3::types::PyModule; use rust_crypto_lib_base::get_private_key_from_eth_signature; +use rust_crypto_lib_base::get_withdrawal_hash; use rust_crypto_lib_base::sign_message; + use rust_crypto_lib_base::starknet_messages::AssetId; use rust_crypto_lib_base::starknet_messages::OffChainMessage; use rust_crypto_lib_base::starknet_messages::Order; @@ -160,50 +162,131 @@ fn rs_get_order_msg( domain_revision: String, ) -> PyResult { py.allow_threads(move || { - //hex fields - let base_asset_id = Felt::from_hex(&base_asset_id_hex).unwrap(); - let quote_asset_id = Felt::from_hex("e_asset_id_hex).unwrap(); - let fee_asset_id = Felt::from_hex(&fee_asset_id_hex).unwrap(); - let user_key = Felt::from_hex(&user_public_key_hex).unwrap(); + // Convert hex fields + let base_asset_id = Felt::from_hex(&base_asset_id_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid base_asset_id_hex: {}", + e + )) + })?; + let quote_asset_id = Felt::from_hex("e_asset_id_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid quote_asset_id_hex: {}", + e + )) + })?; + let fee_asset_id = Felt::from_hex(&fee_asset_id_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid fee_asset_id_hex: {}", + e + )) + })?; + let user_key = Felt::from_hex(&user_public_key_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid user_public_key_hex: {}", + e + )) + })?; - //decimal fields - let position_id = u32::from_str_radix(&position_id, 10).unwrap(); - let base_amount = i64::from_str_radix(&base_amount, 10).unwrap(); - let quote_amount = i64::from_str_radix("e_amount, 10).unwrap(); - let fee_amount = u64::from_str_radix(&fee_amount, 10).unwrap(); - let expiration = u64::from_str_radix(&expiration, 10).unwrap(); - let salt = u64::from_str_radix(&salt, 10).unwrap(); + // Convert decimal fields + let position_id = u32::from_str_radix(&position_id, 10).map_err(|e| { + PyErr::new::(format!("Invalid position_id: {}", e)) + })?; + let base_amount = i64::from_str_radix(&base_amount, 10).map_err(|e| { + PyErr::new::(format!("Invalid base_amount: {}", e)) + })?; + let quote_amount = i64::from_str_radix("e_amount, 10).map_err(|e| { + PyErr::new::(format!("Invalid quote_amount: {}", e)) + })?; + let fee_amount = u64::from_str_radix(&fee_amount, 10).map_err(|e| { + PyErr::new::(format!("Invalid fee_amount: {}", e)) + })?; + let expiration = u64::from_str_radix(&expiration, 10).map_err(|e| { + PyErr::new::(format!("Invalid expiration: {}", e)) + })?; + let salt = u64::from_str_radix(&salt, 10).map_err(|e| { + PyErr::new::(format!("Invalid salt: {}", e)) + })?; + // Construct order and domain let order = Order { position_id: PositionId { value: position_id }, base_asset_id: AssetId { value: base_asset_id, }, - base_amount: base_amount, + base_amount, quote_asset_id: AssetId { value: quote_asset_id, }, - quote_amount: quote_amount, + quote_amount, fee_asset_id: AssetId { value: fee_asset_id, }, - fee_amount: fee_amount, + fee_amount, expiration: Timestamp { seconds: expiration, }, - salt: salt.try_into().unwrap(), + salt: salt.try_into().map_err(|e| { + PyErr::new::(format!( + "Invalid salt conversion: {}", + e + )) + })?, }; let domain = StarknetDomain { name: domain_name, version: domain_version, chain_id: domain_chain_id, - revision: u32::from_str_radix(&domain_revision, 10).unwrap(), + revision: u32::from_str_radix(&domain_revision, 10).map_err(|e| { + PyErr::new::(format!( + "Invalid domain_revision: {}", + e + )) + })?, }; - let message = order.message_hash(&domain, user_key).unwrap(); + + // Compute message hash + let message = order.message_hash(&domain, user_key).map_err(|e| { + PyErr::new::(format!( + "Failed to compute message hash: {}", + e + )) + })?; Ok(message.to_hex_string()) }) } +#[pyfunction] +fn rs_get_withdrawal_hash( + recipient_hex: String, + position_id: String, + collateral_id_hex: String, + amount: String, + expiration: String, + salt: String, + user_public_key_hex: String, + domain_name: String, + domain_version: String, + domain_chain_id: String, + domain_revision: String, +) -> String { + return get_withdrawal_hash( + recipient_hex, + position_id, + collateral_id_hex, + amount, + expiration, + salt, + user_public_key_hex, + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ) + .unwrap() + .to_hex_string(); +} + #[pyfunction] fn rs_generate_keypair_from_eth_signature( _py: Python, From d0f14ac9efb10a45786819cdda4cb338b45e9377 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 30 Jul 2025 11:25:03 +0100 Subject: [PATCH 36/70] fix PR build --- .github/workflows/PR.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 97aabb5..4a55878 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -27,12 +27,12 @@ jobs: submodules: 'true' - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: 3.10 - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist + args: --release -i python3.10 --out dist manylinux: ${{ matrix.platform.manylinux }} - name: pytest shell: bash From 5b10e6db3f44b7a8c80528b9fdca719640607a77 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 30 Jul 2025 11:26:08 +0100 Subject: [PATCH 37/70] fix PR build python version quoting --- .github/workflows/PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 4a55878..3b0aa9f 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -27,7 +27,7 @@ jobs: submodules: 'true' - uses: actions/setup-python@v5 with: - python-version: 3.10 + python-version: '3.10' - name: Build wheels uses: PyO3/maturin-action@v1 with: From 88e72d8781fe691450b2a1f43d2fdb8678a33856 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 30 Jul 2025 11:49:43 +0100 Subject: [PATCH 38/70] add withdrawal test --- python/fast_stark_crypto/lib.py | 34 +++++++++++++++++++ src/lib.rs | 1 + tests/test_withdrawal_msg_rust_integration.py | 19 +++++++++++ 3 files changed, 54 insertions(+) create mode 100644 tests/test_withdrawal_msg_rust_integration.py diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index 7722113..7b50921 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -6,6 +6,7 @@ rs_get_order_msg, rs_get_transfer_msg, rs_generate_keypair_from_eth_signature, + rs_get_withdrawal_msg, ) @@ -16,6 +17,7 @@ def get_public_key(private_key: int) -> int: def pedersen_hash(first: int, second: int) -> int: return int(rs_compute_pedersen_hash(hex(first), hex(second))) + def sign(private_key: int, msg_hash: int) -> tuple[int, int]: (r, s) = rs_sign_message(hex(private_key), hex(msg_hash)) return (int(r), int(s)) @@ -24,6 +26,7 @@ def sign(private_key: int, msg_hash: int) -> tuple[int, int]: def verify(public_key: int, msg_hash: int, r: int, s: int) -> bool: return bool(rs_verify_signature(hex(public_key), hex(msg_hash), hex(r), hex(s)) == True) + def generate_keypair_from_eth_signature( eth_signature: str, ) -> tuple[int, int]: @@ -97,3 +100,34 @@ def get_transfer_msg_hash( ), 16, ) + + +def get_withdrawal_msg_hash( + recipient_hex: str, + position_id: int, + collateral_id: int, + amount: int, + expiration: int, + salt: int, + user_public_key: int, + domain_name: str, + domain_version: str, + domain_chain_id: str, + domain_revision: str, +) -> int: + return int( + rs_get_withdrawal_msg( + recipient_hex, + str(position_id), + hex(collateral_id), + str(amount), + str(expiration), + str(salt), + hex(user_public_key), + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ), + 16, + ) diff --git a/src/lib.rs b/src/lib.rs index afc5605..619733d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -311,6 +311,7 @@ fn fast_stark_crypto(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_get_order_msg, m)?)?; m.add_function(wrap_pyfunction!(rs_get_transfer_msg, m)?)?; m.add_function(wrap_pyfunction!(rs_generate_keypair_from_eth_signature, m)?)?; + m.add_function(wrap_pyfunction!(rs_get_withdrawal_hash, m)?)?; Ok(()) } diff --git a/tests/test_withdrawal_msg_rust_integration.py b/tests/test_withdrawal_msg_rust_integration.py new file mode 100644 index 0000000..c599166 --- /dev/null +++ b/tests/test_withdrawal_msg_rust_integration.py @@ -0,0 +1,19 @@ +import fast_stark_crypto + + +def test_well_known_withdrawal_hash() -> None: + expected_hash = int("2182119571682827544073774098906745929330860211691330979324731407862023927178") + actual_hash = fast_stark_crypto.get_withdrawal_msg_hash( + recipient_hex=hex(206642948138484946401984817000601902748248360221625950604253680558965863254), + position_id=2, + collateral_id=int("1386727789535574059419576650469753513512158569780862144831829362722992755422"), + amount=1000, + expiration=0, + salt=0, + user_public_key=int("0x5D05989E9302DCEBC74E241001E3E3AC3F4402CCF2F8E6F74B034B07AD6A904", 16), + domain_name="Perpetuals", + domain_version="v0", + domain_chain_id="SN_SEPOLIA", + domain_revision="1", + ) + assert actual_hash == expected_hash, "Hashes do not match for get_transfer_msg_hash" From 1ac79955f51807cdcb2278fb393e3c347fb228dc Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 30 Jul 2025 11:54:28 +0100 Subject: [PATCH 39/70] fix CI tests --- python/fast_stark_crypto/lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index 7b50921..66cbdc9 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -6,7 +6,7 @@ rs_get_order_msg, rs_get_transfer_msg, rs_generate_keypair_from_eth_signature, - rs_get_withdrawal_msg, + rs_get_withdrawal_hash, ) @@ -116,7 +116,7 @@ def get_withdrawal_msg_hash( domain_revision: str, ) -> int: return int( - rs_get_withdrawal_msg( + rs_get_withdrawal_hash( recipient_hex, str(position_id), hex(collateral_id), From e2fd1902b126b4e91f0b4cfd490d673fe178785b Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 30 Jul 2025 11:59:19 +0100 Subject: [PATCH 40/70] bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b16f45..40f98ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.5-alpha" +version = "0.3.6-alpha" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index b5fa6d9..96c5388 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.5-alpha" +version = "0.3.6-alpha" edition = "2021" [lib] From 4100fbed0fcf3b56ef77a70b9a0d2d32f8ee2c54 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 16:45:31 +0400 Subject: [PATCH 41/70] Bump base lib version --- Cargo.lock | 1379 +++++++++++++++++++++++++----------------- Cargo.toml | 7 +- rust-crypto-lib-base | 2 +- 3 files changed, 843 insertions(+), 545 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 40f98ba..b07cce9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 4 [[package]] name = "addr2line" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" dependencies = [ "gimli", ] [[package]] name = "adler2" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aes" @@ -28,12 +28,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -51,15 +45,21 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "auto_impl" version = "1.3.0" @@ -73,15 +73,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ "addr2line", "cfg-if", @@ -89,7 +89,7 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -106,9 +106,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" [[package]] name = "bitvec" @@ -122,6 +122,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -133,9 +142,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "byte-slice-cast" @@ -157,26 +166,32 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.19" +version = "1.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" +checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" dependencies = [ + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "num-traits", "serde", @@ -213,16 +228,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -231,27 +236,27 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] [[package]] name = "crunchy" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-bigint" @@ -285,9 +290,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.11" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ "darling_core", "darling_macro", @@ -295,9 +300,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.11" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" dependencies = [ "fnv", "ident_case", @@ -309,9 +314,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.11" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", "quote", @@ -320,12 +325,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.0" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" dependencies = [ "powerfmt", - "serde", + "serde_core", ] [[package]] @@ -351,13 +356,10 @@ dependencies = [ ] [[package]] -name = "encoding_rs" -version = "0.8.35" +name = "dyn-clone" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "equivalent" @@ -377,13 +379,13 @@ dependencies = [ "hex", "hmac", "pbkdf2", - "rand", + "rand 0.8.5", "scrypt", "serde", "serde_json", "sha2", "sha3", - "thiserror", + "thiserror 1.0.69", "uuid", ] @@ -416,15 +418,21 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.6-alpha" +version = "0.3.7" dependencies = [ "cc", "pyo3", "pyo3-build-config", "rust-crypto-lib-base", - "starknet-crypto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "starknet-crypto 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -432,16 +440,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] [[package]] name = "flate2" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" dependencies = [ "crc32fast", "miniz_oxide", @@ -461,9 +469,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] @@ -489,12 +497,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - [[package]] name = "futures-task" version = "0.3.31" @@ -525,41 +527,36 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] -name = "gimli" -version = "0.31.1" +name = "getrandom" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi 0.14.7+wasi-0.2.4", + "wasm-bindgen", +] [[package]] -name = "h2" -version = "0.3.26" +name = "gimli" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 2.9.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "hashbrown" @@ -569,9 +566,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "heck" @@ -596,9 +593,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.12" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -607,12 +604,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", + "futures-core", "http", + "http-body", "pin-project-lite", ] @@ -622,55 +631,73 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" -version = "0.14.32" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" dependencies = [ + "atomic-waker", "bytes", "futures-channel", "futures-core", - "futures-util", - "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "pin-utils", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "futures-util", "http", "hyper", + "hyper-util", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.63" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -692,21 +719,22 @@ dependencies = [ [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", @@ -715,31 +743,11 @@ dependencies = [ "zerovec", ] -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" - [[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", @@ -747,67 +755,54 @@ dependencies = [ "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "potential_utf", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", + "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -816,9 +811,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", @@ -827,9 +822,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", @@ -886,20 +881,21 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.16.0", "serde", + "serde_core", ] [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" [[package]] name = "inout" @@ -910,12 +906,33 @@ dependencies = [ "generic-array", ] +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + [[package]] name = "ipnet" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "itoa" version = "1.0.15" @@ -924,10 +941,11 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -942,11 +960,13 @@ dependencies = [ [[package]] name = "lambdaworks-crypto" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc2a4da0d9e52ccfe6306801a112e81a8fc0c76aa3e4449fefeda7fef72bb34" +checksum = "fce8f59622ed408c318c9b5eca17f1a1154159e3738b5c4d5a22a0dd3700c906" dependencies = [ "lambdaworks-math", + "rand 0.8.5", + "rand_chacha 0.3.1", "serde", "sha2", "sha3", @@ -954,37 +974,33 @@ dependencies = [ [[package]] name = "lambdaworks-math" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1bd2632acbd9957afc5aeec07ad39f078ae38656654043bf16e046fa2730e23" +checksum = "405d65a26831650ba348a503a2881ed7a0483ef3ec17f66e0fc8e2f9c97fc7ca" dependencies = [ + "getrandom 0.2.16", + "rand 0.8.5", "serde", "serde_json", ] -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - [[package]] name = "libc" -version = "0.2.171" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "litemap" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" dependencies = [ "autocfg", "scopeguard", @@ -992,49 +1008,49 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "lru-slab" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "miniz_oxide" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", ] [[package]] name = "mio" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", - "wasi", - "windows-sys 0.52.0", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", ] [[package]] @@ -1073,24 +1089,24 @@ dependencies = [ [[package]] name = "object" -version = "0.36.7" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "parity-scale-codec" -version = "3.7.4" +version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" +checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" dependencies = [ "arrayvec", "bitvec", @@ -1104,9 +1120,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.7.4" +version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" +checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1116,9 +1132,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" dependencies = [ "lock_api", "parking_lot_core", @@ -1126,15 +1142,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -1148,9 +1164,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" @@ -1164,6 +1180,21 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "zerovec", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -1172,9 +1203,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] [[package]] name = "primitive-types" @@ -1191,33 +1225,34 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0" +checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233" dependencies = [ "cfg-if", "indoc", "libc", "memoffset", "parking_lot", + "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -1226,9 +1261,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be" +checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7" dependencies = [ "once_cell", "target-lexicon", @@ -1236,9 +1271,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1" +checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa" dependencies = [ "libc", "pyo3-build-config", @@ -1246,9 +1281,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3" +checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -1258,25 +1293,87 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f" +checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" dependencies = [ "heck", "proc-macro2", + "pyo3-build-config", "quote", "syn", ] +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.3", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + [[package]] name = "quote" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "radium" version = "0.7.0" @@ -1290,8 +1387,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -1301,7 +1408,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -1310,57 +1427,83 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", ] [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ "bitflags", ] [[package]] -name = "reqwest" -version = "0.11.27" +name = "ref-cast" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" dependencies = [ - "base64 0.21.7", + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "reqwest" +version = "0.12.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" +dependencies = [ + "base64 0.22.1", "bytes", - "encoding_rs", "futures-core", - "futures-util", - "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", - "ipnet", + "hyper-util", "js-sys", "log", - "mime", - "once_cell", "percent-encoding", "pin-project-lite", + "quinn", "rustls", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-rustls", + "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "webpki-roots", - "winreg", ] [[package]] @@ -1381,7 +1524,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -1402,19 +1545,23 @@ name = "rust-crypto-lib-base" version = "0.1.0" dependencies = [ "hex", - "lazy_static", "num-bigint", - "serde_json", "sha2", "starknet", - "starknet-crypto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "starknet-crypto 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-demangle" -version = "0.1.24" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustc-hash" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc-hex" @@ -1424,46 +1571,50 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustls" -version = "0.21.12" +version = "0.23.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" dependencies = [ - "log", + "once_cell", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] -name = "rustls-pemfile" -version = "1.0.4" +name = "rustls-pki-types" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" dependencies = [ - "base64 0.21.7", + "web-time", + "zeroize", ] [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.103.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "8572f3c2cb9934231157b45499fc41e1f58c589fdfb81a844ba873265e80f8eb" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "salsa20" @@ -1474,6 +1625,30 @@ dependencies = [ "cipher", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -1493,29 +1668,29 @@ dependencies = [ ] [[package]] -name = "sct" -version = "0.7.1" +name = "serde" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ - "ring", - "untrusted", + "serde_core", + "serde_derive", ] [[package]] -name = "serde" -version = "1.0.219" +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -1524,14 +1699,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", ] [[package]] @@ -1559,15 +1735,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.12.0" +version = "3.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +checksum = "c522100790450cf78eeac1507263d0a350d4d5b30df0c8e1fe051a10c22b376e" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.9.0", + "indexmap 2.11.4", + "schemars 0.9.0", + "schemars 1.0.4", "serde", "serde_derive", "serde_json", @@ -1577,9 +1755,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.12.0" +version = "3.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +checksum = "327ada00f7d64abaac1e55a6911e90cf665aa051b9a561c7006c157f4633135e" dependencies = [ "darling", "proc-macro2", @@ -1589,9 +1767,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -1614,35 +1792,26 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "size-of" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4e36eca171fddeda53901b0a436573b3f2391eaa9189d439b2bd8ea8cebd7e3" - [[package]] name = "slab" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "smallvec" -version = "1.13.1" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.5.9" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1653,14 +1822,14 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starknet" -version = "0.14.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.17.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "starknet-accounts", "starknet-contract", "starknet-core", "starknet-core-derive", - "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-crypto 0.8.1 (git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0)", "starknet-macros", "starknet-providers", "starknet-signers", @@ -1668,22 +1837,22 @@ dependencies = [ [[package]] name = "starknet-accounts" -version = "0.13.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.16.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "async-trait", "auto_impl", "starknet-core", - "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-crypto 0.8.1 (git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0)", "starknet-providers", "starknet-signers", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "starknet-contract" -version = "0.13.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.16.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "serde", "serde_json", @@ -1691,20 +1860,20 @@ dependencies = [ "starknet-accounts", "starknet-core", "starknet-providers", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "starknet-core" -version = "0.13.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.16.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "base64 0.21.7", "crypto-bigint", "flate2", "foldhash", "hex", - "indexmap 2.9.0", + "indexmap 2.11.4", "num-traits", "serde", "serde_json", @@ -1712,14 +1881,14 @@ dependencies = [ "serde_with", "sha3", "starknet-core-derive", - "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-crypto 0.8.1 (git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0)", "starknet-types-core", ] [[package]] name = "starknet-core-derive" version = "0.1.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "proc-macro2", "quote", @@ -1728,9 +1897,9 @@ dependencies = [ [[package]] name = "starknet-crypto" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039a3bad70806b494c9e6b21c5238a6c8a373d66a26071859deb0ccca6f93634" +checksum = "1004a16c25dc6113c19d4f9d0c19ff97d85804829894bba22c0d0e9e7b249812" dependencies = [ "crypto-bigint", "hex", @@ -1740,15 +1909,15 @@ dependencies = [ "num-traits", "rfc6979", "sha2", - "starknet-curve 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "starknet-curve 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "starknet-types-core", "zeroize", ] [[package]] name = "starknet-crypto" -version = "0.7.4" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.8.1" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "crypto-bigint", "hex", @@ -1758,32 +1927,32 @@ dependencies = [ "num-traits", "rfc6979", "sha2", - "starknet-curve 0.5.1 (git+https://github.com/xJonathanLEI/starknet-rs)", + "starknet-curve 0.6.0 (git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0)", "starknet-types-core", "zeroize", ] [[package]] name = "starknet-curve" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcde6bd74269b8161948190ace6cf069ef20ac6e79cd2ba09b320efa7500b6de" +checksum = "22c898ae81b6409532374cf237f1bd752d068b96c6ad500af9ebbd0d9bb712f6" dependencies = [ "starknet-types-core", ] [[package]] name = "starknet-curve" -version = "0.5.1" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.6.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "starknet-types-core", ] [[package]] name = "starknet-macros" -version = "0.2.2" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.2.5" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "starknet-core", "syn", @@ -1791,53 +1960,55 @@ dependencies = [ [[package]] name = "starknet-providers" -version = "0.13.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.16.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "async-trait", "auto_impl", "ethereum-types", "flate2", - "getrandom", + "getrandom 0.2.16", "log", "reqwest", "serde", "serde_json", "serde_with", "starknet-core", - "thiserror", + "thiserror 1.0.69", "url", ] [[package]] name = "starknet-signers" -version = "0.11.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs#47a38ebb6d13bf648a35b4434ee2df6690f80e41" +version = "0.14.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0#85906137d634c86b07de20fa33071e5cf186ce21" dependencies = [ "async-trait", "auto_impl", "crypto-bigint", "eth-keystore", - "getrandom", - "rand", + "getrandom 0.2.16", + "rand 0.8.5", "starknet-core", - "starknet-crypto 0.7.4 (git+https://github.com/xJonathanLEI/starknet-rs)", - "thiserror", + "starknet-crypto 0.8.1 (git+https://github.com/xJonathanLEI/starknet-rs?tag=starknet%2Fv0.17.0)", + "thiserror 1.0.69", ] [[package]] name = "starknet-types-core" -version = "0.1.8" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4037bcb26ce7c508448d221e570d075196fd4f6912ae6380981098937af9522a" +checksum = "92eb6db1a763c350ffa50ed65ea3a92de9888239357cfbcb633e29a4da77f122" dependencies = [ + "blake2", + "digest", "lambdaworks-crypto", "lambdaworks-math", "num-bigint", "num-integer", "num-traits", + "rand 0.9.2", "serde", - "size-of", "zeroize", ] @@ -1855,15 +2026,15 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -1872,42 +2043,24 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tap" version = "1.0.1" @@ -1916,9 +2069,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "thiserror" @@ -1926,7 +2079,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", ] [[package]] @@ -1940,11 +2102,22 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "time" -version = "0.3.41" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", @@ -1957,15 +2130,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", @@ -1982,69 +2155,125 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.44.2" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio", "pin-project-lite", + "slab", "socket2", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ "rustls", "tokio", ] [[package]] -name = "tokio-util" -version = "0.7.14" +name = "toml_datetime" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", + "serde_core", ] [[package]] -name = "toml_datetime" -version = "0.6.8" +name = "toml_edit" +version = "0.23.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "f3effe7c0e86fdff4f69cdd2ccc1b96f933e24811c5441d44904e8683e27184b" +dependencies = [ + "indexmap 2.11.4", + "toml_datetime", + "toml_parser", + "winnow", +] [[package]] -name = "toml_edit" -version = "0.22.24" +name = "toml_parser" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" dependencies = [ - "indexmap 2.9.0", - "toml_datetime", "winnow", ] +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" version = "0.3.3" @@ -2063,9 +2292,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", ] @@ -2078,9 +2307,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "uint" @@ -2096,9 +2325,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] name = "unicode-xid" @@ -2108,9 +2337,9 @@ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "unindent" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" [[package]] name = "untrusted" @@ -2120,21 +2349,16 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.4" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -2147,15 +2371,15 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom", + "getrandom 0.2.16", "serde", ] [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "want" @@ -2168,29 +2392,49 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -2199,21 +2443,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2221,9 +2466,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" dependencies = [ "proc-macro2", "quote", @@ -2234,15 +2479,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -2250,15 +2508,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "windows-core" -version = "0.61.0" +version = "0.62.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" +checksum = "6844ee5416b285084d3d3fffd743b925a6c9385455f64f6d4fa3031c4c2749a9" dependencies = [ "windows-implement", "windows-interface", @@ -2269,9 +2530,9 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" dependencies = [ "proc-macro2", "quote", @@ -2280,9 +2541,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" dependencies = [ "proc-macro2", "quote", @@ -2291,59 +2552,53 @@ dependencies = [ [[package]] name = "windows-link" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" [[package]] name = "windows-result" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" dependencies = [ "windows-link", ] [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "windows-sys" -version = "0.52.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets 0.52.6", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-sys" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets 0.53.4", ] [[package]] @@ -2355,7 +2610,7 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", @@ -2363,10 +2618,21 @@ dependencies = [ ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" +name = "windows-targets" +version = "0.53.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] [[package]] name = "windows_aarch64_gnullvm" @@ -2375,10 +2641,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" +name = "windows_aarch64_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" @@ -2387,10 +2653,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] -name = "windows_i686_gnu" -version = "0.48.5" +name = "windows_aarch64_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" @@ -2398,6 +2664,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" @@ -2405,10 +2677,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "windows_i686_msvc" -version = "0.48.5" +name = "windows_i686_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" @@ -2417,10 +2689,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" +name = "windows_i686_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" @@ -2429,10 +2701,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" +name = "windows_x86_64_gnu" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" @@ -2441,10 +2713,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" +name = "windows_x86_64_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" @@ -2453,35 +2725,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winnow" -version = "0.7.6" +name = "windows_x86_64_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" -dependencies = [ - "memchr", -] +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] -name = "winreg" -version = "0.50.0" +name = "winnow" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ - "cfg-if", - "windows-sys 0.48.0", + "memchr", ] [[package]] -name = "write16" -version = "1.0.0" +name = "wit-bindgen" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "wyz" @@ -2494,9 +2762,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", @@ -2506,9 +2774,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", @@ -2516,6 +2784,26 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zerofrom" version = "0.1.6" @@ -2539,15 +2827,26 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] [[package]] name = "zerovec" -version = "0.10.4" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" dependencies = [ "yoke", "zerofrom", @@ -2556,9 +2855,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 96c5388..43acd8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.6-alpha" +version = "0.3.7" edition = "2021" [lib] @@ -9,9 +9,8 @@ crate-type = ["cdylib"] [dependencies] pyo3 = "0.20.2" -rust-crypto-lib-base = { path = "./rust-crypto-lib-base" } -starknet-crypto = "0.7.4" - +rust-crypto-lib-base = { version = "0.1.0", path = "./rust-crypto-lib-base" } +starknet-crypto = "0.8.1" [build-dependencies] cc = { version = "1" } diff --git a/rust-crypto-lib-base b/rust-crypto-lib-base index 2bd93e6..edb3fa3 160000 --- a/rust-crypto-lib-base +++ b/rust-crypto-lib-base @@ -1 +1 @@ -Subproject commit 2bd93e67ec4bc8cf0dbf70b9d431a363bdd7739e +Subproject commit edb3fa333ac7090ba76a624301e76b842c7399d2 From c2a4367b5c885d15a1b7a5167fd0b456a97ae030 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 16:50:53 +0400 Subject: [PATCH 42/70] Bump base lib version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 43acd8d..837a4c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,4 +14,4 @@ starknet-crypto = "0.8.1" [build-dependencies] cc = { version = "1" } -pyo3-build-config = { version = "^0.20" } +pyo3-build-config = { version = "0.20.2" } From 0418ddb38214a1c67392ce4edd1365653ea81fcc Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 17:13:10 +0400 Subject: [PATCH 43/70] Bump base lib version --- Cargo.toml | 4 ++-- README.md | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 837a4c5..3dedd74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ rust-crypto-lib-base = { version = "0.1.0", path = "./rust-crypto-lib-base" } starknet-crypto = "0.8.1" [build-dependencies] -cc = { version = "1" } -pyo3-build-config = { version = "0.20.2" } +cc = "1.2.39" +pyo3-build-config = "0.20.2" diff --git a/README.md b/README.md index fedcad4..7cda6fa 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,10 @@ The Stark Crypto Wrapper is a powerful library that provides a convenient interf ## Installation -TODO \ No newline at end of file +TODO + +## Building from source + +- `poetry install` to install dependencies +- `maturin develop` to build and install the package in your current environment +- `pytest` to run tests From f978a60f8572843b4cf9e16d1c29c9cec9cd1161 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 17:15:01 +0400 Subject: [PATCH 44/70] Bump base lib version --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7cda6fa..957ea09 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,6 @@ TODO ## Building from source -- `poetry install` to install dependencies -- `maturin develop` to build and install the package in your current environment -- `pytest` to run tests +- `poetry install` -- install dependencies +- `maturin develop` -- build and install the package in your current environment +- `pytest` -- run tests From 77391d2dd21f06f00c1018dacdc9231d7fd9f751 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 20:35:44 +0400 Subject: [PATCH 45/70] Bump PyO3 lib to support Python 3.13 --- Cargo.lock | 74 ++++++++++-------------------------------------------- Cargo.toml | 4 +-- 2 files changed, 15 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b07cce9..8925a48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -572,9 +572,9 @@ checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hex" @@ -996,16 +996,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" -[[package]] -name = "lock_api" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.28" @@ -1130,29 +1120,6 @@ dependencies = [ "syn", ] -[[package]] -name = "parking_lot" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - [[package]] name = "pbkdf2" version = "0.11.0" @@ -1243,15 +1210,15 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.20.3" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233" +checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884" dependencies = [ "cfg-if", "indoc", "libc", "memoffset", - "parking_lot", + "once_cell", "portable-atomic", "pyo3-build-config", "pyo3-ffi", @@ -1261,9 +1228,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.20.3" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7" +checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38" dependencies = [ "once_cell", "target-lexicon", @@ -1271,9 +1238,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.20.3" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa" +checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636" dependencies = [ "libc", "pyo3-build-config", @@ -1281,9 +1248,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.20.3" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158" +checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -1293,9 +1260,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.20.3" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" +checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe" dependencies = [ "heck", "proc-macro2", @@ -1439,15 +1406,6 @@ dependencies = [ "getrandom 0.3.3", ] -[[package]] -name = "redox_syscall" -version = "0.5.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" -dependencies = [ - "bitflags", -] - [[package]] name = "ref-cast" version = "1.0.25" @@ -1649,12 +1607,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "scrypt" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index 3dedd74..c8fdbcb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,10 @@ name = "fast_stark_crypto" crate-type = ["cdylib"] [dependencies] -pyo3 = "0.20.2" +pyo3 = { version = "0.22.6", features = ["gil-refs"] } rust-crypto-lib-base = { version = "0.1.0", path = "./rust-crypto-lib-base" } starknet-crypto = "0.8.1" [build-dependencies] cc = "1.2.39" -pyo3-build-config = "0.20.2" +pyo3-build-config = "0.22.6" From aedc4797d43d823722b98e6bfcd1a39c18f3507d Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 22:45:31 +0400 Subject: [PATCH 46/70] Exclude PyPy from musl linux build --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 620c996..20cae87 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -93,7 +93,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} manylinux: musllinux_1_2 - name: Upload wheels From 72209248c606a2ba93315a5784e3c31e877d9dfb Mon Sep 17 00:00:00 2001 From: alex101xela Date: Wed, 1 Oct 2025 22:47:51 +0400 Subject: [PATCH 47/70] Exclude PyPy from musl linux build --- .github/workflows/CI.yml | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 20cae87..caaaea8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -224,26 +224,26 @@ jobs: name: wheels-sdist path: dist - release: - name: Release - runs-on: ubuntu-latest - needs: [linux, musllinux, windows, macos, sdist] - permissions: - id-token: write - contents: write - attestations: write - steps: - - uses: actions/download-artifact@v4 - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v2 - with: - subject-path: 'wheels-*/*' - - run: | - set -e - mkdir dist - cp wheels-*/* dist/ - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - skip-existing: true +# release: +# name: Release +# runs-on: ubuntu-latest +# needs: [linux, musllinux, windows, macos, sdist] +# permissions: +# id-token: write +# contents: write +# attestations: write +# steps: +# - uses: actions/download-artifact@v4 +# - name: Generate artifact attestation +# uses: actions/attest-build-provenance@v2 +# with: +# subject-path: 'wheels-*/*' +# - run: | +# set -e +# mkdir dist +# cp wheels-*/* dist/ +# - name: Publish package distributions to PyPI +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# skip-existing: true From ee92c82c60bba6dd3c6d3d86d04ca390979a5065 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Thu, 2 Oct 2025 06:51:57 +0400 Subject: [PATCH 48/70] Exclude PyPy from musl linux build --- .github/workflows/CI.yml | 55 ++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index caaaea8..9a1c892 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,12 +1,6 @@ name: Build, Test, and Release on: - # push: - # branches: - # - main - # tags: - # - '*' - # pull_request: workflow_dispatch: permissions: @@ -24,7 +18,6 @@ jobs: - runner: ubuntu-22.04 target: aarch64 manylinux: "2_24" - steps: - name: Checkout from GitHub uses: actions/checkout@v4 @@ -80,7 +73,6 @@ jobs: target: x86_64 - runner: ubuntu-22.04 target: aarch64 - steps: - name: Checkout from GitHub uses: actions/checkout@v4 @@ -132,7 +124,6 @@ jobs: pip install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest - windows: runs-on: ${{ matrix.platform.runner }} strategy: @@ -140,7 +131,6 @@ jobs: platform: - runner: windows-latest target: x64 - steps: - name: Checkout from GitHub uses: actions/checkout@v4 @@ -224,26 +214,25 @@ jobs: name: wheels-sdist path: dist -# release: -# name: Release -# runs-on: ubuntu-latest -# needs: [linux, musllinux, windows, macos, sdist] -# permissions: -# id-token: write -# contents: write -# attestations: write -# steps: -# - uses: actions/download-artifact@v4 -# - name: Generate artifact attestation -# uses: actions/attest-build-provenance@v2 -# with: -# subject-path: 'wheels-*/*' -# - run: | -# set -e -# mkdir dist -# cp wheels-*/* dist/ -# - name: Publish package distributions to PyPI -# uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# skip-existing: true - + release: + name: Release + runs-on: ubuntu-latest + needs: [linux, musllinux, windows, macos, sdist] + permissions: + id-token: write + contents: write + attestations: write + steps: + - uses: actions/download-artifact@v4 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-path: 'wheels-*/*' + - run: | + set -e + mkdir dist + cp wheels-*/* dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true From c7981d280eeb01de210a7644223f12bad5bf9a44 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Sat, 4 Oct 2025 07:38:30 +0400 Subject: [PATCH 49/70] Use explicit Python versions for MacOS --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9a1c892..15badc5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -180,7 +180,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels uses: actions/upload-artifact@v4 From 3c3ff3555f3f9953df9fbfda3f601f20471d864b Mon Sep 17 00:00:00 2001 From: alex101xela Date: Sat, 4 Oct 2025 07:38:42 +0400 Subject: [PATCH 50/70] Use explicit Python versions for MacOS --- .github/workflows/CI.yml | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 15badc5..0d90dac 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -214,25 +214,25 @@ jobs: name: wheels-sdist path: dist - release: - name: Release - runs-on: ubuntu-latest - needs: [linux, musllinux, windows, macos, sdist] - permissions: - id-token: write - contents: write - attestations: write - steps: - - uses: actions/download-artifact@v4 - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v2 - with: - subject-path: 'wheels-*/*' - - run: | - set -e - mkdir dist - cp wheels-*/* dist/ - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - skip-existing: true +# release: +# name: Release +# runs-on: ubuntu-latest +# needs: [linux, musllinux, windows, macos, sdist] +# permissions: +# id-token: write +# contents: write +# attestations: write +# steps: +# - uses: actions/download-artifact@v4 +# - name: Generate artifact attestation +# uses: actions/attest-build-provenance@v2 +# with: +# subject-path: 'wheels-*/*' +# - run: | +# set -e +# mkdir dist +# cp wheels-*/* dist/ +# - name: Publish package distributions to PyPI +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# skip-existing: true From 69599ef4834f8abaf1c697290a3193ef40dfed91 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Sat, 4 Oct 2025 07:42:59 +0400 Subject: [PATCH 51/70] Use explicit Python versions for MacOS --- .github/workflows/CI.yml | 44 ++++++++++++++++++++-------------------- Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0d90dac..15badc5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -214,25 +214,25 @@ jobs: name: wheels-sdist path: dist -# release: -# name: Release -# runs-on: ubuntu-latest -# needs: [linux, musllinux, windows, macos, sdist] -# permissions: -# id-token: write -# contents: write -# attestations: write -# steps: -# - uses: actions/download-artifact@v4 -# - name: Generate artifact attestation -# uses: actions/attest-build-provenance@v2 -# with: -# subject-path: 'wheels-*/*' -# - run: | -# set -e -# mkdir dist -# cp wheels-*/* dist/ -# - name: Publish package distributions to PyPI -# uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# skip-existing: true + release: + name: Release + runs-on: ubuntu-latest + needs: [linux, musllinux, windows, macos, sdist] + permissions: + id-token: write + contents: write + attestations: write + steps: + - uses: actions/download-artifact@v4 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-path: 'wheels-*/*' + - run: | + set -e + mkdir dist + cp wheels-*/* dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true diff --git a/Cargo.toml b/Cargo.toml index c8fdbcb..7079e11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.7" +version = "0.3.8" edition = "2021" [lib] From 066e4c1f576cba761456c0a61e6cee529a19b5e1 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 13:49:45 +0400 Subject: [PATCH 52/70] Update lib version --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- rust-crypto-lib-base | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8925a48..a24e80c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -418,7 +418,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.3.7" +version = "0.4.0" dependencies = [ "cc", "pyo3", @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "rust-crypto-lib-base" -version = "0.1.0" +version = "0.2.0" dependencies = [ "hex", "num-bigint", diff --git a/Cargo.toml b/Cargo.toml index 7079e11..3ead6f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.3.8" +version = "0.4.0" edition = "2021" [lib] @@ -9,7 +9,7 @@ crate-type = ["cdylib"] [dependencies] pyo3 = { version = "0.22.6", features = ["gil-refs"] } -rust-crypto-lib-base = { version = "0.1.0", path = "./rust-crypto-lib-base" } +rust-crypto-lib-base = { version = "0.2.0", path = "./rust-crypto-lib-base" } starknet-crypto = "0.8.1" [build-dependencies] diff --git a/rust-crypto-lib-base b/rust-crypto-lib-base index edb3fa3..a3e500a 160000 --- a/rust-crypto-lib-base +++ b/rust-crypto-lib-base @@ -1 +1 @@ -Subproject commit edb3fa333ac7090ba76a624301e76b842c7399d2 +Subproject commit a3e500a35d33388c1ccb0ffdbf67906863e69008 From 8c30f4c5cbd9542a57daba139eb79142f4649932 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:17:07 +0400 Subject: [PATCH 53/70] debug dist --- .github/workflows/CI.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 15badc5..27a304c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -189,6 +189,9 @@ jobs: path: dist - name: pytest run: | + ls -al + la -al ./dist + set -e python3 -m venv .venv source .venv/bin/activate From 9b48c423c350cf7ea3fa683eaefc03800f4527d1 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:17:19 +0400 Subject: [PATCH 54/70] debug dist --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 27a304c..d997e8c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -190,7 +190,7 @@ jobs: - name: pytest run: | ls -al - la -al ./dist + ls -al ./dist set -e python3 -m venv .venv From 6e7287fba20c6d4d4c8c774e8569eab844323383 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:19:35 +0400 Subject: [PATCH 55/70] debug dist --- .github/workflows/CI.yml | 384 +++++++++++++++++++-------------------- 1 file changed, 192 insertions(+), 192 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d997e8c..f31bd30 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,159 +7,159 @@ permissions: contents: read jobs: - linux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-22.04 - target: x86_64 - manylinux: auto - - runner: ubuntu-22.04 - target: aarch64 - manylinux: "2_24" - steps: - - name: Checkout from GitHub - uses: actions/checkout@v4 - with: - submodules: 'true' - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: ${{ matrix.platform.manylinux }} - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-linux-${{ matrix.platform.target }} - path: dist - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} - shell: bash - run: | - set -e - python3 -m venv .venv - source .venv/bin/activate - pip install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip install pytest - pytest - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'aarch64') }} - uses: uraimo/run-on-arch-action@v2 - with: - arch: ${{ matrix.platform.target }} - distro: ubuntu22.04 - githubToken: ${{ github.token }} - install: | - apt-get update - apt-get install -y --no-install-recommends python3 python3-pip - pip3 install -U pip pytest - run: | - set -e - pip3 install fast-stark-crypto --no-index --find-links dist --force-reinstall - pytest - - musllinux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-22.04 - target: x86_64 - - runner: ubuntu-22.04 - target: aarch64 - steps: - - name: Checkout from GitHub - uses: actions/checkout@v4 - with: - submodules: 'true' - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: musllinux_1_2 - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-musllinux-${{ matrix.platform.target }} - path: dist - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} - uses: addnab/docker-run-action@v3 - with: - image: alpine:latest - options: -v ${{ github.workspace }}:/io -w /io - run: | - set -e - apk add py3-pip py3-virtualenv - python3 -m virtualenv .venv - source .venv/bin/activate - pip install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall - pip install pytest - pytest - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'aarch64') }} - uses: uraimo/run-on-arch-action@v2 - with: - arch: ${{ matrix.platform.target }} - distro: alpine_latest - githubToken: ${{ github.token }} - install: | - apk add py3-virtualenv - run: | - set -e - python3 -m virtualenv .venv - source .venv/bin/activate - pip install pytest - pip install fast-stark-crypto --no-index --find-links dist --force-reinstall - pytest - - windows: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: windows-latest - target: x64 - steps: - - name: Checkout from GitHub - uses: actions/checkout@v4 - with: - submodules: 'true' - - uses: actions/setup-python@v5 - with: - python-version: 3.x - architecture: ${{ matrix.platform.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-windows-${{ matrix.platform.target }} - path: dist - - name: pytest - shell: bash - run: | - set -e - python3 -m venv .venv - source .venv/Scripts/activate - pip install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip install pytest - pytest +# linux: +# runs-on: ${{ matrix.platform.runner }} +# strategy: +# matrix: +# platform: +# - runner: ubuntu-22.04 +# target: x86_64 +# manylinux: auto +# - runner: ubuntu-22.04 +# target: aarch64 +# manylinux: "2_24" +# steps: +# - name: Checkout from GitHub +# uses: actions/checkout@v4 +# with: +# submodules: 'true' +# - uses: actions/setup-python@v5 +# with: +# python-version: 3.x +# - name: Build wheels +# uses: PyO3/maturin-action@v1 +# with: +# target: ${{ matrix.platform.target }} +# args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 +# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} +# manylinux: ${{ matrix.platform.manylinux }} +# - name: Upload wheels +# uses: actions/upload-artifact@v4 +# with: +# name: wheels-linux-${{ matrix.platform.target }} +# path: dist +# - name: pytest +# if: ${{ startsWith(matrix.platform.target, 'x86_64') }} +# shell: bash +# run: | +# set -e +# python3 -m venv .venv +# source .venv/bin/activate +# pip install fast-stark-crypto --no-index --find-links dist --force-reinstall +# pip install pytest +# pytest +# - name: pytest +# if: ${{ startsWith(matrix.platform.target, 'aarch64') }} +# uses: uraimo/run-on-arch-action@v2 +# with: +# arch: ${{ matrix.platform.target }} +# distro: ubuntu22.04 +# githubToken: ${{ github.token }} +# install: | +# apt-get update +# apt-get install -y --no-install-recommends python3 python3-pip +# pip3 install -U pip pytest +# run: | +# set -e +# pip3 install fast-stark-crypto --no-index --find-links dist --force-reinstall +# pytest +# +# musllinux: +# runs-on: ${{ matrix.platform.runner }} +# strategy: +# matrix: +# platform: +# - runner: ubuntu-22.04 +# target: x86_64 +# - runner: ubuntu-22.04 +# target: aarch64 +# steps: +# - name: Checkout from GitHub +# uses: actions/checkout@v4 +# with: +# submodules: 'true' +# - uses: actions/setup-python@v5 +# with: +# python-version: 3.x +# - name: Build wheels +# uses: PyO3/maturin-action@v1 +# with: +# target: ${{ matrix.platform.target }} +# args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 +# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} +# manylinux: musllinux_1_2 +# - name: Upload wheels +# uses: actions/upload-artifact@v4 +# with: +# name: wheels-musllinux-${{ matrix.platform.target }} +# path: dist +# - name: pytest +# if: ${{ startsWith(matrix.platform.target, 'x86_64') }} +# uses: addnab/docker-run-action@v3 +# with: +# image: alpine:latest +# options: -v ${{ github.workspace }}:/io -w /io +# run: | +# set -e +# apk add py3-pip py3-virtualenv +# python3 -m virtualenv .venv +# source .venv/bin/activate +# pip install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall +# pip install pytest +# pytest +# - name: pytest +# if: ${{ startsWith(matrix.platform.target, 'aarch64') }} +# uses: uraimo/run-on-arch-action@v2 +# with: +# arch: ${{ matrix.platform.target }} +# distro: alpine_latest +# githubToken: ${{ github.token }} +# install: | +# apk add py3-virtualenv +# run: | +# set -e +# python3 -m virtualenv .venv +# source .venv/bin/activate +# pip install pytest +# pip install fast-stark-crypto --no-index --find-links dist --force-reinstall +# pytest +# +# windows: +# runs-on: ${{ matrix.platform.runner }} +# strategy: +# matrix: +# platform: +# - runner: windows-latest +# target: x64 +# steps: +# - name: Checkout from GitHub +# uses: actions/checkout@v4 +# with: +# submodules: 'true' +# - uses: actions/setup-python@v5 +# with: +# python-version: 3.x +# architecture: ${{ matrix.platform.target }} +# - name: Build wheels +# uses: PyO3/maturin-action@v1 +# with: +# target: ${{ matrix.platform.target }} +# args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 +# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} +# - name: Upload wheels +# uses: actions/upload-artifact@v4 +# with: +# name: wheels-windows-${{ matrix.platform.target }} +# path: dist +# - name: pytest +# shell: bash +# run: | +# set -e +# python3 -m venv .venv +# source .venv/Scripts/activate +# pip install fast-stark-crypto --no-index --find-links dist --force-reinstall +# pip install pytest +# pytest macos: runs-on: ${{ matrix.platform.runner }} @@ -199,43 +199,43 @@ jobs: pip install pytest pytest - sdist: - runs-on: ubuntu-latest - steps: - - name: Checkout from GitHub - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - command: sdist - args: --out dist - - name: Upload sdist - uses: actions/upload-artifact@v4 - with: - name: wheels-sdist - path: dist +# sdist: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout from GitHub +# uses: actions/checkout@v4 +# with: +# submodules: 'true' +# - name: Build sdist +# uses: PyO3/maturin-action@v1 +# with: +# command: sdist +# args: --out dist +# - name: Upload sdist +# uses: actions/upload-artifact@v4 +# with: +# name: wheels-sdist +# path: dist - release: - name: Release - runs-on: ubuntu-latest - needs: [linux, musllinux, windows, macos, sdist] - permissions: - id-token: write - contents: write - attestations: write - steps: - - uses: actions/download-artifact@v4 - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v2 - with: - subject-path: 'wheels-*/*' - - run: | - set -e - mkdir dist - cp wheels-*/* dist/ - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - skip-existing: true +# release: +# name: Release +# runs-on: ubuntu-latest +# needs: [linux, musllinux, windows, macos, sdist] +# permissions: +# id-token: write +# contents: write +# attestations: write +# steps: +# - uses: actions/download-artifact@v4 +# - name: Generate artifact attestation +# uses: actions/attest-build-provenance@v2 +# with: +# subject-path: 'wheels-*/*' +# - run: | +# set -e +# mkdir dist +# cp wheels-*/* dist/ +# - name: Publish package distributions to PyPI +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# skip-existing: true From 47ec4153672497d4cfdc2b0f8a8bce9c45f3eaa1 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:26:38 +0400 Subject: [PATCH 56/70] debug dist --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f31bd30..650cb7a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -195,7 +195,7 @@ jobs: set -e python3 -m venv .venv source .venv/bin/activate - pip install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall pip install pytest pytest From 3045707506083421c6f30ade4f818cf3fd1ce6f3 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:27:39 +0400 Subject: [PATCH 57/70] debug dist --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 650cb7a..e481755 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -196,6 +196,7 @@ jobs: python3 -m venv .venv source .venv/bin/activate pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall + pip install ./*.whl pip install pytest pytest From d4a90eb0b48afdf9ef10288c01824af05bcf06e4 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:32:03 +0400 Subject: [PATCH 58/70] debug dist --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e481755..7de81c4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -196,7 +196,7 @@ jobs: python3 -m venv .venv source .venv/bin/activate pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall - pip install ./*.whl + pip install ./dist/*cp313*.whl --no-index --force-reinstall pip install pytest pytest From 81c19473af361e21d15b80af195b487f8665e3bc Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:32:26 +0400 Subject: [PATCH 59/70] debug dist --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7de81c4..7fb1af6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -195,7 +195,7 @@ jobs: set -e python3 -m venv .venv source .venv/bin/activate - pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall + # pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall pip install ./dist/*cp313*.whl --no-index --force-reinstall pip install pytest pytest From 6ea59b821474cee94d139ca458a2d9b476a4fc00 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:42:57 +0400 Subject: [PATCH 60/70] debug dist --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7fb1af6..fd02c6d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -196,8 +196,8 @@ jobs: python3 -m venv .venv source .venv/bin/activate # pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall - pip install ./dist/*cp313*.whl --no-index --force-reinstall - pip install pytest + pip3 install ./dist/*cp313*.whl --no-index --force-reinstall + pip3 install pytest pytest # sdist: From 19b614ee950a7e37bd7f377adaa95d1de8f895c3 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:46:19 +0400 Subject: [PATCH 61/70] debug dist --- .github/workflows/CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fd02c6d..1d93795 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -189,10 +189,11 @@ jobs: path: dist - name: pytest run: | - ls -al ls -al ./dist set -e + python3 --version + pip3 --version python3 -m venv .venv source .venv/bin/activate # pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall From 561e4b543002bb5affa4ed0eea8a5e9cb525b337 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:55:04 +0400 Subject: [PATCH 62/70] debug dist --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1d93795..1dc80fe 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -180,7 +180,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 3.14 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels uses: actions/upload-artifact@v4 From d42810492e7458ce3e8f6bec2d792af405f9015d Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 17:56:46 +0400 Subject: [PATCH 63/70] debug dist --- .github/workflows/CI.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1dc80fe..837df1b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -180,7 +180,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 3.14 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels uses: actions/upload-artifact@v4 @@ -190,15 +190,14 @@ jobs: - name: pytest run: | ls -al ./dist - set -e - python3 --version - pip3 --version - python3 -m venv .venv + python3.13 --version + pip3.13 --version + python3.13 -m venv .venv source .venv/bin/activate # pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall - pip3 install ./dist/*cp313*.whl --no-index --force-reinstall - pip3 install pytest + pip3.13 install ./dist/*cp313*.whl --no-index --force-reinstall + pip3.13 install pytest pytest # sdist: From 863e6c16638151dc960603a3a259a966604e7006 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 18:04:05 +0400 Subject: [PATCH 64/70] debug dist --- .github/workflows/CI.yml | 353 ++++++++++++++++++++------------------- 1 file changed, 177 insertions(+), 176 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 837df1b..d43d409 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,164 +2,169 @@ name: Build, Test, and Release on: workflow_dispatch: + inputs: + pytest_python_version: + description: 'Python version for tests' + required: false + default: 3.13 permissions: contents: read jobs: -# linux: -# runs-on: ${{ matrix.platform.runner }} -# strategy: -# matrix: -# platform: -# - runner: ubuntu-22.04 -# target: x86_64 -# manylinux: auto -# - runner: ubuntu-22.04 -# target: aarch64 -# manylinux: "2_24" -# steps: -# - name: Checkout from GitHub -# uses: actions/checkout@v4 -# with: -# submodules: 'true' -# - uses: actions/setup-python@v5 -# with: -# python-version: 3.x -# - name: Build wheels -# uses: PyO3/maturin-action@v1 -# with: -# target: ${{ matrix.platform.target }} -# args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 -# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} -# manylinux: ${{ matrix.platform.manylinux }} -# - name: Upload wheels -# uses: actions/upload-artifact@v4 -# with: -# name: wheels-linux-${{ matrix.platform.target }} -# path: dist -# - name: pytest -# if: ${{ startsWith(matrix.platform.target, 'x86_64') }} -# shell: bash -# run: | -# set -e -# python3 -m venv .venv -# source .venv/bin/activate -# pip install fast-stark-crypto --no-index --find-links dist --force-reinstall -# pip install pytest -# pytest -# - name: pytest -# if: ${{ startsWith(matrix.platform.target, 'aarch64') }} -# uses: uraimo/run-on-arch-action@v2 -# with: -# arch: ${{ matrix.platform.target }} -# distro: ubuntu22.04 -# githubToken: ${{ github.token }} -# install: | -# apt-get update -# apt-get install -y --no-install-recommends python3 python3-pip -# pip3 install -U pip pytest -# run: | -# set -e -# pip3 install fast-stark-crypto --no-index --find-links dist --force-reinstall -# pytest -# -# musllinux: -# runs-on: ${{ matrix.platform.runner }} -# strategy: -# matrix: -# platform: -# - runner: ubuntu-22.04 -# target: x86_64 -# - runner: ubuntu-22.04 -# target: aarch64 -# steps: -# - name: Checkout from GitHub -# uses: actions/checkout@v4 -# with: -# submodules: 'true' -# - uses: actions/setup-python@v5 -# with: -# python-version: 3.x -# - name: Build wheels -# uses: PyO3/maturin-action@v1 -# with: -# target: ${{ matrix.platform.target }} -# args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 -# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} -# manylinux: musllinux_1_2 -# - name: Upload wheels -# uses: actions/upload-artifact@v4 -# with: -# name: wheels-musllinux-${{ matrix.platform.target }} -# path: dist -# - name: pytest -# if: ${{ startsWith(matrix.platform.target, 'x86_64') }} -# uses: addnab/docker-run-action@v3 -# with: -# image: alpine:latest -# options: -v ${{ github.workspace }}:/io -w /io -# run: | -# set -e -# apk add py3-pip py3-virtualenv -# python3 -m virtualenv .venv -# source .venv/bin/activate -# pip install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall -# pip install pytest -# pytest -# - name: pytest -# if: ${{ startsWith(matrix.platform.target, 'aarch64') }} -# uses: uraimo/run-on-arch-action@v2 -# with: -# arch: ${{ matrix.platform.target }} -# distro: alpine_latest -# githubToken: ${{ github.token }} -# install: | -# apk add py3-virtualenv -# run: | -# set -e -# python3 -m virtualenv .venv -# source .venv/bin/activate -# pip install pytest -# pip install fast-stark-crypto --no-index --find-links dist --force-reinstall -# pytest -# -# windows: -# runs-on: ${{ matrix.platform.runner }} -# strategy: -# matrix: -# platform: -# - runner: windows-latest -# target: x64 -# steps: -# - name: Checkout from GitHub -# uses: actions/checkout@v4 -# with: -# submodules: 'true' -# - uses: actions/setup-python@v5 -# with: -# python-version: 3.x -# architecture: ${{ matrix.platform.target }} -# - name: Build wheels -# uses: PyO3/maturin-action@v1 -# with: -# target: ${{ matrix.platform.target }} -# args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 -# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} -# - name: Upload wheels -# uses: actions/upload-artifact@v4 -# with: -# name: wheels-windows-${{ matrix.platform.target }} -# path: dist -# - name: pytest -# shell: bash -# run: | -# set -e -# python3 -m venv .venv -# source .venv/Scripts/activate -# pip install fast-stark-crypto --no-index --find-links dist --force-reinstall -# pip install pytest -# pytest + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + manylinux: auto + - runner: ubuntu-22.04 + target: aarch64 + manylinux: "2_24" + steps: + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + manylinux: ${{ matrix.platform.manylinux }} + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + shell: bash + run: | + set -e + python3.13 -m venv .venv + source .venv/bin/activate + pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip3.13 install pytest + pytest + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'aarch64') }} + uses: uraimo/run-on-arch-action@v2 + with: + arch: ${{ matrix.platform.target }} + distro: ubuntu22.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3.13 python3-pip + pip3.13 install -U pip3.13 pytest + run: | + set -e + pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall + pytest + + musllinux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: aarch64 + steps: + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + manylinux: musllinux_1_2 + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-musllinux-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + uses: addnab/docker-run-action@v3 + with: + image: alpine:latest + options: -v ${{ github.workspace }}:/io -w /io + run: | + set -e + apk add py3-pip3.13 py3-virtualenv + python3.13 -m virtualenv .venv + source .venv/bin/activate + pip3.13 install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall + pip3.13 install pytest + pytest + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'aarch64') }} + uses: uraimo/run-on-arch-action@v2 + with: + arch: ${{ matrix.platform.target }} + distro: alpine_latest + githubToken: ${{ github.token }} + install: | + apk add py3-virtualenv + run: | + set -e + python3.13 -m virtualenv .venv + source .venv/bin/activate + pip3.13 install pytest + pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall + pytest + + windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + steps: + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/setup-python@v5 + with: + python-version: 3.x + architecture: ${{ matrix.platform.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist + - name: pytest + shell: bash + run: | + set -e + python3.13 -m venv .venv + source .venv/Scripts/activate + pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip3.13 install pytest + pytest macos: runs-on: ${{ matrix.platform.runner }} @@ -189,34 +194,30 @@ jobs: path: dist - name: pytest run: | - ls -al ./dist set -e - python3.13 --version - pip3.13 --version - python3.13 -m venv .venv + python${{ pytest_python_version }} -m venv .venv source .venv/bin/activate - # pip install fast-stark-crypto --no-index --find-links ./dist --force-reinstall - pip3.13 install ./dist/*cp313*.whl --no-index --force-reinstall + pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall pip3.13 install pytest pytest -# sdist: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout from GitHub -# uses: actions/checkout@v4 -# with: -# submodules: 'true' -# - name: Build sdist -# uses: PyO3/maturin-action@v1 -# with: -# command: sdist -# args: --out dist -# - name: Upload sdist -# uses: actions/upload-artifact@v4 -# with: -# name: wheels-sdist -# path: dist + sdist: + runs-on: ubuntu-latest + steps: + - name: Checkout from GitHub + uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist # release: # name: Release From 9a12b068d9f11b55dce1d105dcce265075971703 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 18:05:10 +0400 Subject: [PATCH 65/70] debug dist --- .github/workflows/CI.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d43d409..1e815af 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,10 +48,10 @@ jobs: shell: bash run: | set -e - python3.13 -m venv .venv + python${{ pytest_python_version }} -m venv .venv source .venv/bin/activate - pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip3.13 install pytest + pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ pytest_python_version }} install pytest pytest - name: pytest if: ${{ startsWith(matrix.platform.target, 'aarch64') }} @@ -62,11 +62,11 @@ jobs: githubToken: ${{ github.token }} install: | apt-get update - apt-get install -y --no-install-recommends python3.13 python3-pip - pip3.13 install -U pip3.13 pytest + apt-get install -y --no-install-recommends python${{ pytest_python_version }} python3-pip + pip${{ pytest_python_version }} install -U pip${{ pytest_python_version }} pytest run: | set -e - pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest musllinux: @@ -106,11 +106,11 @@ jobs: options: -v ${{ github.workspace }}:/io -w /io run: | set -e - apk add py3-pip3.13 py3-virtualenv - python3.13 -m virtualenv .venv + apk add py3-pip${{ pytest_python_version }} py3-virtualenv + python${{ pytest_python_version }} -m virtualenv .venv source .venv/bin/activate - pip3.13 install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall - pip3.13 install pytest + pip${{ pytest_python_version }} install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall + pip${{ pytest_python_version }} install pytest pytest - name: pytest if: ${{ startsWith(matrix.platform.target, 'aarch64') }} @@ -123,10 +123,10 @@ jobs: apk add py3-virtualenv run: | set -e - python3.13 -m virtualenv .venv + python${{ pytest_python_version }} -m virtualenv .venv source .venv/bin/activate - pip3.13 install pytest - pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ pytest_python_version }} install pytest + pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest windows: @@ -160,10 +160,10 @@ jobs: shell: bash run: | set -e - python3.13 -m venv .venv + python${{ pytest_python_version }} -m venv .venv source .venv/Scripts/activate - pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip3.13 install pytest + pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ pytest_python_version }} install pytest pytest macos: @@ -197,8 +197,8 @@ jobs: set -e python${{ pytest_python_version }} -m venv .venv source .venv/bin/activate - pip3.13 install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip3.13 install pytest + pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ pytest_python_version }} install pytest pytest sdist: From bcd713be02dfaad83eb06a3eed079b3f389be0cc Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 18:07:19 +0400 Subject: [PATCH 66/70] debug dist --- .github/workflows/CI.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1e815af..126715f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,10 +48,10 @@ jobs: shell: bash run: | set -e - python${{ pytest_python_version }} -m venv .venv + python${{ inputs.pytest_python_version }} -m venv .venv source .venv/bin/activate - pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip${{ pytest_python_version }} install pytest + pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ inputs.pytest_python_version }} install pytest pytest - name: pytest if: ${{ startsWith(matrix.platform.target, 'aarch64') }} @@ -62,11 +62,11 @@ jobs: githubToken: ${{ github.token }} install: | apt-get update - apt-get install -y --no-install-recommends python${{ pytest_python_version }} python3-pip - pip${{ pytest_python_version }} install -U pip${{ pytest_python_version }} pytest + apt-get install -y --no-install-recommends python${{ inputs.pytest_python_version }} python3-pip + pip${{ inputs.pytest_python_version }} install -U pip${{ inputs.pytest_python_version }} pytest run: | set -e - pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest musllinux: @@ -106,11 +106,11 @@ jobs: options: -v ${{ github.workspace }}:/io -w /io run: | set -e - apk add py3-pip${{ pytest_python_version }} py3-virtualenv - python${{ pytest_python_version }} -m virtualenv .venv + apk add py3-pip${{ inputs.pytest_python_version }} py3-virtualenv + python${{ inputs.pytest_python_version }} -m virtualenv .venv source .venv/bin/activate - pip${{ pytest_python_version }} install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall - pip${{ pytest_python_version }} install pytest + pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall + pip${{ inputs.pytest_python_version }} install pytest pytest - name: pytest if: ${{ startsWith(matrix.platform.target, 'aarch64') }} @@ -123,10 +123,10 @@ jobs: apk add py3-virtualenv run: | set -e - python${{ pytest_python_version }} -m virtualenv .venv + python${{ inputs.pytest_python_version }} -m virtualenv .venv source .venv/bin/activate - pip${{ pytest_python_version }} install pytest - pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ inputs.pytest_python_version }} install pytest + pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest windows: @@ -160,10 +160,10 @@ jobs: shell: bash run: | set -e - python${{ pytest_python_version }} -m venv .venv + python${{ inputs.pytest_python_version }} -m venv .venv source .venv/Scripts/activate - pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip${{ pytest_python_version }} install pytest + pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ inputs.pytest_python_version }} install pytest pytest macos: @@ -195,10 +195,10 @@ jobs: - name: pytest run: | set -e - python${{ pytest_python_version }} -m venv .venv + python${{ inputs.pytest_python_version }} -m venv .venv source .venv/bin/activate - pip${{ pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip${{ pytest_python_version }} install pytest + pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip${{ inputs.pytest_python_version }} install pytest pytest sdist: From a88241d3ba14f21151f290d059dc8084e66d11f9 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 19:49:06 +0400 Subject: [PATCH 67/70] debug dist --- .github/workflows/CI.yml | 53 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 126715f..6e9047c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,11 +2,6 @@ name: Build, Test, and Release on: workflow_dispatch: - inputs: - pytest_python_version: - description: 'Python version for tests' - required: false - default: 3.13 permissions: contents: read @@ -30,7 +25,7 @@ jobs: submodules: 'true' - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: '>=3.9 <3.14' - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -48,10 +43,10 @@ jobs: shell: bash run: | set -e - python${{ inputs.pytest_python_version }} -m venv .venv + python3 -m venv .venv source .venv/bin/activate - pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip${{ inputs.pytest_python_version }} install pytest + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install pytest pytest - name: pytest if: ${{ startsWith(matrix.platform.target, 'aarch64') }} @@ -62,11 +57,11 @@ jobs: githubToken: ${{ github.token }} install: | apt-get update - apt-get install -y --no-install-recommends python${{ inputs.pytest_python_version }} python3-pip - pip${{ inputs.pytest_python_version }} install -U pip${{ inputs.pytest_python_version }} pytest + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip pytest run: | set -e - pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip3 install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest musllinux: @@ -85,7 +80,7 @@ jobs: submodules: 'true' - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: '>=3.9 <3.14' - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -106,11 +101,11 @@ jobs: options: -v ${{ github.workspace }}:/io -w /io run: | set -e - apk add py3-pip${{ inputs.pytest_python_version }} py3-virtualenv - python${{ inputs.pytest_python_version }} -m virtualenv .venv + apk add py3-pip py3-virtualenv + python3 -m virtualenv .venv source .venv/bin/activate - pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall - pip${{ inputs.pytest_python_version }} install pytest + pip install fast-stark-crypto --no-index --no-index --find-links dist --force-reinstall + pip install pytest pytest - name: pytest if: ${{ startsWith(matrix.platform.target, 'aarch64') }} @@ -123,10 +118,10 @@ jobs: apk add py3-virtualenv run: | set -e - python${{ inputs.pytest_python_version }} -m virtualenv .venv + python3 -m virtualenv .venv source .venv/bin/activate - pip${{ inputs.pytest_python_version }} install pytest - pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install pytest + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall pytest windows: @@ -143,7 +138,7 @@ jobs: submodules: 'true' - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: '>=3.9 <3.14' architecture: ${{ matrix.platform.target }} - name: Build wheels uses: PyO3/maturin-action@v1 @@ -160,10 +155,10 @@ jobs: shell: bash run: | set -e - python${{ inputs.pytest_python_version }} -m venv .venv + python3 -m venv .venv source .venv/Scripts/activate - pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip${{ inputs.pytest_python_version }} install pytest + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install pytest pytest macos: @@ -180,7 +175,7 @@ jobs: submodules: 'true' - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: '>=3.9 <3.14' - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -195,10 +190,10 @@ jobs: - name: pytest run: | set -e - python${{ inputs.pytest_python_version }} -m venv .venv + python3 -m venv .venv source .venv/bin/activate - pip${{ inputs.pytest_python_version }} install fast-stark-crypto --no-index --find-links dist --force-reinstall - pip${{ inputs.pytest_python_version }} install pytest + pip install fast-stark-crypto --no-index --find-links dist --force-reinstall + pip install pytest pytest sdist: @@ -240,4 +235,4 @@ jobs: # - name: Publish package distributions to PyPI # uses: pypa/gh-action-pypi-publish@release/v1 # with: -# skip-existing: true +# skip-existing: true From dfd733fbc0fd49565a4fc2829d9530f27cc64ca4 Mon Sep 17 00:00:00 2001 From: alex101xela Date: Tue, 11 Nov 2025 19:54:23 +0400 Subject: [PATCH 68/70] debug dist --- .github/workflows/CI.yml | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6e9047c..76c0e38 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -214,25 +214,25 @@ jobs: name: wheels-sdist path: dist -# release: -# name: Release -# runs-on: ubuntu-latest -# needs: [linux, musllinux, windows, macos, sdist] -# permissions: -# id-token: write -# contents: write -# attestations: write -# steps: -# - uses: actions/download-artifact@v4 -# - name: Generate artifact attestation -# uses: actions/attest-build-provenance@v2 -# with: -# subject-path: 'wheels-*/*' -# - run: | -# set -e -# mkdir dist -# cp wheels-*/* dist/ -# - name: Publish package distributions to PyPI -# uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# skip-existing: true + release: + name: Release + runs-on: ubuntu-latest + needs: [linux, musllinux, windows, macos, sdist] + permissions: + id-token: write + contents: write + attestations: write + steps: + - uses: actions/download-artifact@v4 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-path: 'wheels-*/*' + - run: | + set -e + mkdir dist + cp wheels-*/* dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true From 4a9a682f0233bf03baeadfe3c88578b0056227b6 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 19 Nov 2025 11:09:22 +0000 Subject: [PATCH 69/70] add support for limit orders --- python/fast_stark_crypto/lib.py | 38 ++++++ src/lib.rs | 112 ++++++++++++++++++ .../test_limit_order_msg_rust_integration.py | 26 ++++ 3 files changed, 176 insertions(+) create mode 100644 tests/test_limit_order_msg_rust_integration.py diff --git a/python/fast_stark_crypto/lib.py b/python/fast_stark_crypto/lib.py index 66cbdc9..03ee7fc 100644 --- a/python/fast_stark_crypto/lib.py +++ b/python/fast_stark_crypto/lib.py @@ -5,9 +5,47 @@ rs_verify_signature, rs_get_order_msg, rs_get_transfer_msg, + rs_get_limit_order_msg, rs_generate_keypair_from_eth_signature, rs_get_withdrawal_hash, ) +def get_limit_order_msg_hash( + source_position_id: int, + receive_position_id: int, + base_asset_id: int, + base_amount: int, + quote_asset_id: int, + quote_amount: int, + fee_asset_id: int, + fee_amount: int, + expiration: int, + salt: int, + user_public_key: int, + domain_name: str, + domain_version: str, + domain_chain_id: str, + domain_revision: str, +) -> int: + return int( + rs_get_limit_order_msg( + str(source_position_id), + str(receive_position_id), + hex(base_asset_id), + str(base_amount), + hex(quote_asset_id), + str(quote_amount), + hex(fee_asset_id), + str(fee_amount), + str(expiration), + str(salt), + hex(user_public_key), + domain_name, + domain_version, + domain_chain_id, + domain_revision, + ), + 16, + ) def get_public_key(private_key: int) -> int: diff --git a/src/lib.rs b/src/lib.rs index 619733d..0c9b54a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -256,6 +256,117 @@ fn rs_get_order_msg( }) } +#[pyfunction] +fn rs_get_limit_order_msg( + py: Python, + source_position_id: String, + receive_position_id: String, + base_asset_id_hex: String, + base_amount: String, + quote_asset_id_hex: String, + quote_amount: String, + fee_asset_id_hex: String, + fee_amount: String, + expiration: String, + salt: String, + user_public_key_hex: String, + domain_name: String, + domain_version: String, + domain_chain_id: String, + domain_revision: String, +) -> PyResult { + py.allow_threads(move || { + // Convert hex fields + let base_asset_id = Felt::from_hex(&base_asset_id_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid base_asset_id_hex: {}", + e + )) + })?; + let quote_asset_id = Felt::from_hex("e_asset_id_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid quote_asset_id_hex: {}", + e + )) + })?; + let fee_asset_id = Felt::from_hex(&fee_asset_id_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid fee_asset_id_hex: {}", + e + )) + })?; + let user_key = Felt::from_hex(&user_public_key_hex).map_err(|e| { + PyErr::new::(format!( + "Invalid user_public_key_hex: {}", + e + )) + })?; + + // Convert decimal fields + let source_position_id = u32::from_str_radix(&source_position_id, 10).map_err(|e| { + PyErr::new::(format!("Invalid source_position_id: {}", e)) + })?; + let receive_position_id = u32::from_str_radix(&receive_position_id, 10).map_err(|e| { + PyErr::new::(format!("Invalid receive_position_id: {}", e)) + })?; + let base_amount = i64::from_str_radix(&base_amount, 10).map_err(|e| { + PyErr::new::(format!("Invalid base_amount: {}", e)) + })?; + let quote_amount = i64::from_str_radix("e_amount, 10).map_err(|e| { + PyErr::new::(format!("Invalid quote_amount: {}", e)) + })?; + let fee_amount = u64::from_str_radix(&fee_amount, 10).map_err(|e| { + PyErr::new::(format!("Invalid fee_amount: {}", e)) + })?; + let expiration = u64::from_str_radix(&expiration, 10).map_err(|e| { + PyErr::new::(format!("Invalid expiration: {}", e)) + })?; + let salt = u64::from_str_radix(&salt, 10).map_err(|e| { + PyErr::new::(format!("Invalid salt: {}", e)) + })?; + + // Construct limit order and domain + let limit_order = rust_crypto_lib_base::starknet_messages::LimitOrder { + source_position: PositionId { value: source_position_id }, + receive_position: PositionId { value: receive_position_id }, + base_asset_id: AssetId { value: base_asset_id }, + base_amount, + quote_asset_id: AssetId { value: quote_asset_id }, + quote_amount, + fee_asset_id: AssetId { value: fee_asset_id }, + fee_amount, + expiration: Timestamp { seconds: expiration }, + salt: salt.try_into().map_err(|e| { + PyErr::new::(format!( + "Invalid salt conversion: {}", + e + )) + })?, + }; + let domain = StarknetDomain { + name: domain_name, + version: domain_version, + chain_id: domain_chain_id, + revision: u32::from_str_radix(&domain_revision, 10).map_err(|e| { + PyErr::new::(format!( + "Invalid domain_revision: {}", + e + )) + })?, + }; + + // Compute message hash + let message = limit_order.message_hash(&domain, user_key).map_err(|e| { + PyErr::new::(format!( + "Failed to compute message hash: {}", + e + )) + })?; + Ok(message.to_hex_string()) + }) +} + + #[pyfunction] fn rs_get_withdrawal_hash( recipient_hex: String, @@ -310,6 +421,7 @@ fn fast_stark_crypto(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(rs_verify_signature, m)?)?; m.add_function(wrap_pyfunction!(rs_get_order_msg, m)?)?; m.add_function(wrap_pyfunction!(rs_get_transfer_msg, m)?)?; + m.add_function(wrap_pyfunction!(rs_get_limit_order_msg, m)?)?; m.add_function(wrap_pyfunction!(rs_generate_keypair_from_eth_signature, m)?)?; m.add_function(wrap_pyfunction!(rs_get_withdrawal_hash, m)?)?; Ok(()) diff --git a/tests/test_limit_order_msg_rust_integration.py b/tests/test_limit_order_msg_rust_integration.py new file mode 100644 index 0000000..545cae2 --- /dev/null +++ b/tests/test_limit_order_msg_rust_integration.py @@ -0,0 +1,26 @@ +from fast_stark_crypto.lib import get_limit_order_msg_hash + + +def test_limit_order_msg_hash(): + expected_hash = int( + "0x396b726a20930d4b4e1a15d3a96aaf3952d788d324a68e1ef06999e7c0fcc97", 16) + + result = get_limit_order_msg_hash( + source_position_id=1, + receive_position_id=2, + base_asset_id=2, + base_amount=3, + quote_asset_id=4, + quote_amount=5, + fee_asset_id=6, + fee_amount=7, + expiration=8, + salt=9, + user_public_key=int( + "0x5d05989e9302dcebc74e241001e3e3ac3f4402ccf2f8e6f74b034b07ad6a904", 16), + domain_name="Perpetuals", + domain_version="v0", + domain_chain_id="SN_SEPOLIA", + domain_revision="1", + ) + assert result == expected_hash, f"Expected {hex(expected_hash)}, got {hex(result)}" From 6a46934da678d24b8cae06c0e27c74f7ae661ee4 Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 19 Nov 2025 14:51:45 +0000 Subject: [PATCH 70/70] bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a24e80c..b6acca0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -418,7 +418,7 @@ dependencies = [ [[package]] name = "fast-stark-crypto" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 3ead6f2..7cc996a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-stark-crypto" -version = "0.4.0" +version = "0.5.0" edition = "2021" [lib]