From 97a14e40800ac28b869c459821ffb8a1715ca53e Mon Sep 17 00:00:00 2001 From: glihm Date: Mon, 23 Oct 2023 22:06:26 -0600 Subject: [PATCH] add mvp from the private repo --- .env_example | 1 + .github/workflows/ci.yml | 83 + .github/workflows/example.yml | 41 + .gitignore | 3 + Cargo.lock | 3065 ++++++++++++++--- Cargo.toml | 27 +- README.md | 56 + clippy.sh | 6 + .../contracts/c1.compiled_contract_class.json | 1 + examples/contracts/c1.contract_class.json | 1 + examples/e2e.rs | 115 + migrations/0_default.sql | 17 + src/db.rs | 402 ++- src/docker_manager.rs | 96 +- src/extractors.rs | 121 + src/handlers.rs | 164 + src/main.rs | 137 +- 17 files changed, 3666 insertions(+), 670 deletions(-) create mode 100644 .env_example create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/example.yml create mode 100644 README.md create mode 100644 clippy.sh create mode 100644 examples/contracts/c1.compiled_contract_class.json create mode 100644 examples/contracts/c1.contract_class.json create mode 100644 examples/e2e.rs create mode 100644 migrations/0_default.sql create mode 100644 src/extractors.rs create mode 100644 src/handlers.rs diff --git a/.env_example b/.env_example new file mode 100644 index 0000000..9b349b8 --- /dev/null +++ b/.env_example @@ -0,0 +1 @@ +export KATANA_CI_USERS_FILE=./users diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..be13315 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,83 @@ +name: ci + +on: + push: + branches: + - main + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + date: ${{ steps.date.outputs.date }} + steps: + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + check: + needs: setup + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Cache cargo dependencies + uses: Swatinem/rust-cache@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + + test: + needs: check + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Cache cargo dependencies + uses: Swatinem/rust-cache@v2 + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace + + lints: + if: github.event_name == 'pull_request' + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Cache cargo dependencies + uses: Swatinem/rust-cache@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml new file mode 100644 index 0000000..d9a91d9 --- /dev/null +++ b/.github/workflows/example.yml @@ -0,0 +1,41 @@ +name: Example of katana-ci-action usage + +on: + push: + branches: + - main + +jobs: + katana-ci-example: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Startup Katana CI instance + id: katanaci + uses: ArkProjectNFTs/katana-ci-action@v1 + with: + api-url: ${{ secrets.KATANA_CI_URL }} + api-key: ${{ secrets.KATANA_CI_KEY }} + cmd: 'start' + + - name: Cache cargo dependencies + uses: Swatinem/rust-cache@v2 + + - name: Run cargo test + uses: actions-rs/cargo@v1 + env: + STARKNET_RPC: ${{ steps.katanaci.outputs.katana-rpc }} + with: + command: run + args: --example e2e + + - name: Terminate Katana CI instance + uses: ArkProjectNFTs/katana-ci-action@v1 + with: + api-url: ${{ secrets.KATANA_CI_URL }} + api-key: ${{ secrets.KATANA_CI_KEY }} + cmd: 'stop' + name: ${{ steps.katanaci.outputs.katana-name }} diff --git a/.gitignore b/.gitignore index ea8c4bf..9e8b22a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ /target +.env +.users +data.db diff --git a/Cargo.lock b/Cargo.lock index 84f078f..f09e03e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,30 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7d5a2cecb58716e47d67d5703a249964b14c7be1ec3cad3affc295b2d1c35d" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -26,6 +50,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -41,6 +71,82 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "async-trait" version = "0.1.74" @@ -52,12 +158,117 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "axum-macros", + "bitflags 1.3.2", + "bytes 1.5.0", + "futures-util", + "headers", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes 1.5.0", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-extra" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a93e433be9382c737320af3924f7d5fc6f89c155cf2bf88949d8f5126fab283f" +dependencies = [ + "axum", + "axum-core", + "bytes 1.5.0", + "futures-util", + "http", + "http-body", + "mime", + "pin-project-lite", + "serde", + "tokio", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-macros" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdca6a10ecad987bda04e95606ef85a5417dcaac1a78455242d72e031e2b6b62" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "backtrace" version = "0.3.69" @@ -79,6 +290,30 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bigdecimal" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -90,6 +325,30 @@ name = "bitflags" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +dependencies = [ + "serde", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] [[package]] name = "bumpalo" @@ -97,6 +356,12 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "byteorder" version = "1.5.0" @@ -145,12 +410,62 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "cpufeatures" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + [[package]] name = "crc32fast" version = "1.3.2" @@ -161,842 +476,2353 @@ dependencies = [ ] [[package]] -name = "filetime" -version = "0.2.22" +name = "crossbeam-queue" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ "cfg-if", - "libc", - "redox_syscall 0.3.5", - "windows-sys", + "crossbeam-utils", ] [[package]] -name = "flate2" -version = "1.0.28" +name = "crossbeam-utils" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ - "crc32fast", - "miniz_oxide", + "cfg-if", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "foreign-types" -version = "0.3.2" +name = "crypto-bigint" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ - "foreign-types-shared", + "generic-array", + "subtle", + "zeroize", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] [[package]] -name = "form_urlencoded" -version = "1.2.0" +name = "ctr" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "percent-encoding", + "cipher", ] [[package]] -name = "futures" -version = "0.3.28" +name = "darling" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "darling_core", + "darling_macro", ] [[package]] -name = "futures-channel" -version = "0.3.28" +name = "darling_core" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ - "futures-core", - "futures-sink", + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.38", ] [[package]] -name = "futures-core" -version = "0.3.28" +name = "darling_macro" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.38", +] [[package]] -name = "futures-executor" -version = "0.3.28" +name = "der" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "const-oid", + "pem-rfc7468", + "zeroize", ] [[package]] -name = "futures-io" -version = "0.3.28" +name = "deranged" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", + "serde", +] [[package]] -name = "futures-macro" -version = "0.3.28" +name = "derivative" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 1.0.109", ] [[package]] -name = "futures-sink" -version = "0.3.28" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] [[package]] -name = "futures-task" -version = "0.3.28" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] -name = "futures-util" -version = "0.3.28" +name = "either" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "serde", ] [[package]] -name = "futures_codec" -version = "0.4.1" +name = "encoding_rs" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "bytes 0.5.6", - "futures", - "memchr", - "pin-project 0.4.30", + "cfg-if", ] [[package]] -name = "getrandom" -version = "0.2.10" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "gimli" -version = "0.28.0" +name = "errno" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys", +] [[package]] -name = "hermit-abi" -version = "0.3.3" +name = "etcetera" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys", +] [[package]] -name = "hex" -version = "0.4.3" +name = "eth-keystore" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest", + "hex", + "hmac", + "pbkdf2", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid 0.8.2", +] [[package]] -name = "http" -version = "0.2.9" +name = "ethbloom" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ - "bytes 1.5.0", - "fnv", - "itoa", + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", ] [[package]] -name = "http-body" -version = "0.4.5" +name = "ethereum-types" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ - "bytes 1.5.0", - "http", - "pin-project-lite", + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", ] [[package]] -name = "httparse" -version = "1.8.0" +name = "event-listener" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] -name = "httpdate" -version = "1.0.3" +name = "fastrand" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] -name = "hyper" -version = "0.14.27" +name = "filetime" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ - "bytes 1.5.0", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.10", - "tokio", - "tower-service", - "tracing", - "want", + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "windows-sys", ] [[package]] -name = "hyper-openssl" -version = "0.9.2" +name = "finl_unicode" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ee5d7a8f718585d1c3c61dfde28ef5b0bb14734b4db13f5ada856cdc6c612b" -dependencies = [ - "http", - "hyper", - "linked_hash_set", - "once_cell", - "openssl", - "openssl-sys", - "parking_lot", - "tokio", - "tokio-openssl", - "tower-layer", -] +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" [[package]] -name = "hyperlocal" +name = "fixed-hash" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ - "futures-util", - "hex", - "hyper", - "pin-project 1.1.3", - "tokio", + "byteorder", + "rand", + "rustc-hex", + "static_assertions", ] [[package]] -name = "iana-time-zone" -version = "0.1.58" +name = "flate2" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", + "crc32fast", + "miniz_oxide", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "flume" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ - "cc", + "futures-core", + "futures-sink", + "spin 0.9.8", ] [[package]] -name = "idna" -version = "0.4.0" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "foreign-types-shared", ] [[package]] -name = "itoa" -version = "1.0.9" +name = "foreign-types-shared" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] -name = "js-sys" -version = "0.3.64" +name = "form_urlencoded" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "wasm-bindgen", + "percent-encoding", ] [[package]] -name = "katana-proxifier" -version = "0.1.0" -dependencies = [ - "async-trait", - "futures-util", - "regex", - "shiplift", - "thiserror", - "tokio", - "tracing", - "tracing-log", - "tracing-subscriber", - "uuid", -] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] -name = "lazy_static" -version = "1.4.0" +name = "futures" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] [[package]] -name = "libc" -version = "0.2.149" +name = "futures-channel" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] [[package]] -name = "linked-hash-map" -version = "0.5.6" +name = "futures-core" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] -name = "linked_hash_set" -version = "0.1.4" +name = "futures-executor" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ - "linked-hash-map", + "futures-core", + "futures-task", + "futures-util", ] [[package]] -name = "lock_api" -version = "0.4.11" +name = "futures-intrusive" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ - "autocfg", - "scopeguard", + "futures-core", + "lock_api", + "parking_lot", ] [[package]] -name = "log" -version = "0.4.20" +name = "futures-io" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] -name = "matchers" -version = "0.1.0" +name = "futures-macro" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "regex-automata 0.1.10", + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] -name = "memchr" -version = "2.6.4" +name = "futures-sink" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] -name = "mime" -version = "0.3.17" +name = "futures-task" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] -name = "miniz_oxide" -version = "0.7.1" +name = "futures-util" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ - "adler", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] -name = "mio" -version = "0.8.9" +name = "futures_codec" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" dependencies = [ - "libc", - "wasi", - "windows-sys", + "bytes 0.5.6", + "futures", + "memchr", + "pin-project 0.4.30", ] [[package]] -name = "nu-ansi-term" -version = "0.46.0" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "overload", - "winapi", + "typenum", + "version_check", ] [[package]] -name = "num-traits" -version = "0.2.17" +name = "getrandom" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "autocfg", + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", ] [[package]] -name = "num_cpus" -version = "1.16.0" +name = "gimli" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] -name = "object" -version = "0.32.1" +name = "h2" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ - "memchr", + "bytes 1.5.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", ] [[package]] -name = "once_cell" -version = "1.18.0" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "openssl" -version = "0.10.57" +name = "hashbrown" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", + "ahash", + "allocator-api2", ] [[package]] -name = "openssl-macros" -version = "0.1.1" +name = "hashlink" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", + "hashbrown 0.14.2", ] [[package]] -name = "openssl-sys" -version = "0.9.93" +name = "headers" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", + "base64 0.21.5", + "bytes 1.5.0", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", ] [[package]] -name = "overload" -version = "0.1.1" +name = "headers-core" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] [[package]] -name = "parking_lot" -version = "0.12.1" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" dependencies = [ - "lock_api", - "parking_lot_core", + "unicode-segmentation", ] [[package]] -name = "parking_lot_core" -version = "0.9.9" +name = "hermit-abi" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.4.1", - "smallvec", - "windows-targets", -] +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] -name = "percent-encoding" -version = "2.3.0" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "pin-project" -version = "0.4.30" +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" dependencies = [ - "pin-project-internal 0.4.30", + "hmac", ] [[package]] -name = "pin-project" -version = "1.1.3" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "pin-project-internal 1.1.3", + "digest", ] [[package]] -name = "pin-project-internal" -version = "0.4.30" +name = "home" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "windows-sys", ] [[package]] -name = "pin-project-internal" -version = "1.1.3" +name = "http" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", + "bytes 1.5.0", + "fnv", + "itoa", ] [[package]] -name = "pin-project-lite" -version = "0.2.13" +name = "http-body" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes 1.5.0", + "http", + "pin-project-lite", +] [[package]] -name = "pin-utils" -version = "0.1.0" +name = "http-range-header" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] -name = "pkg-config" -version = "0.3.27" +name = "httparse" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "httpdate" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] -name = "proc-macro2" -version = "1.0.69" +name = "hyper" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ - "unicode-ident", + "bytes 1.5.0", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", ] [[package]] -name = "quote" -version = "1.0.33" +name = "hyper-openssl" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "d6ee5d7a8f718585d1c3c61dfde28ef5b0bb14734b4db13f5ada856cdc6c612b" dependencies = [ - "proc-macro2", + "http", + "hyper", + "linked_hash_set", + "once_cell", + "openssl", + "openssl-sys", + "parking_lot", + "tokio", + "tokio-openssl", + "tower-layer", ] +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "hyperlocal" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c" +dependencies = [ + "futures-util", + "hex", + "hyper", + "pin-project 1.1.3", + "tokio", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "katana-ci" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "axum", + "axum-extra", + "futures-util", + "hyper", + "rand", + "regex", + "serde", + "serde_json", + "serde_with", + "shiplift", + "sqlx", + "starknet", + "thiserror", + "tokio", + "tower-http", + "tracing", + "tracing-log", + "tracing-subscriber", + "url", + "uuid 1.5.0", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libsqlite3-sys" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linked_hash_set" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "openssl" +version = "0.10.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "openssl-sys" +version = "0.9.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parity-scale-codec" +version = "3.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a" +dependencies = [ + "pin-project-internal 0.4.30", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal 1.1.3", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64 0.21.5", + "bytes 1.5.0", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.17.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted", + "windows-sys", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes 1.5.0", + "rustc-hex", +] + +[[package]] +name = "rsa" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" +dependencies = [ + "byteorder", + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustls" +version = "0.21.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.5", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + +[[package]] +name = "serde" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "serde_json" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +dependencies = [ + "indexmap 2.0.2", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap 1.9.3", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shiplift" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e468265908f45299c26571dad9a2e5cb3656eceb51cd58f1441cf61aa71aad6" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes 1.5.0", + "chrono", + "flate2", + "futures-util", + "futures_codec", + "hyper", + "hyper-openssl", + "hyperlocal", + "log", + "mime", + "openssl", + "pin-project 1.1.3", + "serde", + "serde_json", + "tar", + "tokio", + "url", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", - "rand_chacha", - "rand_core", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "signature" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ - "ppv-lite86", + "digest", "rand_core", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "slab" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "getrandom", + "autocfg", ] [[package]] -name = "redox_syscall" -version = "0.3.5" +name = "smallvec" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ - "bitflags 1.3.2", + "libc", + "winapi", ] [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "socket2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ - "bitflags 1.3.2", + "libc", + "windows-sys", ] [[package]] -name = "regex" -version = "1.10.2" +name = "spin" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "lock_api", ] [[package]] -name = "regex-automata" -version = "0.1.10" +name = "spki" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ - "regex-syntax 0.6.29", + "base64ct", + "der", ] [[package]] -name = "regex-automata" -version = "0.4.3" +name = "sqlformat" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", + "itertools 0.11.0", + "nom", + "unicode_categories", ] [[package]] -name = "regex-syntax" -version = "0.6.29" +name = "sqlx" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] [[package]] -name = "regex-syntax" -version = "0.8.2" +name = "sqlx-core" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes 1.5.0", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap 2.0.2", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] [[package]] -name = "rustc-demangle" -version = "0.1.23" +name = "sqlx-macros" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] [[package]] -name = "ryu" -version = "1.0.15" +name = "sqlx-macros-core" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "sqlx-mysql" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db" +dependencies = [ + "atoi", + "base64 0.21.5", + "bitflags 2.4.1", + "byteorder", + "bytes 1.5.0", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] [[package]] -name = "serde" -version = "1.0.189" +name = "sqlx-postgres" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" dependencies = [ - "serde_derive", + "atoi", + "base64 0.21.5", + "bitflags 2.4.1", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", ] [[package]] -name = "serde_derive" -version = "1.0.189" +name = "sqlx-sqlite" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", ] [[package]] -name = "serde_json" -version = "1.0.107" +name = "starknet" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "6f0623b045f3dc10aef030c9ddd4781cff9cbe1188b71063cc510b75d1f96be6" dependencies = [ - "itoa", - "ryu", - "serde", + "starknet-accounts", + "starknet-contract", + "starknet-core", + "starknet-crypto", + "starknet-ff", + "starknet-macros", + "starknet-providers", + "starknet-signers", ] [[package]] -name = "sharded-slab" -version = "0.1.7" +name = "starknet-accounts" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "68e97edc480348dca300e5a8234e6c4e6f2f1ac028f2b16fcce294ebe93d07f4" dependencies = [ - "lazy_static", + "async-trait", + "auto_impl", + "starknet-core", + "starknet-providers", + "starknet-signers", + "thiserror", ] [[package]] -name = "shiplift" -version = "0.7.0" +name = "starknet-contract" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e468265908f45299c26571dad9a2e5cb3656eceb51cd58f1441cf61aa71aad6" +checksum = "69b86e3f6b3ca9a5c45271ab10871c99f7dc82fee3199d9f8c7baa2a1829947d" dependencies = [ - "base64", - "byteorder", - "bytes 1.5.0", - "chrono", + "serde", + "serde_json", + "serde_with", + "starknet-accounts", + "starknet-core", + "starknet-providers", + "thiserror", +] + +[[package]] +name = "starknet-core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14139b1c39bdc2f1e663c12090ff5108fe50ebe62c09e15e32988dfaf445a7e4" +dependencies = [ + "base64 0.21.5", "flate2", - "futures-util", - "futures_codec", - "hyper", - "hyper-openssl", - "hyperlocal", - "log", - "mime", - "openssl", - "pin-project 1.1.3", + "hex", "serde", "serde_json", - "tar", - "tokio", - "url", + "serde_json_pythonic", + "serde_with", + "sha3", + "starknet-crypto", + "starknet-ff", +] + +[[package]] +name = "starknet-crypto" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbb308033b5c60c5677645f7ba3b012b4e3e81f773480d27fb5f342d50621e6" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-crypto-codegen", + "starknet-curve", + "starknet-ff", + "zeroize", +] + +[[package]] +name = "starknet-crypto-codegen" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af6527b845423542c8a16e060ea1bc43f67229848e7cd4c4d80be994a84220ce" +dependencies = [ + "starknet-curve", + "starknet-ff", + "syn 2.0.38", +] + +[[package]] +name = "starknet-curve" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a68a0d87ae56572abf83ddbfd44259a7c90dbeeee1629a1ffe223e7f9a8f3052" +dependencies = [ + "starknet-ff", +] + +[[package]] +name = "starknet-ff" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2cb1d9c0a50380cddab99cb202c6bfb3332728a2769bd0ca2ee80b0b390dd4" +dependencies = [ + "ark-ff", + "bigdecimal", + "crypto-bigint", + "getrandom", + "hex", + "num-bigint", + "serde", +] + +[[package]] +name = "starknet-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef846b6bb48fc8c3e9a2aa9b5b037414f04a908d9db56493a3ae69a857eb2506" +dependencies = [ + "starknet-core", + "syn 2.0.38", ] [[package]] -name = "signal-hook-registry" -version = "1.4.1" +name = "starknet-providers" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "c3b136c26b72ff1756f0844e0aa80bab680ceb99d63921826facbb8e7340ff82" dependencies = [ - "libc", + "async-trait", + "auto_impl", + "ethereum-types", + "flate2", + "log", + "reqwest", + "serde", + "serde_json", + "serde_with", + "starknet-core", + "thiserror", + "url", ] [[package]] -name = "slab" -version = "0.4.9" +name = "starknet-signers" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "d9386015d2e6dc3df285bfb33a3afd8ad7596c70ed38ab57019de4d2dfc7826f" dependencies = [ - "autocfg", + "async-trait", + "auto_impl", + "crypto-bigint", + "eth-keystore", + "rand", + "starknet-core", + "starknet-crypto", + "thiserror", ] [[package]] -name = "smallvec" -version = "1.11.1" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "socket2" -version = "0.4.10" +name = "stringprep" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ - "libc", - "winapi", + "finl_unicode", + "unicode-bidi", + "unicode-normalization", ] [[package]] -name = "socket2" -version = "0.5.5" +name = "strsim" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" @@ -1020,6 +2846,39 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tar" version = "0.4.40" @@ -1031,6 +2890,19 @@ dependencies = [ "xattr", ] +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys", +] + [[package]] name = "thiserror" version = "1.0.50" @@ -1061,6 +2933,44 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1118,6 +3028,92 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +dependencies = [ + "bytes 1.5.0", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.2", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project 1.1.3", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +dependencies = [ + "bitflags 2.4.1", + "bytes 1.5.0", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" version = "0.3.2" @@ -1136,6 +3132,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -1197,6 +3194,24 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -1218,6 +3233,24 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.4.1" @@ -1229,6 +3262,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "uuid" version = "1.5.0" @@ -1263,6 +3306,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "want" version = "0.3.1" @@ -1303,6 +3352,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -1332,6 +3393,28 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + +[[package]] +name = "whoami" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" + [[package]] name = "winapi" version = "0.3.9" @@ -1429,6 +3512,34 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "winnow" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "xattr" version = "1.0.1" @@ -1437,3 +3548,43 @@ checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] + +[[package]] +name = "zerocopy" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c19fae0c8a9efc6a8281f2e623db8af1db9e57852e04cde3e754dd2dc29340f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc56589e9ddd1f1c28d4b4b5c773ce232910a6bb67a70133d61c9e347585efe9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] diff --git a/Cargo.toml b/Cargo.toml index b50b111..a8f3fe7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,33 @@ [package] -name = "katana-proxifier" +name = "katana-ci" +description = "A docker container manager to start/stop Katana instances." version = "0.1.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +license = "MIT" [dependencies] async-trait = "0.1.73" +axum = { version = "0.6.20", features = ["macros", "headers"] } +axum-extra = "0.7.7" +futures-util = "0.3" +hyper = { version = "0.14", features = ["full"] } +rand = "0.8" +regex = "1.10" +serde = "1.0" shiplift = "0.7" +sqlx = { version = "0.7", features = ["sqlite", "runtime-tokio"] } +thiserror = "1.0.40" tokio = { version = "1", features = ["full"] } +tower-http = { version = "0.4.4", features = ["cors"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } tracing = "0.1" tracing-log = "0.1" uuid = { version = "1.5.0", features = ["v4", "fast-rng", "macro-diagnostics"] } -thiserror = "1.0.40" -regex = "1.10" -futures-util = "0.3" + +[dev-dependencies] +anyhow = "1.0" +serde = { version = "1.0.164", features = ["derive"] } +serde_json = { version = "1.0.99", features = ["preserve_order"] } +serde_with = "2.3.3" +starknet = "0.6.0" +url = "2.4" \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..89ef28b --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# Katana-CI + +This repository contains a tool that helps starting Katana sequencer on demand (mostly for CI purposes). +To work, the `katana-ci` binary must be deployed on a server with docker installed. + +## Design + +To keep things simple and flexible for CI, the `katana-ci` uses docker under the hood. +With an `file` database for now, each user have an `api-key` that allows the `start` and `stop` of a Katana instance. +When a user starts an instance, a new container is created and started. + +The database trait `ProxifierDb` is for now targetting `Sqlite`, but may be reworked to support any backend supported by `sqlx` rust crate. + +## Usage + +The idea is to have the least overhead possible to spawn and interact with a Katana instance. So no client is designed for now, +and you can use very common tools like `curl`. + +1. Start an instance + ```bash + curl -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer my-key' \ + https:///start + + # Returns a simple string with the name of the created instance. + 4f2b3c60ae32 + ``` + The start will return an instance `name`, that can then be used to target Katana for this specific instance. + The `name` returned is always URL friendly. + +2. Use `starkli` to interact with the instance, for example: + ```bash + starkli block --full --rpc https:////katana + ``` + +3. To check the logs, you can hit the endpoint `/logs` of your instance, by default it returns `25` tail lines. You can use `all` or any number you like using the query parameter `n`. + ```bash + curl -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer my-key' \ + https:////logs + + curl -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer my-key' \ + https:////logs?n=100 + ``` + +4. Then, you can stop the instance if it's no longer needed. + ```bash + curl -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer my-key' \ + https:////stop + ``` + +## GitHub CI + +Work in progress. diff --git a/clippy.sh b/clippy.sh new file mode 100644 index 0000000..61f9b75 --- /dev/null +++ b/clippy.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cargo clippy --all-targets --all-features \ + -- -D warnings \ + -D future-incompatible \ + -D nonstandard-style -D rust-2018-idioms -D unused diff --git a/examples/contracts/c1.compiled_contract_class.json b/examples/contracts/c1.compiled_contract_class.json new file mode 100644 index 0000000..a63eeca --- /dev/null +++ b/examples/contracts/c1.compiled_contract_class.json @@ -0,0 +1 @@ +{"prime":"0x800000000000011000000000000000000000000000000000000000000000001","compiler_version":"2.3.0","bytecode":["0xa0680017fff8000","0x7","0x482680017ffa8000","0x100000000000000000000000000000000","0x400280007ff97fff","0x10780017fff7fff","0x4d","0x4825800180007ffa","0x0","0x400280007ff97fff","0x48297ffc80007ffd","0x482680017ff98000","0x1","0x4824800180007ffe","0x0","0x20680017fff7fff","0x4","0x10780017fff7fff","0x10","0x40780017fff7fff","0x1","0x480680017fff8000","0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473","0x400080007ffe7fff","0x48127ffc7fff8000","0x48127ff97fff8000","0x480a7ffb7fff8000","0x480680017fff8000","0x1","0x48127ffa7fff8000","0x482480017ff98000","0x1","0x208b7fff7fff7ffe","0x1104800180018000","0x45","0x482480017fff8000","0x44","0x480080007fff8000","0xa0680017fff8000","0x9","0x4824800180007ff7","0x0","0x482480017fff8000","0x100000000000000000000000000000000","0x400080007ff77fff","0x10780017fff7fff","0x16","0x4824800180007ff7","0x0","0x400080007ff87fff","0x40780017fff7fff","0x1","0x480680017fff8000","0x68656c6c6f","0x48127ffe7fff8000","0x48127ffd7fff8000","0x1104800180018000","0x29","0x482480017ff08000","0x1","0x48127ff67fff8000","0x480a7ffb7fff8000","0x480680017fff8000","0x0","0x48127ffa7fff8000","0x48127ffa7fff8000","0x208b7fff7fff7ffe","0x40780017fff7fff","0x1","0x480680017fff8000","0x4f7574206f6620676173","0x400080007ffe7fff","0x482480017ff58000","0x1","0x48127ff27fff8000","0x480a7ffb7fff8000","0x480680017fff8000","0x1","0x48127ffa7fff8000","0x482480017ff98000","0x1","0x208b7fff7fff7ffe","0x40780017fff7fff","0x1","0x480680017fff8000","0x4f7574206f6620676173","0x400080007ffe7fff","0x482680017ff98000","0x1","0x480a7ffa7fff8000","0x480a7ffb7fff8000","0x480680017fff8000","0x1","0x48127ffa7fff8000","0x482480017ff98000","0x1","0x208b7fff7fff7ffe","0x400380007ffd7ffb","0x480a7ffc7fff8000","0x482680017ffd8000","0x1","0x208b7fff7fff7ffe"],"hints":[[0,[{"TestLessThanOrEqual":{"lhs":{"Immediate":"0x0"},"rhs":{"Deref":{"register":"FP","offset":-6}},"dst":{"register":"AP","offset":0}}}]],[19,[{"AllocSegment":{"dst":{"register":"AP","offset":0}}}]],[38,[{"TestLessThanOrEqual":{"lhs":{"Immediate":"0x0"},"rhs":{"Deref":{"register":"AP","offset":-8}},"dst":{"register":"AP","offset":0}}}]],[50,[{"AllocSegment":{"dst":{"register":"AP","offset":0}}}]],[67,[{"AllocSegment":{"dst":{"register":"AP","offset":0}}}]],[82,[{"AllocSegment":{"dst":{"register":"AP","offset":0}}}]]],"entry_points_by_type":{"EXTERNAL":[{"selector":"0x2e4ad76613f67be4df62830e485c06afe143ff1d3dc068788a6705aeac8b747","offset":0,"builtins":["range_check"]}],"L1_HANDLER":[],"CONSTRUCTOR":[]}} \ No newline at end of file diff --git a/examples/contracts/c1.contract_class.json b/examples/contracts/c1.contract_class.json new file mode 100644 index 0000000..04b3650 --- /dev/null +++ b/examples/contracts/c1.contract_class.json @@ -0,0 +1 @@ +{"sierra_program":["0x1","0x3","0x0","0x2","0x3","0x0","0x73","0x8d","0xe","0x52616e6765436865636b","0x800000000000000100000000000000000000000000000000","0x4172726179","0x800000000000000300000000000000000000000000000001","0x1","0xb","0x536e617073686f74","0x800000000000000700000000000000000000000000000001","0x537472756374","0x800000000000000700000000000000000000000000000002","0x0","0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62","0x2","0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3","0x3","0x800000000000000f00000000000000000000000000000001","0x4275696c74696e436f737473","0x800000000000000700000000000000000000000000000000","0x53797374656d","0x16a4c8d7c05909052238a862d8cc3e7975bf05a07b3a69c6b28951083a6d672","0x800000000000000300000000000000000000000000000003","0x8","0x456e756d","0x9931c641b913035ae674b400b61a51476d506bbe8bba2ff8a6272790aba9e6","0x4","0x9","0x66656c74323532","0x753332","0x4761734275696c74696e","0x29","0x7265766f6b655f61705f747261636b696e67","0x77697468647261775f676173","0x6272616e63685f616c69676e","0x7374727563745f6465636f6e737472756374","0x61727261795f6c656e","0x736e617073686f745f74616b65","0xc","0x64726f70","0x7533325f636f6e7374","0x72656e616d65","0x73746f72655f74656d70","0x7533325f6571","0x61727261795f6e6577","0x66656c743235325f636f6e7374","0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473","0x61727261795f617070656e64","0x7374727563745f636f6e737472756374","0x656e756d5f696e6974","0xa","0xd","0x7","0x6765745f6275696c74696e5f636f737473","0x6","0x77697468647261775f6761735f616c6c","0x68656c6c6f","0x66756e6374696f6e5f63616c6c","0x5","0x4f7574206f6620676173","0x54","0xffffffffffffffff","0x40","0xf","0x10","0x1c","0x11","0x12","0x13","0x14","0x15","0x16","0x17","0x18","0x19","0x1a","0x1b","0x1d","0x33","0x1e","0x1f","0x20","0x21","0x22","0x23","0x26","0x27","0x24","0x25","0x28","0x2a","0x2b","0x2c","0x2d","0x2e","0x2f","0x30","0x31","0x32","0x34","0x35","0x36","0x37","0x38","0x39","0x3a","0x3b","0x3c","0x3d","0x3e","0x3f","0x41","0x42","0x43","0x44","0x4e","0x37e","0x21312110e0b10090f050e0b0a090d050c0b0a090505080706050403020100","0xb200b1f1e021d121c121b1a051905180b1517050516050e0b1509140b1009","0x2925050529250505280b0d05272505052625050524060505230f0505220b21","0xd301a05052f1605052f0605052e060505292d0d052c0605052b0b2a0b0505","0x50524370d052c0b36350505290b34310505293305052932050529050d3105","0x52f0f05052f050505260505052439050526050f0538050505290605052606","0xb0b3b390505293905052f060505280f0505263a0d052c0b0d31050d301905","0x53c050f050f0b0b3c050b0d0b33350d3d39190d3c0d050b0d050b0b3c050b","0x53c050b330b0b3c053105350b06310d3c051a05390b1a053c051605190b16","0x3c050005160b3e053c050605160b0b3c053205350b00320d3c052505390b25","0xb0d0b0b400b3c0d3f3e0d060b19053c051905310b3e053c053e051a0b3f05","0x542410d3e0b42053c054205000b42053c050b320b41053c050b250b0b3c05","0x1905310b46053c054505420b45053c0543440d410b44053c050b3f0b43053c","0x4719054a053c054605450b49053c050d05440b48053c053905430b47053c05","0xd4b39190f480b4b053c054b05470b4b053c050b460b0b3c050b0d0b4a4948","0x54a0b51053c050b490b50053c050b250b0b3c050b0d0b4f4e0d4d4c400d3c","0x4c0b55053c055005400b54053c055305000b0b3c0552054b0b53520d3c0551","0xb3c055805500b1e580d3c0556054f0b0b3c0557054e0b57560d3c0555540d","0x53c054005310b5b053c055a05530b5a053c055905520b59053c051e05510b","0x5f5e5d5c19055f053c055b05450b5e053c050d05440b5d053c054c05430b5c","0xd3e0b61053c056105000b61053c050b560b60053c050b250b0b3c050b0d0b","0xb64053c056305420b63053c054d620d410b62053c050b3f0b4d053c056160","0x68053c056405450b67053c050d05440b66053c054f05430b65053c054e0531","0x3c050b560b69053c050b250b0b3c050f05570b0b3c050b0d0b686766651905","0x6b6c0d410b6c053c050b3f0b6b053c056a690d3e0b6a053c056a05000b6a05","0x5440b6f053c053305430b6e053c053505310b3d053c056d05420b6d053c05","0x50d3e0b0d053c050b05540b71706f6e190571053c053d05450b70053c050d","0x390d0535053c051905580b39053c050f05400b19053c050b550b0f053c050d","0x72050b39050d05060d0b0f0d050b3133320b190f33320b190d35"],"sierra_program_debug_info":{"type_names":[[0,"RangeCheck"],[1,"Array"],[2,"Snapshot>"],[3,"core::array::Span::"],[4,"Tuple>"],[5,"Unit"],[6,"BuiltinCosts"],[7,"System"],[8,"core::panics::Panic"],[9,"Tuple>"],[10,"core::panics::PanicResult::<(core::array::Span::,)>"],[11,"felt252"],[12,"u32"],[13,"GasBuiltin"]],"libfunc_names":[[0,"revoke_ap_tracking"],[1,"withdraw_gas"],[2,"branch_align"],[3,"struct_deconstruct>"],[4,"array_len"],[5,"snapshot_take"],[6,"drop"],[7,"u32_const<0>"],[8,"rename"],[9,"store_temp"],[10,"store_temp"],[11,"u32_eq"],[12,"array_new"],[13,"felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>"],[14,"store_temp"],[15,"array_append"],[16,"struct_construct"],[17,"struct_construct>>"],[18,"enum_init,)>, 1>"],[19,"store_temp"],[20,"store_temp"],[21,"store_temp,)>>"],[22,"get_builtin_costs"],[23,"store_temp"],[24,"withdraw_gas_all"],[25,"felt252_const<448378203247>"],[26,"snapshot_take"],[27,"drop"],[28,"store_temp>"],[29,"function_call"],[30,"drop"],[31,"snapshot_take>"],[32,"drop>"],[33,"struct_construct>"],[34,"struct_construct>>"],[35,"enum_init,)>, 0>"],[36,"felt252_const<375233589013918064796019>"],[37,"drop>"],[38,"rename"],[39,"struct_construct"],[40,"store_temp"]],"user_func_names":[[0,"scarb_pg::simple::simple::__wrapper__say_hello"],[1,"core::Felt252Serde::serialize"]]},"contract_class_version":"0.1.0","entry_points_by_type":{"EXTERNAL":[{"selector":"0x2e4ad76613f67be4df62830e485c06afe143ff1d3dc068788a6705aeac8b747","function_idx":0}],"L1_HANDLER":[],"CONSTRUCTOR":[]},"abi":[{"type":"function","name":"say_hello","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"},{"type":"event","name":"scarb_pg::simple::simple::Event","kind":"enum","variants":[]}]} \ No newline at end of file diff --git a/examples/e2e.rs b/examples/e2e.rs new file mode 100644 index 0000000..63d7c1a --- /dev/null +++ b/examples/e2e.rs @@ -0,0 +1,115 @@ +use anyhow::Result; +use std::{env, sync::Arc}; + +use starknet::{ + accounts::{Account, ExecutionEncoding, SingleOwnerAccount}, + contract::ContractFactory, + core::types::{contract::SierraClass, BlockId, BlockTag, FieldElement, FunctionCall}, + macros::{felt, selector}, + providers::{jsonrpc::HttpTransport, AnyProvider, JsonRpcClient, Provider}, + signers::{LocalWallet, SigningKey}, +}; +use tokio::time::{sleep, Duration}; +use url::Url; + +#[tokio::main] +async fn main() -> Result<()> { + let rpc_url = env::var("STARKNET_RPC").expect("STARKNET_RPC must be set"); + let rpc_url = Url::parse(&rpc_url).expect("Invalid STARKNET_RPC URL"); + + let provider = + AnyProvider::JsonRpcHttp(JsonRpcClient::new(HttpTransport::new(rpc_url.clone()))); + + // KATANA-0 account with default seed. + let katana_chain_id = felt!("0x4b4154414e41"); + let katana_0_addr = FieldElement::from_hex_be( + "0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973", + ) + .unwrap(); + let katana_0_key = + FieldElement::from_hex_be("0x1800000000300000180000000000030000000000003006001800006600") + .unwrap(); + + let signer = LocalWallet::from(SigningKey::from_secret_scalar(katana_0_key)); + + let account = SingleOwnerAccount::new( + provider, + signer, + katana_0_addr, + katana_chain_id, + ExecutionEncoding::Legacy, + ); + + println!("Declaring"); + let casm_class_hash = FieldElement::from_hex_be( + "0x025dbb58db5071c88292cb25c81be128f2f47ccd8e3bd86260187f9937d181bb", + ) + .unwrap(); + + let class = serde_json::from_reader::<_, SierraClass>(std::fs::File::open( + "./examples/contracts/c1.contract_class.json", + )?) + .expect("Failed to read sierra class"); + + let class_hash = class.class_hash().unwrap(); + + let declaration = account.declare(Arc::new(class.flatten()?), casm_class_hash); + + let _tx = match declaration.send().await { + Ok(d) => Some(d.transaction_hash), + Err(_e) => { + // maybe already declared, skip for this example. + None + } + }; + + // Wait katana to process this tx, fairly quick. In production code + // it's more reliable to poll the tx receipt with the tx hash. + sleep(Duration::from_millis(2000)).await; + + println!("Deploying"); + let factory = ContractFactory::new(class_hash, account); + + let args = vec![]; + // Using a fix salt is usefull to have reproducible addresses + // for testing. + let salt = FieldElement::ZERO; + let is_unique = false; + let contract_deployment = factory.deploy(args, salt, is_unique); + let deployed_address = contract_deployment.deployed_address(); + + let _tx = contract_deployment.send().await?.transaction_hash; + + sleep(Duration::from_millis(2000)).await; + + let calldata = vec![]; + let block = BlockId::Tag(BlockTag::Pending); + + // account is for now consumed by the factory, and the provider + // by the account and for now we can't get account from ContractFactory. + println!("Calling"); + let provider = + AnyProvider::JsonRpcHttp(JsonRpcClient::new(HttpTransport::new(rpc_url.clone()))); + + let r = provider + .call( + FunctionCall { + contract_address: deployed_address, + entry_point_selector: selector!("say_hello"), + calldata, + }, + block, + ) + .await?; + + assert_eq!( + r[0], + felt!("0x00000000000000000000000000000000000000000000000000000068656c6c6f") + ); + + println!("Call result: {:?}", r); + + // r[0] should be: 0x00000000000000000000000000000000000000000000000000000068656c6c6f, which is 'hello'. + + Ok(()) +} diff --git a/migrations/0_default.sql b/migrations/0_default.sql new file mode 100644 index 0000000..02c5de9 --- /dev/null +++ b/migrations/0_default.sql @@ -0,0 +1,17 @@ +-- SQL default migration with simple tables. + +CREATE TABLE user_info ( + user_name TEXT NOT NULL, + api_key TEXT NOT NULL, + + PRIMARY KEY (api_key) +); + +CREATE TABLE instance_info ( + container_id TEXT NOT NULL, + instance_name TEXT NOT NULL, + api_key TEXT NOT NULL, + proxied_port INT NOT NULL, + + PRIMARY KEY (`instance_name`) +); diff --git a/src/db.rs b/src/db.rs index f6ef784..337fdad 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,8 +1,10 @@ //! Database abstraction to manage Katana instances. //! use async_trait::async_trait; -use regex::Regex; -use std::collections::HashMap; +//use regex::Regex; +use sqlx::{sqlite::SqliteConnectOptions, Error as SqlxError, FromRow, SqlitePool}; +use std::str::FromStr; +use tracing::trace; use uuid::Uuid; /// Errors for DB operations. @@ -12,32 +14,41 @@ pub enum DbError { Generic(String), #[error("Entity already in the database: {0}")] AlreadyExists(String), + #[error("SQLx error: {0}")] + Sqlx(SqlxError), } /// Katana instance info, used to track /// the spawned instances in docker containers. /// The `name` of an instance must follow the `is_valid_instance_name` rules. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, sqlx::FromRow)] pub struct InstanceInfo { pub container_id: String, pub proxied_port: u16, + #[sqlx(rename = "instance_name")] pub name: String, pub api_key: String, } /// User's info. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, sqlx::FromRow)] pub struct UserInfo { + #[sqlx(rename = "user_name")] pub name: String, pub api_key: String, } -/// -fn is_valid_instance_name(name: &str) -> bool { - let re = Regex::new(r"^[a-z0-9]+$").unwrap(); - re.is_match(name) +pub fn get_random_name() -> String { + let uid = Uuid::new_v4().to_string(); + uid.rsplit('-').next().unwrap().to_string() } +/// +// fn is_valid_instance_name(name: &str) -> bool { +// let re = Regex::new(r"^[a-z0-9]+$").unwrap(); +// re.is_match(name) +// } + #[async_trait] pub trait ProxifierDb: Send + Sync { async fn user_add(&mut self, name: &str, api_key: Option) -> Result; @@ -48,35 +59,96 @@ pub trait ProxifierDb: Send + Sync { async fn is_port_in_use(&self, port: u16) -> Result; } -/// Default implementation fully in memory of the ProxifierDb. -pub enum AnyEntry { - User(UserInfo), - Instance(InstanceInfo), +impl From for DbError { + fn from(e: SqlxError) -> Self { + DbError::Sqlx(e) + } } -pub struct HashMapDb { - map: HashMap, +/// Default implementation with SQLx. +#[derive(Debug, Clone)] +pub struct SqlxDb { + pool: SqlitePool, } -impl HashMapDb { - pub fn new() -> Self { - Self { - map: HashMap::new(), +impl SqlxDb { + pub fn get_pool_ref(&self) -> &SqlitePool { + &self.pool + } + + pub async fn new_any(_db_url: &str) -> Result { + Ok(Self { + pool: SqlitePool::connect_with(SqliteConnectOptions::from_str("sqlite:data.db")?) + .await?, + }) + } + + pub async fn get_free_port(&self) -> Option { + trace!("checking for free port"); + + loop { + let port = rand::random::(); + if port > 10000 && port < 65000 { + match self.is_port_in_use(port).await { + Ok(in_use) => { + if in_use { + trace!("port {port} in use"); + continue; + } else { + trace!("free port found {port}"); + return Some(port); + } + } + Err(_e) => return None, + }; + } } } - fn get_user_key(&self, api_key: &str) -> String { - format!("USER#{}", api_key) + async fn get_instance_by_name(&self, name: &str) -> Result, DbError> { + let q = "SELECT * FROM instance_info WHERE instance_name = ?;"; + + match sqlx::query(q) + .bind(name.to_string()) + .fetch_all(&self.pool) + .await + { + Ok(rows) => { + if rows.is_empty() { + Ok(None) + } else { + Ok(Some(InstanceInfo::from_row(&rows[0])?)) + } + } + Err(e) => Err(DbError::Sqlx(e)), + } } - fn get_instance_key(&self, name: &str) -> String { - format!("INSTANCE#{}", name) + async fn get_user_by_apikey(&self, api_key: &str) -> Result, DbError> { + let q = "SELECT * FROM user_info WHERE api_key = ?;"; + + match sqlx::query(q) + .bind(api_key.to_string()) + .fetch_all(&self.pool) + .await + { + Ok(rows) => { + if rows.is_empty() { + Ok(None) + } else { + Ok(Some(UserInfo::from_row(&rows[0])?)) + } + } + Err(e) => Err(DbError::Sqlx(e)), + } } } #[async_trait] -impl ProxifierDb for HashMapDb { +impl ProxifierDb for SqlxDb { async fn user_add(&mut self, name: &str, api_key: Option) -> Result { + trace!("adding new user {name} with api_key {:?}", api_key); + let name = name.to_string(); let api_key = if let Some(k) = api_key { if (self.user_from_api_key(&k).await?).is_some() { @@ -88,33 +160,32 @@ impl ProxifierDb for HashMapDb { Uuid::new_v4().to_string() }; - let user_key = self.get_user_key(&api_key); - let info = UserInfo { name, api_key }; - self.map.insert(user_key, AnyEntry::User(info.clone())); + let q = "INSERT INTO user_info (user_name, api_key) VALUES (?, ?);"; + + let _r = sqlx::query(q) + .bind(info.name.clone()) + .bind(info.api_key.clone()) + .execute(&self.pool) + .await?; + Ok(info) } async fn user_from_api_key(&self, api_key: &str) -> Result, DbError> { - let user_key = self.get_user_key(&api_key); - if let Some(AnyEntry::User(info)) = self.map.get(&user_key) { - Ok(Some(info.clone())) - } else { - Ok(None) - } + trace!("getting user from api_key {api_key}"); + self.get_user_by_apikey(api_key).await } async fn instance_from_name(&self, name: &str) -> Result, DbError> { - let instance_key = self.get_instance_key(&name); - if let Some(AnyEntry::Instance(info)) = self.map.get(&instance_key) { - Ok(Some(info.clone())) - } else { - Ok(None) - } + trace!("getting instance from name {name}"); + self.get_instance_by_name(name).await } async fn instance_add(&mut self, info: &InstanceInfo) -> Result<(), DbError> { + trace!("adding instance {:?}", info); + if (self.instance_from_name(&info.name).await?).is_some() { return Err(DbError::AlreadyExists(format!( "Instance {} already exists", @@ -122,144 +193,151 @@ impl ProxifierDb for HashMapDb { ))); } - let instance_key = self.get_instance_key(&info.name); + let q = "INSERT INTO instance_info (container_id, proxied_port, instance_name, api_key) VALUES (?, ?, ?, ?);"; + + let _r = sqlx::query(q) + .bind(info.container_id.clone()) + .bind(info.proxied_port) + .bind(info.name.clone()) + .bind(info.api_key.clone()) + .execute(&self.pool) + .await?; - self.map - .insert(instance_key, AnyEntry::Instance(info.clone())); Ok(()) } async fn instance_rm(&mut self, name: &str) -> Result<(), DbError> { + trace!("removing instance {name}"); + if (self.instance_from_name(name).await?).is_some() { - let instance_key = self.get_instance_key(name); - self.map.remove(&instance_key); + let q = "DELETE FROM instance_info WHERE instance_name = ?;"; + sqlx::query(q) + .bind(name.to_string()) + .fetch_all(&self.pool) + .await?; } Ok(()) } async fn is_port_in_use(&self, port: u16) -> Result { - for (key, value) in self.map.iter() { - if !key.starts_with("INSTANCE#") { - continue; - } + trace!("checking port {port}"); - if let AnyEntry::Instance(info) = value { - if info.proxied_port == port { - return Ok(true); - } - } - } + let q = "SELECT * FROM instance_info WHERE proxied_port = ?;"; - Ok(false) + Ok(!sqlx::query(q) + .bind(port.to_string()) + .fetch_all(&self.pool) + .await? + .is_empty()) } } -#[cfg(test)] -mod tests { - use super::*; - - #[tokio::test] - async fn test_hashmap_db_user_add() { - let mut db = HashMapDb::new(); - let u = db.user_add("user1", None).await.unwrap(); - - assert_eq!(u.name, "user1"); - } - - #[tokio::test] - async fn test_hashmap_db_user_from_api_key() { - let mut db = HashMapDb::new(); - - let u = db.user_from_api_key("abcd").await.unwrap(); - assert_eq!(u, None); - - db.user_add("user1", Some("my-key".to_string())) - .await - .unwrap(); - - let u = db.user_from_api_key("my-key").await.unwrap(); - assert_eq!( - u, - Some(UserInfo { - name: "user1".to_string(), - api_key: "my-key".to_string(), - }) - ); - } - - #[tokio::test] - async fn test_hashmap_db_instance_add() { - let mut db = HashMapDb::new(); - let i = InstanceInfo { - container_id: "1".to_string(), - api_key: "my-key".to_string(), - name: "test1".to_string(), - proxied_port: 1234, - }; - - db.instance_add(&i).await.unwrap(); - } - - #[tokio::test] - async fn test_hashmap_db_instance_from_name() { - let mut db = HashMapDb::new(); - - let db_i = db.instance_from_name("test1").await.unwrap(); - assert_eq!(db_i, None); - - let i = InstanceInfo { - container_id: "1".to_string(), - api_key: "my-key".to_string(), - name: "test1".to_string(), - proxied_port: 1234, - }; - - db.instance_add(&i).await.unwrap(); - - let db_i = db.instance_from_name("test1").await.unwrap(); - assert_eq!(db_i, Some(i)); - } - - #[tokio::test] - async fn test_hashmap_db_instance_rm() { - let mut db = HashMapDb::new(); - - db.instance_rm("test1").await.unwrap(); - - let i = InstanceInfo { - container_id: "1".to_string(), - api_key: "my-key".to_string(), - name: "test1".to_string(), - proxied_port: 1234, - }; - - db.instance_add(&i).await.unwrap(); - - let db_i = db.instance_from_name("test1").await.unwrap(); - assert_eq!(db_i, Some(i)); - - db.instance_rm("test1").await.unwrap(); - - let db_i = db.instance_from_name("test1").await.unwrap(); - assert_eq!(db_i, None); - } - - #[tokio::test] - async fn test_hashmap_db_is_port_in_use() { - let mut db = HashMapDb::new(); - - assert_eq!(db.is_port_in_use(1234).await.unwrap(), false); - - let i = InstanceInfo { - container_id: "1".to_string(), - api_key: "my-key".to_string(), - name: "test1".to_string(), - proxied_port: 1234, - }; - - db.instance_add(&i).await.unwrap(); - - assert_eq!(db.is_port_in_use(1234).await.unwrap(), true); - } -} +// #[cfg(test)] +// mod tests { +// use super::*; + +// #[tokio::test] +// async fn test_hashmap_db_user_add() { +// let mut db = HashMapDb::new(); +// let u = db.user_add("user1", None).await.unwrap(); + +// assert_eq!(u.name, "user1"); +// } + +// #[tokio::test] +// async fn test_hashmap_db_user_from_api_key() { +// let mut db = HashMapDb::new(); + +// let u = db.user_from_api_key("abcd").await.unwrap(); +// assert_eq!(u, None); + +// db.user_add("user1", Some("my-key".to_string())) +// .await +// .unwrap(); + +// let u = db.user_from_api_key("my-key").await.unwrap(); +// assert_eq!( +// u, +// Some(UserInfo { +// name: "user1".to_string(), +// api_key: "my-key".to_string(), +// }) +// ); +// } + +// #[tokio::test] +// async fn test_hashmap_db_instance_add() { +// let mut db = HashMapDb::new(); +// let i = InstanceInfo { +// container_id: "1".to_string(), +// api_key: "my-key".to_string(), +// name: "test1".to_string(), +// proxied_port: 1234, +// }; + +// db.instance_add(&i).await.unwrap(); +// } + +// #[tokio::test] +// async fn test_hashmap_db_instance_from_name() { +// let mut db = HashMapDb::new(); + +// let db_i = db.instance_from_name("test1").await.unwrap(); +// assert_eq!(db_i, None); + +// let i = InstanceInfo { +// container_id: "1".to_string(), +// api_key: "my-key".to_string(), +// name: "test1".to_string(), +// proxied_port: 1234, +// }; + +// db.instance_add(&i).await.unwrap(); + +// let db_i = db.instance_from_name("test1").await.unwrap(); +// assert_eq!(db_i, Some(i)); +// } + +// #[tokio::test] +// async fn test_hashmap_db_instance_rm() { +// let mut db = HashMapDb::new(); + +// db.instance_rm("test1").await.unwrap(); + +// let i = InstanceInfo { +// container_id: "1".to_string(), +// api_key: "my-key".to_string(), +// name: "test1".to_string(), +// proxied_port: 1234, +// }; + +// db.instance_add(&i).await.unwrap(); + +// let db_i = db.instance_from_name("test1").await.unwrap(); +// assert_eq!(db_i, Some(i)); + +// db.instance_rm("test1").await.unwrap(); + +// let db_i = db.instance_from_name("test1").await.unwrap(); +// assert_eq!(db_i, None); +// } + +// #[tokio::test] +// async fn test_hashmap_db_is_port_in_use() { +// let mut db = HashMapDb::new(); + +// assert_eq!(db.is_port_in_use(1234).await.unwrap(), false); + +// let i = InstanceInfo { +// container_id: "1".to_string(), +// api_key: "my-key".to_string(), +// name: "test1".to_string(), +// proxied_port: 1234, +// }; + +// db.instance_add(&i).await.unwrap(); + +// assert_eq!(db.is_port_in_use(1234).await.unwrap(), true); +// } +// } diff --git a/src/docker_manager.rs b/src/docker_manager.rs index feb9b75..1d81089 100644 --- a/src/docker_manager.rs +++ b/src/docker_manager.rs @@ -1,8 +1,10 @@ //! Docker abstraction to create, start and stop containers. -use shiplift::{errors::Error as ShipliftError, ContainerOptions, Docker, LogsOptions}; -use shiplift::tty::TtyChunk; use futures_util::stream::StreamExt; -use tracing::{debug, trace}; +use shiplift::tty::TtyChunk; +use shiplift::{ + errors::Error as ShipliftError, ContainerOptions, Docker, LogsOptions, RmContainerOptions, +}; +use tracing::trace; /// Errors for docker operations. #[derive(Debug, thiserror::Error)] @@ -19,11 +21,42 @@ impl From for DockerError { } } +#[derive(Clone)] pub struct DockerManager { docker: Docker, image: String, } +#[derive(Debug, Default)] +pub struct KatanaDockerOptions { + pub port: u32, + pub block_time: Option, + pub no_mining: Option, +} + +impl KatanaDockerOptions { + pub fn to_str_vec(&self) -> Vec { + let mut out = vec![ + "katana".to_string(), + "--port".to_string(), + self.port.to_string(), + "--disable-fee".to_string(), + ]; + + if let Some(v) = self.block_time { + out.push("--block-time".to_string()); + out.push(v.to_string()); + } + + if let Some(v) = self.no_mining { + out.push("--no-mining".to_string()); + out.push(v.to_string()); + } + + out + } +} + impl DockerManager { pub fn new(image: &str) -> Self { Self { @@ -32,28 +65,36 @@ impl DockerManager { } } - pub async fn create(&self, port: u32) -> Result { + pub async fn create(&self, opts: &KatanaDockerOptions) -> Result { let c = self .docker .containers() .create( &ContainerOptions::builder(self.image.as_ref()) - .expose(port, "tcp", port) - .cmd(vec!["katana", "--port", &port.to_string()]) + .expose(opts.port, "tcp", opts.port) + .cmd(opts.to_str_vec().iter().map(|n| &**n).collect()) .build(), ) .await?; - trace!("created {}", c.id); + trace!("created {} with opts {:?}", c.id, opts); Ok(c.id) } - pub async fn remove(&self, container_id: &str) -> Result<(), DockerError> { + pub async fn remove(&self, container_id: &str, force: bool) -> Result<(), DockerError> { let c = self.docker.containers().get(container_id); - trace!("stopping {}", container_id); - c.stop(None).await?; - trace!("deleting {}", container_id); - c.delete().await?; + + if force { + trace!("force removing {}", container_id); + let opts = RmContainerOptions::builder().force(true).build(); + c.remove(opts).await?; + } else { + trace!("stopping {}", container_id); + c.stop(None).await?; + trace!("deleting {}", container_id); + c.delete().await?; + } + Ok(()) } @@ -63,27 +104,32 @@ impl DockerManager { Ok(()) } - pub async fn logs(&self, container_id: &str) -> Result { + pub async fn logs(&self, container_id: &str, n: String) -> Result { + // TODO: n must be en enum All/Number. let mut output: String = String::new(); - let mut logs_stream = self.docker - .containers() - .get(container_id) - .logs(&LogsOptions::builder().stdout(true).stderr(true).tail("all").build()); + let mut logs_stream = self.docker.containers().get(container_id).logs( + &LogsOptions::builder() + .stdout(true) + .stderr(true) + .tail(&n) + .build(), + ); while let Some(log_result) = logs_stream.next().await { match log_result { - Ok(chunk) => { - match chunk { - TtyChunk::StdOut(bytes) => output.push_str(std::str::from_utf8(&bytes).unwrap()), - TtyChunk::StdErr(bytes) => output.push_str(std::str::from_utf8(&bytes).unwrap()), - TtyChunk::StdIn(_) => unreachable!(), + Ok(chunk) => match chunk { + TtyChunk::StdOut(bytes) => { + output.push_str(std::str::from_utf8(&bytes).unwrap()) } - - } + TtyChunk::StdErr(bytes) => { + output.push_str(std::str::from_utf8(&bytes).unwrap()) + } + TtyChunk::StdIn(_) => unreachable!(), + }, Err(e) => return Err(DockerError::Shiplift(e)), }; - }; + } Ok(output) } diff --git a/src/extractors.rs b/src/extractors.rs new file mode 100644 index 0000000..8263327 --- /dev/null +++ b/src/extractors.rs @@ -0,0 +1,121 @@ +use axum::{ + async_trait, + extract::rejection::TypedHeaderRejectionReason, + extract::{FromRef, FromRequestParts}, + headers::{self, authorization::Bearer, Authorization}, + http::{header, request::Parts, StatusCode}, + response::{IntoResponse, Response}, + RequestPartsExt, TypedHeader, +}; + +use tracing::error; + +use crate::db::{DbError, ProxifierDb, SqlxDb}; + +/// Errors during authentication. +#[derive(Debug, thiserror::Error)] +pub enum AuthenticationError { + #[error("Unauthorized: {0}")] + Unauthorized(String), + #[error("Database error: {0}")] + DbError(DbError), +} + +impl IntoResponse for AuthenticationError { + fn into_response(self) -> Response { + match self { + Self::Unauthorized(s) => { + error!("{s}"); + StatusCode::UNAUTHORIZED.into_response() + } + Self::DbError(e) => { + error!("{e}"); + StatusCode::INTERNAL_SERVER_ERROR.into_response() + } + } + } +} + +#[derive(Debug)] +pub struct AuthenticatedUser { + pub api_key: String, +} + +#[async_trait] +impl FromRequestParts for AuthenticatedUser +where + SqlxDb: FromRef, + S: Send + Sync, +{ + type Rejection = AuthenticationError; + + async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { + // To complicated to have a bad request without info. + // Return unauthorized for now. + let bearer = extract_authorization_bearer(parts) + .await + .ok_or(AuthenticationError::Unauthorized("no bearer".to_string()))?; + + let api_key = bearer.token().to_string(); + + let db = SqlxDb::from_ref(state); + + match db + .user_from_api_key(&api_key) + .await + .map_err(AuthenticationError::DbError)? + { + Some(_u) => Ok(AuthenticatedUser { api_key }), + None => Err(AuthenticationError::Unauthorized(format!( + "API-KEY {api_key}" + ))), + } + } +} + +/// Extract authorization bearer from headers. +async fn extract_authorization_bearer( + parts: &mut Parts, +) -> Option>> { + match parts + .extract::>>() + .await + { + Ok(bearer) => Some(bearer), + Err(e) => match *e.name() { + header::AUTHORIZATION => match e.reason() { + TypedHeaderRejectionReason::Missing => None, + _ => { + error!("unexpected error getting Authorization header(s): {}", e); + None + } + }, + _ => { + error!("unexpected error getting authorization: {}", e); + None + } + }, + } +} + +struct DatabaseConnection(sqlx::AnyPool); + +#[async_trait] +impl FromRequestParts for DatabaseConnection +where + sqlx::AnyPool: FromRef, + S: Send + Sync, +{ + type Rejection = (StatusCode, String); + + async fn from_request_parts(_parts: &mut Parts, state: &S) -> Result { + let pool = sqlx::AnyPool::from_ref(state); + + let _conn = pool + .acquire() + .await + .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("conn error {e}")))?; + + Ok(Self(pool)) + } +} diff --git a/src/handlers.rs b/src/handlers.rs new file mode 100644 index 0000000..26158ba --- /dev/null +++ b/src/handlers.rs @@ -0,0 +1,164 @@ +use axum::{ + body::Body, + extract::{FromRef, Path, Query, State}, + http::{uri::Uri, Request, StatusCode}, + response::{IntoResponse, Response}, +}; + +use serde::Deserialize; +use tracing::error; + +use crate::db::{DbError, InstanceInfo, ProxifierDb, SqlxDb}; +use crate::docker_manager::{DockerError, DockerManager, KatanaDockerOptions}; +use crate::extractors::AuthenticatedUser; +use crate::{AppState, HttpClient}; + +impl From for hyper::StatusCode { + fn from(e: DbError) -> Self { + error!("{}", e); + StatusCode::INTERNAL_SERVER_ERROR + } +} + +impl From for (hyper::StatusCode, String) { + fn from(e: DbError) -> Self { + error!("{}", e); + (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()) + } +} + +impl From for hyper::StatusCode { + fn from(e: DockerError) -> Self { + error!("{}", e); + StatusCode::INTERNAL_SERVER_ERROR + } +} + +impl From for (hyper::StatusCode, String) { + fn from(e: DockerError) -> Self { + error!("{}", e); + (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()) + } +} + +#[derive(Deserialize)] +pub struct KatanaStartQueryParams { + pub block_time: Option, + pub no_mining: Option, +} + +pub async fn start_katana( + State(state): State, + Query(params): Query, + user: AuthenticatedUser, +) -> Result { + let mut db = SqlxDb::from_ref(&state); + let docker = DockerManager::from_ref(&state); + + let port = db.get_free_port().await.expect("Impossible to get a port"); + + let container_id = docker + .create(&KatanaDockerOptions { + block_time: params.block_time, + no_mining: params.no_mining, + port: port as u32, + }) + .await?; + + docker.start(&container_id).await?; + + let name = crate::db::get_random_name(); + + db.instance_add(&InstanceInfo { + container_id, + api_key: user.api_key.clone(), + name: name.clone(), + proxied_port: port, + }) + .await?; + + Ok(name) +} + +pub async fn stop_katana( + State(state): State, + Path(name): Path, + _user: AuthenticatedUser, +) -> Result { + let mut db = SqlxDb::from_ref(&state); + let docker = DockerManager::from_ref(&state); + + let instance = db.instance_from_name(&name).await?; + if instance.is_none() { + return Ok((StatusCode::BAD_REQUEST, "Invalid name").into_response()); + } + + let instance = instance.unwrap(); + + let force = true; + docker.remove(&instance.container_id, force).await?; + + db.instance_rm(&instance.name).await?; + + Ok(().into_response()) +} + +pub async fn proxy_request_katana( + State(state): State, + Path(name): Path, + mut req: Request, +) -> Result { + let db = SqlxDb::from_ref(&state); + let http = HttpClient::from_ref(&state); + //let docker = DockerManager::from_ref(&state); + + let instance = db.instance_from_name(&name).await?; + if instance.is_none() { + return Ok((StatusCode::BAD_REQUEST, "Invalid name").into_response()); + } + + let instance = instance.unwrap(); + + let path = req.uri().path(); + let path_query = req + .uri() + .path_and_query() + .map(|v| v.as_str()) + .unwrap_or(path); + + let uri = format!("http://127.0.0.1:{}{}", instance.proxied_port, path_query); + + *req.uri_mut() = Uri::try_from(uri).unwrap(); + + Ok(http + .request(req) + .await + .map_err(|_| StatusCode::BAD_REQUEST)? + .into_response()) +} + +#[derive(Deserialize)] +pub struct KatanaLogsQueryParams { + pub n: Option, +} + +pub async fn logs_katana( + State(state): State, + Path(name): Path, + Query(params): Query, + _user: AuthenticatedUser, +) -> Result { + let db = SqlxDb::from_ref(&state); + let docker = DockerManager::from_ref(&state); + + let n = params.n.unwrap_or("25".to_string()); + + let instance = db.instance_from_name(&name).await?; + if instance.is_none() { + return Err((StatusCode::BAD_REQUEST, "Invalid name".to_string())); + } + + let instance = instance.unwrap(); + + Ok(docker.logs(&instance.container_id, n).await?) +} diff --git a/src/main.rs b/src/main.rs index cebb095..290d08f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,47 +5,101 @@ //! and then manage it internally using the name provided by the user. //! This version is fully on-memory, and will drop every managed service //! if killed. -use shiplift::{ContainerOptions, Docker}; -use std::collections::HashMap; +use axum::{ + body::Body, + extract::FromRef, + routing::{get, post}, + Router, Server, +}; +use hyper::client::HttpConnector; +use std::env; use std::error::Error; -use tokio::time::{sleep, Duration}; -use tracing::{debug, info, trace}; +use std::fs::File; +use std::io::{self, BufRead}; +use tower_http::cors::{Any, CorsLayer}; +use tracing::{debug, error, info, warn}; use tracing_subscriber::{EnvFilter, FmtSubscriber}; mod db; -use db::HashMapDb; +use db::{ProxifierDb, SqlxDb}; mod docker_manager; use docker_manager::DockerManager; +mod extractors; +mod handlers; + +type HttpClient = hyper::client::Client; + +#[derive(Clone)] +pub struct AppState { + pub db: SqlxDb, + pub docker: DockerManager, + pub http: HttpClient, +} + +impl FromRef for SqlxDb { + fn from_ref(state: &AppState) -> Self { + state.db.clone() + } +} + +impl FromRef for HttpClient { + fn from_ref(state: &AppState) -> Self { + state.http.clone() + } +} + +impl FromRef for DockerManager { + fn from_ref(state: &AppState) -> Self { + state.docker.clone() + } +} + #[tokio::main] async fn main() -> Result<(), Box> { init_logging()?; - let mut db = HashMapDb::new(); - let docker = DockerManager::new("katana"); + let docker_image = env::var("KATANA_CI_IMAGE").expect("KATANA_CI_IMAGE is not set"); - let id = docker.create(8899).await?; - info!("id {}", id); + sqlx::any::install_default_drivers(); - sleep(Duration::from_millis(2000)).await; + let mut db = SqlxDb::new_any("sqlite::memory:").await?; - docker.start(&id).await?; + sqlx::migrate!("./migrations") + .run(db.get_pool_ref()) + .await?; - sleep(Duration::from_millis(2000)).await; + load_users_from_env(&mut db).await; - let logs = docker.logs(&id).await?; - debug!("{}", logs); + let docker = DockerManager::new(&docker_image); + let http: HttpClient = hyper::Client::builder().build(HttpConnector::new()); - sleep(Duration::from_millis(10000)).await; + let state = AppState { + db: db.clone(), + http, + docker, + }; - sleep(Duration::from_millis(2000)).await; + let dev_cors = CorsLayer::new() + .allow_methods(Any) + .allow_headers(Any) + .allow_origin(Any); - let logs = docker.logs(&id).await?; - debug!("{}", logs); - - docker.remove(&id).await?; + // build our application with a route + let app = Router::new() + .route("/start", get(handlers::start_katana)) + .route("/:name/stop", get(handlers::stop_katana)) + .route("/:name/logs", get(handlers::logs_katana)) + .route("/:name/katana", post(handlers::proxy_request_katana)) + .with_state(state) + .layer(dev_cors); + let ip = "127.0.0.1:5050"; + info!("{}", format!("📡 waiting for requests on http://{ip}...")); + Server::bind(&ip.parse().unwrap()) + .serve(app.into_make_service()) + .await?; Ok(()) } @@ -63,3 +117,46 @@ fn init_logging() -> Result<(), Box> { Ok(()) } + +async fn load_users_from_env(db: &mut SqlxDb) { + let file_path = match env::var("KATANA_CI_USERS_FILE") { + Ok(path) => path, + Err(_) => { + warn!("KATANA_CI_USERS_FILE not set, skipping default users"); + return; + } + }; + + let file = match File::open(&file_path) { + Ok(file) => file, + Err(err) => { + eprintln!("Failed to open file: {}", err); + std::process::exit(1); + } + }; + + for line in io::BufReader::new(file).lines() { + match line { + Ok(contents) => { + let parts: Vec<&str> = contents.split(',').collect(); + + if parts.len() != 2 { + eprintln!("File should contain two comma-separated strings."); + std::process::exit(1); + } + + let name = parts[0].trim(); + let api_key = parts[1].trim(); + + match db.user_add(name, Some(api_key.to_string())).await { + Ok(_) => debug!("Default user {} added", name), + Err(e) => error!("Can't add default user {name}: {e}"), + } + } + Err(err) => { + eprintln!("Failed to read line: {}", err); + std::process::exit(1); + } + } + } +}