diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 0895fc1ad4..441c7e91b5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,12 +4,23 @@ ARG VARIANT FROM mcr.microsoft.com/vscode/devcontainers/rust:${VARIANT} +ARG VARIANT # Install additional packages RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev + && apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev libzstd-dev + +RUN apt install -y gh libgmp3-dev software-properties-common + +# Install Cairo Native dependencies +RUN curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null +RUN echo "deb http://apt.llvm.org/${VARIANT}/ llvm-toolchain-${VARIANT}-17 main" | tee /etc/apt/sources.list.d/llvm.list && apt-get update +RUN apt-get -y install -t llvm-toolchain-${VARIANT}-17 llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools -RUN apt install -y gh libgmp3-dev +# To build Katana with 'native' feature, we need to set the following environment variables +ENV MLIR_SYS_170_PREFIX=/usr/lib/llvm-17 +ENV LLVM_SYS_170_PREFIX=/usr/lib/llvm-17 +ENV TABLEGEN_170_PREFIX=/usr/lib/llvm-17 # To allow independent workflow of the container, the rust-toolchain is explicitely given. RUN echo "1.74.0" > rust_toolchain_version diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cab4a26e16..958cc2a4e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,11 +14,15 @@ jobs: test: runs-on: ubuntu-latest-16-cores container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 - - run: cargo build -r --bin katana && cargo llvm-cov nextest --all-features --lcov --output-path lcov.info + - run: | + cargo llvm-cov nextest --no-report --all-features --workspace --exclude katana + cargo llvm-cov nextest --no-report -p katana + cargo llvm-cov nextest --no-report -p katana --no-default-features --features sir + cargo llvm-cov report --lcov --output-path lcov.info - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -27,7 +31,7 @@ jobs: ensure-wasm: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -62,7 +66,7 @@ jobs: dojo-core-test: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -71,7 +75,7 @@ jobs: dojo-spawn-and-move-example-test: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -80,7 +84,7 @@ jobs: dojo-world-bindings-check: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -89,7 +93,7 @@ jobs: clippy: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -98,7 +102,7 @@ jobs: fmt: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -107,7 +111,7 @@ jobs: docs: runs-on: ubuntu-latest container: - image: ghcr.io/dojoengine/dojo-dev:5d61184 + image: nondeterministickari/dojo-dev:cc6554da steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 diff --git a/Cargo.lock b/Cargo.lock index 8d4b3b6639..b9e988165a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,9 +39,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -149,9 +149,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -197,9 +197,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "arc-swap" @@ -220,7 +220,7 @@ dependencies = [ "derivative", "hashbrown 0.13.1", "itertools 0.10.5", - "num-traits 0.2.17", + "num-traits 0.2.18", "zeroize", ] @@ -236,7 +236,7 @@ dependencies = [ "ark-std 0.3.0", "derivative", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "paste", "rustc_version 0.3.3", "zeroize", @@ -256,7 +256,7 @@ dependencies = [ "digest 0.10.7", "itertools 0.10.5", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "paste", "rustc_version 0.4.0", "zeroize", @@ -289,7 +289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "quote", "syn 1.0.109", ] @@ -301,7 +301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "proc-macro2", "quote", "syn 1.0.109", @@ -381,7 +381,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", "rand", ] @@ -391,7 +391,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", "rand", ] @@ -432,7 +432,7 @@ dependencies = [ "asn1-rs-impl", "displaydoc", "nom", - "num-traits 0.2.17", + "num-traits 0.2.18", "rusticata-macros", "thiserror", "time", @@ -495,13 +495,13 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 4.0.3", - "event-listener-strategy", + "event-listener 5.1.0", + "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite", ] @@ -542,7 +542,7 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.2.0", "async-executor", "async-io 2.3.1", "async-lock 3.3.0", @@ -570,10 +570,10 @@ dependencies = [ "futures-util", "handlebars", "http", - "indexmap 2.2.2", + "indexmap 2.2.3", "mime", "multer", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "pin-project-lite", "regex", @@ -593,12 +593,12 @@ checksum = "c7f329c7eb9b646a72f70c9c4b516c70867d356ec46cb00dcac8ad343fd006b0" dependencies = [ "Inflector", "async-graphql-parser", - "darling 0.20.5", + "darling 0.20.6", "proc-macro-crate 1.1.3", "proc-macro2", "quote", "strum 0.25.0", - "syn 2.0.48", + "syn 2.0.49", "thiserror", ] @@ -621,7 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "323a5143f5bdd2030f45e3f2e0c821c9b1d36e79cf382129c64299c50a7f3750" dependencies = [ "bytes", - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_json", ] @@ -670,7 +670,7 @@ dependencies = [ "futures-io", "futures-lite 2.2.0", "parking", - "polling 3.4.0", + "polling 3.5.0", "rustix 0.38.31", "slab", "tracing", @@ -693,7 +693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ "event-listener 4.0.3", - "event-listener-strategy", + "event-listener-strategy 0.4.0", "pin-project-lite", ] @@ -705,7 +705,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -753,7 +753,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -770,7 +770,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -803,7 +803,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -841,7 +841,7 @@ checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -987,7 +987,7 @@ checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" dependencies = [ "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "serde", ] @@ -1009,6 +1009,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags 2.4.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease 0.2.16", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.49", + "which 4.4.2", +] + [[package]] name = "bindgen" version = "0.68.1" @@ -1020,13 +1043,16 @@ dependencies = [ "clang-sys", "lazy_static", "lazycell", + "log", "peeking_take_while", + "prettyplease 0.2.16", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.48", + "syn 2.0.49", + "which 4.4.2", ] [[package]] @@ -1122,16 +1148,16 @@ dependencies = [ "cairo-lang-runner", "cairo-lang-starknet", "cairo-lang-utils", - "cairo-vm", + "cairo-vm 0.9.2", "ctor", "derive_more", - "indexmap 2.2.2", + "indexmap 2.2.3", "itertools 0.10.5", "keccak", "log", "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "phf", "serde", "serde_json", @@ -1149,7 +1175,7 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.2.0", "async-lock 3.3.0", "async-task", "fastrand 2.0.1", @@ -1231,14 +1257,14 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dd6407f73a9b8b6162d8a2ef999fe6afd7cc15902ebf42c5cd296addf17e0ad" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "byte-slice-cast" @@ -1398,7 +1424,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.8.0", - "syn 2.0.48", + "syn 2.0.49", "thiserror", ] @@ -1411,7 +1437,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.9.0", - "syn 2.0.48", + "syn 2.0.49", "thiserror", ] @@ -1427,7 +1453,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.8.0", - "syn 2.0.48", + "syn 2.0.49", "thiserror", ] @@ -1443,7 +1469,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.9.0", - "syn 2.0.48", + "syn 2.0.49", "thiserror", ] @@ -1460,7 +1486,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.9.0", - "syn 2.0.48", + "syn 2.0.49", "thiserror", ] @@ -1472,7 +1498,7 @@ dependencies = [ "lazy_static", "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "serde", ] @@ -1485,7 +1511,7 @@ dependencies = [ "cairo-lang-utils", "indoc 2.0.4", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "parity-scale-codec", "serde", ] @@ -1643,7 +1669,7 @@ dependencies = [ "itertools 0.11.0", "log", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "salsa", "smol_str", @@ -1663,7 +1689,7 @@ dependencies = [ "colored", "itertools 0.11.0", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "salsa", "smol_str", "unescaper", @@ -1696,7 +1722,7 @@ checksum = "85aa42c1206b5848bb9ea7e77885ab5196bddcabe55332cc584ced6af9dd459e" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1732,12 +1758,12 @@ dependencies = [ "cairo-lang-sierra-type-size", "cairo-lang-starknet", "cairo-lang-utils", - "cairo-vm", + "cairo-vm 0.9.2", "itertools 0.11.0", "keccak", "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "smol_str", "starknet-crypto 0.6.1", "thiserror", @@ -1763,7 +1789,7 @@ dependencies = [ "indoc 2.0.4", "itertools 0.11.0", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "salsa", "smol_str", @@ -1785,7 +1811,7 @@ dependencies = [ "lalrpop", "lalrpop-util", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "regex", "salsa", "serde", @@ -1806,7 +1832,7 @@ dependencies = [ "cairo-lang-sierra-type-size", "cairo-lang-utils", "itertools 0.11.0", - "num-traits 0.2.17", + "num-traits 0.2.18", "thiserror", ] @@ -1821,7 +1847,7 @@ dependencies = [ "cairo-lang-sierra-type-size", "cairo-lang-utils", "itertools 0.11.0", - "num-traits 0.2.17", + "num-traits 0.2.18", "thiserror", ] @@ -1865,7 +1891,7 @@ dependencies = [ "indoc 2.0.4", "itertools 0.11.0", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "thiserror", ] @@ -1907,7 +1933,7 @@ dependencies = [ "itertools 0.11.0", "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "serde", "serde_json", @@ -1927,7 +1953,7 @@ dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "salsa", "smol_str", "unescaper", @@ -1935,9 +1961,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dc563a3457190f1f9d371fbfbb67e7f99675c54dcf9cb2f260e5aecb5ed3a73" +checksum = "9dab4d07bd78658f0fdc3fd20f1236bc3e6ebdd8a8fc72ece95a5dd03b7a09da" dependencies = [ "genco", "xshell", @@ -1966,7 +1992,7 @@ dependencies = [ "indoc 2.0.4", "itertools 0.11.0", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "serde", ] @@ -1988,7 +2014,7 @@ dependencies = [ "cairo-lang-utils", "colored", "itertools 0.11.0", - "num-traits 0.2.17", + "num-traits 0.2.18", "rayon", ] @@ -2012,16 +2038,68 @@ checksum = "80f3de16afa605c6cc491661bc2dab71da10b379af0fdb7176f4f27e08d6286e" dependencies = [ "env_logger", "hashbrown 0.14.3", - "indexmap 2.2.2", + "indexmap 2.2.3", "itertools 0.11.0", "log", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "schemars", "serde", "time", ] +[[package]] +name = "cairo-native" +version = "0.1.0" +source = "git+https://github.com/lambdaclass/cairo_native?rev=96ea3a37180a194ba14c3b21788b09e76bb634fd#96ea3a37180a194ba14c3b21788b09e76bb634fd" +dependencies = [ + "bumpalo", + "cairo-lang-compiler", + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-lowering", + "cairo-lang-semantic", + "cairo-lang-sierra", + "cairo-lang-sierra-ap-change", + "cairo-lang-sierra-gas", + "cairo-lang-sierra-generator", + "cairo-lang-starknet", + "cairo-lang-utils", + "cairo-native-runtime", + "cc", + "clap", + "educe", + "id-arena", + "itertools 0.12.1", + "lazy_static", + "libc", + "libloading", + "llvm-sys", + "melior", + "mlir-sys", + "num-bigint", + "num-traits 0.2.18", + "starknet-types-core", + "tempfile", + "thiserror", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "cairo-native-runtime" +version = "0.1.0" +source = "git+https://github.com/lambdaclass/cairo_native?rev=96ea3a37180a194ba14c3b21788b09e76bb634fd#96ea3a37180a194ba14c3b21788b09e76bb634fd" +dependencies = [ + "cairo-lang-runner", + "lazy_static", + "libc", + "starknet-crypto 0.6.1", + "starknet-curve 0.4.1", + "starknet-types-core", +] + [[package]] name = "cairo-vm" version = "0.9.2" @@ -2041,15 +2119,49 @@ dependencies = [ "num-bigint", "num-integer", "num-prime", - "num-traits 0.2.17", + "num-traits 0.2.18", + "rand", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3", + "starknet-crypto 0.6.1", + "starknet-curve 0.4.1", + "thiserror-no-std", +] + +[[package]] +name = "cairo-vm" +version = "1.0.0-rc0" +source = "git+https://github.com/lambdaclass/cairo-vm?rev=1f98feff566dd2da016e439f5e8db912c6e39872#1f98feff566dd2da016e439f5e8db912c6e39872" +dependencies = [ + "anyhow", + "ark-ff 0.4.2", + "ark-std 0.4.0", + "bincode 2.0.0-rc.3", + "bitvec", + "cairo-lang-casm", + "cairo-lang-starknet", + "generic-array", + "hashbrown 0.14.3", + "hex", + "keccak", + "lazy_static", + "mimalloc", + "nom", + "num-bigint", + "num-integer", + "num-prime", + "num-traits 0.2.18", "rand", "serde", "serde_json", "sha2 0.10.8", "sha3", "starknet-crypto 0.6.1", - "starknet-curve 0.4.0", + "starknet-types-core", "thiserror-no-std", + "zip", ] [[package]] @@ -2063,9 +2175,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" dependencies = [ "serde", ] @@ -2078,7 +2190,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -2163,7 +2275,7 @@ dependencies = [ "ed25519-consensus", "flex-error", "futures", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "prost 0.12.3", "prost-types 0.12.3", @@ -2188,7 +2300,7 @@ dependencies = [ "bytes", "flex-error", "num-derive", - "num-traits 0.2.17", + "num-traits 0.2.18", "prost 0.12.3", "prost-types 0.12.3", "serde", @@ -2265,14 +2377,14 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", - "num-traits 0.2.17", + "num-traits 0.2.18", "serde", "wasm-bindgen", "windows-targets 0.52.0", @@ -2341,9 +2453,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -2351,9 +2463,9 @@ dependencies = [ [[package]] name = "clap-verbosity-flag" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b57f73ca21b17a0352944b9bb61803b6007bd911b6cccfef7153f7f0600ac495" +checksum = "bb9b20c0dd58e4c2e991c8d203bbeb76c11304d1011659686b5b644bc29aa478" dependencies = [ "clap", "log", @@ -2361,42 +2473,43 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", + "terminal_size", ] [[package]] name = "clap_complete" -version = "4.4.10" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb745187d7f4d76267b37485a65e0149edd0e91a4cfcdd3f27524ad86cee9f3" +checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "clru" @@ -2503,6 +2616,26 @@ dependencies = [ "thiserror", ] +[[package]] +name = "comrak" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6751998a48e2327773c95f6f8e03c6e77c0156ce539d74c17d2199ff3d05e197" +dependencies = [ + "clap", + "derive_builder 0.12.0", + "entities", + "memchr", + "once_cell", + "regex", + "shell-words", + "slug", + "syntect", + "typed-arena", + "unicode_categories", + "xdg", +] + [[package]] name = "concurrent-queue" version = "2.4.0" @@ -2652,9 +2785,9 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -2683,7 +2816,7 @@ dependencies = [ "criterion-plot", "is-terminal", "itertools 0.10.5", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "oorandom", "plotters", @@ -2799,7 +2932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2846,7 +2979,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2874,12 +3007,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" +checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955" dependencies = [ - "darling_core 0.20.5", - "darling_macro 0.20.5", + "darling_core 0.20.6", + "darling_macro 0.20.6", ] [[package]] @@ -2892,22 +3025,22 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 1.0.109", ] [[package]] name = "darling_core" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" +checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.48", + "strsim 0.10.0", + "syn 2.0.49", ] [[package]] @@ -2923,13 +3056,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" +checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" dependencies = [ - "darling_core 0.20.5", + "darling_core 0.20.6", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3008,7 +3141,7 @@ dependencies = [ "displaydoc", "nom", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "rusticata-macros", ] @@ -3035,18 +3168,27 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.13.0" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" +dependencies = [ + "derive_builder_macro 0.12.0", +] + +[[package]] +name = "derive_builder" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "660047478bc508c0fde22c868991eec0c40a63e48d610befef466d48e2bee574" +checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" dependencies = [ - "derive_builder_macro", + "derive_builder_macro 0.20.0", ] [[package]] name = "derive_builder_core" -version = "0.13.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b217e6dd1011a54d12f3b920a411b5abd44b1716ecfe94f5f2f2f7b52e08ab7" +checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" dependencies = [ "darling 0.14.4", "proc-macro2", @@ -3054,16 +3196,38 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_builder_core" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" +dependencies = [ + "darling 0.20.6", + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "derive_builder_macro" -version = "0.13.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5f77d7e20ac9153428f7ca14a88aba652adfc7a0ef0a06d654386310ef663b" +checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ - "derive_builder_core", + "derive_builder_core 0.12.0", "syn 1.0.109", ] +[[package]] +name = "derive_builder_macro" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" +dependencies = [ + "derive_builder_core 0.20.0", + "syn 2.0.49", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -3077,6 +3241,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "deunicode" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e854126756c496b8c81dec88f9a706b15b875c5849d4097a3854476b9fdf94" + [[package]] name = "diff" version = "0.1.13" @@ -3198,7 +3368,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3262,12 +3432,12 @@ dependencies = [ "indoc 1.0.9", "itertools 0.10.5", "lazy_static", - "num-traits 0.2.17", + "num-traits 0.2.18", "once_cell", "pretty_assertions", "salsa", "scarb", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "serde_with", @@ -3472,11 +3642,23 @@ dependencies = [ "zeroize", ] +[[package]] +name = "educe" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4bd92664bf78c4d3dba9b7cdafce6fa15b13ed3ed16175218196942e99168a8" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" dependencies = [ "serde", ] @@ -3556,6 +3738,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "entities" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" + [[package]] name = "enum-as-inner" version = "0.6.0" @@ -3565,7 +3753,27 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", +] + +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", ] [[package]] @@ -3577,7 +3785,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3601,9 +3809,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55d05712b2d8d88102bc9868020c9e5c7a1f5527c452b9b97450a1d006140ba7" +checksum = "388979d208a049ffdfb22fa33b9c81942215b940910bccfe258caeb25d125cb3" dependencies = [ "serde", ] @@ -3765,7 +3973,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.48", + "syn 2.0.49", "toml 0.8.10", "walkdir", ] @@ -3783,7 +3991,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3809,7 +4017,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.48", + "syn 2.0.49", "tempfile", "thiserror", "tiny-keccak", @@ -3825,7 +4033,7 @@ dependencies = [ "chrono", "ethers-core", "reqwest", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -3934,7 +4142,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "solang-parser", @@ -3964,6 +4172,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + [[package]] name = "event-listener-strategy" version = "0.4.0" @@ -3974,6 +4193,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" +dependencies = [ + "event-listener 5.1.0", + "pin-project-lite", +] + [[package]] name = "eyre" version = "0.6.12" @@ -3984,6 +4213,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fancy-regex" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +dependencies = [ + "bit-set", + "regex", +] + [[package]] name = "fast_chemail" version = "0.9.6" @@ -4202,7 +4441,7 @@ dependencies = [ [[package]] name = "futures-bounded" version = "0.2.3" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "futures-timer", "futures-util", @@ -4299,7 +4538,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4391,7 +4630,7 @@ checksum = "d4cf186fea4af17825116f72932fe52cce9a13bae39ff63b4dc0cfdb3fb4bde1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4418,6 +4657,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getset" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ghash" version = "0.5.0" @@ -4503,7 +4754,7 @@ dependencies = [ "gix-date", "itoa", "thiserror", - "winnow", + "winnow 0.5.40", ] [[package]] @@ -4598,7 +4849,7 @@ dependencies = [ "smallvec", "thiserror", "unicode-bom", - "winnow", + "winnow 0.5.40", ] [[package]] @@ -4824,7 +5075,7 @@ checksum = "d75e7ab728059f595f6ddc1ad8771b8d6a231971ae493d9d5948ecad366ee8bb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4871,7 +5122,7 @@ dependencies = [ "itoa", "smallvec", "thiserror", - "winnow", + "winnow 0.5.40", ] [[package]] @@ -4998,7 +5249,7 @@ dependencies = [ "gix-validate", "memmap2", "thiserror", - "winnow", + "winnow 0.5.40", ] [[package]] @@ -5328,7 +5579,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -5413,7 +5664,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" dependencies = [ "byteorder", - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -5460,9 +5711,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -5602,9 +5853,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "human_format" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86cce260d758a9aa3d7c4b99d55c815a540f8a37514ba6046ab6be402a157cb0" +checksum = "5c3b1f728c459d27b12448862017b96ad4767b1ec2ec5e6434e99f1577f085b8" [[package]] name = "humantime" @@ -5928,9 +6179,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -5939,9 +6190,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" dependencies = [ "console", "instant", @@ -6115,12 +6366,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix 0.38.31", + "libc", "windows-sys 0.52.0", ] @@ -6190,9 +6441,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] @@ -6528,6 +6779,7 @@ version = "0.6.0-alpha.3" dependencies = [ "anyhow", "assert_matches", + "cfg-if", "clap", "clap_complete", "common", @@ -6563,7 +6815,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -6576,7 +6828,7 @@ dependencies = [ "blockifier", "cairo-lang-casm", "cairo-lang-starknet", - "cairo-vm", + "cairo-vm 0.9.2", "convert_case 0.6.0", "derive_more", "ethers", @@ -6610,7 +6862,7 @@ version = "0.6.0-alpha.3" dependencies = [ "anyhow", "cairo-lang-starknet", - "cairo-vm", + "cairo-vm 0.9.2", "criterion", "katana-primitives", "page_size", @@ -6630,7 +6882,8 @@ name = "katana-executor" version = "0.6.0-alpha.3" dependencies = [ "blockifier", - "cairo-vm", + "cairo-lang-sierra", + "cairo-vm 0.9.2", "convert_case 0.6.0", "futures", "katana-primitives", @@ -6640,7 +6893,9 @@ dependencies = [ "serde_json", "similar-asserts", "starknet 0.9.0", + "starknet-types-core", "starknet_api", + "starknet_in_rust", "thiserror", "tracing", ] @@ -6654,7 +6909,7 @@ dependencies = [ "blockifier", "cairo-lang-sierra", "cairo-lang-starknet", - "cairo-vm", + "cairo-vm 0.9.2", "derive_more", "ethers", "flate2", @@ -6881,6 +7136,15 @@ dependencies = [ "regex", ] +[[package]] +name = "lambdaworks-math" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6c4d0ddd1fcd235be5196b1bcc404f89ad3e911f4c190fa01459e05dbf40f8" +dependencies = [ + "thiserror", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -6931,7 +7195,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.53.2" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "bytes", "either", @@ -6965,7 +7229,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", "libp2p-identity", @@ -6976,7 +7240,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.3.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", "libp2p-identity", @@ -7015,7 +7279,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.41.2" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "either", "fnv", @@ -7042,7 +7306,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.41.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "async-trait", "futures", @@ -7088,7 +7352,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.46.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "asynchronous-codec", "base64 0.21.7", @@ -7118,7 +7382,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.44.2" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "asynchronous-codec", "either", @@ -7158,7 +7422,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.45.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "data-encoding", "futures", @@ -7178,7 +7442,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.14.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "futures", "instant", @@ -7196,7 +7460,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "asynchronous-codec", "bytes", @@ -7221,7 +7485,7 @@ dependencies = [ [[package]] name = "libp2p-ping" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "either", "futures", @@ -7238,7 +7502,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.10.2" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "bytes", "futures", @@ -7261,7 +7525,7 @@ dependencies = [ [[package]] name = "libp2p-relay" version = "0.17.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "asynchronous-codec", "bytes", @@ -7306,7 +7570,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.44.2" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "either", "fnv", @@ -7331,18 +7595,18 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.34.3" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "libp2p-tcp" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "futures", "futures-timer", @@ -7358,7 +7622,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "futures", "futures-rustls", @@ -7376,7 +7640,7 @@ dependencies = [ [[package]] name = "libp2p-upnp" version = "0.2.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "futures", "futures-timer", @@ -7391,7 +7655,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.7.1-alpha" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "async-trait", "bytes", @@ -7419,7 +7683,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-utils" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "asynchronous-codec", "bytes", @@ -7441,7 +7705,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-websys" version = "0.3.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "bytes", "futures", @@ -7462,7 +7726,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.45.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "either", "futures", @@ -7479,7 +7743,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "229004ebba9d1d5caf41623f1523b6d52abb47d9f6ab87f7e6fc992e3b854aef" dependencies = [ - "bindgen", + "bindgen 0.68.1", "errno", "libc", ] @@ -7506,6 +7770,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "line-wrap" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" +dependencies = [ + "safemem", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -7524,6 +7797,20 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +[[package]] +name = "llvm-sys" +version = "170.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed90f72df5504c0af2e3a08ee7762a4a3e42ec2605811fc19f64879de40c50a" +dependencies = [ + "anyhow", + "cc", + "lazy_static", + "libc", + "regex-lite", + "semver 1.0.22", +] + [[package]] name = "lock_api" version = "0.4.11" @@ -7633,13 +7920,42 @@ dependencies = [ ] [[package]] -name = "memchr" -version = "2.7.1" +name = "melior" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "eecfff3838ac49bdc71179c27950f231fc7cdf289ac741ebc5f5ec462a9410cf" +dependencies = [ + "dashmap", + "melior-macro", + "mlir-sys", + "once_cell", +] [[package]] -name = "memmap2" +name = "melior-macro" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "944e2ba4856e5057e54408196c8e795f835b16a2aff75efd8832c8be96f84339" +dependencies = [ + "comrak", + "convert_case 0.6.0", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn 2.0.49", + "tblgen", + "unindent", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memmap2" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" @@ -7720,7 +8036,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -7819,6 +8135,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mlir-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5e19a5391ed2759fd9060f538330b9b89191e7b13503d7499a4f9580af6699a" +dependencies = [ + "bindgen 0.68.1", +] + [[package]] name = "monch" version = "0.5.0" @@ -7950,7 +8275,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "bytes", "futures", @@ -7987,7 +8312,7 @@ dependencies = [ "matrixmultiply", "num-complex", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "rawpointer", ] @@ -8186,7 +8511,7 @@ checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "rand", "serde", ] @@ -8202,7 +8527,7 @@ dependencies = [ "libm", "num-integer", "num-iter", - "num-traits 0.2.17", + "num-traits 0.2.18", "rand", "smallvec", "zeroize", @@ -8215,7 +8540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ "autocfg", - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -8237,23 +8562,22 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -8264,7 +8588,7 @@ checksum = "64a5fe11d4135c3bcdf3a95b18b194afa9608a5f6ff034f5d857bc9a27fb0119" dependencies = [ "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -8279,7 +8603,7 @@ dependencies = [ "num-bigint", "num-integer", "num-modular", - "num-traits 0.2.17", + "num-traits 0.2.18", "rand", ] @@ -8289,14 +8613,14 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -8330,14 +8654,14 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] @@ -8372,6 +8696,28 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "onig" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" +dependencies = [ + "bitflags 1.3.2", + "libc", + "once_cell", + "onig_sys", +] + +[[package]] +name = "onig_sys" +version = "69.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "oorandom" version = "11.1.3" @@ -8432,7 +8778,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -8465,7 +8811,7 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -8474,7 +8820,7 @@ version = "3.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", ] [[package]] @@ -8529,9 +8875,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ "arrayvec", "bitvec", @@ -8543,11 +8889,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn 1.0.109", @@ -8747,7 +9093,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -8768,7 +9114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.2", + "indexmap 2.2.3", ] [[package]] @@ -8811,7 +9157,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -8855,7 +9201,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -8904,9 +9250,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" @@ -8914,13 +9260,27 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +[[package]] +name = "plist" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" +dependencies = [ + "base64 0.21.7", + "indexmap 2.2.3", + "line-wrap", + "quick-xml", + "serde", + "time", +] + [[package]] name = "plotters" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" dependencies = [ - "num-traits 0.2.17", + "num-traits 0.2.18", "plotters-backend", "plotters-svg", "wasm-bindgen", @@ -8960,9 +9320,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" +checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" dependencies = [ "cfg-if", "concurrent-queue", @@ -9084,7 +9444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -9120,15 +9480,6 @@ dependencies = [ "toml 0.5.11", ] -[[package]] -name = "proc-macro-crate" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", -] - [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -9224,7 +9575,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -9237,7 +9588,7 @@ dependencies = [ "bit-vec", "bitflags 2.4.2", "lazy_static", - "num-traits 0.2.17", + "num-traits 0.2.18", "rand", "rand_chacha", "rand_xorshift", @@ -9306,7 +9657,7 @@ dependencies = [ "prost 0.12.3", "prost-types 0.12.3", "regex", - "syn 2.0.48", + "syn 2.0.49", "tempfile", "which 4.4.2", ] @@ -9334,7 +9685,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -9402,7 +9753,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.3.1" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "asynchronous-codec", "bytes", @@ -9411,6 +9762,15 @@ dependencies = [ "unsigned-varint 0.8.0", ] +[[package]] +name = "quick-xml" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +dependencies = [ + "memchr", +] + [[package]] name = "quinn" version = "0.10.2" @@ -9641,6 +10001,12 @@ dependencies = [ "regex-syntax 0.8.2", ] +[[package]] +name = "regex-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" + [[package]] name = "regex-syntax" version = "0.6.29" @@ -9731,7 +10097,7 @@ dependencies = [ "bitflags 2.4.2", "byteorder", "derive_more", - "indexmap 2.2.2", + "indexmap 2.2.3", "libc", "parking_lot 0.12.1", "reth-mdbx-sys", @@ -9743,7 +10109,7 @@ name = "reth-mdbx-sys" version = "0.1.0-alpha.13" source = "git+https://github.com/paradigmxyz/reth.git?rev=b34b0d3#b34b0d3c8de2598b2976f7ee2fc1a166c50b1b94" dependencies = [ - "bindgen", + "bindgen 0.68.1", "cc", "libc", ] @@ -9775,16 +10141,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -9837,7 +10204,7 @@ dependencies = [ "digest 0.10.7", "num-bigint-dig", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "pkcs1", "pkcs8", "rand_core", @@ -9872,7 +10239,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.0", - "syn 2.0.48", + "syn 2.0.49", "unicode-ident", ] @@ -9885,7 +10252,7 @@ dependencies = [ "quote", "rand", "rustc_version 0.4.0", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -9939,7 +10306,7 @@ dependencies = [ "bytes", "fastrlp", "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "parity-scale-codec", "primitive-types", "proptest", @@ -9962,7 +10329,7 @@ name = "runner-macro" version = "0.6.0-alpha.3" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -9998,7 +10365,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.21", + "semver 1.0.22", ] [[package]] @@ -10056,7 +10423,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.17.7", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -10088,7 +10455,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -10124,7 +10491,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p#3b4c636e290628de2352949ab10c2c610bf39e0a" +source = "git+https://github.com/libp2p/rust-libp2p#261965d9fc49d14db36e20ab7dcf9c8c08cfa1a8" dependencies = [ "futures", "pin-project", @@ -10133,9 +10500,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "safemem" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" [[package]] name = "salsa" @@ -10281,7 +10654,7 @@ dependencies = [ "create-output-dir", "data-encoding", "deno_task_shell", - "derive_builder", + "derive_builder 0.20.0", "directories", "dunce", "fs4", @@ -10301,7 +10674,7 @@ dependencies = [ "scarb-build-metadata", "scarb-metadata 1.10.0", "scarb-ui", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde-untagged", "serde-value", @@ -10342,8 +10715,8 @@ version = "1.10.0" source = "git+https://github.com/software-mansion/scarb?tag=v2.5.0#c531a6e509dbb8b43f1c2d37f9d74a7b1bf7243d" dependencies = [ "camino", - "derive_builder", - "semver 1.0.21", + "derive_builder 0.20.0", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -10356,7 +10729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abe986fc184f6af12d1e2522040ab55af2f5411a36651ea1e81aac8666751679" dependencies = [ "camino", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -10441,7 +10814,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -10505,9 +10878,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] @@ -10582,7 +10955,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -10626,7 +10999,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -10672,10 +11045,10 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ - "darling 0.20.5", + "darling 0.20.6", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -10710,7 +11083,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -10863,7 +11236,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ "num-bigint", - "num-traits 0.2.17", + "num-traits 0.2.18", "thiserror", "time", ] @@ -10889,6 +11262,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slug" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + [[package]] name = "smallvec" version = "1.13.1" @@ -10906,9 +11289,9 @@ dependencies = [ [[package]] name = "snapbox" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73145a30df4935f50a7b13c1882bce7d194d7071ad0bcc36e7cacbf9ef16e3ec" +checksum = "4b831b6e80fbcd2889efa75b185d24005f85981431495f995292b25836519d84" dependencies = [ "anstream", "anstyle", @@ -10919,9 +11302,9 @@ dependencies = [ [[package]] name = "snapbox-macros" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ccde059aad940984ff696fe8c280900f7ea71a6fb45fce65071a3f2c40b667" +checksum = "e1c4b838b05d15ab22754068cb73500b2f3b07bf09d310e15b27f88160f1de40" dependencies = [ "anstream", ] @@ -10937,7 +11320,7 @@ dependencies = [ "chacha20poly1305", "curve25519-dalek", "rand_core", - "ring 0.17.7", + "ring 0.17.8", "rustc_version 0.4.0", "sha2 0.10.8", "subtle", @@ -11027,7 +11410,7 @@ dependencies = [ "notify-debouncer-mini", "scarb", "scarb-ui", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "smol_str", @@ -11134,7 +11517,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.2.2", + "indexmap 2.2.3", "log", "memchr", "once_cell", @@ -11305,6 +11688,22 @@ dependencies = [ "uuid 1.7.0", ] +[[package]] +name = "starknet" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcb61961b91757a9bc2d11549067445b2f921bd957f53710db35449767a1ba3" +dependencies = [ + "starknet-accounts 0.4.0", + "starknet-contract 0.4.0", + "starknet-core 0.5.1", + "starknet-crypto 0.6.1", + "starknet-ff", + "starknet-macros", + "starknet-providers 0.5.0", + "starknet-signers 0.3.0", +] + [[package]] name = "starknet" version = "0.8.0" @@ -11337,6 +11736,19 @@ dependencies = [ "starknet-signers 0.7.0", ] +[[package]] +name = "starknet-accounts" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111ed887e4db14f0df1f909905e7737e4730770c8ed70997b58a71d5d940daac" +dependencies = [ + "async-trait", + "starknet-core 0.5.1", + "starknet-providers 0.5.0", + "starknet-signers 0.3.0", + "thiserror", +] + [[package]] name = "starknet-accounts" version = "0.7.0" @@ -11365,6 +11777,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "starknet-contract" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d6f81a647694b2cb669ab60e77954b57bf5fbc757f5fcaf0a791c3bd341f04" +dependencies = [ + "serde", + "serde_json", + "serde_with", + "starknet-accounts 0.4.0", + "starknet-core 0.5.1", + "starknet-providers 0.5.0", + "thiserror", +] + [[package]] name = "starknet-contract" version = "0.7.0" @@ -11395,6 +11822,24 @@ dependencies = [ "thiserror", ] +[[package]] +name = "starknet-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91f89c79b641618de8aa9668d74c6b6634659ceca311c6318a35c025f9d4d969" +dependencies = [ + "base64 0.21.7", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with", + "sha3", + "starknet-crypto 0.6.1", + "starknet-ff", +] + [[package]] name = "starknet-core" version = "0.8.1" @@ -11442,7 +11887,7 @@ dependencies = [ "hmac", "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "rfc6979", "sha2 0.10.8", "starknet-crypto-codegen", @@ -11462,11 +11907,11 @@ dependencies = [ "hmac", "num-bigint", "num-integer", - "num-traits 0.2.17", + "num-traits 0.2.18", "rfc6979", "sha2 0.10.8", "starknet-crypto-codegen", - "starknet-curve 0.4.0", + "starknet-curve 0.4.1", "starknet-ff", "zeroize", ] @@ -11477,9 +11922,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af6527b845423542c8a16e060ea1bc43f67229848e7cd4c4d80be994a84220ce" dependencies = [ - "starknet-curve 0.4.0", + "starknet-curve 0.4.1", "starknet-ff", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -11493,9 +11938,9 @@ dependencies = [ [[package]] name = "starknet-curve" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68a0d87ae56572abf83ddbfd44259a7c90dbeeee1629a1ffe223e7f9a8f3052" +checksum = "63c454fecadfb3fe56ee82c405439d663c8a037667cc9d8e4acb1fb17e15b1af" dependencies = [ "starknet-ff", ] @@ -11522,7 +11967,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c5d2964612f0ccd0a700279e33cfc98d6db04f64645ff834f3b7ec422142d7a" dependencies = [ "starknet-core 0.9.0", - "syn 2.0.48", + "syn 2.0.49", +] + +[[package]] +name = "starknet-providers" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbbfccb46a8969fb3ac803718d9d8270cff4eed5b7f6b9ba234875ad2cc997c5" +dependencies = [ + "async-trait", + "auto_impl", + "ethereum-types", + "flate2", + "log", + "reqwest", + "serde", + "serde_json", + "serde_with", + "starknet-core 0.5.1", + "thiserror", + "url", ] [[package]] @@ -11565,6 +12030,22 @@ dependencies = [ "url", ] +[[package]] +name = "starknet-signers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313524cc79344015ef2a8618947332ab17012b5c50600c7f84c60989bdec980" +dependencies = [ + "async-trait", + "auto_impl", + "crypto-bigint", + "eth-keystore", + "rand", + "starknet-core 0.5.1", + "starknet-crypto 0.6.1", + "thiserror", +] + [[package]] name = "starknet-signers" version = "0.6.0" @@ -11597,17 +12078,34 @@ dependencies = [ "thiserror", ] +[[package]] +name = "starknet-types-core" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b6b868f545d43b474c2c00e9349c489fdeb7ff17eb00cdf339744ac4cae0930" +dependencies = [ + "bitvec", + "lambdaworks-math", + "lazy_static", + "num-bigint", + "num-integer", + "num-traits 0.2.18", + "serde", +] + [[package]] name = "starknet_api" -version = "0.7.0-rc.0" +version = "0.7.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a1012226101cbe3c0483c637ca90186240f131f6af89069ae37c59073f16f9" +checksum = "88969610ab6ea9391e0e05a3e7c38acc49dc1cb49941b93ca52814075002b92f" dependencies = [ "cairo-lang-starknet", "derive_more", "hex", - "indexmap 2.2.2", + "indexmap 2.2.3", "once_cell", + "parity-scale-codec", + "parity-scale-codec-derive", "primitive-types", "serde", "serde_json", @@ -11617,6 +12115,44 @@ dependencies = [ "thiserror", ] +[[package]] +name = "starknet_in_rust" +version = "0.4.0" +source = "git+https://github.com/dojoengine/starknet_in_rust.git?rev=47b65ca#47b65ca24b397c4c8886b6b1d8eb50e76c87d714" +dependencies = [ + "anyhow", + "auto_impl", + "base64 0.21.7", + "cairo-lang-casm", + "cairo-lang-sierra", + "cairo-lang-starknet", + "cairo-lang-utils", + "cairo-native", + "cairo-vm 1.0.0-rc0", + "flate2", + "getset", + "hex", + "k256", + "keccak", + "lazy_static", + "mimalloc", + "num-bigint", + "num-integer", + "num-traits 0.2.18", + "once_cell", + "p256", + "sec1", + "serde", + "serde_json", + "serde_json_pythonic", + "sha3", + "starknet 0.5.0", + "starknet-crypto 0.6.1", + "starknet_api", + "thiserror", + "tracing", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -11653,6 +12189,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "strum" version = "0.24.1" @@ -11691,7 +12233,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -11754,7 +12296,7 @@ dependencies = [ "hex", "once_cell", "reqwest", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "sha2 0.10.8", @@ -11776,9 +12318,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -11803,6 +12345,29 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syntect" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" +dependencies = [ + "bincode 1.3.3", + "bitflags 1.3.2", + "fancy-regex", + "flate2", + "fnv", + "once_cell", + "onig", + "plist", + "regex-syntax 0.8.2", + "serde", + "serde_derive", + "serde_json", + "thiserror", + "walkdir", + "yaml-rust", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -11841,6 +12406,18 @@ dependencies = [ "xattr", ] +[[package]] +name = "tblgen" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d19c09266feb8b16718d1183044d14703a0b4b59e55ce8beb4d6e21dd066b1b" +dependencies = [ + "bindgen 0.66.1", + "cc", + "paste", + "thiserror", +] + [[package]] name = "tempfile" version = "3.10.0" @@ -11873,6 +12450,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix 0.38.31", + "windows-sys 0.48.0", +] + [[package]] name = "termtree" version = "0.4.1" @@ -11897,27 +12484,27 @@ checksum = "7ba277e77219e9eea169e8508942db1bf5d8a41ff2db9b20aab5a5aadc9fa25d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -12054,7 +12641,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -12159,7 +12746,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.4", + "toml_edit 0.22.6", ] [[package]] @@ -12177,22 +12764,11 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.2.2", - "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] @@ -12201,24 +12777,24 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.4" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.1", ] [[package]] @@ -12294,7 +12870,7 @@ dependencies = [ "proc-macro2", "prost-build 0.12.3", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -12696,7 +13272,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -12725,7 +13301,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -12857,6 +13433,12 @@ dependencies = [ "webrtc-util", ] +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typed-builder" version = "0.18.1" @@ -12874,7 +13456,7 @@ checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -12967,9 +13549,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -12989,6 +13571,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unindent" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" + [[package]] name = "universal-hash" version = "0.5.1" @@ -13203,7 +13791,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -13237,7 +13825,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -13270,7 +13858,7 @@ checksum = "a5211b7550606857312bba1d978a8ec75692eae187becc5e680444fffc5e6f89" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -13330,7 +13918,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -13786,9 +14374,18 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.39" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" dependencies = [ "memchr", ] @@ -13872,6 +14469,12 @@ dependencies = [ "rustix 0.38.31", ] +[[package]] +name = "xdg" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" + [[package]] name = "xml-rs" version = "0.8.19" @@ -13904,9 +14507,18 @@ checksum = "7e2c411759b501fb9501aac2b1b2d287a6e93e5bdcf13c25306b23e1b716dd0e" [[package]] name = "xxhash-rust" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] [[package]] name = "yamux" @@ -13971,7 +14583,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -13991,7 +14603,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] diff --git a/bin/katana/Cargo.toml b/bin/katana/Cargo.toml index b208bb03d5..774a438211 100644 --- a/bin/katana/Cargo.toml +++ b/bin/katana/Cargo.toml @@ -8,6 +8,7 @@ version.workspace = true [dependencies] anyhow.workspace = true +cfg-if = "1.0.0" clap.workspace = true clap_complete.workspace = true common.workspace = true @@ -31,7 +32,11 @@ url.workspace = true assert_matches = "1.5.0" [features] -default = [ "jemalloc", "messaging" ] +default = [ "blockifier", "jemalloc", "messaging" ] + +blockifier = [ "katana-executor/blockifier" ] +sir = [ "katana-executor/sir" ] + jemalloc = [ "metrics/jemalloc" ] messaging = [ "katana-core/messaging" ] starknet-messaging = [ "katana-core/starknet-messaging", "messaging" ] diff --git a/bin/katana/src/main.rs b/bin/katana/src/main.rs index 1c20a4c0f2..0c62ce949a 100644 --- a/bin/katana/src/main.rs +++ b/bin/katana/src/main.rs @@ -61,8 +61,19 @@ async fn main() -> Result<(), Box> { ..Default::default() }; - use katana_executor::implementation::blockifier::BlockifierFactory; - let executor_factory = BlockifierFactory::new(cfg_env, simulation_flags); + cfg_if::cfg_if! { + if #[cfg(all(feature = "blockifier", feature = "sir"))] { + compile_error!("Cannot enable both `blockifier` and `sir` features at the same time"); + } else if #[cfg(feature = "blockifier")] { + use katana_executor::implementation::blockifier::BlockifierFactory; + let executor_factory = BlockifierFactory::new(cfg_env, simulation_flags); + } else if #[cfg(feature = "sir")] { + use katana_executor::implementation::sir::NativeExecutorFactory; + let executor_factory = NativeExecutorFactory::new(cfg_env, simulation_flags); + } else { + compile_error!("At least one of the following features must be enabled: blockifier, sir"); + } + } let sequencer = Arc::new(KatanaSequencer::new(executor_factory, sequencer_config, starknet_config).await?); diff --git a/crates/katana/executor/.env.cairo-native b/crates/katana/executor/.env.cairo-native new file mode 100644 index 0000000000..d47b8fabea --- /dev/null +++ b/crates/katana/executor/.env.cairo-native @@ -0,0 +1,3 @@ +export MLIR_SYS_170_PREFIX=/opt/homebrew/opt/llvm@17 +export LLVM_SYS_170_PREFIX=/opt/homebrew/opt/llvm@17 +export TABLEGEN_170_PREFIX=/opt/homebrew/opt/llvm@17 diff --git a/crates/katana/executor/Cargo.toml b/crates/katana/executor/Cargo.toml index 87bbcc529c..9290933a59 100644 --- a/crates/katana/executor/Cargo.toml +++ b/crates/katana/executor/Cargo.toml @@ -22,6 +22,11 @@ tracing.workspace = true # blockifier deps blockifier = { workspace = true, optional = true } +# starknet_in_rust deps +cairo-lang-sierra = { workspace = true, optional = true } +sir = { package = "starknet_in_rust", git = "https://github.com/dojoengine/starknet_in_rust.git", rev = "47b65ca", optional = true } +starknet-types-core = { version = "0.0.6", optional = true } + [dev-dependencies] cairo-vm.workspace = true katana-provider.workspace = true @@ -30,6 +35,8 @@ serde_json.workspace = true similar-asserts.workspace = true [features] -default = [ "blockifier" ] +default = [ "blockifier", "sir" ] blockifier = [ "dep:blockifier", "katana-primitives/blockifier" ] +native = [ "sir", "sir/cairo-native" ] +sir = [ "dep:sir", "dep:starknet-types-core" ] diff --git a/crates/katana/executor/src/abstraction.rs b/crates/katana/executor/src/abstraction.rs index d8eff5d75d..bcec491c48 100644 --- a/crates/katana/executor/src/abstraction.rs +++ b/crates/katana/executor/src/abstraction.rs @@ -35,8 +35,13 @@ pub enum ExecutorError { #[error(transparent)] Other(Box), + #[cfg(feature = "blockifier")] #[error(transparent)] BlockifierError(#[from] crate::implementation::blockifier::Error), + + #[cfg(feature = "sir")] + #[error(transparent)] + SirError(#[from] crate::implementation::sir::Error), } pub type ExecutorResult = Result; diff --git a/crates/katana/executor/src/implementation/mod.rs b/crates/katana/executor/src/implementation/mod.rs index 1ce7601f62..3e4f93f2b9 100644 --- a/crates/katana/executor/src/implementation/mod.rs +++ b/crates/katana/executor/src/implementation/mod.rs @@ -1,3 +1,7 @@ +#[cfg(feature = "blockifier")] pub mod blockifier; +#[cfg(feature = "sir")] +pub mod sir; + pub mod noop; diff --git a/crates/katana/executor/src/implementation/sir/mod.rs b/crates/katana/executor/src/implementation/sir/mod.rs new file mode 100644 index 0000000000..c5939a29ae --- /dev/null +++ b/crates/katana/executor/src/implementation/sir/mod.rs @@ -0,0 +1,299 @@ +mod output; +mod state; +mod utils; + +use std::collections::HashMap; +use std::sync::Arc; + +use katana_primitives::block::{ExecutableBlock, PartialHeader}; +use katana_primitives::class::{ClassHash, CompiledClassHash}; +use katana_primitives::contract::{ContractAddress, StorageKey, StorageValue}; +use katana_primitives::env::{BlockEnv, CfgEnv}; +use katana_primitives::receipt::Receipt; +use katana_primitives::state::{StateUpdates, StateUpdatesWithDeclaredClasses}; +use katana_primitives::transaction::{ExecutableTx, ExecutableTxWithHash, TxWithHash}; +use katana_primitives::FieldElement; +use katana_provider::traits::state::StateProvider; +use sir::definitions::block_context::{ + self, BlockContext, FeeTokenAddresses, GasPrices, StarknetOsConfig, +}; +use sir::state::contract_class_cache::PermanentContractClassCache; +use sir::state::{cached_state, BlockInfo}; + +use self::state::CachedState; +pub use self::utils::Error; +use crate::abstraction::{ + BlockExecutor, ExecutionOutput, ExecutorFactory, ExecutorResult, SimulationFlag, + StateProviderDb, TransactionExecutionOutput, TransactionExecutor, +}; +use crate::EntryPointCall; + +/// A factory for creating [StarknetVMProcessor] instances. +#[derive(Debug)] +pub struct NativeExecutorFactory { + cfg: CfgEnv, + flags: SimulationFlag, +} + +impl NativeExecutorFactory { + /// Create a new factory with the given configuration and simulation flags. + pub fn new(cfg: CfgEnv, flags: SimulationFlag) -> Self { + Self { cfg, flags } + } +} + +impl ExecutorFactory for NativeExecutorFactory { + fn with_state<'a, P>(&self, state: P) -> Box + 'a> + where + P: StateProvider + 'a, + { + self.with_state_and_block_env(state, BlockEnv::default()) + } + + fn with_state_and_block_env<'a, P>( + &self, + state: P, + block_env: BlockEnv, + ) -> Box + 'a> + where + P: StateProvider + 'a, + { + let cfg_env = self.cfg.clone(); + let simulation_flags = self.flags.clone(); + Box::new(StarknetVMProcessor::new(Box::new(state), block_env, cfg_env, simulation_flags)) + } + + fn cfg(&self) -> &CfgEnv { + &self.cfg + } +} + +pub struct StarknetVMProcessor<'a> { + block_context: BlockContext, + state: Arc, PermanentContractClassCache>>, + transactions: Vec<(TxWithHash, Option)>, + simulation_flags: SimulationFlag, +} + +impl<'a> StarknetVMProcessor<'a> { + pub fn new( + state: Box, + block_env: BlockEnv, + cfg_env: CfgEnv, + simulation_flags: SimulationFlag, + ) -> Self { + let chain_id = utils::to_sir_felt(&cfg_env.chain_id.id()); + let fee_token_addreses = FeeTokenAddresses::new( + utils::to_sir_address(&cfg_env.fee_token_addresses.eth), + utils::to_sir_address(&cfg_env.fee_token_addresses.strk), + ); + + let gas_price = GasPrices { + eth_l1_gas_price: block_env.l1_gas_prices.eth, + strk_l1_gas_price: block_env.l1_gas_prices.strk, + }; + + let block_info = BlockInfo { + gas_price, + block_number: block_env.number, + block_timestamp: block_env.timestamp, + sequencer_address: utils::to_sir_address(&block_env.sequencer_address), + }; + + let block_context = BlockContext::new( + StarknetOsConfig::new(chain_id, fee_token_addreses), + Default::default(), + Default::default(), + cfg_env.vm_resource_fee_cost.clone(), + cfg_env.invoke_tx_max_n_steps as u64, + cfg_env.validate_max_n_steps as u64, + block_info, + Default::default(), + false, + ); + + let contract_class_cache = PermanentContractClassCache::default(); + let state = Arc::new(CachedState::new(StateProviderDb(state), contract_class_cache)); + let executed_txs = Vec::new(); + + Self { block_context, state, transactions: executed_txs, simulation_flags } + } + + fn fill_block_env_from_header(&mut self, header: &PartialHeader) { + let number = header.number; + let timestamp = header.timestamp; + let sequencer_address = utils::to_sir_address(&header.sequencer_address); + + let gas_prices = block_context::GasPrices { + eth_l1_gas_price: header.gas_prices.eth, + strk_l1_gas_price: header.gas_prices.strk, + }; + + self.block_context.block_info_mut().block_number = number; + self.block_context.block_info_mut().gas_price = gas_prices; + self.block_context.block_info_mut().block_timestamp = timestamp; + self.block_context.block_info_mut().sequencer_address = sequencer_address; + } +} + +impl<'a> TransactionExecutor for StarknetVMProcessor<'a> { + fn execute( + &mut self, + tx: ExecutableTxWithHash, + ) -> ExecutorResult> { + let state = &self.state; + let block_context = &self.block_context; + let flags = &self.simulation_flags; + + let class_declaration_artifacts = if let ExecutableTx::Declare(tx) = tx.as_ref() { + let class_hash = tx.class_hash(); + Some((class_hash, tx.compiled_class.clone(), tx.sierra_class.clone())) + } else { + None + }; + + let tx_ = TxWithHash::from(&tx); + + let gas = 0; + let res = utils::transact(tx, &mut state.0.write().inner, block_context, gas, flags)?; + + let receipt = res.receipt(tx_.as_ref()); + self.transactions.push((tx_, Some(receipt))); + + if let Some((class_hash, compiled_class, sierra_class)) = class_declaration_artifacts { + state.0.write().declared_classes.insert(class_hash, (compiled_class, sierra_class)); + } + + Ok(Box::new(res)) + } + + fn simulate( + &self, + tx: ExecutableTxWithHash, + flags: SimulationFlag, + ) -> ExecutorResult> { + let state = &self.state.0.read().inner; + + let state_reader = Arc::new(state); + let contract_classes = Arc::new(PermanentContractClassCache::default()); + let mut state = cached_state::CachedState::new(state_reader, contract_classes); + + let block_context = &self.block_context; + + let gas = 0; + let res = utils::transact(tx, &mut state, block_context, gas, &flags)?; + + Ok(Box::new(res)) + } + + fn call(&self, call: EntryPointCall, initial_gas: u128) -> ExecutorResult> { + let block_context = &self.block_context; + + let state_reader = Arc::clone(&self.state); + let contract_classes = Arc::new(PermanentContractClassCache::default()); + let mut state = cached_state::CachedState::new(state_reader, contract_classes); + + let res = utils::call(call, &mut state, block_context, initial_gas)?; + + let info = res.call_info.expect("should exist in call result"); + let retdata = info.retdata.iter().map(utils::to_felt).collect(); + + Ok(retdata) + } +} + +impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> { + fn execute_block(&mut self, block: ExecutableBlock) -> ExecutorResult<()> { + self.fill_block_env_from_header(&block.header); + + for tx in block.body { + let _ = self.execute(tx)?; + } + + Ok(()) + } + + fn take_execution_output(&mut self) -> ExecutorResult { + let transactions = std::mem::take(&mut self.transactions); + let state = &mut self.state.0.write(); + + let state_changes = std::mem::take(state.inner.cache_mut()); + let state_diffs = utils::state_diff_from_state_cache(state_changes); + let compiled_classes = std::mem::take(&mut state.declared_classes); + + let nonce_updates: HashMap = state_diffs + .address_to_nonce() + .iter() + .map(|(k, v)| (utils::to_address(k), utils::to_felt(v))) + .collect(); + + let declared_classes: HashMap = state_diffs + .class_hash_to_compiled_class() + .iter() + .map(|(k, v)| (utils::to_class_hash(k), utils::to_class_hash(v))) + .collect(); + + let contract_updates: HashMap = state_diffs + .address_to_class_hash() + .iter() + .map(|(k, v)| (utils::to_address(k), utils::to_class_hash(v))) + .collect(); + + let storage_updates: HashMap> = + state_diffs + .storage_updates() + .iter() + .map(|(k, v)| { + let k = utils::to_address(k); + let v = v.iter().map(|(k, v)| (utils::to_felt(k), utils::to_felt(v))).collect(); + (k, v) + }) + .collect(); + + let total_classes = declared_classes.len(); + let mut declared_compiled_classes = HashMap::with_capacity(total_classes); + let mut declared_sierra_classes = HashMap::with_capacity(total_classes); + + for (hash, (compiled, sierra)) in compiled_classes { + declared_compiled_classes.insert(hash, compiled); + if let Some(sierra) = sierra { + declared_sierra_classes.insert(hash, sierra); + } + } + + let state_updates = StateUpdatesWithDeclaredClasses { + declared_sierra_classes, + declared_compiled_classes, + state_updates: StateUpdates { + nonce_updates, + storage_updates, + contract_updates, + declared_classes, + }, + }; + + Ok(ExecutionOutput { states: state_updates, transactions }) + } + + fn state(&self) -> Box { + Box::new(self.state.clone()) + } + + fn transactions(&self) -> &[(TxWithHash, Option)] { + &self.transactions + } + + fn block_env(&self) -> BlockEnv { + BlockEnv { + number: self.block_context.block_info().block_number, + timestamp: self.block_context.block_info().block_timestamp, + sequencer_address: utils::to_address( + &self.block_context.block_info().sequencer_address, + ), + l1_gas_prices: katana_primitives::block::GasPrices { + eth: self.block_context.block_info().gas_price.eth_l1_gas_price, + strk: self.block_context.block_info().gas_price.strk_l1_gas_price, + }, + } + } +} diff --git a/crates/katana/executor/src/implementation/sir/output.rs b/crates/katana/executor/src/implementation/sir/output.rs new file mode 100644 index 0000000000..05a418e83d --- /dev/null +++ b/crates/katana/executor/src/implementation/sir/output.rs @@ -0,0 +1,168 @@ +use std::collections::HashMap; + +use katana_primitives::receipt::{ + DeclareTxReceipt, DeployAccountTxReceipt, Event, InvokeTxReceipt, L1HandlerTxReceipt, + MessageToL1, Receipt, TxExecutionResources, +}; +use katana_primitives::transaction::Tx; +use sir::execution::CallInfo; + +use super::utils; +use crate::abstraction::TransactionExecutionOutput; + +#[derive(Debug, Default)] +pub struct TransactionExecutionInfo { + pub gas_used: u128, + pub(super) inner: sir::execution::TransactionExecutionInfo, +} + +impl TransactionExecutionOutput for TransactionExecutionInfo { + fn receipt(&self, tx: &Tx) -> Receipt { + let actual_fee = self.inner.actual_fee; + let revert_error = self.inner.revert_error.clone(); + + let events = events_from_exec_info(self); + let messages_sent = l2_to_l1_messages_from_exec_info(self); + let execution_resources = parse_actual_resources(&self.inner.actual_resources); + + match tx { + Tx::Invoke(_) => Receipt::Invoke(InvokeTxReceipt { + events, + actual_fee, + revert_error, + messages_sent, + execution_resources, + }), + + Tx::Declare(_) => Receipt::Declare(DeclareTxReceipt { + events, + actual_fee, + revert_error, + messages_sent, + execution_resources, + }), + + Tx::L1Handler(tx) => Receipt::L1Handler(L1HandlerTxReceipt { + events, + actual_fee, + revert_error, + messages_sent, + execution_resources, + message_hash: tx.message_hash, + }), + + Tx::DeployAccount(tx) => Receipt::DeployAccount(DeployAccountTxReceipt { + events, + actual_fee, + revert_error, + messages_sent, + execution_resources, + contract_address: tx.contract_address(), + }), + } + } + + fn actual_fee(&self) -> u128 { + self.inner.actual_fee + } + + fn gas_used(&self) -> u128 { + self.gas_used + } + + fn revert_error(&self) -> Option<&str> { + self.inner.revert_error.as_deref() + } +} + +fn events_from_exec_info(info: &TransactionExecutionInfo) -> Vec { + let mut events: Vec = vec![]; + + fn get_events_recursively(call_info: &CallInfo) -> Vec { + let mut events: Vec = vec![]; + + events.extend(call_info.events.iter().map(|e| Event { + from_address: utils::to_address(&call_info.contract_address), + data: e.data.iter().map(utils::to_felt).collect(), + keys: e.keys.iter().map(utils::to_felt).collect(), + })); + + call_info.internal_calls.iter().for_each(|call| { + events.extend(get_events_recursively(call)); + }); + + events + } + + if let Some(ref call) = info.inner.validate_info { + events.extend(get_events_recursively(call)); + } + + if let Some(ref call) = info.inner.call_info { + events.extend(get_events_recursively(call)); + } + + if let Some(ref call) = info.inner.fee_transfer_info { + events.extend(get_events_recursively(call)); + } + + events +} + +fn l2_to_l1_messages_from_exec_info(info: &TransactionExecutionInfo) -> Vec { + let mut messages = vec![]; + + fn get_messages_recursively(info: &CallInfo) -> Vec { + let mut messages = vec![]; + + // By default, `from_address` must correspond to the contract address that + // is sending the message. In the case of library calls, `code_address` is `None`, + // we then use the `caller_address` instead (which can also be an account). + let from_address = if let Some(ref code_address) = info.code_address { + utils::to_address(code_address) + } else { + utils::to_address(&info.caller_address) + }; + + messages.extend(info.l2_to_l1_messages.iter().map(|m| MessageToL1 { + from_address, + to_address: utils::to_felt(&m.to_address.0), + payload: m.payload.iter().map(utils::to_felt).collect(), + })); + + info.internal_calls.iter().for_each(|call| { + messages.extend(get_messages_recursively(call)); + }); + + messages + } + + if let Some(ref info) = info.inner.validate_info { + messages.extend(get_messages_recursively(info)); + } + + if let Some(ref info) = info.inner.call_info { + messages.extend(get_messages_recursively(info)); + } + + if let Some(ref info) = info.inner.fee_transfer_info { + messages.extend(get_messages_recursively(info)); + } + + messages +} + +fn parse_actual_resources(resources: &HashMap) -> TxExecutionResources { + TxExecutionResources { + steps: resources.get("n_steps").copied().unwrap_or_default() as u64, + memory_holes: resources.get("memory_holes").map(|x| *x as u64), + ec_op_builtin: resources.get("ec_op_builtin").map(|x| *x as u64), + ecdsa_builtin: resources.get("ecdsa_builtin").map(|x| *x as u64), + keccak_builtin: resources.get("keccak_builtin").map(|x| *x as u64), + bitwise_builtin: resources.get("bitwise_builtin").map(|x| *x as u64), + pedersen_builtin: resources.get("pedersen_builtin").map(|x| *x as u64), + poseidon_builtin: resources.get("poseidon_builtin").map(|x| *x as u64), + range_check_builtin: resources.get("range_check_builtin").map(|x| *x as u64), + segment_arena_builtin: resources.get("segment_arena_builtin").map(|x| *x as u64), + } +} diff --git a/crates/katana/executor/src/implementation/sir/state.rs b/crates/katana/executor/src/implementation/sir/state.rs new file mode 100644 index 0000000000..76085ce46e --- /dev/null +++ b/crates/katana/executor/src/implementation/sir/state.rs @@ -0,0 +1,249 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use katana_primitives::class::{CompiledClass, FlattenedSierraClass}; +use katana_primitives::contract::{ContractAddress, Nonce, StorageKey, StorageValue}; +use katana_primitives::FieldElement; +use katana_provider::error::ProviderError; +use katana_provider::traits::contract::ContractClassProvider; +use katana_provider::traits::state::StateProvider; +use katana_provider::ProviderResult; +use parking_lot::RwLock; +use sir::core::errors::state_errors::StateError; +use sir::state::cached_state; +use sir::state::contract_class_cache::ContractClassCache; +use sir::state::state_api::StateReader; +use sir::state::state_cache::StorageEntry; +use sir::transaction::{Address, ClassHash, CompiledClassHash}; +use sir::Felt252; + +use super::utils; +use crate::abstraction::StateProviderDb; + +/// A helper trait to enforce that a type must implement both [StateProvider] and [StateReader]. +pub(super) trait StateDb: StateProvider + StateReader {} +impl StateDb for T where T: StateProvider + StateReader {} + +impl<'a> StateReader for StateProviderDb<'a> { + fn get_class_hash_at(&self, contract_address: &Address) -> Result { + match self.0.class_hash_of_contract(utils::to_address(contract_address)) { + Ok(Some(value)) => Ok(utils::to_sir_class_hash(&value)), + + Ok(None) => Ok(ClassHash::default()), + Err(e) => Err(StateError::CustomError(e.to_string())), + } + } + + fn get_compiled_class_hash( + &self, + class_hash: &ClassHash, + ) -> Result { + match self.0.compiled_class_hash_of_class_hash(utils::to_class_hash(class_hash)) { + Ok(Some(value)) => Ok(utils::to_sir_class_hash(&value)), + + Ok(None) => Err(StateError::NoneCompiledHash(*class_hash)), + Err(e) => Err(StateError::CustomError(e.to_string())), + } + } + + fn get_contract_class( + &self, + class_hash: &ClassHash, + ) -> Result + { + match self.0.class(utils::to_class_hash(class_hash)) { + Ok(Some(value)) => Ok(utils::to_sir_compiled_class(value)), + + Ok(None) => Err(StateError::NoneCompiledClass(*class_hash)), + Err(e) => Err(StateError::CustomError(e.to_string())), + } + } + + fn get_nonce_at(&self, contract_address: &Address) -> Result { + match self.0.nonce(utils::to_address(contract_address)) { + Ok(Some(value)) => Ok(utils::to_sir_felt(&value)), + + Ok(None) => Ok(Felt252::ZERO), + Err(e) => Err(StateError::CustomError(e.to_string())), + } + } + + fn get_storage_at(&self, storage_entry: &StorageEntry) -> Result { + let address = utils::to_address(&storage_entry.0); + let key = FieldElement::from_bytes_be(&storage_entry.1).unwrap(); + + match self.0.storage(address, key) { + Ok(Some(value)) => Ok(utils::to_sir_felt(&value)), + + Ok(None) => Ok(Felt252::ZERO), + Err(e) => Err(StateError::CustomError(e.to_string())), + } + } +} + +type DeclaredClass = (CompiledClass, Option); + +#[derive(Debug, Default)] +pub(super) struct CachedState(pub(super) Arc>>) +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync; + +impl Clone for CachedState +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } +} + +#[derive(Debug, Default)] +pub(super) struct CachedStateInner +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + pub(super) inner: cached_state::CachedState, + pub(super) declared_classes: HashMap, +} + +impl CachedState +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + pub(super) fn new(state: S, classes_cache: C) -> Self { + let declared_classes = HashMap::new(); + let cached_state = cached_state::CachedState::new(Arc::new(state), Arc::new(classes_cache)); + let inner = CachedStateInner { inner: cached_state, declared_classes }; + Self(Arc::new(RwLock::new(inner))) + } +} + +impl ContractClassProvider for CachedState +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + fn class( + &self, + hash: katana_primitives::class::ClassHash, + ) -> ProviderResult> { + let inner = self.0.read(); + let class = inner.declared_classes.get(&hash).map(|(class, _)| class.clone()); + Ok(class) + } + + fn compiled_class_hash_of_class_hash( + &self, + hash: katana_primitives::class::ClassHash, + ) -> ProviderResult> { + let state = self.0.read(); + let hash = utils::to_sir_class_hash(&hash); + + match state.inner.get_compiled_class_hash(&hash) { + Ok(value) => Ok(Some(utils::to_class_hash(&value))), + + Err(StateError::NoneCompiledHash(_)) => Ok(None), + Err(e) => Err(ProviderError::Other(e.to_string())), + } + } + + fn sierra_class( + &self, + hash: katana_primitives::class::ClassHash, + ) -> ProviderResult> { + let state = self.0.read(); + if let Some((_, sierra)) = state.declared_classes.get(&hash) { + Ok(sierra.clone()) + } else { + state.inner.state_reader.sierra_class(hash) + } + } +} + +impl StateProvider for CachedState +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + fn class_hash_of_contract( + &self, + address: ContractAddress, + ) -> ProviderResult> { + let state = self.0.read(); + let address = utils::to_sir_address(&address); + + match state.inner.get_class_hash_at(&address) { + Ok(value) => Ok(Some(utils::to_class_hash(&value))), + + Err(StateError::NoneClassHash(_)) => Ok(None), + Err(e) => Err(ProviderError::Other(e.to_string())), + } + } + + fn nonce(&self, address: ContractAddress) -> ProviderResult> { + let state = self.0.read(); + let address = utils::to_sir_address(&address); + + match state.inner.get_nonce_at(&address) { + Ok(value) => Ok(Some(utils::to_felt(&value))), + + Err(StateError::NoneNonce(_)) => Ok(None), + Err(e) => Err(ProviderError::Other(e.to_string())), + } + } + + fn storage( + &self, + address: ContractAddress, + storage_key: StorageKey, + ) -> ProviderResult> { + let state = self.0.read(); + + let address = utils::to_sir_address(&address); + let key = utils::to_sir_felt(&storage_key); + + match state.inner.get_storage_at(&(address, key.to_bytes_be())) { + Ok(value) => Ok(Some(utils::to_felt(&value))), + + Err(StateError::NoneStorage(_)) => Ok(None), + Err(e) => Err(ProviderError::Other(e.to_string())), + } + } +} + +impl StateReader for CachedState +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + fn get_class_hash_at(&self, contract_address: &Address) -> Result { + self.0.read().inner.get_class_hash_at(contract_address) + } + + fn get_compiled_class_hash( + &self, + class_hash: &ClassHash, + ) -> Result { + self.0.read().inner.get_compiled_class_hash(class_hash) + } + + fn get_contract_class( + &self, + class_hash: &ClassHash, + ) -> Result + { + self.0.read().inner.get_contract_class(class_hash) + } + + fn get_nonce_at(&self, contract_address: &Address) -> Result { + self.0.read().inner.get_nonce_at(contract_address) + } + + fn get_storage_at(&self, storage_entry: &StorageEntry) -> Result { + self.0.read().inner.get_storage_at(storage_entry) + } +} diff --git a/crates/katana/executor/src/implementation/sir/utils.rs b/crates/katana/executor/src/implementation/sir/utils.rs new file mode 100644 index 0000000000..4dda6aff7a --- /dev/null +++ b/crates/katana/executor/src/implementation/sir/utils.rs @@ -0,0 +1,563 @@ +use std::str::FromStr; +use std::sync::Arc; + +use katana_primitives::class::{CompiledClass, DeprecatedCompiledClass}; +use katana_primitives::contract::ContractAddress; +use katana_primitives::transaction::{ + DeployAccountTx, ExecutableTx, ExecutableTxWithHash, InvokeTx, +}; +use katana_primitives::FieldElement; +use sir::definitions::block_context::BlockContext; +use sir::definitions::constants::TRANSACTION_VERSION; +use sir::execution::execution_entry_point::{ExecutionEntryPoint, ExecutionResult}; +use sir::execution::{CallType, TransactionExecutionContext}; +use sir::services::api::contract_classes::compiled_class::CompiledClass as SirCompiledClass; +use sir::services::api::contract_classes::deprecated_contract_class::ContractClass as SirDeprecatedContractClass; +use sir::state::contract_class_cache::ContractClassCache; +use sir::state::state_api::StateReader; +use sir::state::state_cache::StateCache; +use sir::state::{cached_state, ExecutionResourcesManager, StateDiff}; +use sir::transaction::error::TransactionError; +use sir::transaction::fee::calculate_tx_l1_gas_usage; +use sir::transaction::{ + Address, ClassHash, CurrentAccountTxFields, DataAvailabilityMode, Declare, DeclareDeprecated, + DeployAccount, InvokeFunction, L1Handler, ResourceBounds, Transaction, + VersionSpecificAccountTxFields, +}; +use sir::utils::calculate_sn_keccak; +use sir::EntryPointType; +use starknet_types_core::felt::Felt; + +use super::output::TransactionExecutionInfo; +use super::state::StateDb; +use super::SimulationFlag; +use crate::EntryPointCall; + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error("failed to execute transaction: {0}")] + TransactionError(#[from] sir::transaction::error::TransactionError), +} + +pub(super) fn transact( + tx: ExecutableTxWithHash, + state: &mut cached_state::CachedState, + block_context: &BlockContext, + remaining_gas: u128, + simulation_flag: &SimulationFlag, +) -> Result +where + S: StateReader, + C: ContractClassCache, +{ + let tx = to_executor_tx(tx, simulation_flag)?; + let res = match tx { + Transaction::InvokeFunction(tx) => tx.execute( + state, + block_context, + remaining_gas, + #[cfg(feature = "native")] + None, + ), + + Transaction::DeployAccount(tx) => tx.execute( + state, + block_context, + #[cfg(feature = "native")] + None, + ), + + Transaction::DeclareDeprecated(tx) => tx.execute( + state, + block_context, + #[cfg(feature = "native")] + None, + ), + + Transaction::Deploy(tx) => tx.execute( + state, + block_context, + #[cfg(feature = "native")] + None, + ), + + Transaction::L1Handler(tx) => tx.execute( + state, + block_context, + remaining_gas, + #[cfg(feature = "native")] + None, + ), + + Transaction::Declare(tx) => tx.execute( + state, + block_context, + #[cfg(feature = "native")] + None, + ), + }?; + + let gas_used = calculate_tx_l1_gas_usage(&res.actual_resources, block_context)?; + Ok(TransactionExecutionInfo { inner: res, gas_used }) +} + +pub(super) fn call( + params: EntryPointCall, + state: &mut cached_state::CachedState, + block_context: &BlockContext, + initial_gas: u128, +) -> Result +where + S: StateDb + Send + Sync, + C: ContractClassCache + Send + Sync, +{ + // let state_reader = Arc::new(state); + // let contract_classes = Arc::new(PermanentContractClassCache::default()); + // let mut state = cached_state::CachedState::new(state_reader, contract_classes); + + let contract_address = to_sir_address(¶ms.contract_address); + let entry_point_selector = to_sir_felt(¶ms.entry_point_selector); + let calldata = params.calldata.iter().map(to_sir_felt).collect::>(); + let call_type = Some(CallType::Call); + let caller_address = Address::default(); + let entry_point_type = EntryPointType::External; + + let call = ExecutionEntryPoint::new( + contract_address, + calldata, + entry_point_selector, + caller_address, + entry_point_type, + call_type, + None, + initial_gas, + ); + + let max_steps = block_context.invoke_tx_max_n_steps(); + let mut resources_manager = ExecutionResourcesManager::default(); + let mut tx_execution_context = TransactionExecutionContext::new( + Address::default(), + Felt::default(), + Vec::new(), + Default::default(), + Felt::default(), + block_context.invoke_tx_max_n_steps(), + *TRANSACTION_VERSION, + ); + + let result = call.execute( + state, + block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + max_steps, + #[cfg(feature = "native")] + None, + )?; + + Ok(result) +} + +fn to_executor_tx( + katana_tx: ExecutableTxWithHash, + simulation_flag: &SimulationFlag, +) -> Result { + match katana_tx.transaction { + ExecutableTx::Invoke(tx) => match tx { + InvokeTx::V1(tx) => { + let version = Felt::ONE; + let contract_address = to_sir_address(&tx.sender_address); + let entry_point = Felt::from_bytes_be(&calculate_sn_keccak(b"__execute__")); + let ver_specifc_fields = VersionSpecificAccountTxFields::Deprecated(tx.max_fee); + let calldata = tx.calldata.iter().map(to_sir_felt).collect::>(); + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = Some(to_sir_felt(&tx.nonce)); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let tx = InvokeFunction::new_with_tx_hash( + contract_address, + entry_point, + ver_specifc_fields, + version, + calldata, + signature, + nonce, + tx_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + + InvokeTx::V3(tx) => { + let version = Felt::THREE; + let contract_address = to_sir_address(&tx.sender_address); + let entry_point = Felt::from_bytes_be(&calculate_sn_keccak(b"__execute__")); + + let ver_specifc_fields = to_sir_current_account_tx_fields( + tx.tip, + tx.resource_bounds.l1_gas, + tx.resource_bounds.l2_gas, + tx.nonce_data_availability_mode, + tx.fee_data_availability_mode, + tx.paymaster_data, + tx.account_deployment_data, + ); + + let calldata = tx.calldata.iter().map(to_sir_felt).collect::>(); + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = Some(to_sir_felt(&tx.nonce)); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let tx = InvokeFunction::new_with_tx_hash( + contract_address, + entry_point, + ver_specifc_fields, + version, + calldata, + signature, + nonce, + tx_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + }, + + ExecutableTx::DeployAccount(tx) => match tx { + DeployAccountTx::V1(tx) => { + let version = Felt::ONE; + let class_hash = to_sir_class_hash(&tx.class_hash); + let ver_specifc_fields = VersionSpecificAccountTxFields::Deprecated(tx.max_fee); + let calldata = tx.constructor_calldata.iter().map(to_sir_felt).collect(); + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = to_sir_felt(&tx.nonce); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let tx = DeployAccount::new_with_tx_hash( + class_hash, + ver_specifc_fields, + version, + nonce, + calldata, + signature, + nonce, + tx_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + + DeployAccountTx::V3(tx) => { + let version = Felt::THREE; + + let class_hash = to_sir_class_hash(&tx.class_hash); + let ver_specifc_fields = to_sir_current_account_tx_fields( + tx.tip, + tx.resource_bounds.l1_gas, + tx.resource_bounds.l2_gas, + tx.nonce_data_availability_mode, + tx.fee_data_availability_mode, + tx.paymaster_data, + vec![], + ); + let calldata = tx.constructor_calldata.iter().map(to_sir_felt).collect(); + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = to_sir_felt(&tx.nonce); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let tx = DeployAccount::new_with_tx_hash( + class_hash, + ver_specifc_fields, + version, + nonce, + calldata, + signature, + nonce, + tx_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + }, + + ExecutableTx::Declare(declare) => match declare.transaction { + katana_primitives::transaction::DeclareTx::V1(tx) => { + let sender_address = to_sir_address(&tx.sender_address); + let max_fee = tx.max_fee; + let version = Felt::ONE; + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = to_sir_felt(&tx.nonce); + let tx_hash = to_sir_felt(&katana_tx.hash); + let class_hash = to_sir_class_hash(&tx.class_hash); + + let CompiledClass::Deprecated(class) = declare.compiled_class else { panic!() }; + let contract_class = to_sir_deprecated_class(class.clone()); + + let tx = DeclareDeprecated::new_with_tx_and_class_hash( + contract_class, + sender_address, + max_fee, + version, + signature, + nonce, + tx_hash, + class_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + + katana_primitives::transaction::DeclareTx::V2(tx) => { + let sierra_contract_class = None; + let sierra_class_hash = to_sir_felt(&tx.class_hash); + let compiled_class_hash = to_sir_felt(&tx.compiled_class_hash); + let sender_address = to_sir_address(&tx.sender_address); + let account_tx_fields = VersionSpecificAccountTxFields::Deprecated(tx.max_fee); + let version = Felt::TWO; + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = to_sir_felt(&tx.nonce); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let CompiledClass::Class(class) = declare.compiled_class else { panic!() }; + let casm_contract_class = Some(class.casm.clone()); + + let tx = Declare::new_with_sierra_class_hash_and_tx_hash( + sierra_contract_class, + sierra_class_hash, + casm_contract_class, + compiled_class_hash, + sender_address, + account_tx_fields, + version, + signature, + nonce, + tx_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + + katana_primitives::transaction::DeclareTx::V3(tx) => { + let sierra_contract_class = None; + let sierra_class_hash = to_sir_felt(&tx.class_hash); + let compiled_class_hash = to_sir_felt(&tx.compiled_class_hash); + let sender_address = to_sir_address(&tx.sender_address); + let ver_specifc_fields = to_sir_current_account_tx_fields( + tx.tip, + tx.resource_bounds.l1_gas, + tx.resource_bounds.l2_gas, + tx.nonce_data_availability_mode, + tx.fee_data_availability_mode, + tx.paymaster_data, + tx.account_deployment_data, + ); + let version = Felt::THREE; + let signature = tx.signature.iter().map(to_sir_felt).collect::>(); + let nonce = to_sir_felt(&tx.nonce); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let CompiledClass::Class(class) = declare.compiled_class else { panic!() }; + let casm_contract_class = Some(class.casm.clone()); + + let tx = Declare::new_with_sierra_class_hash_and_tx_hash( + sierra_contract_class, + sierra_class_hash, + casm_contract_class, + compiled_class_hash, + sender_address, + ver_specifc_fields, + version, + signature, + nonce, + tx_hash, + )?; + + let tx = tx.create_for_simulation( + simulation_flag.skip_validate, + simulation_flag.skip_execute, + simulation_flag.skip_fee_transfer, + simulation_flag.ignore_max_fee, + simulation_flag.skip_nonce_check, + ); + + Ok(tx) + } + }, + + ExecutableTx::L1Handler(tx) => { + let contract_address = to_sir_address(&tx.contract_address); + let entry_point = to_sir_felt(&tx.entry_point_selector); + let calldata = tx.calldata.iter().map(to_sir_felt).collect::>(); + let nonce = to_sir_felt(&tx.nonce); + let paid_fee_on_l1 = Some(Felt::from(tx.paid_fee_on_l1)); + let tx_hash = to_sir_felt(&katana_tx.hash); + + let tx = L1Handler::new_with_tx_hash( + contract_address, + entry_point, + calldata, + nonce, + paid_fee_on_l1, + tx_hash, + )?; + + let tx = tx + .create_for_simulation(simulation_flag.skip_validate, simulation_flag.skip_execute); + + Ok(tx) + } + } +} + +pub(super) fn state_diff_from_state_cache(mut cache: StateCache) -> StateDiff { + let address_to_class_hash = std::mem::take(cache.class_hash_writes_mut()); + let address_to_nonce = std::mem::take(cache.nonce_writes_mut()); + let class_hash_to_compiled_class = std::mem::take(cache.compiled_class_hash_writes_mut()); + let storage_updates = sir::utils::to_state_diff_storage_mapping(cache.storage_writes()); + + StateDiff::new( + address_to_class_hash, + address_to_nonce, + class_hash_to_compiled_class, + storage_updates, + ) +} + +pub(super) fn to_felt(value: &Felt) -> FieldElement { + FieldElement::from_bytes_be(&value.to_bytes_be()).unwrap() +} + +pub(super) fn to_sir_felt(value: &FieldElement) -> Felt { + Felt::from_bytes_be(&value.to_bytes_be()) +} + +pub(super) fn to_address(value: &Address) -> ContractAddress { + ContractAddress::new(FieldElement::from_bytes_be(&value.0.to_bytes_be()).unwrap()) +} + +pub(super) fn to_sir_address(value: &ContractAddress) -> Address { + Address(to_sir_felt(&value.0)) +} + +pub(super) fn to_class_hash(value: &ClassHash) -> katana_primitives::class::ClassHash { + FieldElement::from_bytes_be(&value.0).unwrap() +} + +pub(super) fn to_sir_class_hash(value: &katana_primitives::class::ClassHash) -> ClassHash { + ClassHash(value.to_bytes_be()) +} + +pub(super) fn to_sir_compiled_class(class: CompiledClass) -> SirCompiledClass { + match class { + CompiledClass::Class(class) => { + let casm = Arc::new(class.casm); + let sierra = Some(Arc::new((class.sierra.program, class.sierra.entry_points_by_type))); + SirCompiledClass::Casm { casm, sierra } + } + + CompiledClass::Deprecated(class) => { + let class = Arc::new(to_sir_deprecated_class(class)); + SirCompiledClass::Deprecated(class) + } + } +} + +pub(super) fn to_sir_deprecated_class( + class: DeprecatedCompiledClass, +) -> SirDeprecatedContractClass { + let json = serde_json::to_string(&class).unwrap(); + SirDeprecatedContractClass::from_str(&json).unwrap() +} + +fn to_sir_current_account_tx_fields( + tip: u64, + l1_gas_resource_bounds: starknet::core::types::ResourceBounds, + l2_gas_resource_bounds: starknet::core::types::ResourceBounds, + nonce_data_availability_mode: starknet::core::types::DataAvailabilityMode, + fee_data_availability_mode: starknet::core::types::DataAvailabilityMode, + paymaster_data: Vec, + account_deployment_data: Vec, +) -> VersionSpecificAccountTxFields { + fn to_sir_da_mode(mode: starknet::core::types::DataAvailabilityMode) -> DataAvailabilityMode { + match mode { + starknet::core::types::DataAvailabilityMode::L1 => DataAvailabilityMode::L1, + starknet::core::types::DataAvailabilityMode::L2 => DataAvailabilityMode::L2, + } + } + + fn to_sir_resource_bounds( + resource_bounds: starknet::core::types::ResourceBounds, + ) -> ResourceBounds { + ResourceBounds { + max_amount: resource_bounds.max_amount, + max_price_per_unit: resource_bounds.max_price_per_unit, + } + } + + let l1_resource_bounds = to_sir_resource_bounds(l1_gas_resource_bounds); + let l2_resource_bounds = Some(to_sir_resource_bounds(l2_gas_resource_bounds)); + let nonce_data_availability_mode = to_sir_da_mode(nonce_data_availability_mode); + let fee_data_availability_mode = to_sir_da_mode(fee_data_availability_mode); + let paymaster_data = paymaster_data.iter().map(to_sir_felt).collect::>(); + let account_deployment_data = + account_deployment_data.iter().map(to_sir_felt).collect::>(); + + VersionSpecificAccountTxFields::Current(CurrentAccountTxFields { + tip, + paymaster_data, + l1_resource_bounds, + l2_resource_bounds, + account_deployment_data, + fee_data_availability_mode, + nonce_data_availability_mode, + }) +} diff --git a/crates/katana/executor/tests/executor.rs b/crates/katana/executor/tests/executor.rs index a3f7c83397..93bb76de90 100644 --- a/crates/katana/executor/tests/executor.rs +++ b/crates/katana/executor/tests/executor.rs @@ -2,9 +2,7 @@ mod fixtures; use std::collections::HashMap; -use fixtures::blockifier::factory as blockifier_factory; use fixtures::{state_provider, valid_blocks}; -use katana_executor::implementation::blockifier::BlockifierFactory; use katana_executor::{ExecutionOutput, ExecutorFactory}; use katana_primitives::block::ExecutableBlock; use katana_primitives::contract::ContractAddress; @@ -16,15 +14,6 @@ use katana_provider::traits::state::StateProvider; use starknet::core::utils::{get_udc_deployed_address, UdcUniqueSettings, UdcUniqueness}; use starknet::macros::felt; -#[rstest::rstest] -fn test_blockifier_executor_with_valid_blocks( - #[from(blockifier_factory)] factory: BlockifierFactory, - #[from(state_provider)] state: Box, - #[from(valid_blocks)] blocks: [ExecutableBlock; 3], -) { - test_executor_with_valid_blocks_impl(factory, state, blocks) -} - fn test_executor_with_valid_blocks_impl( factory: EF, state: Box, @@ -33,7 +22,8 @@ fn test_executor_with_valid_blocks_impl( let mut executor = factory.with_state(state); let mut expected_txs: Vec = Vec::with_capacity(3); - // execute the blocks and assert the block env is equivalent to the values in the block header + // execute the blocks and assert the block env is equivalent to the values in the header + { let block = &blocks[0]; expected_txs.extend(block.body.iter().map(|t| t.into())); @@ -90,7 +80,7 @@ fn test_executor_with_valid_blocks_impl( assert_eq!( actual_new_acc_class_hash, Some(DEFAULT_OZ_ACCOUNT_CONTRACT_CLASS_HASH), - "account is deployed" + "account should be deployed" ); assert_eq!(actual_new_acc_nonce, Some(1u64.into()), "account nonce is updated"); @@ -119,29 +109,15 @@ fn test_executor_with_valid_blocks_impl( ); let class_hash = state.class_hash_of_contract(deployed_contr.into()).unwrap(); - assert_eq!(class_hash, Some(DEFAULT_LEGACY_ERC20_CONTRACT_CLASS_HASH), "contract is deployed"); // assert that the nonce of the main contract is updated, 4 txs were executed let nonce = state.nonce(main_account).unwrap(); - assert_eq!(nonce, Some(4u64.into()), "account nonce is updated"); - - // assert that the legacy class is declared - let hash = felt!("0xbadbeef"); - - let actual_class = state.class(hash).unwrap(); - let actual_compiled_hash = state.compiled_class_hash_of_class_hash(hash).unwrap(); - - assert_eq!(actual_class, Some(fixtures::legacy_contract_class()), "legacy class is declared"); - assert_eq!( - actual_compiled_hash, - Some(hash), - "legacy compiled class hash is the same as class hash" - ); + assert_eq!(nonce, Some(3u64.into()), "account nonce is updated"); // assert that the sierra class is declared let hash = felt!("0x420"); - let compiled_hash = felt!("0x1337"); + let compiled_hash = felt!("0x016c6081eb34ad1e0c5513234ed0c025b3c7f305902d291bad534cd6474c85bc"); let (casm, sierra) = fixtures::contract_class(); let actual_casm = state.class(hash).unwrap(); @@ -163,15 +139,15 @@ fn test_executor_with_valid_blocks_impl( assert!(transactions.iter().all(|(_, rct)| rct.is_some()), "all txs should have a receipt"); let actual_nonce_updates = states.state_updates.nonce_updates; - let expected_nonce_updates = HashMap::from([(main_account, felt!("4")), (new_acc, felt!("1"))]); + let expected_nonce_updates = HashMap::from([(main_account, felt!("3")), (new_acc, felt!("1"))]); similar_asserts::assert_eq!(actual_nonce_updates, expected_nonce_updates); let actual_declared_classes = states.state_updates.declared_classes; - let expected_declared_classes = HashMap::from([ - (felt!("0xbadbeef"), felt!("0xbadbeef")), - (felt!("0x420"), felt!("0x1337")), - ]); + let expected_declared_classes = HashMap::from([( + felt!("0x420"), + felt!("0x016c6081eb34ad1e0c5513234ed0c025b3c7f305902d291bad534cd6474c85bc"), + )]); similar_asserts::assert_eq!(actual_declared_classes, expected_declared_classes); @@ -183,3 +159,40 @@ fn test_executor_with_valid_blocks_impl( similar_asserts::assert_eq!(actual_contract_deployed, expected_contract_deployed); } + +#[cfg(feature = "blockifier")] +mod blockifier { + use fixtures::blockifier::factory; + use katana_executor::implementation::blockifier::BlockifierFactory; + + use super::*; + + #[rstest::rstest] + fn test_executor_with_valid_blocks( + factory: BlockifierFactory, + #[from(state_provider)] state: Box, + #[from(valid_blocks)] blocks: [ExecutableBlock; 3], + ) { + test_executor_with_valid_blocks_impl(factory, state, blocks) + } +} + +#[cfg(feature = "sir")] +mod sir { + use fixtures::sir::factory; + use katana_executor::implementation::sir::NativeExecutorFactory; + + use super::*; + + // TODO: find out why cant deploy contract using UDC, ignore this test until it's fixed + // (possible an upstream issue) + #[ignore] + #[rstest::rstest] + fn test_executor_with_valid_blocks( + factory: NativeExecutorFactory, + #[from(state_provider)] state: Box, + #[from(valid_blocks)] blocks: [ExecutableBlock; 3], + ) { + test_executor_with_valid_blocks_impl(factory, state, blocks) + } +} diff --git a/crates/katana/executor/tests/fixtures/mod.rs b/crates/katana/executor/tests/fixtures/mod.rs index b871f9a231..bc6281661d 100644 --- a/crates/katana/executor/tests/fixtures/mod.rs +++ b/crates/katana/executor/tests/fixtures/mod.rs @@ -19,8 +19,8 @@ use katana_primitives::genesis::constant::{ }; use katana_primitives::genesis::Genesis; use katana_primitives::transaction::{ - DeclareTx, DeclareTxV1, DeclareTxV2, DeclareTxWithClass, DeployAccountTx, DeployAccountTxV1, - ExecutableTx, ExecutableTxWithHash, InvokeTx, InvokeTxV1, + DeclareTx, DeclareTxV2, DeclareTxWithClass, DeployAccountTx, DeployAccountTxV1, ExecutableTx, + ExecutableTxWithHash, InvokeTx, InvokeTxV1, }; use katana_primitives::utils::class::{parse_compiled_class, parse_sierra_class}; use katana_primitives::version::Version; @@ -30,6 +30,8 @@ use katana_provider::traits::block::BlockWriter; use katana_provider::traits::state::{StateFactoryProvider, StateProvider}; use starknet::macros::felt; +// TODO: remove support for legacy contract declaration +#[allow(unused)] pub fn legacy_contract_class() -> CompiledClass { let json = include_str!("legacy_contract.json"); let artifact = serde_json::from_str(json).unwrap(); @@ -76,7 +78,6 @@ pub fn state_provider() -> Box { } // TODO: update the txs to include valid signatures -// TODO: add a declare transactions /// Returns an array of blocks with transaction that are valid against the state by /// [state_provider]. #[rstest::fixture] @@ -89,6 +90,8 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { "0x06b86e40118f29ebe393a75469b4d926c7a44c2e2681b6d319520b7c1156d114" )); + let gas_prices = GasPrices { eth: 100 * u128::pow(10, 9), strk: 100 * u128::pow(10, 9) }; + [ ExecutableBlock { header: PartialHeader { @@ -97,7 +100,7 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { timestamp: 100, sequencer_address, parent_hash: 123u64.into(), - gas_prices: GasPrices::default(), + gas_prices: gas_prices.clone(), }, body: vec![ // fund the account to be deployed, sending 0x9999999999999 amount @@ -113,7 +116,7 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { felt!("0x9999999999999"), felt!("0x0"), ], - max_fee: 0, + max_fee: 954300000000000, signature: vec![], nonce: FieldElement::ZERO, }))), @@ -125,12 +128,14 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { sierra_class: Some(sierra), transaction: DeclareTx::V2(DeclareTxV2 { nonce: FieldElement::ONE, - max_fee: 0, + max_fee: 666300000000000, chain_id, signature: vec![], sender_address, class_hash: felt!("0x420"), - compiled_class_hash: felt!("0x1337"), + compiled_class_hash: felt!( + "0x16c6081eb34ad1e0c5513234ed0c025b3c7f305902d291bad534cd6474c85bc" + ), }), } })), @@ -143,14 +148,14 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { timestamp: 200, sequencer_address, parent_hash: 1234u64.into(), - gas_prices: GasPrices::default(), + gas_prices: gas_prices.clone(), }, body: vec![ // deploy account tx with the default account class ExecutableTxWithHash::new(ExecutableTx::DeployAccount(DeployAccountTx::V1( DeployAccountTxV1 { chain_id, - max_fee: 0, + max_fee: 883800000000000, signature: vec![], nonce: 0u64.into(), contract_address_salt: felt!( @@ -176,7 +181,7 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { timestamp: 300, sequencer_address, parent_hash: 12345u64.into(), - gas_prices: GasPrices::default(), + gas_prices: gas_prices.clone(), }, body: vec![ // deploy contract using UDC @@ -199,23 +204,10 @@ pub fn valid_blocks() -> [ExecutableBlock; 3] { felt!("0x0"), felt!("0x6b86e40118f29ebe393a75469b4d926c7a44c2e2681b6d319520b7c1156d114"), ], - max_fee: 0, + max_fee: 2700700000000000, signature: vec![], nonce: FieldElement::TWO, }))), - // legacy declare transaction - ExecutableTxWithHash::new(ExecutableTx::Declare(DeclareTxWithClass { - sierra_class: None, - compiled_class: legacy_contract_class(), - transaction: DeclareTx::V1(DeclareTxV1 { - chain_id, - sender_address, - max_fee: 0, - signature: vec![], - nonce: FieldElement::THREE, - class_hash: felt!("0xbadbeef"), - }), - })), ], }, ] @@ -251,15 +243,14 @@ pub fn cfg() -> CfgEnv { // TODO: test both with and without the flags turned on #[rstest::fixture] -pub fn flags() -> SimulationFlag { - SimulationFlag { - skip_validate: true, - ignore_max_fee: true, - skip_fee_transfer: true, - ..Default::default() - } +pub fn flags( + #[default(false)] skip_validate: bool, + #[default(false)] skip_fee_transfer: bool, +) -> SimulationFlag { + SimulationFlag { skip_validate, skip_fee_transfer, ..Default::default() } } +#[cfg(feature = "blockifier")] pub mod blockifier { use katana_executor::implementation::blockifier::BlockifierFactory; use katana_executor::SimulationFlag; @@ -267,7 +258,20 @@ pub mod blockifier { use super::{cfg, flags, CfgEnv}; #[rstest::fixture] - pub fn factory(cfg: CfgEnv, flags: SimulationFlag) -> BlockifierFactory { + pub fn factory(cfg: CfgEnv, #[with(true)] flags: SimulationFlag) -> BlockifierFactory { BlockifierFactory::new(cfg, flags) } } + +#[cfg(feature = "sir")] +pub mod sir { + use katana_executor::implementation::sir::NativeExecutorFactory; + use katana_executor::SimulationFlag; + + use super::{cfg, flags, CfgEnv}; + + #[rstest::fixture] + pub fn factory(cfg: CfgEnv, #[with(true)] flags: SimulationFlag) -> NativeExecutorFactory { + NativeExecutorFactory::new(cfg, flags) + } +} diff --git a/scripts/clippy.sh b/scripts/clippy.sh index 8c01e87ecb..a3ec765c8c 100755 --- a/scripts/clippy.sh +++ b/scripts/clippy.sh @@ -1,7 +1,11 @@ #!/bin/bash run_clippy() { - cargo clippy --all-targets --all-features "$@" -- -D warnings -D future-incompatible -D nonstandard-style -D rust-2018-idioms -D unused + cargo clippy --all-targets "$@" -- -D warnings -D future-incompatible -D nonstandard-style -D rust-2018-idioms -D unused } -run_clippy +run_clippy --all-features --workspace --exclude katana --exclude katana-executor + +run_clippy -p katana-executor --all +run_clippy -p katana +run_clippy -p katana --no-default-features --features sir diff --git a/scripts/docs.sh b/scripts/docs.sh index a0e973eb3d..1d6440fc5e 100755 --- a/scripts/docs.sh +++ b/scripts/docs.sh @@ -1,3 +1,4 @@ #!/bin/bash -RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items --no-deps --all-features +RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items --no-deps --all-features --workspace --exclude katana +RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items --no-deps -p katana