From 5b8b67ab9f80260445c5e89fd71864dddaae3dad Mon Sep 17 00:00:00 2001 From: "Lucas @ StarkWare" <70894690+LucasLvy@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:56:29 +0100 Subject: [PATCH] Wasm compatibility (#7) * make code wasm-compatible Note: only the main code compiles, not the tests yet * fix tests, use standard Felts * update readme * fix dependencies * chore(trie): make it fully wasm compatible * chore(logs): add logs back * chore(proof): add wasm compat * fix: resoluve review * fix suggestions * impl suggestions --------- Co-authored-by: Damir Vodenicarevic --- .github/workflows/check_lint.yml | 77 +- .github/workflows/test.yml | 1 + .gitignore | 3 +- Cargo.lock | 4970 ----------------------------- Cargo.toml | 52 +- README.md | 17 +- ensure_no_std/.cargo/config.toml | 2 + ensure_no_std/Cargo.lock | 537 ++++ ensure_no_std/Cargo.toml | 15 + ensure_no_std/rust-toolchain.toml | 4 + ensure_no_std/src/main.rs | 21 + rust-toolchain.toml | 4 + src/bonsai_database.rs | 14 +- src/changes.rs | 12 +- src/databases/hashmap_db.rs | 41 +- src/databases/mod.rs | 1 + src/databases/rocks_db.rs | 2 +- src/error.rs | 2 + src/id.rs | 4 +- src/key_value_db.rs | 12 +- src/lib.rs | 76 +- src/tests/madara_comparison.rs | 9 +- src/tests/proof.rs | 58 +- src/tests/simple.rs | 11 +- src/tests/transactional_state.rs | 57 +- src/tests/trie_log.rs | 31 +- src/trie/merkle_node.rs | 16 +- src/trie/merkle_tree.rs | 511 +-- src/trie/trie_db.rs | 2 + 29 files changed, 1126 insertions(+), 5436 deletions(-) delete mode 100644 Cargo.lock create mode 100644 ensure_no_std/.cargo/config.toml create mode 100644 ensure_no_std/Cargo.lock create mode 100644 ensure_no_std/Cargo.toml create mode 100644 ensure_no_std/rust-toolchain.toml create mode 100644 ensure_no_std/src/main.rs create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/check_lint.yml b/.github/workflows/check_lint.yml index 7500a11..f95f00b 100644 --- a/.github/workflows/check_lint.yml +++ b/.github/workflows/check_lint.yml @@ -5,51 +5,56 @@ on: - oss -name: Check and Lint +name: Check and Lint and no-std jobs: - check: - name: Check + build-no-std: + name: Build no-std runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: check - + - uses: actions/checkout@v3 + - name: Install rust + working-directory: ./ensure_no_std + run: rustup show + - name: Build no-std + run: cargo build + fmt: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - uses: actions/checkout@v3 + - name: Install rust + run: rustup show + - name: Check format + run: cargo fmt --check --all + + clippy-all-features: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install rust + run: rustup show + - name: Clippy all features + run: cargo clippy --all-features + + clippy-default-features: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install rust + run: rustup show + - name: Clippy default features + run: cargo clippy - clippy: + clippy-no-std: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy - override: true - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features - name: Clippy Output \ No newline at end of file + - uses: actions/checkout@v3 + - name: Install rust + run: rustup show + - name: Clippy no-std + run: cargo clippy --no-default-features diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2265daa..251c4dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,7 @@ jobs: tree; zip -0 ccov.zip `find . \( -name "$PROJECT_NAME_UNDERSCORE*.gc*" \) -print`; grcov ccov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" --ignore "tests/*" -o lcov.info; + cargo test $CARGO_OPTIONS --no-default-features - name: Upload test results uses: EnricoMi/publish-unit-test-result-action@v1 with: diff --git a/.gitignore b/.gitignore index b1dec57..baa0341 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ rocksdb/ .vscode/ -documentation/node_modules/ \ No newline at end of file +documentation/node_modules/ +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 1a1ef0a..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,4970 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli 0.27.3", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli 0.28.1", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" -dependencies = [ - "getrandom 0.2.11", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "ark-bls12-377" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-std", -] - -[[package]] -name = "ark-bls12-381" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-serialize", - "ark-std", -] - -[[package]] -name = "ark-ec" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" -dependencies = [ - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.13.2", - "itertools", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ed-on-bls12-381-bandersnatch" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cde0f2aa063a2a5c28d39b47761aa102bda7c13c84fc118a61b87c7b2f785c" -dependencies = [ - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-std", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "derivative", - "digest 0.10.7", - "itertools", - "num-bigint", - "num-traits", - "paste", - "rustc_version", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-poly" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.13.2", -] - -[[package]] -name = "ark-scale" -version = "0.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bd73bb6ddb72630987d37fa963e99196896c0d0ea81b7c894567e74a2f83af" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-serialize", - "ark-std", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "ark-secp256k1" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02e954eaeb4ddb29613fee20840c2bbc85ca4396d53e33837e11905363c5f2" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-std", -] - -[[package]] -name = "ark-secret-scalar" -version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-serialize", - "ark-std", - "ark-transcript", - "digest 0.10.7", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-serialize-derive", - "ark-std", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "ark-transcript" -version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "digest 0.10.7", - "rand_core 0.6.4", - "sha3", -] - -[[package]] -name = "array-bytes" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "async-trait" -version = "0.1.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line 0.21.0", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object 0.32.1", - "rustc-demangle", -] - -[[package]] -name = "bandersnatch_vrfs" -version = "0.0.1" -source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" -dependencies = [ - "ark-bls12-381", - "ark-ec", - "ark-ed-on-bls12-381-bandersnatch", - "ark-ff", - "ark-serialize", - "ark-std", - "dleq_vrf", - "fflonk", - "merlin 3.0.0", - "rand_chacha 0.3.1", - "rand_core 0.6.4", - "ring", - "sha2 0.10.8", - "zeroize", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" - -[[package]] -name = "bigdecimal" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", - "serde", -] - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bincode" -version = "2.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11ea1a0346b94ef188834a65c068a03aec181c94896d481d7a0a40d85b0ce95" -dependencies = [ - "bincode_derive", - "serde", -] - -[[package]] -name = "bincode" -version = "2.0.0-rc.3" -source = "git+https://github.com/bincode-org/bincode.git?tag=v2.0.0-rc.3#aada4bb4cb457677a4b8e47572ae7ca8dd44927c" -dependencies = [ - "serde", -] - -[[package]] -name = "bincode_derive" -version = "2.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e30759b3b99a1b802a7a3aa21c85c3ded5c28e1c83170d82d70f08bbf7f3e4c" -dependencies = [ - "virtue", -] - -[[package]] -name = "bindgen" -version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.40", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - -[[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 = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "blake2b_simd" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "constant_time_eq", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "blockifier" -version = "0.1.0-rc2" -source = "git+https://github.com/keep-starknet-strange/blockifier?branch=no_std-support-7578442#e7a85edd7078eb25f3f56d82d45be56d617ccc85" -dependencies = [ - "ark-ff", - "ark-secp256k1", - "cached", - "cairo-felt", - "cairo-lang-casm", - "cairo-lang-casm-contract-class", - "cairo-lang-utils", - "cairo-lang-vm-utils", - "cairo-vm", - "derive_more", - "hashbrown 0.14.3", - "indexmap 2.0.0-pre", - "itertools", - "keccak", - "lazy_static", - "log", - "num-bigint", - "num-integer", - "num-traits", - "parity-scale-codec", - "phf", - "scale-info", - "serde", - "serde_json", - "sha3", - "sp-arithmetic", - "spin 0.9.8", - "starknet-crypto", - "starknet_api", - "strum", - "strum_macros", - "thiserror-no-std", -] - -[[package]] -name = "bonsai-trie" -version = "0.1.0" -dependencies = [ - "bincode 1.3.3", - "bitvec", - "derive_more", - "env_logger", - "log", - "lru 0.12.1", - "mp-commitments", - "mp-felt", - "mp-hashers", - "parity-scale-codec", - "parking_lot", - "pathfinder-common", - "pathfinder-crypto", - "pathfinder-merkle-tree", - "pathfinder-storage", - "rand 0.8.5", - "rocksdb", - "rustc-hex", - "serde", - "smallvec", - "tempfile", -] - -[[package]] -name = "bounded-collections" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" -dependencies = [ - "log", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "bs58" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "cached" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b195e4fbc4b6862bbd065b991a34750399c119797efff72492f28a5864de8700" -dependencies = [ - "hashbrown 0.13.2", - "instant", - "once_cell", - "thiserror", -] - -[[package]] -name = "cairo-felt" -version = "0.8.5" -source = "git+https://github.com/keep-starknet-strange/cairo-rs?branch=no_std-support-21eff70#53dfed63ce010e9de8fb39e31f96b3034682762d" -dependencies = [ - "lazy_static", - "num-bigint", - "num-integer", - "num-traits", - "parity-scale-codec", - "serde", -] - -[[package]] -name = "cairo-lang-casm" -version = "2.1.0" -source = "git+https://github.com/keep-starknet-strange/cairo.git?branch=no_std-support-8bbf530#f8b5fe438e0d201b7d1afb39c21d343ff95b5850" -dependencies = [ - "cairo-lang-utils", - "hashbrown 0.14.3", - "indoc", - "num-bigint", - "num-traits", - "parity-scale-codec", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "cairo-lang-casm-contract-class" -version = "2.1.0" -source = "git+https://github.com/keep-starknet-strange/cairo.git?branch=no_std-support-8bbf530#f8b5fe438e0d201b7d1afb39c21d343ff95b5850" -dependencies = [ - "cairo-lang-casm", - "cairo-lang-utils", - "itertools", - "num-bigint", - "serde", -] - -[[package]] -name = "cairo-lang-utils" -version = "2.1.0" -source = "git+https://github.com/keep-starknet-strange/cairo.git?branch=no_std-support-8bbf530#f8b5fe438e0d201b7d1afb39c21d343ff95b5850" -dependencies = [ - "cairo-felt", - "hashbrown 0.14.3", - "indexmap 2.0.0-pre", - "itertools", - "num-bigint", - "num-integer", - "num-traits", - "parity-scale-codec", - "serde", -] - -[[package]] -name = "cairo-lang-vm-utils" -version = "2.1.0" -source = "git+https://github.com/keep-starknet-strange/cairo.git?branch=no_std-support-8bbf530#f8b5fe438e0d201b7d1afb39c21d343ff95b5850" -dependencies = [ - "ark-ff", - "ark-std", - "cairo-felt", - "cairo-lang-casm", - "cairo-lang-utils", - "cairo-vm", - "hashbrown 0.14.3", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "cairo-take_until_unbalanced" -version = "0.29.0" -source = "git+https://github.com/keep-starknet-strange/cairo-rs?branch=no_std-support-21eff70#53dfed63ce010e9de8fb39e31f96b3034682762d" -dependencies = [ - "nom", -] - -[[package]] -name = "cairo-vm" -version = "0.8.5" -source = "git+https://github.com/keep-starknet-strange/cairo-rs?branch=no_std-support-21eff70#53dfed63ce010e9de8fb39e31f96b3034682762d" -dependencies = [ - "anyhow", - "ark-ff", - "ark-std", - "bincode 2.0.0-rc.3 (git+https://github.com/bincode-org/bincode.git?tag=v2.0.0-rc.3)", - "bitvec", - "cairo-felt", - "cairo-lang-casm", - "cairo-lang-casm-contract-class", - "cairo-take_until_unbalanced", - "generic-array 0.14.7", - "hashbrown 0.14.3", - "hex", - "keccak", - "lazy_static", - "nom", - "num-bigint", - "num-integer", - "num-prime", - "num-traits", - "parity-scale-codec", - "rand 0.8.5", - "serde", - "serde_json", - "sha2 0.10.8", - "sha3", - "starknet-crypto", - "thiserror-no-std", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "serde", - "windows-targets 0.48.5", -] - -[[package]] -name = "clang-sys" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "common" -version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof#b273d33f9981e2bb3375ab45faeb537f7ee35224" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "fflonk", - "getrandom_or_panic", - "merlin 3.0.0", - "rand_chacha 0.3.1", -] - -[[package]] -name = "const-decoder" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5241cd7938b1b415942e943ea96f615953d500b50347b505b0b507080bad5a6f" - -[[package]] -name = "const_format" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - -[[package]] -name = "constcat" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[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.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "cpufeatures" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-entity" -version = "0.95.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" -dependencies = [ - "serde", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array 0.14.7", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array 0.14.7", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.40", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "data-encoding" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" - -[[package]] -name = "deranged" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" -dependencies = [ - "powerfmt", - "serde", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", -] - -[[package]] -name = "deunicode" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae2a35373c5c74340b79ae6780b498b2b183915ec5dacf263aac5a099bf485a" - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "crypto-common", - "subtle", -] - -[[package]] -name = "dleq_vrf" -version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-scale", - "ark-secret-scalar", - "ark-serialize", - "ark-std", - "ark-transcript", - "arrayvec 0.7.4", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "dummy" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e57e12b69e57fad516e01e2b3960f122696fdb13420e1a88ed8e210316f2876" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "dyn-clonable" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" -dependencies = [ - "dyn-clonable-impl", - "dyn-clone", -] - -[[package]] -name = "dyn-clonable-impl" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dyn-clone" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" - -[[package]] -name = "ed25519-zebra" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" -dependencies = [ - "curve25519-dalek 3.2.0", - "hashbrown 0.12.3", - "hex", - "rand_core 0.6.4", - "sha2 0.9.9", - "zeroize", -] - -[[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.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "env_logger" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "environmental" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fake" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26221445034074d46b276e13eb97a265ebdb8ed8da705c4dddd3dd20b66b45d2" -dependencies = [ - "deunicode", - "dummy", - "rand 0.8.5", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "fflonk" -version = "0.1.0" -source = "git+https://github.com/w3f/fflonk#1e854f35e9a65d08b11a86291405cdc95baa0a35" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "merlin 3.0.0", -] - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -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 = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[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" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" - -[[package]] -name = "futures-executor" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" - -[[package]] -name = "futures-macro" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "futures-sink" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" - -[[package]] -name = "futures-task" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - -[[package]] -name = "futures-util" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom_or_panic" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" -dependencies = [ - "rand_core 0.6.4", -] - -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" -dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "h2" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hash-db" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" - -[[package]] -name = "hash256-std-hasher" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" -dependencies = [ - "crunchy", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.7", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.6", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -dependencies = [ - "ahash 0.8.6", - "allocator-api2", - "serde", -] - -[[package]] -name = "hashlink" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" -dependencies = [ - "hashbrown 0.14.3", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "http" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.10", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "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 = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[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-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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[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.0.0-pre" -source = "git+https://github.com/bluss/indexmap?rev=ca5f848e10c31e80aeaad0720d14aa2f6dd6cfb1#ca5f848e10c31e80aeaad0720d14aa2f6dd6cfb1" -dependencies = [ - "hashbrown 0.13.2", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", - "serde", -] - -[[package]] -name = "indoc" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "integer-sqrt" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" -dependencies = [ - "num-traits", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix 0.38.28", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "keccak-hash" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c" -dependencies = [ - "primitive-types", - "tiny-keccak", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin 0.5.2", -] - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.151" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "librocksdb-sys" -version = "0.11.0+8.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" -dependencies = [ - "bindgen", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", - "lz4-sys", - "zstd-sys", -] - -[[package]] -name = "libsecp256k1" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" -dependencies = [ - "arrayref", - "base64 0.13.1", - "digest 0.9.0", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.8.5", - "serde", - "sha2 0.9.9", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsqlite3-sys" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - -[[package]] -name = "linux-raw-sys" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown 0.12.3", -] - -[[package]] -name = "lru" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" -dependencies = [ - "hashbrown 0.14.3", -] - -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "matchers" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix 0.38.28", -] - -[[package]] -name = "memoffset" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" -dependencies = [ - "autocfg", -] - -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "merlin" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "metrics" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b9b8653cec6897f73b519a43fba5ee3d50f62fe9af80b428accdcc093b4a849" -dependencies = [ - "ahash 0.7.7", - "metrics-macros", - "portable-atomic 0.3.20", -] - -[[package]] -name = "metrics-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "731f8ecebd9f3a4aa847dfe75455e4757a45da40a7793d2f0b1f9b6ed18b23f3" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "mp-commitments" -version = "0.6.0" -source = "git+https://github.com/keep-starknet-strange/madara.git?rev=f30acea8af7e28e956e771928130e12bfc084832#f30acea8af7e28e956e771928130e12bfc084832" -dependencies = [ - "bitvec", - "derive_more", - "mp-felt", - "mp-hashers", - "mp-transactions", - "starknet-crypto", - "starknet_api", -] - -[[package]] -name = "mp-fee" -version = "0.6.0" -source = "git+https://github.com/keep-starknet-strange/madara.git?rev=f30acea8af7e28e956e771928130e12bfc084832#f30acea8af7e28e956e771928130e12bfc084832" -dependencies = [ - "blockifier", - "hashbrown 0.14.3", - "mp-state", - "phf", - "sp-arithmetic", - "starknet_api", -] - -[[package]] -name = "mp-felt" -version = "0.6.0" -source = "git+https://github.com/keep-starknet-strange/madara.git?rev=f30acea8af7e28e956e771928130e12bfc084832#f30acea8af7e28e956e771928130e12bfc084832" -dependencies = [ - "cairo-vm", - "hex", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "starknet-ff", - "starknet_api", - "thiserror-no-std", -] - -[[package]] -name = "mp-hashers" -version = "0.6.0" -source = "git+https://github.com/keep-starknet-strange/madara.git?rev=f30acea8af7e28e956e771928130e12bfc084832#f30acea8af7e28e956e771928130e12bfc084832" -dependencies = [ - "mp-felt", - "parity-scale-codec", - "scale-info", - "serde", - "starknet-core", - "starknet-crypto", -] - -[[package]] -name = "mp-state" -version = "0.6.0" -source = "git+https://github.com/keep-starknet-strange/madara.git?rev=f30acea8af7e28e956e771928130e12bfc084832#f30acea8af7e28e956e771928130e12bfc084832" -dependencies = [ - "blockifier", - "starknet_api", -] - -[[package]] -name = "mp-transactions" -version = "0.6.0" -source = "git+https://github.com/keep-starknet-strange/madara.git?rev=f30acea8af7e28e956e771928130e12bfc084832#f30acea8af7e28e956e771928130e12bfc084832" -dependencies = [ - "blockifier", - "cairo-lang-casm-contract-class", - "cairo-lang-utils", - "cairo-vm", - "derive_more", - "mp-fee", - "mp-felt", - "mp-hashers", - "mp-state", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json", - "starknet-core", - "starknet-crypto", - "starknet-ff", - "starknet_api", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", - "rand 0.8.5", - "serde", -] - -[[package]] -name = "num-format" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" -dependencies = [ - "arrayvec 0.7.4", - "itoa", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-modular" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a5fe11d4135c3bcdf3a95b18b194afa9608a5f6ff034f5d857bc9a27fb0119" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-prime" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4e3bc495f6e95bc15a6c0c55ac00421504a5a43d09e3cc455d1fea7015581d" -dependencies = [ - "bitvec", - "either", - "lru 0.7.8", - "num-bigint", - "num-integer", - "num-modular", - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "object" -version = "0.30.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" -dependencies = [ - "crc32fast", - "hashbrown 0.13.2", - "indexmap 1.9.3", - "memchr", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "openssl" -version = "0.10.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" -dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "parity-scale-codec" -version = "3.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" -dependencies = [ - "arrayvec 0.7.4", - "bitvec", - "byte-slice-cast", - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" -dependencies = [ - "proc-macro-crate 2.0.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - -[[package]] -name = "pathfinder-common" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "anyhow", - "bitvec", - "fake", - "metrics", - "num-bigint", - "paste", - "pathfinder-crypto", - "primitive-types", - "rand 0.8.5", - "semver", - "serde", - "serde_json", - "serde_with 3.4.0", - "sha3", - "thiserror", - "vergen", -] - -[[package]] -name = "pathfinder-crypto" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "ark-ff", - "bitvec", - "fake", - "rand 0.8.5", - "serde", -] - -[[package]] -name = "pathfinder-ethereum" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "anyhow", - "async-trait", - "const-decoder", - "hex", - "keccak-hash", - "pathfinder-common", - "pathfinder-crypto", - "primitive-types", - "reqwest", - "serde_json", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "pathfinder-merkle-tree" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "anyhow", - "bitvec", - "pathfinder-common", - "pathfinder-crypto", - "pathfinder-storage", - "rand 0.8.5", - "starknet-gateway-types", - "thiserror", - "tracing", -] - -[[package]] -name = "pathfinder-serde" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "anyhow", - "num-bigint", - "pathfinder-common", - "pathfinder-crypto", - "primitive-types", - "serde", - "serde_json", - "serde_with 3.4.0", -] - -[[package]] -name = "pathfinder-storage" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "anyhow", - "base64 0.13.1", - "bincode 2.0.0-rc.3 (registry+https://github.com/rust-lang/crates.io-index)", - "bitvec", - "const_format", - "data-encoding", - "fake", - "hex", - "lazy_static", - "pathfinder-common", - "pathfinder-crypto", - "pathfinder-ethereum", - "pathfinder-serde", - "primitive-types", - "r2d2", - "r2d2_sqlite", - "rand 0.8.5", - "rusqlite", - "serde", - "serde_json", - "serde_with 3.4.0", - "sha3", - "starknet-gateway-types", - "thiserror", - "tokio", - "tracing", - "zstd", -] - -[[package]] -name = "pbkdf2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" -dependencies = [ - "crypto-mac", -] - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_macros", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared", - "rand 0.8.5", -] - -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "portable-atomic" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e30165d31df606f5726b090ec7592c308a0eaf61721ff64c9a3018e344a8753e" -dependencies = [ - "portable-atomic 1.6.0", -] - -[[package]] -name = "portable-atomic" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "prettyplease" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" -dependencies = [ - "proc-macro2", - "syn 2.0.40", -] - -[[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-serde", - "scale-info", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-crate" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" -dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", -] - -[[package]] -name = "proc-macro2" -version = "1.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r2d2" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" -dependencies = [ - "log", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "r2d2_sqlite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f5d0337e99cd5cacd91ffc326c6cc9d8078def459df560c4f9bf9ba4a51034" -dependencies = [ - "r2d2", - "rusqlite", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.11", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "ref-cast" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "regex" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "relative-path" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" - -[[package]] -name = "reqwest" -version = "0.11.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" -dependencies = [ - "base64 0.21.5", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac 0.12.1", - "subtle", -] - -[[package]] -name = "ring" -version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof#b273d33f9981e2bb3375ab45faeb537f7ee35224" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "blake2", - "common", - "fflonk", - "merlin 3.0.0", -] - -[[package]] -name = "rocksdb" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" -dependencies = [ - "libc", - "librocksdb-sys", -] - -[[package]] -name = "rstest" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eeab2f3c0a199bc4be135c36c924b6590b88c377d416494288c14f2db30199" -dependencies = [ - "futures", - "futures-timer", - "rstest_macros", - "rustc_version", -] - -[[package]] -name = "rstest_macros" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d428f8247852f894ee1be110b375111b586d4fa431f6c46e64ba5a0dcccbe605" -dependencies = [ - "cfg-if", - "glob", - "proc-macro2", - "quote", - "regex", - "relative-path", - "rustc_version", - "syn 2.0.40", - "unicode-ident", -] - -[[package]] -name = "rusqlite" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e213bc3ecb39ac32e81e51ebe31fd888a940515173e3a18a35f8c6e896422a" -dependencies = [ - "bitflags 1.3.2", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.36.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] - -[[package]] -name = "rustix" -version = "0.38.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys 0.4.12", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "ryu" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" - -[[package]] -name = "scale-info" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" -dependencies = [ - "bitvec", - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", - "serde", -] - -[[package]] -name = "scale-info-derive" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "scheduled-thread-pool" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "getrandom 0.1.16", - "merlin 2.0.1", - "rand 0.7.3", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", - "zeroize", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "secp256k1" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - -[[package]] -name = "secrecy" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" -dependencies = [ - "zeroize", -] - -[[package]] -name = "security-framework" -version = "2.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" - -[[package]] -name = "serde" -version = "1.0.193" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.193" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "serde_json" -version = "1.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" -dependencies = [ - "itoa", - "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 = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" -dependencies = [ - "base64 0.13.1", - "chrono", - "hex", - "serde", - "serde_json", - "serde_with_macros 2.3.3", - "time", -] - -[[package]] -name = "serde_with" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" -dependencies = [ - "base64 0.21.5", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.1.0", - "serde", - "serde_json", - "serde_with_macros 3.4.0", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "serde_with_macros" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[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.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "sp-arithmetic" -version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-std", - "static_assertions", -] - -[[package]] -name = "sp-core" -version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "array-bytes", - "bandersnatch_vrfs", - "bitflags 1.3.2", - "blake2", - "bounded-collections", - "bs58", - "dyn-clonable", - "ed25519-zebra", - "futures", - "hash-db", - "hash256-std-hasher", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin 2.0.1", - "parity-scale-codec", - "parking_lot", - "paste", - "primitive-types", - "rand 0.8.5", - "regex", - "scale-info", - "schnorrkel", - "secp256k1", - "secrecy", - "serde", - "sp-core-hashing", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "tracing", - "w3f-bls", - "zeroize", -] - -[[package]] -name = "sp-core-hashing" -version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "blake2b_simd", - "byteorder", - "digest 0.10.7", - "sha2 0.10.8", - "sha3", - "twox-hash", -] - -[[package]] -name = "sp-debug-derive" -version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "sp-externalities" -version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std", - "sp-storage", -] - -[[package]] -name = "sp-runtime-interface" -version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities", - "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage", - "sp-tracing", - "sp-wasm-interface", - "static_assertions", -] - -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "Inflector", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "sp-std" -version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" - -[[package]] -name = "sp-storage" -version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-tracing" -version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "parity-scale-codec", - "sp-std", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-wasm-interface" -version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#401f8a3e9448db854f5605b679fa085b8f445039" -dependencies = [ - "anyhow", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "sp-std", - "wasmtime", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "ss58-registry" -version = "1.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35935738370302d5e33963665b77541e4b990a3e919ec904c837a56cfc891de1" -dependencies = [ - "Inflector", - "num-format", - "proc-macro2", - "quote", - "serde", - "serde_json", - "unicode-xid", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "starknet-core" -version = "0.7.2" -source = "git+https://github.com/xJonathanLEI/starknet-rs.git?rev=a35ce22#a35ce22be52bf33b8e544d0df926031b0ec7d761" -dependencies = [ - "base64 0.21.5", - "flate2", - "hex", - "serde", - "serde_json", - "serde_json_pythonic", - "serde_with 2.3.3", - "sha3", - "starknet-crypto", - "starknet-ff", -] - -[[package]] -name = "starknet-crypto" -version = "0.6.1" -source = "git+https://github.com/xJonathanLEI/starknet-rs.git?rev=a35ce22#a35ce22be52bf33b8e544d0df926031b0ec7d761" -dependencies = [ - "crypto-bigint", - "hex", - "hmac 0.12.1", - "num-bigint", - "num-integer", - "num-traits", - "rfc6979", - "sha2 0.10.8", - "starknet-crypto-codegen", - "starknet-curve", - "starknet-ff", - "zeroize", -] - -[[package]] -name = "starknet-crypto-codegen" -version = "0.3.2" -source = "git+https://github.com/xJonathanLEI/starknet-rs.git?rev=a35ce22#a35ce22be52bf33b8e544d0df926031b0ec7d761" -dependencies = [ - "starknet-curve", - "starknet-ff", - "syn 2.0.40", -] - -[[package]] -name = "starknet-curve" -version = "0.4.0" -source = "git+https://github.com/xJonathanLEI/starknet-rs.git?rev=a35ce22#a35ce22be52bf33b8e544d0df926031b0ec7d761" -dependencies = [ - "starknet-ff", -] - -[[package]] -name = "starknet-ff" -version = "0.3.5" -source = "git+https://github.com/xJonathanLEI/starknet-rs.git?rev=a35ce22#a35ce22be52bf33b8e544d0df926031b0ec7d761" -dependencies = [ - "ark-ff", - "bigdecimal", - "crypto-bigint", - "getrandom 0.2.11", - "hex", - "serde", -] - -[[package]] -name = "starknet-gateway-types" -version = "0.1.0" -source = "git+https://github.com/massalabs/pathfinder.git?rev=b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db#b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" -dependencies = [ - "anyhow", - "fake", - "lazy_static", - "pathfinder-common", - "pathfinder-crypto", - "pathfinder-serde", - "primitive-types", - "rand 0.8.5", - "reqwest", - "rstest", - "serde", - "serde_json", - "serde_with 3.4.0", - "sha3", - "thiserror", - "tokio", -] - -[[package]] -name = "starknet_api" -version = "0.4.1" -source = "git+https://github.com/keep-starknet-strange/starknet-api?branch=no_std-support-dc83f05#60e13594b5d3560ad3a6439c5dc6807e5f425866" -dependencies = [ - "cairo-lang-casm-contract-class", - "derive_more", - "hashbrown 0.14.3", - "hex", - "indexmap 2.0.0-pre", - "once_cell", - "parity-scale-codec", - "primitive-types", - "scale-info", - "serde", - "serde_json", - "starknet-crypto", - "thiserror-no-std", -] - -[[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.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" - -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - -[[package]] -name = "substrate-bip39" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e620c7098893ba667438b47169c00aacdd9e7c10e042250ce2b60b087ec97328" -dependencies = [ - "hmac 0.11.0", - "pbkdf2 0.8.0", - "schnorrkel", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fa70a4ee923979ffb522cacce59d34421ebdea5625e1073c4326ef9d2dd42e" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "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.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" - -[[package]] -name = "tempfile" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix 0.38.28", - "windows-sys 0.48.0", -] - -[[package]] -name = "termcolor" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "thiserror-impl-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" -dependencies = [ - "thiserror-impl-no-std", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" -dependencies = [ - "deranged", - "itoa", - "libc", - "num_threads", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" -dependencies = [ - "time-core", -] - -[[package]] -name = "tiny-bip39" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" -dependencies = [ - "anyhow", - "hmac 0.12.1", - "once_cell", - "pbkdf2 0.11.0", - "rand 0.8.5", - "rustc-hash", - "sha2 0.10.8", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -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.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2 0.5.5", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml_datetime" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "regex", - "serde", - "serde_json", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", - "tracing-serde", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "digest 0.10.7", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "typenum" -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-bidi" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vergen" -version = "8.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1290fd64cc4e7d3c9b07d7f333ce0ce0007253e32870e632624835cc80b83939" -dependencies = [ - "anyhow", - "rustversion", - "time", -] - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "virtue" -version = "0.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcc60c0624df774c82a0ef104151231d37da4962957d691c011c852b2473314" - -[[package]] -name = "w3f-bls" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7335e4c132c28cc43caef6adb339789e599e39adbe78da0c4d547fad48cbc331" -dependencies = [ - "ark-bls12-377", - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-serialize", - "ark-serialize-derive", - "arrayref", - "constcat", - "digest 0.10.7", - "rand 0.8.5", - "rand_chacha 0.3.1", - "rand_core 0.6.4", - "sha2 0.10.8", - "sha3", - "thiserror", - "zeroize", -] - -[[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.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.40", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" - -[[package]] -name = "wasmparser" -version = "0.102.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" -dependencies = [ - "indexmap 1.9.3", - "url", -] - -[[package]] -name = "wasmtime" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" -dependencies = [ - "anyhow", - "bincode 1.3.3", - "cfg-if", - "indexmap 1.9.3", - "libc", - "log", - "object 0.30.4", - "once_cell", - "paste", - "psm", - "serde", - "target-lexicon", - "wasmparser", - "wasmtime-environ", - "wasmtime-jit", - "wasmtime-runtime", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "wasmtime-environ" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" -dependencies = [ - "anyhow", - "cranelift-entity", - "gimli 0.27.3", - "indexmap 1.9.3", - "log", - "object 0.30.4", - "serde", - "target-lexicon", - "thiserror", - "wasmparser", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-jit" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" -dependencies = [ - "addr2line 0.19.0", - "anyhow", - "bincode 1.3.3", - "cfg-if", - "cpp_demangle", - "gimli 0.27.3", - "log", - "object 0.30.4", - "rustc-demangle", - "serde", - "target-lexicon", - "wasmtime-environ", - "wasmtime-jit-icache-coherence", - "wasmtime-runtime", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" -dependencies = [ - "once_cell", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" -dependencies = [ - "cfg-if", - "libc", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-runtime" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" -dependencies = [ - "anyhow", - "cc", - "cfg-if", - "indexmap 1.9.3", - "libc", - "log", - "mach", - "memfd", - "memoffset", - "paste", - "rand 0.8.5", - "rustix 0.36.17", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-jit-debug", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-types" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" -dependencies = [ - "cranelift-entity", - "serde", - "thiserror", - "wasmparser", -] - -[[package]] -name = "web-sys" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[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.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -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", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - -[[package]] -name = "winnow" -version = "0.5.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" -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 = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "zerocopy" -version = "0.7.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306dca4455518f1f31635ec308b6b3e4eb1b11758cefafc782827d0aa7acb5c7" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be912bf68235a88fbefd1b73415cb218405958d1655b2ece9035a19920bdf6ba" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "zeroize" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.40", -] - -[[package]] -name = "zstd" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "6.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/Cargo.toml b/Cargo.toml index b7b3295..4ab77d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,36 +1,46 @@ [package] +edition = "2021" name = "bonsai-trie" version = "0.1.0" -edition = "2021" [features] -default = ["rocksdb"] +default = ["std", "rocksdb"] rocksdb = ["dep:rocksdb"] +std = ["parity-scale-codec/std", "bitvec/std", "starknet-types-core/std"] [dependencies] -parity-scale-codec = { version = "3.0.0", features = ["derive"] } -serde = { version = "1.0.193", features = ["derive"] } -bincode = "1.3.3" +bitvec = { version = "1", default-features = false, features = ["alloc"] } +derive_more = { version = "0.99.17", default-features = false, features = [ + "constructor", +] } +hashbrown = "0.14.3" log = "0.4.20" -smallvec = "1.11.2" -rustc-hex = "2.1.0" -env_logger = "0.10.1" -lru = "0.12.1" -parking_lot = "0.12.1" - -bitvec = { version = "1", default-features = false } -derive_more = { version = "0.99.17", features = ["constructor"] } -mp-felt = { git = "https://github.com/keep-starknet-strange/madara.git", rev = "f30acea8af7e28e956e771928130e12bfc084832", package = "mp-felt", features = ["parity-scale-codec", "serde"]} -mp-hashers = { git = "https://github.com/keep-starknet-strange/madara.git", rev = "f30acea8af7e28e956e771928130e12bfc084832", package = "mp-hashers" } +parity-scale-codec = { version = "3.0.0", default-features = false, features = [ + "derive", +] } +serde = { version = "1.0.195", default-features = false, features = [ + "derive", + "alloc", +] } +starknet-types-core = { version = "0.0.7", default-features = false, features = [ + "hash", + "parity-scale-codec", +] } # Optionals -rocksdb = { optional = true, version = "0.21.0", features = ["multi-threaded-cf"] } +rocksdb = { optional = true, version = "0.21.0", features = [ + "multi-threaded-cf", +] } [dev-dependencies] -tempfile = "3.8.0" -mp-commitments = { git = "https://github.com/keep-starknet-strange/madara.git", rev = "f30acea8af7e28e956e771928130e12bfc084832", package = "mp-commitments" } -rand = "0.8.5" -pathfinder-merkle-tree = { git = "https://github.com/massalabs/pathfinder.git", package = "pathfinder-merkle-tree", rev = "b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" } +mp-felt = { git = "https://github.com/keep-starknet-strange/madara.git", branch = "main", package = "mp-felt", features = [ + "parity-scale-codec", + "serde", +] } +mp-hashers = { git = "https://github.com/keep-starknet-strange/madara.git", branch = "main", package = "mp-hashers" } pathfinder-common = { git = "https://github.com/massalabs/pathfinder.git", package = "pathfinder-common", rev = "b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" } pathfinder-crypto = { git = "https://github.com/massalabs/pathfinder.git", package = "pathfinder-crypto", rev = "b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" } -pathfinder-storage = { git = "https://github.com/massalabs/pathfinder.git", package = "pathfinder-storage", rev = "b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" } \ No newline at end of file +pathfinder-merkle-tree = { git = "https://github.com/massalabs/pathfinder.git", package = "pathfinder-merkle-tree", rev = "b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" } +pathfinder-storage = { git = "https://github.com/massalabs/pathfinder.git", package = "pathfinder-storage", rev = "b7b6d76a76ab0e10f92e5f84ce099b5f727cb4db" } +rand = "0.8.5" +tempfile = "3.8.0" diff --git a/README.md b/README.md index 94e97f4..307fd88 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ use bonsai_trie::{ BonsaiStorage, BonsaiStorageConfig, BonsaiTrieHash, ProofNode, Membership }; -use mp_felt::Felt252Wrapper; +use starknet_types_core::felt::Felt; +use starknet_types_core::hash::Pedersen; use bitvec::prelude::*; fn main() { @@ -49,19 +50,19 @@ fn main() { // Create a BonsaiStorage with default parameters. let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); // Create a simple incremental ID builder for commit IDs. // This is not necessary, you can use any kind of strictly monotonically increasing value to tag your commits. let mut id_builder = BasicIdBuilder::new(); // Insert an item `pair1`. - let pair1 = (vec![1, 2, 1], Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()); + let pair1 = (vec![1, 2, 1], Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()); let bitvec_1 = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec_1, &pair1.1).unwrap(); // Insert a second item `pair2`. - let pair2 = (vec![1, 2, 2], Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap()); + let pair2 = (vec![1, 2, 2], Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap()); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, &pair2.1).unwrap(); @@ -70,7 +71,7 @@ fn main() { bonsai_storage.commit(id1); // Insert a new item `pair3`. - let pair3 = (vec![1, 2, 2], Felt252Wrapper::from_hex_be("0x664D033c195fec3ce2568b62052e").unwrap()); + let pair3 = (vec![1, 2, 2], Felt::from_hex("0x664D033c195fec3ce2568b62052e").unwrap()); let bitvec = BitVec::from_vec(pair3.0.clone()); bonsai_storage.insert(&bitvec, &pair3.1).unwrap(); @@ -102,7 +103,7 @@ fn main() { // asserting in both of them that the item `pair1` is present and has the right value. std::thread::scope(|s| { s.spawn(|| { - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, bonsai_storage.get_config()) .unwrap() .unwrap(); @@ -111,7 +112,7 @@ fn main() { }); s.spawn(|| { - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, bonsai_storage.get_config()) .unwrap() .unwrap(); @@ -128,7 +129,7 @@ fn main() { // Insert a new item and commit. let pair4 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); bonsai_storage .insert(&BitVec::from_vec(pair4.0.clone()), &pair4.1) diff --git a/ensure_no_std/.cargo/config.toml b/ensure_no_std/.cargo/config.toml new file mode 100644 index 0000000..f4e8c00 --- /dev/null +++ b/ensure_no_std/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-unknown-unknown" diff --git a/ensure_no_std/Cargo.lock b/ensure_no_std/Cargo.lock new file mode 100644 index 0000000..05af383 --- /dev/null +++ b/ensure_no_std/Cargo.lock @@ -0,0 +1,537 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bonsai-trie" +version = "0.1.0" +dependencies = [ + "bitvec", + "derive_more", + "hashbrown", + "log", + "parity-scale-codec", + "serde", + "starknet-types-core", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "ensure_no_std" +version = "0.1.0" +dependencies = [ + "bonsai-trie", + "wee_alloc", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lambdaworks-crypto" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4c222d5b2fdc0faf702d3ab361d14589b097f40eac9dc550e27083483edc65" +dependencies = [ + "lambdaworks-math", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee7dcab3968c71896b8ee4dc829147acc918cffe897af6265b1894527fe3add" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[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.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +dependencies = [ + "arrayvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +dependencies = [ + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "serde" +version = "1.0.195" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.195" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if 1.0.0", + "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 = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "starknet-types-core" +version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d791c671fecde494f435170a01c6fcb2949d0dd61be0b31b7c410b041609f96" +dependencies = [ + "bitvec", + "lambdaworks-crypto", + "lambdaworks-math", + "lazy_static", + "num-bigint", + "num-integer", + "num-traits", + "parity-scale-codec", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "memory_units", + "winapi", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winnow" +version = "0.5.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml new file mode 100644 index 0000000..bff67b7 --- /dev/null +++ b/ensure_no_std/Cargo.toml @@ -0,0 +1,15 @@ +[package] +edition = "2021" +name = "ensure_no_std" +version = "0.1.0" + +[dependencies] +bonsai-trie = { path = "../", default-features = false } +wee_alloc = "0.4.5" + + +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" diff --git a/ensure_no_std/rust-toolchain.toml b/ensure_no_std/rust-toolchain.toml new file mode 100644 index 0000000..ead536e --- /dev/null +++ b/ensure_no_std/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +targets = ["wasm32-unknown-unknown"] +profile = "minimal" diff --git a/ensure_no_std/src/main.rs b/ensure_no_std/src/main.rs new file mode 100644 index 0000000..05abacb --- /dev/null +++ b/ensure_no_std/src/main.rs @@ -0,0 +1,21 @@ +#![no_std] +#![no_main] + +use core::panic::PanicInfo; + +/// This function is called on panic. +#[panic_handler] +fn panic(_info: &PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +pub extern "C" fn _start() -> ! { + loop {} +} + +#[global_allocator] +static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + +#[allow(unused_imports)] +use bonsai_trie; diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..85f3606 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/src/bonsai_database.rs b/src/bonsai_database.rs index 6317c78..0d49152 100644 --- a/src/bonsai_database.rs +++ b/src/bonsai_database.rs @@ -1,6 +1,6 @@ -use std::error::Error; - use crate::{changes::ChangeKeyType, error::BonsaiStorageError, id::Id}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; #[derive(Debug, Hash, PartialEq, Eq)] pub enum KeyType<'a> { @@ -31,7 +31,10 @@ impl KeyType<'_> { /// Trait to be implemented on any type that can be used as a database. pub trait BonsaiDatabase { type Batch: Default; - type DatabaseError: Error + Into; + #[cfg(feature = "std")] + type DatabaseError: std::error::Error + Into; + #[cfg(not(feature = "std"))] + type DatabaseError: Into; /// Create a new empty batch of changes to be used in `insert`, `remove` and applied in database using `write_batch`. fn create_batch(&self) -> Self::Batch; @@ -78,7 +81,10 @@ pub trait BonsaiDatabase { } pub trait BonsaiPersistentDatabase { - type DatabaseError: Error + Into; + #[cfg(feature = "std")] + type DatabaseError: std::error::Error + Into; + #[cfg(not(feature = "std"))] + type DatabaseError: Into; type Transaction: BonsaiDatabase; /// Save a snapshot of the current database state /// This function returns a snapshot id that can be used to create a transaction diff --git a/src/changes.rs b/src/changes.rs index 1195e48..12fac91 100644 --- a/src/changes.rs +++ b/src/changes.rs @@ -1,6 +1,12 @@ use crate::id::Id; use serde::{Deserialize, Serialize}; -use std::collections::{HashMap, VecDeque}; +#[cfg(feature = "std")] +use std::collections::{hash_map::Entry, HashMap, VecDeque}; +#[cfg(not(feature = "std"))] +use { + alloc::{collections::VecDeque, vec::Vec}, + hashbrown::{hash_map::Entry, HashMap}, +}; #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Change { @@ -48,14 +54,14 @@ const OLD_VALUE: u8 = 0x01; impl ChangeBatch { pub fn insert_in_place(&mut self, key: ChangeKeyType, change: Change) { match self.0.entry(key) { - std::collections::hash_map::Entry::Occupied(mut entry) => { + Entry::Occupied(mut entry) => { let e = entry.get_mut(); if e.old_value.is_none() { e.old_value = change.old_value; } e.new_value = change.new_value; } - std::collections::hash_map::Entry::Vacant(entry) => { + Entry::Vacant(entry) => { entry.insert(change); } } diff --git a/src/databases/hashmap_db.rs b/src/databases/hashmap_db.rs index df37e1f..74a2d13 100644 --- a/src/databases/hashmap_db.rs +++ b/src/databases/hashmap_db.rs @@ -1,50 +1,41 @@ -use std::{ - collections::{BTreeMap, HashMap}, - error::Error, - fmt::Display, -}; - use crate::{ bonsai_database::BonsaiPersistentDatabase, error::BonsaiStorageError, id::Id, BonsaiDatabase, }; +#[cfg(not(feature = "std"))] +use alloc::{ + vec::Vec, + {collections::BTreeMap, string::ToString}, +}; +use core::{fmt, fmt::Display}; +#[cfg(not(feature = "std"))] +use hashbrown::HashMap; +#[cfg(feature = "std")] +use std::collections::{BTreeMap, HashMap}; #[derive(Debug)] pub struct HashMapDbError {} +#[cfg(feature = "std")] +impl std::error::Error for HashMapDbError {} + impl Display for HashMapDbError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "") } } -impl Error for HashMapDbError {} - impl From for BonsaiStorageError { fn from(err: HashMapDbError) -> Self { Self::Database(err.to_string()) } } -#[derive(Clone)] -pub struct HashMapDbConfig {} - -#[derive(Clone)] +#[derive(Clone, Default)] pub struct HashMapDb { - config: HashMapDbConfig, db: HashMap, Vec>, snapshots: BTreeMap>, } -impl HashMapDb { - pub fn new(config: HashMapDbConfig) -> Self { - Self { - config, - db: HashMap::new(), - snapshots: BTreeMap::new(), - } - } -} - impl BonsaiDatabase for HashMapDb { type Batch = (); type DatabaseError = HashMapDbError; @@ -114,7 +105,7 @@ impl BonsaiDatabase for HashMapDb { #[cfg(test)] fn dump_database(&self) { - println!("{:?}", self.db); + log::debug!("{:?}", self.db); } } diff --git a/src/databases/mod.rs b/src/databases/mod.rs index 59d8435..e73625d 100644 --- a/src/databases/mod.rs +++ b/src/databases/mod.rs @@ -1,5 +1,6 @@ #![allow(dead_code)] mod hashmap_db; +pub use hashmap_db::HashMapDb; #[cfg(feature = "rocksdb")] mod rocks_db; diff --git a/src/databases/rocks_db.rs b/src/databases/rocks_db.rs index 1739501..6819586 100644 --- a/src/databases/rocks_db.rs +++ b/src/databases/rocks_db.rs @@ -5,7 +5,6 @@ use std::{ path::Path, }; -use log::trace; use rocksdb::{ ColumnFamilyDescriptor, ColumnFamilyRef, Direction, Error, IteratorMode, MultiThreaded, OptimisticTransactionDB, OptimisticTransactionOptions, Options, ReadOptions, @@ -17,6 +16,7 @@ use crate::{ id::Id, BonsaiStorageError, }; +use log::trace; const TRIE_LOG_CF: &str = "trie_log"; const TRIE_CF: &str = "trie"; diff --git a/src/error.rs b/src/error.rs index 8055cda..e49ddd1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,3 +1,5 @@ +#[cfg(not(feature = "std"))] +use alloc::string::String; /// All errors that can be returned by BonsaiStorage. #[derive(Debug)] pub enum BonsaiStorageError { diff --git a/src/id.rs b/src/id.rs index 8945a01..0495067 100644 --- a/src/id.rs +++ b/src/id.rs @@ -1,4 +1,6 @@ -use std::{fmt::Debug, hash}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; +use core::{fmt::Debug, hash}; /// Trait to be implemented on any type that can be used as an ID. pub trait Id: hash::Hash + PartialEq + Eq + PartialOrd + Ord + Debug + Copy { diff --git a/src/key_value_db.rs b/src/key_value_db.rs index 9bd831a..aad5dc9 100644 --- a/src/key_value_db.rs +++ b/src/key_value_db.rs @@ -1,4 +1,7 @@ +#[cfg(not(feature = "std"))] +use alloc::{collections::BTreeSet, format, string::ToString, vec::Vec}; use log::trace; +#[cfg(feature = "std")] use std::collections::BTreeSet; use crate::{ @@ -67,7 +70,7 @@ impl KeyValueDB where DB: BonsaiDatabase, ID: Id, - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { pub(crate) fn new(underline_db: DB, config: KeyValueDBConfig, created_at: Option) -> Self { let mut changes_store = ChangeStore::new(); @@ -96,7 +99,7 @@ where // Insert flat db changes let mut batch = self.db.create_batch(); - let current_changes = std::mem::take(&mut self.changes_store.current_changes); + let current_changes = core::mem::take(&mut self.changes_store.current_changes); for (key, change) in current_changes.serialize(&id).iter() { self.db .insert(&KeyType::TrieLog(key), change, Some(&mut batch))?; @@ -195,7 +198,7 @@ where id: ID, ) -> Result, BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let Some(change_id) = self.snap_holder.range(..=id).last() else { return Ok(None); @@ -254,7 +257,8 @@ where transaction: KeyValueDB, ) -> Result<(), BonsaiStorageError> where - BonsaiStorageError: std::convert::From<>::DatabaseError>, + BonsaiStorageError: + core::convert::From<>::DatabaseError>, { let Some(created_at) = transaction.created_at else { return Err(BonsaiStorageError::Merge( diff --git a/src/lib.rs b/src/lib.rs index a89f353..8335803 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,33 +3,34 @@ //! This implementation can be used with any database that implements the `BonsaiDatabase` trait. //! //! Example usage with a RocksDB database: -//! ``` +//! ```ignore //! # use bonsai_trie::{ //! # databases::{RocksDB, create_rocks_db, RocksDBConfig}, //! # BonsaiStorageError, //! # id::{BasicIdBuilder, BasicId}, //! # BonsaiStorage, BonsaiStorageConfig, BonsaiTrieHash, //! # }; -//! # use mp_felt::Felt252Wrapper; +//! # use starknet_types_core::felt::Felt; +//! # use starknet_types_core::hash::Pedersen; //! # use bitvec::prelude::*; //! let db = create_rocks_db("./rocksdb").unwrap(); //! let config = BonsaiStorageConfig::default(); //! -//! let mut bonsai_storage = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); +//! let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); //! let mut id_builder = BasicIdBuilder::new(); //! -//! let pair1 = (vec![1, 2, 1], Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()); +//! let pair1 = (vec![1, 2, 1], Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()); //! let bitvec_1 = BitVec::from_vec(pair1.0.clone()); //! bonsai_storage.insert(&bitvec_1, &pair1.1).unwrap(); //! -//! let pair2 = (vec![1, 2, 2], Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap()); +//! let pair2 = (vec![1, 2, 2], Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap()); //! let bitvec = BitVec::from_vec(pair2.0.clone()); //! bonsai_storage.insert(&bitvec, &pair2.1).unwrap(); //! //! let id1 = id_builder.new_id(); //! bonsai_storage.commit(id1); //! -//! let pair3 = (vec![1, 2, 2], Felt252Wrapper::from_hex_be("0x664D033c195fec3ce2568b62052e").unwrap()); +//! let pair3 = (vec![1, 2, 2], Felt::from_hex("0x664D033c195fec3ce2568b62052e").unwrap()); //! let bitvec = BitVec::from_vec(pair3.0.clone()); //! bonsai_storage.insert(&bitvec, &pair3.1).unwrap(); //! @@ -52,7 +53,7 @@ //! println!("value: {:#?}", bonsai_storage.get(&bitvec).unwrap()); //! std::thread::scope(|s| { //! s.spawn(|| { -//! let bonsai_at_txn = bonsai_storage +//! let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage //! .get_transactional_state(id1, bonsai_storage.get_config()) //! .unwrap() //! .unwrap(); @@ -61,7 +62,7 @@ //! }); //! //! s.spawn(|| { -//! let bonsai_at_txn = bonsai_storage +//! let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage //! .get_transactional_state(id1, bonsai_storage.get_config()) //! .unwrap() //! .unwrap(); @@ -74,23 +75,28 @@ //! .unwrap(); //! let pair2 = ( //! vec![1, 2, 3], -//! Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), +//! Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), //! ); //! bonsai_storage //! .insert(&BitVec::from_vec(pair2.0.clone()), &pair2.1) //! .unwrap(); //! bonsai_storage.commit(id_builder.new_id()).unwrap(); //! ``` +#![cfg_attr(not(feature = "std"), no_std)] +#[cfg(not(feature = "std"))] +extern crate alloc; +use crate::trie::merkle_tree::MerkleTree; +#[cfg(not(feature = "std"))] +use alloc::{format, vec::Vec}; use bitvec::{order::Msb0, slice::BitSlice}; -use bonsai_database::BonsaiPersistentDatabase; +use bonsai_database::{BonsaiPersistentDatabase, KeyType}; use changes::ChangeBatch; use key_value_db::KeyValueDB; -use mp_felt::Felt252Wrapper; -use mp_hashers::pedersen::PedersenHasher; - -use bonsai_database::KeyType; -use trie::merkle_tree::MerkleTree; +use starknet_types_core::{ + felt::Felt, + hash::{Pedersen, StarkHash}, +}; mod changes; mod key_value_db; @@ -141,22 +147,24 @@ impl Default for BonsaiStorageConfig { /// Structure that hold the trie and all the necessary information to work with it. /// /// This structure is the main entry point to work with this crate. -pub struct BonsaiStorage +pub struct BonsaiStorage where DB: BonsaiDatabase, ChangeID: id::Id, + H: StarkHash, { - trie: MerkleTree, + trie: MerkleTree, } /// Trie root hash type. -pub type BonsaiTrieHash = Felt252Wrapper; +pub type BonsaiTrieHash = Felt; -impl BonsaiStorage +impl BonsaiStorage where DB: BonsaiDatabase, ChangeID: id::Id, - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, + H: StarkHash, { /// Create a new bonsai storage instance pub fn new(db: DB, config: BonsaiStorageConfig) -> Result { @@ -182,7 +190,7 @@ where pub fn insert( &mut self, key: &BitSlice, - value: &Felt252Wrapper, + value: &Felt, ) -> Result<(), BonsaiStorageError> { self.trie.set(key, *value)?; Ok(()) @@ -191,15 +199,12 @@ where /// Remove a key/value in the trie /// If the value doesn't exist it will do nothing pub fn remove(&mut self, key: &BitSlice) -> Result<(), BonsaiStorageError> { - self.trie.set(key, Felt252Wrapper::ZERO)?; + self.trie.set(key, Felt::ZERO)?; Ok(()) } /// Get a value in the trie. - pub fn get( - &self, - key: &BitSlice, - ) -> Result, BonsaiStorageError> { + pub fn get(&self, key: &BitSlice) -> Result, BonsaiStorageError> { self.trie.get(key) } @@ -318,20 +323,21 @@ where /// Verifies a merkle-proof for a given `key` and `value`. pub fn verify_proof( - root: Felt252Wrapper, + root: Felt, key: &BitSlice, - value: Felt252Wrapper, + value: Felt, proofs: &[ProofNode], ) -> Option { - MerkleTree::::verify_proof(root, key, value, proofs) + MerkleTree::::verify_proof(root, key, value, proofs) } } -impl BonsaiStorage +impl BonsaiStorage where DB: BonsaiDatabase + BonsaiPersistentDatabase, ChangeID: id::Id, - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, + H: StarkHash, { /// Update trie and database using all changes since the last commit. pub fn commit(&mut self, id: ChangeID) -> Result<(), BonsaiStorageError> { @@ -349,9 +355,9 @@ where &self, change_id: ChangeID, config: BonsaiStorageConfig, - ) -> Result>, BonsaiStorageError> + ) -> Result>, BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { if let Some(transaction) = self.trie.db_ref().get_transaction(change_id)? { Ok(Some(BonsaiStorage::new_from_transactional_state( @@ -372,11 +378,11 @@ where /// Merge a transactional state into the main trie. pub fn merge( &mut self, - transactional_bonsai_storage: BonsaiStorage, + transactional_bonsai_storage: BonsaiStorage, ) -> Result<(), BonsaiStorageError> where BonsaiStorageError: - std::convert::From<>::DatabaseError>, + core::convert::From<>::DatabaseError>, { self.trie .db_mut() diff --git a/src/tests/madara_comparison.rs b/src/tests/madara_comparison.rs index b7d7c0d..6a525f5 100644 --- a/src/tests/madara_comparison.rs +++ b/src/tests/madara_comparison.rs @@ -1,5 +1,6 @@ +#![cfg(feature = "std")] use bitvec::{bits, order::Msb0, vec::BitVec}; -use mp_felt::Felt252Wrapper; +use starknet_types_core::{felt::Felt, hash::Pedersen}; use crate::{ databases::{create_rocks_db, RocksDB, RocksDBConfig}, @@ -12,12 +13,12 @@ fn trie_height_251() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); for i in 0..251 { let mut key: BitVec = bits![u8, Msb0; 0; 251].to_bitvec(); key.set(i, true); - let value = Felt252Wrapper::from_hex_be("0x01").unwrap(); + let value = Felt::from_hex("0x01").unwrap(); bonsai_storage.insert(key.as_bitslice(), &value).unwrap(); } let mut id_builder = BasicIdBuilder::new(); @@ -32,7 +33,7 @@ fn trie_height_251() { // for i in 0..251 { // let mut key: BitVec = bits![u8, Msb0; 0; 251].to_bitvec(); // key.set(i, true); -// let value = Felt252Wrapper::from_hex_be("0x01").unwrap(); +// let value = Felt::from_hex_be("0x01").unwrap(); // tree.set(key.as_bitslice(), value); // } // let root_hash = tree.commit(); diff --git a/src/tests/proof.rs b/src/tests/proof.rs index 48a5dbb..a315eda 100644 --- a/src/tests/proof.rs +++ b/src/tests/proof.rs @@ -1,12 +1,12 @@ -use std::collections::HashMap; - +#![cfg(feature = "std")] use bitvec::vec::BitVec; -use mp_felt::Felt252Wrapper; use pathfinder_common::{hash::PedersenHash, trie::TrieNode}; -use pathfinder_crypto::Felt; +use pathfinder_crypto::Felt as PathfinderFelt; use pathfinder_merkle_tree::tree::{MerkleTree, TestStorage}; use pathfinder_storage::{Node, StoredNode}; use rand::Rng; +use starknet_types_core::{felt::Felt, hash::Pedersen}; +use std::collections::HashMap; use crate::{ databases::{create_rocks_db, RocksDB, RocksDBConfig}, @@ -19,11 +19,11 @@ use crate::{ fn commit_and_persist( tree: MerkleTree, storage: &mut TestStorage, -) -> (Felt, u64) { +) -> (PathfinderFelt, u64) { use pathfinder_storage::Child; for (key, value) in &tree.leaves { - let key = Felt::from_bits(key).unwrap(); + let key = PathfinderFelt::from_bits(key).unwrap(); storage.leaves.insert(key, *value); } @@ -88,10 +88,10 @@ fn assert_eq_proof(bonsai_proof: &[ProofNode], pathfinder_proof: &[TrieNode]) { }, ) => { let pathfinder_left_bits = pathfinder_left.to_hex_str(); - let pathfinder_felt = Felt252Wrapper::from_hex_be(&pathfinder_left_bits).unwrap(); + let pathfinder_felt = Felt::from_hex(&pathfinder_left_bits).unwrap(); assert_eq!(left, &pathfinder_felt); let pathfinder_right_bits = pathfinder_right.to_hex_str(); - let pathfinder_felt = Felt252Wrapper::from_hex_be(&pathfinder_right_bits).unwrap(); + let pathfinder_felt = Felt::from_hex(&pathfinder_right_bits).unwrap(); assert_eq!(right, &pathfinder_felt); } ( @@ -102,7 +102,7 @@ fn assert_eq_proof(bonsai_proof: &[ProofNode], pathfinder_proof: &[TrieNode]) { }, ) => { let pathfinder_child_bits = pathfinder_child.to_hex_str(); - let pathfinder_felt = Felt252Wrapper::from_hex_be(&pathfinder_child_bits).unwrap(); + let pathfinder_felt = Felt::from_hex(&pathfinder_child_bits).unwrap(); assert_eq!(child, &pathfinder_felt); assert_eq!(&path.0, pathfinder_path); } @@ -118,13 +118,14 @@ fn basic_proof() { let config = BonsaiStorageConfig::default(); let mut storage = pathfinder_merkle_tree::tree::TestStorage::default(); let mut bonsai_storage = - BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); + BonsaiStorage::<_, _, Pedersen>::new(RocksDB::new(&db, RocksDBConfig::default()), config) + .unwrap(); let mut pathfinder_merkle_tree: MerkleTree = pathfinder_merkle_tree::tree::MerkleTree::empty(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 1], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); @@ -132,12 +133,12 @@ fn basic_proof() { .set( &storage, bitvec, - Felt::from_hex_str("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + PathfinderFelt::from_hex_str("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ) .unwrap(); let pair2 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, &pair2.1).unwrap(); @@ -145,12 +146,12 @@ fn basic_proof() { .set( &storage, bitvec, - Felt::from_hex_str("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + PathfinderFelt::from_hex_str("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ) .unwrap(); let pair3 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair3.0.clone()); bonsai_storage.insert(&bitvec, &pair3.1).unwrap(); @@ -158,7 +159,7 @@ fn basic_proof() { .set( &storage, bitvec, - Felt::from_hex_str("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + PathfinderFelt::from_hex_str("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ) .unwrap(); bonsai_storage.commit(id_builder.new_id()).unwrap(); @@ -175,7 +176,7 @@ fn basic_proof() { .unwrap(); assert_eq_proof(&bonsai_proof, &pathfinder_proof); assert_eq!( - BonsaiStorage::>::verify_proof( + BonsaiStorage::, Pedersen>::verify_proof( bonsai_storage.root_hash().unwrap(), &BitVec::from_vec(vec![1, 2, 1]), pair1.1, @@ -192,7 +193,8 @@ fn multiple_proofs() { let config = BonsaiStorageConfig::default(); let mut storage = pathfinder_merkle_tree::tree::TestStorage::default(); let mut bonsai_storage = - BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); + BonsaiStorage::<_, _, Pedersen>::new(RocksDB::new(&db, RocksDBConfig::default()), config) + .unwrap(); let mut pathfinder_merkle_tree: MerkleTree = pathfinder_merkle_tree::tree::MerkleTree::empty(); let mut id_builder = BasicIdBuilder::new(); @@ -206,8 +208,8 @@ fn multiple_proofs() { let random_byte: u8 = rng.gen(); element.push_str(&format!("{:02x}", random_byte)); } - let value = Felt252Wrapper::from_hex_be(&element).unwrap(); - let key = &value.0.to_bytes_be()[..31]; + let value = Felt::from_hex(&element).unwrap(); + let key = &value.to_bytes_be()[..31]; bonsai_storage .insert(&BitVec::from_vec(key.to_vec()), &value) .unwrap(); @@ -215,7 +217,7 @@ fn multiple_proofs() { .set( &storage, BitVec::from_vec(key.to_vec()), - Felt::from_hex_str(&element).unwrap(), + PathfinderFelt::from_hex_str(&element).unwrap(), ) .unwrap(); elements.push((key.to_vec(), value)); @@ -235,7 +237,7 @@ fn multiple_proofs() { .unwrap(); assert_eq_proof(&proof, &pathfinder_proof); assert_eq!( - BonsaiStorage::>::verify_proof( + BonsaiStorage::, Pedersen>::verify_proof( bonsai_storage.root_hash().unwrap(), &BitVec::from_vec(element.0.clone()), element.1, @@ -253,13 +255,14 @@ fn one_element_proof() { let config = BonsaiStorageConfig::default(); let mut storage = pathfinder_merkle_tree::tree::TestStorage::default(); let mut bonsai_storage = - BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); + BonsaiStorage::<_, _, Pedersen>::new(RocksDB::new(&db, RocksDBConfig::default()), config) + .unwrap(); let mut pathfinder_merkle_tree: MerkleTree = pathfinder_merkle_tree::tree::MerkleTree::empty(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 1], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); @@ -267,7 +270,7 @@ fn one_element_proof() { .set( &storage, bitvec, - Felt::from_hex_str("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + PathfinderFelt::from_hex_str("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ) .unwrap(); bonsai_storage.commit(id_builder.new_id()).unwrap(); @@ -284,7 +287,7 @@ fn one_element_proof() { .unwrap(); assert_eq_proof(&bonsai_proof, &pathfinder_proof); assert_eq!( - BonsaiStorage::>::verify_proof( + BonsaiStorage::, Pedersen>::verify_proof( bonsai_storage.root_hash().unwrap(), &BitVec::from_vec(vec![1, 2, 1]), pair1.1, @@ -300,7 +303,8 @@ fn zero_not_crashing() { let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); let mut bonsai_storage = - BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); + BonsaiStorage::<_, _, Pedersen>::new(RocksDB::new(&db, RocksDBConfig::default()), config) + .unwrap(); let mut id_builder = BasicIdBuilder::new(); bonsai_storage.commit(id_builder.new_id()).unwrap(); bonsai_storage diff --git a/src/tests/simple.rs b/src/tests/simple.rs index c9a4139..a67902f 100644 --- a/src/tests/simple.rs +++ b/src/tests/simple.rs @@ -1,36 +1,37 @@ +#![cfg(feature = "std")] use crate::{ databases::{create_rocks_db, RocksDB, RocksDBConfig}, id::BasicIdBuilder, BonsaiStorage, BonsaiStorageConfig, }; use bitvec::vec::BitVec; -use mp_felt::Felt252Wrapper; +use starknet_types_core::{felt::Felt, hash::Pedersen}; #[test] fn basics() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 1], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); bonsai_storage.commit(id_builder.new_id()).unwrap(); let pair2 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, &pair2.1).unwrap(); bonsai_storage.commit(id_builder.new_id()).unwrap(); let pair3 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair3.0.clone()); bonsai_storage.insert(&bitvec, &pair3.1).unwrap(); diff --git a/src/tests/transactional_state.rs b/src/tests/transactional_state.rs index 5311c2e..84c1fd7 100644 --- a/src/tests/transactional_state.rs +++ b/src/tests/transactional_state.rs @@ -1,10 +1,11 @@ +#![cfg(feature = "std")] use crate::{ databases::{create_rocks_db, RocksDB, RocksDBConfig}, id::BasicIdBuilder, BonsaiStorage, BonsaiStorageConfig, }; use bitvec::vec::BitVec; -use mp_felt::Felt252Wrapper; +use starknet_types_core::{felt::Felt, hash::Pedersen}; #[test] fn basics() { @@ -17,7 +18,7 @@ fn basics() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -26,14 +27,14 @@ fn basics() { let pair2 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ); let id2 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, &pair2.1).unwrap(); bonsai_storage.commit(id2).unwrap(); - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); @@ -54,7 +55,7 @@ fn test_thread() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -63,7 +64,7 @@ fn test_thread() { std::thread::scope(|s| { s.spawn(|| { - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, bonsai_storage.get_config()) .unwrap() .unwrap(); @@ -72,7 +73,7 @@ fn test_thread() { }); s.spawn(|| { - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, bonsai_storage.get_config()) .unwrap() .unwrap(); @@ -86,7 +87,7 @@ fn test_thread() { .unwrap(); let pair2 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); bonsai_storage .insert(&BitVec::from_vec(pair2.0.clone()), &pair2.1) @@ -105,7 +106,7 @@ fn remove() { let pair1 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -118,14 +119,14 @@ fn remove() { bonsai_storage.commit(id2).unwrap(); bonsai_storage.dump_database(); - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); let bitvec = BitVec::from_vec(pair1.0.clone()); assert_eq!(bonsai_at_txn.get(&bitvec).unwrap().unwrap(), pair1.1); - let bonsai_at_txn = bonsai_storage + let bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id2, BonsaiStorageConfig::default()) .unwrap() .unwrap(); @@ -144,19 +145,19 @@ fn merge() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); bonsai_storage.commit(id1).unwrap(); - let mut bonsai_at_txn = bonsai_storage + let mut bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); let pair2 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); bonsai_at_txn .insert(&BitVec::from_vec(pair2.0.clone()), &pair2.1) @@ -184,19 +185,19 @@ fn merge_override() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); bonsai_storage.commit(id1).unwrap(); - let mut bonsai_at_txn = bonsai_storage + let mut bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); let pair2 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); bonsai_at_txn .insert(&BitVec::from_vec(pair2.0.clone()), &pair2.1) @@ -224,13 +225,13 @@ fn merge_remove() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); bonsai_storage.commit(id1).unwrap(); - let mut bonsai_at_txn = bonsai_storage + let mut bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); @@ -258,7 +259,7 @@ fn merge_txn_revert() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -266,7 +267,7 @@ fn merge_txn_revert() { bonsai_storage.commit(id1).unwrap(); let root_hash1 = bonsai_storage.root_hash().unwrap(); - let mut bonsai_at_txn = bonsai_storage + let mut bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); @@ -279,7 +280,7 @@ fn merge_txn_revert() { let pair2 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); bonsai_at_txn .insert(&BitVec::from_vec(pair2.0.clone()), &pair2.1) @@ -313,14 +314,14 @@ fn merge_invalid() { let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD5D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); bonsai_storage.insert(&bitvec, &pair1.1).unwrap(); bonsai_storage.commit(id1).unwrap(); - let mut bonsai_at_txn = bonsai_storage + let mut bonsai_at_txn: BonsaiStorage<_, _, Pedersen> = bonsai_storage .get_transactional_state(id1, BonsaiStorageConfig::default()) .unwrap() .unwrap(); @@ -332,7 +333,7 @@ fn merge_invalid() { let pair2 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); bonsai_storage .insert(&BitVec::from_vec(pair2.0.clone()), &pair2.1) @@ -351,13 +352,13 @@ fn many_snapshots() { snapshot_interval: 1, ..Default::default() }; - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 2], - Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -366,7 +367,7 @@ fn many_snapshots() { let pair2 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FD54D033c195fec3ce2568b62052e").unwrap(), ); let id2 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair2.0.clone()); diff --git a/src/tests/trie_log.rs b/src/tests/trie_log.rs index 7d50eb4..3145425 100644 --- a/src/tests/trie_log.rs +++ b/src/tests/trie_log.rs @@ -1,23 +1,24 @@ +#![cfg(feature = "std")] use crate::{ databases::{create_rocks_db, RocksDB, RocksDBConfig}, id::BasicIdBuilder, BonsaiStorage, BonsaiStorageConfig, BonsaiTrieHash, }; use bitvec::vec::BitVec; -use mp_felt::Felt252Wrapper; +use starknet_types_core::{felt::Felt, hash::Pedersen}; #[test] fn basics() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 1], - &Felt252Wrapper::from_hex_be("0x16342762FDD54D033c195fec3ce2568b62052e").unwrap(), + &Felt::from_hex("0x16342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -28,7 +29,7 @@ fn basics() { let id2 = id_builder.new_id(); let pair2 = ( vec![1, 2, 2], - &Felt252Wrapper::from_hex_be("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), + &Felt::from_hex("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, pair2.1).unwrap(); @@ -55,13 +56,13 @@ fn unrecorded_revert() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -77,7 +78,7 @@ fn in_place_revert() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); @@ -97,13 +98,13 @@ fn truncated_revert() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 1], - &Felt252Wrapper::from_hex_be("0x16342762FDD54D033c195fec3ce2568b62052e").unwrap(), + &Felt::from_hex("0x16342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -114,7 +115,7 @@ fn truncated_revert() { let id2 = id_builder.new_id(); let pair2 = ( vec![1, 2, 2], - &Felt252Wrapper::from_hex_be("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), + &Felt::from_hex("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, pair2.1).unwrap(); @@ -132,13 +133,13 @@ fn double_revert() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 1], - &Felt252Wrapper::from_hex_be("0x16342762FDD54D033c195fec3ce2568b62052e").unwrap(), + &Felt::from_hex("0x16342762FDD54D033c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); @@ -149,7 +150,7 @@ fn double_revert() { let id2 = id_builder.new_id(); let pair2 = ( vec![1, 2, 2], - &Felt252Wrapper::from_hex_be("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), + &Felt::from_hex("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), ); let bitvec = BitVec::from_vec(pair2.0.clone()); bonsai_storage.insert(&bitvec, pair2.1).unwrap(); @@ -169,13 +170,13 @@ fn remove_and_reinsert() { let tempdir = tempfile::tempdir().unwrap(); let db = create_rocks_db(tempdir.path()).unwrap(); let config = BonsaiStorageConfig::default(); - let mut bonsai_storage = + let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> = BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap(); let mut id_builder = BasicIdBuilder::new(); let pair1 = ( vec![1, 2, 3], - Felt252Wrapper::from_hex_be("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), + Felt::from_hex("0x66342762FDD54D3c195fec3ce2568b62052e").unwrap(), ); let id1 = id_builder.new_id(); let bitvec = BitVec::from_vec(pair1.0.clone()); diff --git a/src/trie/merkle_node.rs b/src/trie/merkle_node.rs index 9ec8e1e..4905a94 100644 --- a/src/trie/merkle_node.rs +++ b/src/trie/merkle_node.rs @@ -6,8 +6,8 @@ use bitvec::order::Msb0; use bitvec::slice::BitSlice; -use mp_felt::Felt252Wrapper; use parity_scale_codec::{Decode, Encode}; +use starknet_types_core::felt::Felt; use super::merkle_tree::Path; @@ -33,7 +33,7 @@ pub enum Node { /// A node that has not been fetched from storage yet. /// /// As such, all we know is its hash. - Unresolved(Felt252Wrapper), + Unresolved(Felt), /// A branch node with exactly two children. Binary(BinaryNode), /// Describes a path connecting two other nodes. @@ -42,7 +42,7 @@ pub enum Node { #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode)] pub enum NodeHandle { - Hash(Felt252Wrapper), + Hash(Felt), InMemory(NodeId), } @@ -50,7 +50,7 @@ pub enum NodeHandle { #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode)] pub struct BinaryNode { /// The hash of this node. - pub hash: Option, + pub hash: Option, /// The height of this node in the tree. pub height: u64, /// [Left](Direction::Left) child. @@ -64,7 +64,7 @@ pub struct BinaryNode { pub struct EdgeNode { /// The hash of this node. Is [None] if the node /// has not yet been committed. - pub hash: Option, + pub hash: Option, /// The starting height of this node in the tree. pub height: u64, /// The path this edge takes. @@ -157,12 +157,12 @@ impl BinaryNode { impl Node { /// Returns true if the node represents an empty node -- this is defined as a node - /// with the [Felt252Wrapper::ZERO]. + /// with the [Felt::ZERO]. /// /// This can occur for the root node in an empty graph. pub fn is_empty(&self) -> bool { match self { - Node::Unresolved(hash) => hash == &Felt252Wrapper::ZERO, + Node::Unresolved(hash) => hash == &Felt::ZERO, _ => false, } } @@ -180,7 +180,7 @@ impl Node { } } - pub fn hash(&self) -> Option { + pub fn hash(&self) -> Option { match self { Node::Unresolved(hash) => Some(*hash), Node::Binary(binary) => binary.hash, diff --git a/src/trie/merkle_tree.rs b/src/trie/merkle_tree.rs index f506318..df2debe 100644 --- a/src/trie/merkle_tree.rs +++ b/src/trie/merkle_tree.rs @@ -1,15 +1,19 @@ -use core::iter::once; -use core::marker::PhantomData; - +#[cfg(not(feature = "std"))] +use alloc::{format, string::ToString, vec, vec::Vec}; use bitvec::{ prelude::{BitSlice, BitVec, Msb0}, view::BitView, }; +use core::iter::once; +use core::marker::PhantomData; +use core::mem; use derive_more::Constructor; -use mp_felt::Felt252Wrapper; -use mp_hashers::HasherT; +#[cfg(not(feature = "std"))] +use hashbrown::HashMap; use parity_scale_codec::{Decode, Encode, Error, Input, Output}; -use std::{collections::HashMap, mem}; +use starknet_types_core::{felt::Felt, hash::StarkHash}; +#[cfg(feature = "std")] +use std::collections::HashMap; use crate::{error::BonsaiStorageError, id::Id, BonsaiDatabase, KeyValueDB}; @@ -123,28 +127,22 @@ fn test_shared_path_encode_decode() { /// Each node hold only the minimum of data that need to be known for the proof: the child hashes (and path for edge node) #[derive(Debug, Clone, PartialEq)] pub enum ProofNode { - Binary { - left: Felt252Wrapper, - right: Felt252Wrapper, - }, - Edge { - child: Felt252Wrapper, - path: Path, - }, + Binary { left: Felt, right: Felt }, + Edge { child: Felt, path: Path }, } impl ProofNode { - pub fn hash(&self) -> Felt252Wrapper { + pub fn hash(&self) -> Felt { match self { - ProofNode::Binary { left, right } => Felt252Wrapper(H::hash_elements(left.0, right.0)), + ProofNode::Binary { left, right } => H::hash(left, right), ProofNode::Edge { child, path } => { let mut bytes = [0u8; 32]; bytes.view_bits_mut::()[256 - path.0.len()..].copy_from_bitslice(&path.0); // SAFETY: path len is <= 251 - let path_hash = Felt252Wrapper::try_from(&bytes).unwrap(); + let path_hash = Felt::from_bytes_be(&bytes); - let length = Felt252Wrapper::from(path.0.len() as u8); - Felt252Wrapper(H::hash_elements(child.0, path_hash.0) + length.0) + let length = Felt::from(path.0.len() as u8); + H::hash(child, &path_hash) + length } } } @@ -156,14 +154,14 @@ impl ProofNode { /// states. /// /// For more information on how this functions internally, see [here](super::merkle_node). -pub struct MerkleTree { +pub struct MerkleTree { root_handle: NodeHandle, - root_hash: Felt252Wrapper, + root_hash: Felt, storage_nodes: NodesMapping, db: KeyValueDB, latest_node_id: NodeId, death_row: Vec, - cache_leaf_modified: HashMap, InsertOrRemove>, + cache_leaf_modified: HashMap, InsertOrRemove>, _hasher: PhantomData, } @@ -173,13 +171,13 @@ enum InsertOrRemove { Remove, } -impl MerkleTree { +impl MerkleTree { /// Less visible initialization for `MerkleTree` as the main entry points should be /// [`MerkleTree::::load`] for persistent trees and [`MerkleTree::empty`] for /// transient ones. pub fn new(mut db: KeyValueDB) -> Result where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let nodes_mapping: HashMap = HashMap::new(); let root_node = db.get(&TrieKeyType::Trie(vec![]))?; @@ -190,10 +188,10 @@ impl MerkleTree { } else { db.insert( &TrieKeyType::Trie(vec![]), - &Node::Unresolved(Felt252Wrapper::ZERO).encode(), + &Node::Unresolved(Felt::ZERO).encode(), None, )?; - Node::Unresolved(Felt252Wrapper::ZERO) + Node::Unresolved(Felt::ZERO) }; let root = node.hash().ok_or(BonsaiStorageError::Trie( "Root doesn't exist in the storage".to_string(), @@ -210,13 +208,13 @@ impl MerkleTree { }) } - pub fn root_hash(&self) -> Felt252Wrapper { + pub fn root_hash(&self) -> Felt { self.root_hash } pub fn reset_root_from_db(&mut self) -> Result<(), BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let node = self .get_tree_branch_in_db_from_path(&BitVec::::new())? @@ -235,9 +233,9 @@ impl MerkleTree { } /// Persists all changes to storage and returns the new root hash. - pub fn commit(&mut self) -> Result + pub fn commit(&mut self) -> Result where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let mut batch = self.db.create_batch(); for node_key in mem::take(&mut self.death_row) { @@ -278,9 +276,9 @@ impl MerkleTree { node_handle: NodeHandle, path: BitVec, batch: &mut DB::Batch, - ) -> Result + ) -> Result where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { use Node::*; let node_id = match node_handle { @@ -314,7 +312,7 @@ impl MerkleTree { let mut right_path = path.clone(); right_path.push(true); let right_hash = self.commit_subtree(binary.right, right_path, batch)?; - let hash = Felt252Wrapper(H::hash_elements(left_hash.0, right_hash.0)); + let hash = H::hash(&left_hash, &right_hash); binary.hash = Some(hash); binary.left = NodeHandle::Hash(left_hash); binary.right = NodeHandle::Hash(right_hash); @@ -335,17 +333,13 @@ impl MerkleTree { bytes.view_bits_mut::()[256 - edge.path.0.len()..] .copy_from_bitslice(&edge.path.0); - let felt_path = Felt252Wrapper::try_from(&bytes).map_err(|err| { - BonsaiStorageError::Trie(format!("Couldn't convert path to felt: {}", err)) - })?; + let felt_path = Felt::from_bytes_be(&bytes); let mut length = [0; 32]; // Safe as len() is guaranteed to be <= 251 length[31] = edge.path.0.len() as u8; - let length = Felt252Wrapper::try_from(&length).map_err(|err| { - BonsaiStorageError::Trie(format!("Couldn't convert length to felt: {}", err)) - })?; - let hash = Felt252Wrapper(H::hash_elements(child_hash.0, felt_path.0) + length.0); + let length = Felt::from_bytes_be(&length); + let hash = H::hash(&child_hash, &felt_path) + length; edge.hash = Some(hash); edge.child = NodeHandle::Hash(child_hash); let key_bytes = if path.is_empty() { @@ -363,21 +357,17 @@ impl MerkleTree { } } - /// Sets the value of a key. To delete a key, set the value to [Felt252Wrapper::ZERO]. + /// Sets the value of a key. To delete a key, set the value to [Felt::ZERO]. /// /// # Arguments /// /// * `key` - The key to set. /// * `value` - The value to set. - pub fn set( - &mut self, - key: &BitSlice, - value: Felt252Wrapper, - ) -> Result<(), BonsaiStorageError> + pub fn set(&mut self, key: &BitSlice, value: Felt) -> Result<(), BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { - if value == Felt252Wrapper::ZERO { + if value == Felt::ZERO { return self.delete_leaf(key); } let path = self.preload_nodes(key)?; @@ -543,14 +533,14 @@ impl MerkleTree { /// Deletes a leaf node from the tree. /// /// This is not an external facing API; the functionality is instead accessed by calling - /// [`MerkleTree::set`] with value set to [`Felt252Wrapper::ZERO`]. + /// [`MerkleTree::set`] with value set to [`Felt::ZERO`]. /// /// # Arguments /// /// * `key` - The key to delete. fn delete_leaf(&mut self, key: &BitSlice) -> Result<(), BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { // Algorithm explanation: // @@ -642,9 +632,9 @@ impl MerkleTree { self.latest_node_id.next_id(); self.storage_nodes .0 - .insert(self.latest_node_id, Node::Unresolved(Felt252Wrapper::ZERO)); + .insert(self.latest_node_id, Node::Unresolved(Felt::ZERO)); self.root_handle = NodeHandle::InMemory(self.latest_node_id); - self.root_hash = Felt252Wrapper::ZERO; + self.root_hash = Felt::ZERO; return Ok(()); } }; @@ -705,12 +695,9 @@ impl MerkleTree { /// # Returns /// /// The value of the key. - pub fn get( - &self, - key: &BitSlice, - ) -> Result, BonsaiStorageError> + pub fn get(&self, key: &BitSlice) -> Result, BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let key = &[&[key.len() as u8], key.to_bitvec().as_raw_slice()].concat(); if let Some(value) = self.cache_leaf_modified.get(key) { @@ -721,12 +708,12 @@ impl MerkleTree { } self.db .get(&TrieKeyType::Flat(key.to_vec())) - .map(|r| r.map(|opt| Felt252Wrapper::decode(&mut opt.as_slice()).unwrap())) + .map(|r| r.map(|opt| Felt::decode(&mut opt.as_slice()).unwrap())) } pub fn contains(&self, key: &BitSlice) -> Result where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let key = &[&[key.len() as u8], key.to_bitvec().as_raw_slice()].concat(); if let Some(value) = self.cache_leaf_modified.get(key) { @@ -738,7 +725,7 @@ impl MerkleTree { self.db.contains(&TrieKeyType::Flat(key.to_vec())) } - /// Generates a merkle-proof for a given `key`. + /// Returns the list of nodes along the path. /// /// if it exists, or down to the node which proves that the key does not exist. /// @@ -758,7 +745,7 @@ impl MerkleTree { /// The merkle proof and all the child nodes hashes. pub fn get_proof(&self, key: &BitSlice) -> Result, BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let mut nodes = Vec::with_capacity(251); let mut node = match self.root_handle { @@ -894,6 +881,7 @@ impl MerkleTree { } } + /// preload_nodes from the current root towards the destination [Leaf](Node::Leaf) node. /// If the destination node exists, it will be the final node in the list. /// /// This means that the final node will always be either a the destination [Leaf](Node::Leaf) @@ -913,7 +901,7 @@ impl MerkleTree { /// The list of nodes along the path. fn preload_nodes(&mut self, dst: &BitSlice) -> Result, BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let mut nodes = Vec::with_capacity(251); let node_id = match self.root_handle { @@ -949,7 +937,7 @@ impl MerkleTree { nodes: &mut Vec, ) -> Result<(), BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let node = self .storage_nodes @@ -1027,7 +1015,7 @@ impl MerkleTree { path: &BitVec, ) -> Result, BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { let key = if path.is_empty() { vec![] @@ -1057,7 +1045,7 @@ impl MerkleTree { /// * `parent` - The parent node to merge the child with. fn merge_edges(&self, parent: &mut EdgeNode) -> Result<(), BonsaiStorageError> where - BonsaiStorageError: std::convert::From<::DatabaseError>, + BonsaiStorageError: core::convert::From<::DatabaseError>, { //TODO: Add deletion of unused nodes let child_node = match parent.child { @@ -1097,9 +1085,9 @@ impl MerkleTree { /// 4. set expected_hash <- to the child hash /// 3. check that the expected_hash is `value` (we should've reached the leaf) pub fn verify_proof( - root: Felt252Wrapper, + root: Felt, key: &BitSlice, - value: Felt252Wrapper, + value: Felt, proofs: &[ProofNode], ) -> Option { // Protect from ill-formed keys @@ -1212,157 +1200,197 @@ impl MerkleTree { } } -#[cfg(test)] +#[cfg(all(test, feature = "std"))] mod tests { - use bitvec::vec::BitVec; - use mp_commitments::{calculate_class_commitment_leaf_hash, StateCommitmentTree}; - use mp_felt::Felt252Wrapper; - use mp_hashers::pedersen::PedersenHasher; - use crate::{ databases::{create_rocks_db, RocksDB, RocksDBConfig}, id::BasicId, key_value_db::KeyValueDBConfig, KeyValueDB, }; + use bitvec::vec::BitVec; + use mp_felt::Felt252Wrapper; + use mp_hashers::pedersen::PedersenHasher; + use parity_scale_codec::{Decode, Encode}; use rand::prelude::*; + use starknet_types_core::{felt::Felt, hash::Pedersen}; - #[test] - fn one_commit_tree_compare() { - let mut elements = vec![]; - let tempdir = tempfile::tempdir().unwrap(); - let mut rng = rand::thread_rng(); - let tree_size = rng.gen_range(10..100); - for _ in 0..tree_size { - let mut element = String::from("0x"); - let element_size = rng.gen_range(10..32); - for _ in 0..element_size { - let random_byte: u8 = rng.gen(); - element.push_str(&format!("{:02x}", random_byte)); - } - elements.push(Felt252Wrapper::from_hex_be(&element).unwrap()); - } - let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); - let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); - let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); - let mut bonsai_tree: super::MerkleTree, BasicId> = - super::MerkleTree::new(db).unwrap(); - let root_hash = - mp_commitments::calculate_class_commitment_tree_root_hash::(&elements); - elements.iter().for_each(|element| { - let final_hash = calculate_class_commitment_leaf_hash::(*element); - let key = &element.0.to_bytes_be()[..31]; - bonsai_tree - .set(&BitVec::from_vec(key.to_vec()), final_hash) - .unwrap(); - }); - bonsai_tree.display(); - assert_eq!(bonsai_tree.commit().unwrap(), root_hash); + // convert a Madara felt to a standard Felt + fn felt_from_madara_felt(madara_felt: &Felt252Wrapper) -> Felt { + let encoded = madara_felt.encode(); + Felt::decode(&mut &encoded[..]).unwrap() } - #[test] - fn simple_commits() { - let tempdir = tempfile::tempdir().unwrap(); - let mut madara_tree = StateCommitmentTree::::default(); - let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); - let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); - let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); - let mut bonsai_tree: super::MerkleTree, BasicId> = - super::MerkleTree::new(db).unwrap(); - let elements = [ - [Felt252Wrapper::from_hex_be("0x665342762FDD54D0303c195fec3ce2568b62052e").unwrap()], - [Felt252Wrapper::from_hex_be("0x66342762FDD54D0303c195fec3ce2568b62052e").unwrap()], - [Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()], - ]; - for elem in elements { - elem.iter().for_each(|class_hash| { - let final_hash = - calculate_class_commitment_leaf_hash::(*class_hash); - madara_tree.set(*class_hash, final_hash); - let key = &class_hash.0.to_bytes_be()[..31]; - bonsai_tree - .set(&BitVec::from_vec(key.to_vec()), final_hash) - .unwrap(); - }); - } - let madara_root_hash = madara_tree.commit(); - let bonsai_root_hash = bonsai_tree.commit().unwrap(); - assert_eq!(bonsai_root_hash, madara_root_hash); + // convert a standard Felt to a Madara felt + fn madara_felt_from_felt(felt: &Felt) -> Felt252Wrapper { + let encoded = felt.encode(); + Felt252Wrapper::decode(&mut &encoded[..]).unwrap() } - #[test] - fn simple_commits_and_delete() { - let tempdir = tempfile::tempdir().unwrap(); - let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); - let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); - let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); - let mut bonsai_tree: super::MerkleTree, BasicId> = - super::MerkleTree::new(db).unwrap(); - let elements = [ - [Felt252Wrapper::from_hex_be("0x665342762FDD54D0303c195fec3ce2568b62052e").unwrap()], - [Felt252Wrapper::from_hex_be("0x66342762FDD54D0303c195fec3ce2568b62052e").unwrap()], - [Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()], - ]; - for elem in elements { - elem.iter().for_each(|class_hash| { - let final_hash = - calculate_class_commitment_leaf_hash::(*class_hash); - let key = &class_hash.0.to_bytes_be()[..31]; - bonsai_tree - .set(&BitVec::from_vec(key.to_vec()), final_hash) - .unwrap(); - }); - } - bonsai_tree.commit().unwrap(); - for elem in elements { - elem.iter().for_each(|class_hash| { - let key = &class_hash.0.to_bytes_be()[..31]; - bonsai_tree - .set(&BitVec::from_vec(key.to_vec()), Felt252Wrapper::ZERO) - .unwrap(); - }); - } - bonsai_tree.commit().unwrap(); - } + // #[test] + // fn one_commit_tree_compare() { + // let mut elements = vec![]; + // let tempdir = tempfile::tempdir().unwrap(); + // let mut rng = rand::thread_rng(); + // let tree_size = rng.gen_range(10..100); + // for _ in 0..tree_size { + // let mut element = String::from("0x"); + // let element_size = rng.gen_range(10..32); + // for _ in 0..element_size { + // let random_byte: u8 = rng.gen(); + // element.push_str(&format!("{:02x}", random_byte)); + // } + // elements.push(Felt::from_hex(&element).unwrap()); + // } + // let madara_elements = elements + // .iter() + // .map(madara_felt_from_felt) + // .collect::>(); + // let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); + // let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); + // let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); + // let mut bonsai_tree: super::MerkleTree, BasicId> = + // super::MerkleTree::new(db).unwrap(); + // let root_hash = mp_commitments::calculate_class_commitment_tree_root_hash::( + // &madara_elements, + // ); + // elements + // .iter() + // .zip(madara_elements.iter()) + // .for_each(|(element, madara_element)| { + // let final_hash = + // calculate_class_commitment_leaf_hash::(*madara_element); + // let key = &element.to_bytes_be()[..31]; + // bonsai_tree + // .set( + // &BitVec::from_vec(key.to_vec()), + // felt_from_madara_felt(&final_hash), + // ) + // .unwrap(); + // }); + // bonsai_tree.display(); + // assert_eq!( + // bonsai_tree.commit().unwrap(), + // felt_from_madara_felt(&root_hash) + // ); + // } - #[test] - fn multiple_commits_tree_compare() { - let mut rng = rand::thread_rng(); - let tempdir = tempfile::tempdir().unwrap(); - let mut madara_tree = StateCommitmentTree::::default(); - let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); - let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); - let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); - let mut bonsai_tree: super::MerkleTree, BasicId> = - super::MerkleTree::new(db).unwrap(); - let nb_commits = rng.gen_range(2..4); - for _ in 0..nb_commits { - let mut elements = vec![]; - let tree_size = rng.gen_range(10..100); - for _ in 0..tree_size { - let mut element = String::from("0x"); - let element_size = rng.gen_range(10..32); - for _ in 0..element_size { - let random_byte: u8 = rng.gen(); - element.push_str(&format!("{:02x}", random_byte)); - } - elements.push(Felt252Wrapper::from_hex_be(&element).unwrap()); - } - elements.iter().for_each(|class_hash| { - let final_hash = - calculate_class_commitment_leaf_hash::(*class_hash); - madara_tree.set(*class_hash, final_hash); - let key = &class_hash.0.to_bytes_be()[..31]; - bonsai_tree - .set(&BitVec::from_vec(key.to_vec()), final_hash) - .unwrap(); - }); - - let bonsai_root_hash = bonsai_tree.commit().unwrap(); - let madara_root_hash = madara_tree.commit(); - assert_eq!(bonsai_root_hash, madara_root_hash); - } - } + // #[test] + // fn simple_commits() { + // let tempdir = tempfile::tempdir().unwrap(); + // let mut madara_tree = StateCommitmentTree::::default(); + // let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); + // let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); + // let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); + // let mut bonsai_tree: super::MerkleTree, BasicId> = + // super::MerkleTree::new(db).unwrap(); + // let elements = [ + // [Felt::from_hex("0x665342762FDD54D0303c195fec3ce2568b62052e").unwrap()], + // [Felt::from_hex("0x66342762FDD54D0303c195fec3ce2568b62052e").unwrap()], + // [Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()], + // ]; + // for elem in elements { + // elem.iter().for_each(|class_hash| { + // let final_hash = + // felt_from_madara_felt(&calculate_class_commitment_leaf_hash::( + // madara_felt_from_felt(class_hash), + // )); + // madara_tree.set( + // madara_felt_from_felt(class_hash), + // madara_felt_from_felt(&final_hash), + // ); + // let key = &class_hash.to_bytes_be()[..31]; + // bonsai_tree + // .set(&BitVec::from_vec(key.to_vec()), final_hash) + // .unwrap(); + // }); + // } + // let madara_root_hash = madara_tree.commit(); + // let bonsai_root_hash = bonsai_tree.commit().unwrap(); + // assert_eq!(bonsai_root_hash, felt_from_madara_felt(&madara_root_hash)); + // } + + // #[test] + // fn simple_commits_and_delete() { + // let tempdir = tempfile::tempdir().unwrap(); + // let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); + // let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); + // let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); + // let mut bonsai_tree: super::MerkleTree, BasicId> = + // super::MerkleTree::new(db).unwrap(); + // let elements = [ + // [Felt::from_hex("0x665342762FDD54D0303c195fec3ce2568b62052e").unwrap()], + // [Felt::from_hex("0x66342762FDD54D0303c195fec3ce2568b62052e").unwrap()], + // [Felt::from_hex("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()], + // ]; + // for elem in elements { + // elem.iter().for_each(|class_hash| { + // let final_hash = calculate_class_commitment_leaf_hash::( + // madara_felt_from_felt(class_hash), + // ); + // let key = &class_hash.to_bytes_be()[..31]; + // bonsai_tree + // .set( + // &BitVec::from_vec(key.to_vec()), + // felt_from_madara_felt(&final_hash), + // ) + // .unwrap(); + // }); + // } + // bonsai_tree.commit().unwrap(); + // for elem in elements { + // elem.iter().for_each(|class_hash| { + // let key = &class_hash.to_bytes_be()[..31]; + // bonsai_tree + // .set(&BitVec::from_vec(key.to_vec()), Felt::ZERO) + // .unwrap(); + // }); + // } + // bonsai_tree.commit().unwrap(); + // } + + // #[test] + // fn multiple_commits_tree_compare() { + // let mut rng = rand::thread_rng(); + // let tempdir = tempfile::tempdir().unwrap(); + // let mut madara_tree = StateCommitmentTree::::default(); + // let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); + // let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); + // let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); + // let mut bonsai_tree: super::MerkleTree, BasicId> = + // super::MerkleTree::new(db).unwrap(); + // let nb_commits = rng.gen_range(2..4); + // for _ in 0..nb_commits { + // let mut elements = vec![]; + // let tree_size = rng.gen_range(10..100); + // for _ in 0..tree_size { + // let mut element = String::from("0x"); + // let element_size = rng.gen_range(10..32); + // for _ in 0..element_size { + // let random_byte: u8 = rng.gen(); + // element.push_str(&format!("{:02x}", random_byte)); + // } + // elements.push(Felt::from_hex(&element).unwrap()); + // } + // elements.iter().for_each(|class_hash| { + // let final_hash = calculate_class_commitment_leaf_hash::( + // madara_felt_from_felt(class_hash), + // ); + // madara_tree.set(madara_felt_from_felt(class_hash), final_hash); + // let key = &class_hash.to_bytes_be()[..31]; + // bonsai_tree + // .set( + // &BitVec::from_vec(key.to_vec()), + // felt_from_madara_felt(&final_hash), + // ) + // .unwrap(); + // }); + + // let bonsai_root_hash = bonsai_tree.commit().unwrap(); + // let madara_root_hash = madara_tree.commit(); + // assert_eq!(bonsai_root_hash, felt_from_madara_felt(&madara_root_hash)); + // } + // } // #[test] // fn multiple_commits_tree_compare_with_deletes() { // let mut rng = rand::thread_rng(); @@ -1384,10 +1412,10 @@ mod tests { // element.push_str(&format!("{:02x}", random_byte)); // } // if rng.gen_bool(0.1) { - // elements_to_delete.push(Felt252Wrapper::from_hex_be(&element).unwrap()); - // elements.push(Felt252Wrapper::from_hex_be(&element).unwrap()); + // elements_to_delete.push(Felt::from_hex_be(&element).unwrap()); + // elements.push(Felt::from_hex_be(&element).unwrap()); // } else { - // elements.push(Felt252Wrapper::from_hex_be(&element).unwrap()); + // elements.push(Felt::from_hex_be(&element).unwrap()); // } // } // elements.iter().for_each(|class_hash| { @@ -1403,9 +1431,9 @@ mod tests { // assert_eq!(bonsai_root_hash, madara_root_hash); // } // elements_to_delete.iter().for_each(|class_hash| { - // madara_tree.set(*class_hash, Felt252Wrapper::ZERO); + // madara_tree.set(*class_hash, Felt::ZERO); // let key = &class_hash.0.to_bytes_be()[..31]; - // bonsai_tree.set(&BitVec::from_vec(key.to_vec()), Felt252Wrapper::ZERO); + // bonsai_tree.set(&BitVec::from_vec(key.to_vec()), Felt::ZERO); // }); // let bonsai_root_hash = bonsai_tree.commit(); @@ -1413,37 +1441,40 @@ mod tests { // assert_eq!(bonsai_root_hash, madara_root_hash); // } - #[test] - fn test_proof() { - let tempdir = tempfile::tempdir().unwrap(); - let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); - let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); - let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); - let mut bonsai_tree: super::MerkleTree, BasicId> = - super::MerkleTree::new(db).unwrap(); - let elements = [ - [Felt252Wrapper::from_hex_be("0x665342762FDD54D0303c195fec3ce2568b62052e").unwrap()], - [Felt252Wrapper::from_hex_be("0x66342762FDD54D0303c195fec3ce2568b62052e").unwrap()], - [Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()], - ]; - for elem in elements { - elem.iter().for_each(|class_hash| { - let final_hash = - calculate_class_commitment_leaf_hash::(*class_hash); - let key = &class_hash.0.to_bytes_be()[..31]; - bonsai_tree - .set(&BitVec::from_vec(key.to_vec()), final_hash) - .unwrap(); - }); - } - bonsai_tree.commit().unwrap(); - let bonsai_proof = bonsai_tree - .get_proof(&BitVec::from_vec( - elements[0][0].0.to_bytes_be()[..31].to_vec(), - )) - .unwrap(); - println!("bonsai_proof: {:?}", bonsai_proof); - } + // #[test] + // fn test_proof() { + // let tempdir = tempfile::tempdir().unwrap(); + // let rocks_db = create_rocks_db(std::path::Path::new(tempdir.path())).unwrap(); + // let rocks_db = RocksDB::new(&rocks_db, RocksDBConfig::default()); + // let db = KeyValueDB::new(rocks_db, KeyValueDBConfig::default(), None); + // let mut bonsai_tree: super::MerkleTree, BasicId> = + // super::MerkleTree::new(db).unwrap(); + // let elements = [ + // [Felt252Wrapper::from_hex_be("0x665342762FDD54D0303c195fec3ce2568b62052e").unwrap()], + // [Felt252Wrapper::from_hex_be("0x66342762FDD54D0303c195fec3ce2568b62052e").unwrap()], + // [Felt252Wrapper::from_hex_be("0x66342762FDD54D033c195fec3ce2568b62052e").unwrap()], + // ]; + // for elem in elements { + // elem.iter().for_each(|class_hash| { + // let final_hash = + // calculate_class_commitment_leaf_hash::(*class_hash); + // let key = &class_hash.0.to_bytes_be()[..31]; + // bonsai_tree + // .set( + // &BitVec::from_vec(key.to_vec()), + // Felt::from_bytes_be(&final_hash.0.to_bytes_be()), + // ) + // .unwrap(); + // }); + // } + // bonsai_tree.commit().unwrap(); + // let bonsai_proof = bonsai_tree + // .get_proof(&BitVec::from_vec( + // elements[0][0].0.to_bytes_be()[..31].to_vec(), + // )) + // .unwrap(); + // println!("bonsai_proof: {:?}", bonsai_proof); + // } // test in madara // #[test] diff --git a/src/trie/trie_db.rs b/src/trie/trie_db.rs index 84bc876..534a754 100644 --- a/src/trie/trie_db.rs +++ b/src/trie/trie_db.rs @@ -1,4 +1,6 @@ use crate::{bonsai_database::KeyType, changes::ChangeKeyType}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; #[derive(Debug, Hash, PartialEq, Eq)] pub enum TrieKeyType {