diff --git a/.env.example b/.env.example index 6ade5e55..a46ffb1c 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,9 @@ -# Note that RPC_URL_{CHAIN_ID} is required for fetch data -RPC_URL_ETHEREUM_SEPOLIA=https://goerli.infura.io/v3/your-infura-api-key +# Note that PROVIDER_URL_{CHAIN_ID} is required for fetch data +PROVIDER_URL_ETHEREUM_SEPOLIA=https://goerli.infura.io/v3/your-infura-api-key # this value is optional -RPC_CHUNK_SIZE_ETHEREUM_SEPOLIA=2000 +PROVIDER_CHUNK_SIZE_ETHEREUM_SEPOLIA=2000 + +PROVIDER_URL_STARKNET_SEPOLIA=# if it's starknet make sure to use pathfinder # Optional DRY_RUN_CAIRO_PATH= # path for dry run cairo diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d247b59d..7575e505 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,6 @@ jobs: run: | rustup component add clippy rustup component add rustfmt - - name: Install cargo-make - run: cargo install --debug cargo-make + - uses: taiki-e/install-action@just - name: Run clippy and formatter checks - run: cargo make run-ci-flow + run: just run-ci-flow diff --git a/.github/workflows/fixtures.yml b/.github/workflows/fixtures.yml new file mode 100644 index 00000000..db92973c --- /dev/null +++ b/.github/workflows/fixtures.yml @@ -0,0 +1,85 @@ +name: Generate and Merge Fixtures + +on: + workflow_dispatch: + push: + branches: + - dev + +jobs: + generate_fixtures: + runs-on: ubuntu-latest + steps: + - name: Checkout current repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Display Python version + run: python -c "import sys; print(sys.version)" + + - uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Install CLI binary + run: | + cargo install --locked -f --path cli/ + + - name: Clone hdp-test repository + run: | + git clone -b ${{ github.ref_name }} https://x-access-token:${{ secrets.REPO_ACCESS_TOKEN }}@github.com/HerodotusDev/hdp-test.git hdp-test || git clone https://x-access-token:${{ secrets.REPO_ACCESS_TOKEN }}@github.com/HerodotusDev/hdp-test.git hdp-test + cd hdp-test + git checkout -b ${{ github.ref_name }} || git checkout ${{ github.ref_name }} + git config user.name github-actions + git config user.email github-actions@github.com + + - name: Generate .env file + run: | + cd hdp-test + cat << EOF > .env + RPC_URL_ETHEREUM_SEPOLIA=${{ secrets.RPC_URL_ETHEREUM_SEPOLIA }} + RPC_CHUNK_SIZE_ETHEREUM_SEPOLIA=${{ secrets.RPC_CHUNK_SIZE_ETHEREUM_SEPOLIA }} + DRY_RUN_CAIRO_PATH=${{ secrets.DRY_RUN_CAIRO_PATH }} + SOUND_RUN_CAIRO_PATH=${{ secrets.SOUND_RUN_CAIRO_PATH }} + SAVE_FETCH_KEYS_FILE=${{ secrets.SAVE_FETCH_KEYS_FILE }} + EOF + + - name: Set up and generate fixtures + run: | + cd hdp-test + make cleanup + make setup + source venv/bin/activate + make generate + + - name: Commit and push new fixtures + run: | + cd hdp-test + git add . + git commit -m "Update fixtures" + git push origin ${{ github.ref_name }} + + merge_to_main: + needs: generate_fixtures + if: github.ref == 'refs/heads/dev' + runs-on: ubuntu-latest + steps: + - name: Checkout hdp-test repository + uses: actions/checkout@v4 + with: + repository: HerodotusDev/hdp-test + token: ${{ secrets.REPO_ACCESS_TOKEN }} + fetch-depth: 0 + + - name: Merge fixtures to main + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git fetch origin + git checkout main + git merge --no-ff origin/${{ github.ref_name }} -m "Merge ${{ github.ref_name }} into main" + git push origin main diff --git a/Cargo.lock b/Cargo.lock index 30a118f9..6b7cc530 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aes" @@ -57,9 +57,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134b68e24175eff6c3c4d2bffeefb0a1b7435462130862c88d1524ca376e7e5" +checksum = "0ba1c79677c9ce51c8d45e20845b05e6fb070ea2c863fba03ad6af2c778474bd" dependencies = [ "alloy-consensus", "alloy-contract", @@ -78,14 +78,13 @@ dependencies = [ "alloy-transport-http", "alloy-transport-ipc", "alloy-transport-ws", - "reqwest 0.12.5", ] [[package]] name = "alloy-chains" -version = "0.1.22" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e9a1892803b02f53e25bea3e414ddd0501f12d97456c9d5ade4edf88f9516f" +checksum = "b68b94c159bcc2ca5f758b8663d7b00fc7c5e40569984595ddf2221b0f7f7f6e" dependencies = [ "num_enum", "strum", @@ -93,9 +92,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a016bfa21193744d4c38b3f3ab845462284d129e5e23c7cc0fafca7e92d9db37" +checksum = "da374e868f54c7f4ad2ad56829827badca388efd645f8cf5fccc61c2b5343504" dependencies = [ "alloy-eips", "alloy-primitives", @@ -107,9 +106,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e47b2a620fd588d463ccf0f5931b41357664b293a8d31592768845a2a101bb9e" +checksum = "7dc6957ff706f9e5f6fd42f52a93e4bce476b726c92d077b348de28c4a76730c" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -127,9 +126,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5af3faff14c12c8b11037e0a093dd157c3702becb8435577a2408534d0758315" +checksum = "529fc6310dc1126c8de51c376cbc59c79c7f662bd742be7dc67055d5421a81b4" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -139,9 +138,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" +checksum = "413902aa18a97569e60f679c23f46a18db1656d87ab4d4e49d0e1e52042f66df" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -151,14 +150,14 @@ dependencies = [ "itoa", "serde", "serde_json", - "winnow 0.6.7", + "winnow", ] [[package]] name = "alloy-eips" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d6d8118b83b0489cfb7e6435106948add2b35217f4a5004ef895f613f60299" +checksum = "f76ecab54890cdea1e4808fc0891c7e6cfcf71fe1a9fe26810c7280ef768f4ed" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -172,9 +171,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "894f33a7822abb018db56b10ab90398e63273ce1b5a33282afd186c132d764a6" +checksum = "bca15afde1b6d15e3fc1c97421262b1bbb37aee45752e3c8b6d6f13f776554ff" dependencies = [ "alloy-primitives", "alloy-serde", @@ -183,9 +182,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" +checksum = "bc05b04ac331a9f07e3a4036ef7926e49a8bf84a99a1ccfc7e2ab55a5fcbb372" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -195,9 +194,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f0ae6e93b885cc70fe8dae449e7fd629751dbee8f59767eaaa7285333c5727" +checksum = "6d6f34930b7e3e2744bcc79056c217f00cb2abb33bc5d4ff88da7623c5bb078b" dependencies = [ "alloy-primitives", "serde", @@ -219,9 +218,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc122cbee2b8523854cc11d87bcd5773741602c553d2d2d106d82eeb9c16924a" +checksum = "25f6895fc31b48fa12306ef9b4f78b7764f8bd6d7d91cdb0a40e233704a0f23f" dependencies = [ "alloy-consensus", "alloy-eips", @@ -239,9 +238,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" dependencies = [ "alloy-rlp", "bytes", @@ -261,9 +260,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d5af289798fe8783acd0c5f10644d9d26f54a12bc52a083e4f3b31718e9bf92" +checksum = "9c538bfa893d07e27cb4f3c1ab5f451592b7c526d511d62b576a2ce59e146e4a" dependencies = [ "alloy-chains", "alloy-consensus", @@ -286,7 +285,7 @@ dependencies = [ "futures-utils-wasm", "lru", "pin-project", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "serde_json", "tokio", @@ -296,9 +295,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702f330b7da123a71465ab9d39616292f8344a2811c28f2cc8d8438a69d79e35" +checksum = "0a7341322d9bc0e49f6e9fd9f2eb8e30f73806f2dd12cbb3d6bab2694c921f87" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -315,9 +314,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -326,20 +325,20 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "alloy-rpc-client" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40fcb53b2a9d0a78a4968b2eca8805a4b7011b9ee3fdfa2acaf137c5128f36b" +checksum = "5ba31bae67773fd5a60020bea900231f8396202b7feca4d0c70c6b59308ab4a8" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -350,7 +349,7 @@ dependencies = [ "alloy-transport-ws", "futures", "pin-project", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "serde_json", "tokio", @@ -362,9 +361,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f2fbe956a3e0f0975c798f488dc6be96b669544df3737e18f4a325b42f4c86" +checksum = "184a7a42c7ba9141cc9e76368356168c282c3bc3d9e5d78f3556bdfe39343447" dependencies = [ "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -373,9 +372,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd473d98ec552f8229cd6d566bd2b0bbfc5bb4efcefbb5288c834aa8fd832020" +checksum = "6e765962e3b82fd6f276a0873b5bd897e5d75a25f78fa9a6a21bd350d8e98a4e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -391,9 +390,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083f443a83b9313373817236a8f4bea09cca862618e9177d822aee579640a5d6" +checksum = "ab4123ee21f99ba4bd31bfa36ba89112a18a500f8b452f02b35708b1b951e2b9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -409,9 +408,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d94da1c0c4e27cc344b05626fe22a89dc6b8b531b9475f3b7691dbf6913e4109" +checksum = "9416c52959e66ead795a11f4a86c248410e9e368a0765710e57055b8a1774dd6" dependencies = [ "alloy-primitives", "serde", @@ -420,9 +419,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58d876be3afd8b78979540084ff63995292a26aa527ad0d44276405780aa0ffd" +checksum = "b33753c09fa1ad85e5b092b8dc2372f1e337a42e84b9b4cff9fede75ba4adb32" dependencies = [ "alloy-primitives", "async-trait", @@ -434,9 +433,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40a37dc216c269b8a7244047cb1c18a9c69f7a0332ab2c4c2aa4cbb1a31468b" +checksum = "6dfc9c26fe6c6f1bad818c9a976de9044dd12e1f75f1f156a801ee3e8148c1b6" dependencies = [ "alloy-consensus", "alloy-network", @@ -450,42 +449,42 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.5.0", - "indexmap 2.2.6", + "indexmap 2.5.0", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ "alloy-json-abi", "const-hex", @@ -494,24 +493,25 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.60", + "syn 2.0.77", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa2fbd22d353d8685bd9fee11ba2d8b5c3b1d11e56adb3265fcf1f32bfdf404" +checksum = "cbcba3ca07cf7975f15d871b721fb18031eec8bce51103907f6dcce00b255d98" dependencies = [ - "winnow 0.6.7", + "serde", + "winnow", ] [[package]] name = "alloy-sol-types" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" +checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -522,12 +522,12 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245af9541f0a0dbd5258669c80dfe3af118164cacec978a520041fc130550deb" +checksum = "01b51a291f949f755e6165c3ed562883175c97423703703355f4faa4b7d0a57c" dependencies = [ "alloy-json-rpc", - "base64 0.22.0", + "base64 0.22.1", "futures-util", "futures-utils-wasm", "serde", @@ -535,18 +535,19 @@ dependencies = [ "thiserror", "tokio", "tower", + "tracing", "url", ] [[package]] name = "alloy-transport-http" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5619c017e1fdaa1db87f9182f4f0ed97c53d674957f4902fba655e972d359c6c" +checksum = "86d65871f9f1cafe1ed25cde2f1303be83e6473e995a2d56c275ae4fcce6119c" dependencies = [ "alloy-json-rpc", "alloy-transport", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde_json", "tower", "tracing", @@ -555,9 +556,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cefa110afac7a53cf2e75519327761f2344d305eea2993f3af1b2c1fc1c44" +checksum = "cd7fbc8b6282ce41b01cbddef7bffb133fe6e1bf65dcd39770d45a905c051179" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -574,15 +575,15 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0aff8af5be5e58856c5cdd1e46db2c67c7ecd3a652d9100b4822c96c899947" +checksum = "aec83fd052684556c78c54df111433493267234d82321c2236560c752f595f20" dependencies = [ "alloy-pubsub", "alloy-transport", "futures", "http 1.1.0", - "rustls 0.23.10", + "rustls 0.23.13", "serde_json", "tokio", "tokio-tungstenite", @@ -613,47 +614,48 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -661,9 +663,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "ark-ff" @@ -699,7 +701,7 @@ dependencies = [ "num-bigint", "num-traits 0.2.19", "paste", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "zeroize", ] @@ -791,9 +793,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ascii-canvas" @@ -829,18 +831,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -851,7 +853,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version 0.4.0", + "rustc_version 0.4.1", ] [[package]] @@ -873,28 +875,28 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -917,9 +919,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -927,18 +929,6 @@ 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 0.2.19", - "serde", -] - [[package]] name = "bimap" version = "0.6.3" @@ -968,9 +958,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -995,9 +985,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" dependencies = [ "cc", "glob", @@ -1025,32 +1015,33 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] [[package]] name = "c-kzg" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" dependencies = [ "blst", "cc", "glob", "hex", "libc", + "once_cell", "serde", ] [[package]] name = "cairo-lang-casm" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a43421bf72645b3a562d264747166d6f093e960a69dfa38b67bb3209e370366" +checksum = "60a4b4ca8473c25d1e760c83c2a49d953197556f82f6feb636004d3b6d6cc4a7" dependencies = [ "cairo-lang-utils", "indoc", @@ -1062,9 +1053,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaa8ac24c97770739f5a78d630b8515273c8b9f4aff34e1f88b988fac50340de" +checksum = "a0cd844e568f51e39729e8ac18bd27ada2e2b6dc9138f8c81adad48456480681" dependencies = [ "cairo-lang-utils", "good_lp", @@ -1072,9 +1063,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918fb0611203fb8cdd1fcdb434f395a59e0ebb0db64b11a0e15bfbfb03552821" +checksum = "891488c1a3184ce91679f5bdb63015a1d24769a48bd07e5d51a1779d0031dfbe" dependencies = [ "anyhow", "cairo-lang-utils", @@ -1087,22 +1078,21 @@ dependencies = [ "num-bigint", "num-integer", "num-traits 0.2.19", - "once_cell", "regex", - "salsa", + "rust-analyzer-salsa", "serde", "serde_json", "sha3", "smol_str", - "starknet-types-core", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "cairo-lang-sierra-ap-change" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa1834ec729e89fcbd00df03f2a64a18515fcf07eb18dfef39afe020a10955d" +checksum = "ea7752cd48c86b2cde8603b753a6df4da086dacd16a73d288854d5f040b51171" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -1116,9 +1106,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b00927d39f910dd5ae1047cef9b46b2ee11617d33d290f875bc00dfc7e3d992" +checksum = "340892a09c9421414b2ac45b03c705f16e2bd737e4559dfd98ee1d20718dec9e" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -1132,9 +1122,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67bd155770abf91d4290a31b0c0a1fb393ecee85eb0af40c16893b4601eff4d6" +checksum = "1c22ff7e8113a46a907f82f191096c96935cc48247e3079971ddf536ccc2f4f8" dependencies = [ "assert_matches", "cairo-lang-casm", @@ -1147,15 +1137,15 @@ dependencies = [ "itertools 0.12.1", "num-bigint", "num-traits 0.2.19", - "starknet-types-core", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "cairo-lang-sierra-type-size" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbae9458999da692c272501678b6cfec358a6bcadb54921bf35d21afdcd91251" +checksum = "5bf41941776e7410a8853a8e2a116292fc24d219df1989a92ffe5ab0e98037eb" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -1163,9 +1153,9 @@ dependencies = [ [[package]] name = "cairo-lang-starknet-classes" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa17b313f46fcf7ff4de32b86c250eaf584d1e2c8e37ed16db155b221721e735" +checksum = "482b8f9d7f8cc7140f1260ee71f3308a66d15bd228a06281067ca3f8f4410db2" dependencies = [ "cairo-lang-casm", "cairo-lang-sierra", @@ -1176,23 +1166,22 @@ dependencies = [ "num-bigint", "num-integer", "num-traits 0.2.19", - "once_cell", "serde", "serde_json", "sha3", "smol_str", - "starknet-types-core", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "cairo-lang-utils" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd5c8c127b9362a12ffb9dede38e792c81b4ded5a98b448baec157b745f47d1" +checksum = "73104609a7d865e4cd1de9cbf4e750683d076b6d0233bf81be511df274a26916" dependencies = [ "hashbrown 0.14.5", - "indexmap 2.2.6", + "indexmap 2.5.0", "itertools 0.12.1", "num-bigint", "num-traits 0.2.19", @@ -1208,9 +1197,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.95" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" +checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -1228,7 +1220,7 @@ dependencies = [ "iana-time-zone", "num-traits 0.2.19", "serde", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1282,9 +1274,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -1292,26 +1284,26 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", - "clap_lex 0.7.0", - "strsim 0.11.1", + "clap_lex 0.7.2", + "strsim", ] [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -1325,15 +1317,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "const-fnv1a-hash" @@ -1343,9 +1335,9 @@ checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" [[package]] name = "const-hex" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba00838774b4ab0233e355d26710fbfc8327a05c017f6dc4873f876d1f79f78" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" dependencies = [ "cfg-if", "cpufeatures", @@ -1387,15 +1379,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -1480,8 +1472,8 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi", "libc", - "mio", - "parking_lot 0.12.2", + "mio 0.8.11", + "parking_lot", "signal-hook", "signal-hook-mio", "winapi", @@ -1535,9 +1527,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -1545,27 +1537,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 2.0.60", + "strsim", + "syn 2.0.77", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -1578,7 +1570,7 @@ dependencies = [ "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core 0.9.10", + "parking_lot_core", ] [[package]] @@ -1620,15 +1612,15 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case 0.4.0", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn 1.0.109", + "rustc_version 0.4.1", + "syn 2.0.77", ] [[package]] @@ -1687,9 +1679,9 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "dyn-clone" @@ -1713,9 +1705,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -1762,9 +1754,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1795,19 +1787,14 @@ dependencies = [ [[package]] name = "eth-trie-proofs" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffad0513a634350b4859934c3367cd171b4ed57c6b5c64d443e30bf278f1f8d0" +source = "git+https://github.com/HerodotusDev/trie-proofs.git#1412def6df010e3c9bca7bc1bae8798740398e5a" dependencies = [ "alloy", "alloy-primitives", "alloy-rlp", - "clap 4.5.4", "eth_trie", "ethereum-types", "reqwest 0.11.27", - "serde", - "serde_json", - "serde_with 3.8.1", "thiserror", "tokio", "url", @@ -1823,7 +1810,7 @@ dependencies = [ "hashbrown 0.14.5", "keccak-hash", "log", - "parking_lot 0.12.2", + "parking_lot", "rlp", ] @@ -1856,9 +1843,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fastrlp" @@ -1901,9 +1888,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", "miniz_oxide", @@ -2001,7 +1988,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -2071,9 +2058,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -2084,9 +2071,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "glob" @@ -2127,7 +2114,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -2179,9 +2166,11 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", + "sn-trie-proofs", "starknet", "starknet-crypto", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile", "thiserror", "tokio", @@ -2194,7 +2183,7 @@ version = "0.4.0" dependencies = [ "alloy", "anyhow", - "clap 4.5.4", + "clap 4.5.17", "dotenv", "hdp", "inquire", @@ -2208,12 +2197,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "heck" @@ -2295,9 +2281,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http 1.1.0", @@ -2312,15 +2298,15 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -2330,9 +2316,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -2354,15 +2340,15 @@ dependencies = [ [[package]] name = "hyper" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "httparse", "itoa", "pin-project-lite", @@ -2379,7 +2365,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.28", + "hyper 0.14.30", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -2392,7 +2378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.28", + "hyper 0.14.30", "native-tls", "tokio", "tokio-native-tls", @@ -2406,7 +2392,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.3.1", + "hyper 1.4.1", "hyper-util", "native-tls", "tokio", @@ -2416,16 +2402,16 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", - "hyper 1.3.1", + "http-body 1.0.1", + "hyper 1.4.1", "pin-project-lite", "socket2", "tokio", @@ -2524,9 +2510,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2554,7 +2540,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "crossterm", "dyn-clone", "fuzzy-matcher", @@ -2565,20 +2551,11 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "interprocess" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67bafc2f5dbdad79a6d925649758d5472647b416028099f0b829d1b67fdd47d3" +checksum = "d2f4e4a06d42fab3e85ab1b419ad32b09eab58b901d40c57935ff92db3287a13" dependencies = [ "doctest-file", "futures-core", @@ -2591,9 +2568,15 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -2639,9 +2622,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -2685,9 +2668,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -2717,7 +2700,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", "string_cache", "term", "tiny-keccak", @@ -2731,7 +2714,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" dependencies = [ - "regex-automata 0.4.6", + "regex-automata 0.4.7", ] [[package]] @@ -2758,15 +2741,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.154" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libm" @@ -2780,15 +2763,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", ] [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -2802,15 +2785,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ "hashbrown 0.14.5", ] @@ -2835,9 +2818,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -2857,11 +2840,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -2876,13 +2859,24 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -2999,52 +2993,52 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "object" -version = "0.32.2" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -3061,7 +3055,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -3072,9 +3066,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -3096,9 +3090,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec", "bitvec", @@ -3110,9 +3104,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3122,37 +3116,12 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - -[[package]] -name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", - "parking_lot_core 0.9.10", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -3163,16 +3132,16 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.1", + "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pbkdf2" @@ -3189,7 +3158,7 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "serde", ] @@ -3201,9 +3170,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.9" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95" +checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" dependencies = [ "memchr", "thiserror", @@ -3217,7 +3186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap 2.5.0", ] [[package]] @@ -3227,7 +3196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version 0.4.0", + "rustc_version 0.4.1", ] [[package]] @@ -3262,7 +3231,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -3295,9 +3264,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plotters" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits 0.2.19", "plotters-backend", @@ -3308,15 +3277,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] @@ -3329,9 +3298,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "precomputed-hash" @@ -3363,9 +3335,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] @@ -3396,28 +3368,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.6.0", "lazy_static", "num-traits 0.2.19", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", "rusty-fork", "tempfile", "unarray", @@ -3431,9 +3403,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -3517,27 +3489,18 @@ checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" -dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", @@ -3546,14 +3509,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -3567,13 +3530,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -3584,9 +3547,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -3602,7 +3565,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.28", + "hyper 0.14.30", "hyper-rustls", "hyper-tls 0.5.0", "ipnet", @@ -3629,23 +3592,23 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots 0.25.4", - "winreg 0.50.0", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "bytes", "futures-core", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", - "hyper 1.3.1", + "hyper 1.4.1", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -3656,7 +3619,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile 2.1.2", + "rustls-pemfile 2.1.3", "serde", "serde_json", "serde_urlencoded", @@ -3668,7 +3631,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -3736,11 +3699,40 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" +[[package]] +name = "rust-analyzer-salsa" +version = "0.17.0-pre.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719825638c59fd26a55412a24561c7c5bcf54364c88b9a7a04ba08a6eafaba8d" +dependencies = [ + "indexmap 2.5.0", + "lock_api", + "oorandom", + "parking_lot", + "rust-analyzer-salsa-macros", + "rustc-hash", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "rust-analyzer-salsa-macros" +version = "0.17.0-pre.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d96498e9684848c6676c399032ebc37c52da95ecbefa83d71ccc53b9f8a4a8e" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -3765,20 +3757,20 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.22", + "semver 1.0.23", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -3799,14 +3791,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.10" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] @@ -3822,19 +3814,19 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" @@ -3848,9 +3840,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -3877,38 +3869,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "salsa" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b84d9f96071f3f3be0dc818eae3327625d8ebc95b58da37d6850724f31d3403" -dependencies = [ - "crossbeam-utils", - "indexmap 1.9.3", - "lock_api", - "log", - "oorandom", - "parking_lot 0.11.2", - "rustc-hash", - "salsa-macros", - "smallvec", -] - -[[package]] -name = "salsa-macros" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3904a4ba0a9d0211816177fd34b04c7095443f8cdacd11175064fe541c8fe2" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "salsa20" @@ -3930,11 +3893,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3959,7 +3922,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -4006,11 +3969,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -4019,9 +3982,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -4038,9 +4001,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "semver-parser" @@ -4059,22 +4022,22 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -4085,16 +4048,17 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -4134,25 +4098,7 @@ dependencies = [ "indexmap 1.9.3", "serde", "serde_json", - "serde_with_macros 2.3.3", - "time", -] - -[[package]] -name = "serde_with" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" -dependencies = [ - "base64 0.22.0", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.2.6", - "serde", - "serde_derive", - "serde_json", - "serde_with_macros 3.8.1", + "serde_with_macros", "time", ] @@ -4165,19 +4111,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", -] - -[[package]] -name = "serde_with_macros" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -4214,9 +4148,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" dependencies = [ "cc", "cfg-if", @@ -4231,6 +4165,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook" version = "0.3.17" @@ -4243,12 +4183,12 @@ dependencies = [ [[package]] name = "signal-hook-mio" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", - "mio", + "mio 0.8.11", "signal-hook", ] @@ -4313,6 +4253,32 @@ dependencies = [ "serde", ] +[[package]] +name = "sn-merkle-trie" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a46c1daa6d9bef421896da0fd2d17c80c02c93a966ca832c8f607b106d443ae0" +dependencies = [ + "anyhow", + "bitvec", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sn-trie-proofs" +version = "0.1.0" +source = "git+https://github.com/HerodotusDev/trie-proofs.git#1412def6df010e3c9bca7bc1bae8798740398e5a" +dependencies = [ + "bitflags 2.6.0", + "reqwest 0.11.27", + "serde_json", + "sn-merkle-trie", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "starknet-types-rpc", + "thiserror", + "tokio", +] + [[package]] name = "socket2" version = "0.5.7" @@ -4350,17 +4316,22 @@ dependencies = [ "num-traits 0.1.43", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "starknet" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b9a7b7bfd87287af85854f7458b8170ba6aa59c39113436532b7ff3d2fcbd8" +checksum = "1e633a772f59214c296d5037c95c36b72792c9360323818da2b625c7b4ec4b49" dependencies = [ "starknet-accounts", "starknet-contract", "starknet-core", "starknet-crypto", - "starknet-ff", "starknet-macros", "starknet-providers", "starknet-signers", @@ -4368,13 +4339,14 @@ dependencies = [ [[package]] name = "starknet-accounts" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2095d7584608ae1707bd1cf2889368ab3734d9f54e4fcef4765cba1f3b3f7618" +checksum = "eee8a6b588a22c7e79f5d8d4e33413387db63a8beb98be8610138541794cc0a5" dependencies = [ "async-trait", "auto_impl", "starknet-core", + "starknet-crypto", "starknet-providers", "starknet-signers", "thiserror", @@ -4382,13 +4354,13 @@ dependencies = [ [[package]] name = "starknet-contract" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3b73d437b4d62241612d13fce612602de6684c149cccf696e76a20757e2156" +checksum = "a5f91344f1e0b81873b6dc235c50ae4d084c6ea4dd4a1e3e27ad895803adb610" dependencies = [ "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "starknet-accounts", "starknet-core", "starknet-providers", @@ -4397,27 +4369,28 @@ dependencies = [ [[package]] name = "starknet-core" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed286d637e34fb8ae1cd2f9615120ec8ff38d1cffd311ed7fdd497cdd2bd01f" +checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" dependencies = [ "base64 0.21.7", + "crypto-bigint", "flate2", "hex", "serde", "serde_json", "serde_json_pythonic", - "serde_with 2.3.3", + "serde_with", "sha3", "starknet-crypto", - "starknet-ff", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "starknet-crypto" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2c30c01e8eb0fc913c4ee3cf676389fffc1d1182bfe5bb9670e4e72e968064" +checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" dependencies = [ "crypto-bigint", "hex", @@ -4429,70 +4402,56 @@ dependencies = [ "sha2", "starknet-crypto-codegen", "starknet-curve", - "starknet-ff", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize", ] [[package]] name = "starknet-crypto-codegen" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" +checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" dependencies = [ "starknet-curve", - "starknet-ff", - "syn 2.0.60", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 2.0.77", ] [[package]] name = "starknet-curve" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c383518bb312751e4be80f53e8644034aa99a0afb29d7ac41b89a997db875b" -dependencies = [ - "starknet-ff", -] - -[[package]] -name = "starknet-ff" -version = "0.3.7" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abf1b44ec5b18d87c1ae5f54590ca9d0699ef4dd5b2ffa66fc97f24613ec585" +checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" dependencies = [ - "ark-ff 0.4.2", - "bigdecimal", - "crypto-bigint", - "getrandom", - "hex", - "num-bigint", - "serde", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "starknet-macros" -version = "0.1.7" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95d549d3078bdbe775d0deaa8ddb57a19942989ce7c1f2dfd60beeb322bb4945" +checksum = "f4fe4f8d615329410578cbedcdbaa4a36c7f28f68c3f3ac56006cfbdaeaa2b41" dependencies = [ "starknet-core", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "starknet-providers" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6abf40ffcbe3b887b4d5cfc8ab73170c816b4aa78d1d4ad59abd3fb3b0f53cd" +checksum = "59c85e0a0f4563ae95dfeae14ea0f0c70610efc0ec2462505c64eff5765e7b97" dependencies = [ "async-trait", "auto_impl", "ethereum-types", "flate2", + "getrandom", "log", "reqwest 0.11.27", "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "starknet-core", "thiserror", "url", @@ -4500,14 +4459,15 @@ dependencies = [ [[package]] name = "starknet-signers" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9a2bd4fd66090003c3b7f0d76476e5b63cd44f6a49ede2442673f4427d5a40" +checksum = "c17da2139119dbe3aacf1d5d4338798a5c489d17f424916ceb9d2efd83554f87" dependencies = [ "async-trait", "auto_impl", "crypto-bigint", "eth-keystore", + "getrandom", "rand", "starknet-core", "starknet-crypto", @@ -4529,6 +4489,28 @@ dependencies = [ "serde", ] +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "git+https://github.com/starknet-io/types-rs#ffcf7e65983df3cb53d7a228849a073034cba161" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits 0.2.19", + "serde", +] + +[[package]] +name = "starknet-types-rpc" +version = "0.7.1" +source = "git+https://github.com/starknet-io/types-rs#ffcf7e65983df3cb53d7a228849a073034cba161" +dependencies = [ + "serde", + "starknet-types-core 0.1.5 (git+https://github.com/starknet-io/types-rs)", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -4543,17 +4525,11 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", - "parking_lot 0.12.2", + "parking_lot", "phf_shared", "precomputed-hash", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -4579,14 +4555,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -4601,9 +4577,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -4612,14 +4588,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -4633,6 +4609,9 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "system-configuration" @@ -4663,14 +4642,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4707,7 +4687,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -4781,9 +4761,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -4796,32 +4776,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", - "mio", - "num_cpus", - "parking_lot 0.12.2", + "mio 1.0.2", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -4850,16 +4829,16 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.10", + "rustls 0.23.13", "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -4875,43 +4854,42 @@ checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" dependencies = [ "futures-util", "log", - "rustls 0.23.10", + "rustls 0.23.13", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", "tungstenite", - "webpki-roots 0.26.3", + "webpki-roots 0.26.5", ] [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.20.7" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] @@ -4932,15 +4910,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -4962,7 +4940,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] @@ -5004,6 +4982,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "triomphe" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" +dependencies = [ + "serde", + "stable_deref_trait", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -5023,7 +5011,7 @@ dependencies = [ "httparse", "log", "rand", - "rustls 0.23.10", + "rustls 0.23.13", "rustls-pki-types", "sha1", "thiserror", @@ -5068,9 +5056,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -5083,21 +5071,21 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -5107,9 +5095,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -5124,9 +5112,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" @@ -5152,9 +5140,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -5192,34 +5180,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -5229,9 +5218,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5239,28 +5228,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -5274,9 +5263,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" dependencies = [ "rustls-pki-types", ] @@ -5305,11 +5294,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5324,7 +5313,37 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", ] [[package]] @@ -5342,7 +5361,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -5362,18 +5390,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -5384,9 +5412,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -5396,9 +5424,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -5408,15 +5436,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -5426,9 +5454,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -5438,9 +5466,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -5450,9 +5478,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -5462,24 +5490,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" - -[[package]] -name = "winnow" -version = "0.5.40" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.7" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -5494,16 +5513,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -5515,7 +5524,7 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "send_wrapper", "thiserror", "wasm-bindgen", @@ -5534,29 +5543,30 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -5569,5 +5579,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.77", ] diff --git a/Cargo.toml b/Cargo.toml index 05890d1e..cc851d51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [workspace] -resolver = "2" members = ["cli", "examples/private-input-module", "hdp"] [workspace.package] +resolver = "2" version = "0.4.0" edition = "2021" license-file = "LICENSE" @@ -35,12 +35,15 @@ tracing = "0.1" reqwest = { version = "0.11", features = ["json"] } rand = "0.8.4" regex = "1" -starknet = "0.10.0" -starknet-crypto = "0.6.1" +starknet = "0.11.0" +starknet-crypto = "0.7.1" +starknet-types-core = "0.1.5" cairo-lang-starknet-classes = "2.7.0" cairo-vm = "1.0.0-rc6" futures = "0.3.30" lazy_static = "1.4.0" thiserror = "1.0" -eth-trie-proofs = "0.1.1" +eth-trie-proofs = { version = "0.1.1", git = "https://github.com/HerodotusDev/trie-proofs.git" } +sn-trie-proofs = { version = "0.1.0", git = "https://github.com/HerodotusDev/trie-proofs.git" } + itertools = "0.10" diff --git a/Makefile.toml b/Makefile.toml deleted file mode 100644 index 408c717c..00000000 --- a/Makefile.toml +++ /dev/null @@ -1,29 +0,0 @@ -[env] -CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true - -[tasks.format] -install_crate = "rustfmt" -command = "cargo" -args = ["fmt", "--", "--check"] -description = "Run rustfmt to check the code formatting without making changes." - -[tasks.clean] -command = "cargo" -args = ["clean"] -description = "Clean up the project by removing the target directory." - -[tasks.clippy] -command = "cargo" -args = ["clippy", "--all-targets", "--all-features", "--", "-Dwarnings"] -description = "Run clippy to catch common mistakes and improve your Rust code." - -[tasks.test] -workspace = false -command = "cargo" -args = ["llvm-cov", "nextest", "--features", "test_utils"] -description = "Execute all unit tests in the workspace." - -[tasks.run-ci-flow] -workspace = false -description = "Run the entire CI pipeline including format, clippy, and test checks." -dependencies = ["format", "clippy", "test"] diff --git a/README.md b/README.md index 489016f7..f2128c5f 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ _Note: Fields marked with "-" are not applicable for the specified aggregate fun ```sh # CI check -cargo make run-ci-flow +just run-ci-flow ``` ### Local Run diff --git a/batch.json b/batch.json new file mode 100644 index 00000000..0f6e15f4 --- /dev/null +++ b/batch.json @@ -0,0 +1,41 @@ +{ + "raw_results": [ + "0x000000000000000000000000000000000000000000000000000012309ce54000" + ], + "results_commitments": [ + "0xfe22879bf0cec62207a65426fd87f413f75880825b5bdc3e57cb343e9ca42c99" + ], + "tasks_commitments": [ + "0xa9420109bac8cb6b5e8e1e92120dc4d15abc6915024ed2e8d8e0c427d91e1e91" + ], + "task_inclusion_proofs": [ + [] + ], + "results_inclusion_proofs": [ + [] + ], + "results_root": "0x6b2b1f8a44a9a263aaab7dc8456d03ec2365c535f6e34d249992dcf10c2c9009", + "tasks_root": "0x914cb49c66560929b7c2d89cb61a01af234eb6317bd8fcfa3215979cd8479484", + "mmr_metas": [ + { + "id": 27, + "root": "0x492627ffa5084ec078f4d461408dfaa50b504a022c5471452d598da0040c066", + "size": 13024091, + "peaks": [ + "0x262c4c9b1cb2a036924aecf563dc9952e5f8b41004310adde86f22abb793eb1", + "0x10b39aed56c8f244a1df559c944ada6f12b7238f8c06a2c243ba4276b8059b0", + "0x46f45f218ea3aec481f350cda528a6f9f926a2dd53dae302e2cb610e5f152c7", + "0x1d52a06e6d02569893a1d842c00bb67c044be541c614e88613d7fc7187e18c1", + "0x770ebf618a589c17e3dc05bda7121acbedc0b48cd25f2943dc43f395f8bf0db", + "0x7263e878f7deafdc49b47da57f8594d477e572d3ac2bec27bb73860a35b1899", + "0x7b9e99f008949f9ee33d2965708ac6773a57965514df6383d55de104a39ab8c", + "0x28f6ccdcd38f6be6c437d100fcd62604c3293e31342a777dc37c712869ab08c", + "0x13d87197fe5d6f646a57dc918dcbef210737020dca9b89537fd8718ac69da3e", + "0x7eef4b790b56858c0232b494034d4c8699112d88f358209f71f02d5e93a7084", + "0x25cd2f0b579c902c41ac26df96ed5b21e16a3127dce2b471973dc86eb4c099f", + "0x5fdedfd0123b7461d5b3162fe82f7f3172c42fda6209415367870086f7c7918", + "0x7c0a415d5a6c4c90fd2dde1b340c3be305a72aa3b758dd26b8d7b4a78b53681" + ] + } + ] +} \ No newline at end of file diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 3ee0a053..bd63c234 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -176,7 +176,7 @@ pub async fn entry_run(args: RunArgs) -> Result<()> { args.dry_run_cairo_file, args.sound_run_cairo_file, args.program_input_file, - args.cairo_format, + args.not_cairo_format, None, args.batch_proof_file, args.cairo_pie_file, diff --git a/cli/src/commands/run.rs b/cli/src/commands/run.rs index 43ba9356..a3a2ca3e 100644 --- a/cli/src/commands/run.rs +++ b/cli/src/commands/run.rs @@ -21,8 +21,8 @@ pub struct RunArgs { /// Set this boolean to true to generate cairo format program_input_file /// /// By default, program_input_file is generated in cairo format. If you dont want, set this to false. - #[arg(long, default_value_t = true)] - pub cairo_format: bool, + #[arg(long, default_value_t = false)] + pub not_cairo_format: bool, /// Path to save batch proof file after pre-processing. /// diff --git a/cli/src/commands/run_datalake.rs b/cli/src/commands/run_datalake.rs index 8feedeca..50e68505 100644 --- a/cli/src/commands/run_datalake.rs +++ b/cli/src/commands/run_datalake.rs @@ -17,7 +17,7 @@ pub struct RunDatalakeArgs { pub aggregate_fn_id: AggregationFunction, /// Optional context for applying conditions on the aggregate function "count". /// Format: "{operator}.{value}" (e.g., "eq.100" for equality, "gt.100" for greater-than). - /// Supported operators are in the [`Operator`] enum. + /// Supported operators are in the Operator enum. pub aggregate_fn_ctx: Option, #[command(subcommand)] diff --git a/cli/src/interactive.rs b/cli/src/interactive.rs index 2be26667..aed27e98 100644 --- a/cli/src/interactive.rs +++ b/cli/src/interactive.rs @@ -230,7 +230,7 @@ pub async fn run_interactive() -> anyhow::Result<()> { start_index, end_index, increment, - IncludedTypes::from(&included_types), + IncludedTypes::from_bytes(&included_types), ); DatalakeEnvelope::TransactionsInBlock(transactions_datalake) } diff --git a/hdp/Cargo.toml b/hdp/Cargo.toml index 6ff37feb..7989f621 100644 --- a/hdp/Cargo.toml +++ b/hdp/Cargo.toml @@ -24,6 +24,7 @@ serde = { workspace = true } serde_with = { workspace = true } serde_json = { workspace = true } starknet-crypto = { workspace = true } +starknet-types-core = { workspace = true } starknet = { workspace = true } thiserror.workspace = true alloy-merkle-tree = { workspace = true } @@ -33,6 +34,7 @@ reqwest = { workspace = true } lazy_static = { workspace = true } eth-trie-proofs = { workspace = true } itertools = { workspace = true } +sn-trie-proofs = { workspace = true } [features] default = [] diff --git a/hdp/src/cairo_runner/dry_run.rs b/hdp/src/cairo_runner/dry_run.rs index 5683f9a1..65991901 100644 --- a/hdp/src/cairo_runner/dry_run.rs +++ b/hdp/src/cairo_runner/dry_run.rs @@ -7,7 +7,7 @@ use crate::provider::key::{ use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_crypto::Felt; use std::fs; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; @@ -25,7 +25,7 @@ pub struct DryRunnedModule { pub fetch_keys: Vec, pub result: Uint256, #[serde_as(as = "UfeHex")] - pub program_hash: FieldElement, + pub program_hash: Felt, } fn deserialize_fetch_keys<'de, D>(deserializer: D) -> Result, D::Error> @@ -170,10 +170,11 @@ mod tests { let result = dry_runner.run(input).unwrap(); assert_eq!(result.len(), 1); assert_eq!(result[0].fetch_keys.len(), 3); - assert_eq!(result[0].result, Uint256::from_strs("0x0", "0x0").unwrap()); + assert_eq!(result[0].result, Uint256::ZERO); assert_eq!( result[0].program_hash, - felt!("0x04df21eb479ae4416fbdc00abab6fab43bff0b8083be4d1fd8602c8fbfbd2274") + Felt::from_hex("0x04df21eb479ae4416fbdc00abab6fab43bff0b8083be4d1fd8602c8fbfbd2274") + .unwrap() ); } @@ -233,7 +234,7 @@ mod tests { println!("Fetch key {}: {:?}", i, key); } - assert_eq!(module.result, Uint256::from_strs("0x0", "0x0").unwrap()); + assert_eq!(module.result, Uint256::ZERO); assert_eq!( module.program_hash, felt!("0xc8580f74b6e6e04d8073602ad0c0d55538b56bf8307fefebb6b65b1bbf2a27") diff --git a/hdp/src/hdp_run.rs b/hdp/src/hdp_run.rs index 897359aa..1489e6de 100644 --- a/hdp/src/hdp_run.rs +++ b/hdp/src/hdp_run.rs @@ -19,7 +19,7 @@ pub struct HdpRunConfig { pub dry_run_program_path: PathBuf, pub sound_run_program_path: PathBuf, pub program_input_file: PathBuf, - pub is_cairo_format: bool, + pub is_not_cairo_format: bool, pub batch_proof_file: Option, pub cairo_pie_file: Option, pub save_fetch_keys_file: Option, @@ -33,7 +33,7 @@ impl Default for HdpRunConfig { dry_run_program_path: DEFAULT_DRY_CAIRO_RUN_CAIRO_FILE.into(), sound_run_program_path: DEFAULT_SOUND_CAIRO_RUN_CAIRO_FILE.into(), program_input_file: "program_input.json".into(), - is_cairo_format: false, + is_not_cairo_format: false, cairo_pie_file: None, batch_proof_file: None, save_fetch_keys_file: None, @@ -46,23 +46,23 @@ impl HdpRunConfig { cli_dry_run_cairo_file: Option, cli_sound_run_cairo_file: Option, program_input_file: PathBuf, - cli_is_cairo_format: bool, + cli_is_not_cairo_format: bool, cli_save_fetch_keys_file: Option, batch_proof_file: Option, cli_cairo_pie_file: Option, ) -> Self { let mut provider_config = HashMap::new(); - // Iterate through environment variables to find RPC_URL and RPC_CHUNK_SIZE configurations + // Iterate through environment variables to find PROVIDER_URL and PROVIDER_CHUNK_SIZE configurations for (key, value) in env::vars() { - if let Some(stripped_chain_id) = key.strip_prefix("RPC_URL_") { + if let Some(stripped_chain_id) = key.strip_prefix("PROVIDER_URL_") { let chain_id: ChainId = stripped_chain_id .parse() - .expect("Invalid chain ID in RPC_URL env var"); - let rpc_url: Url = value.parse().expect("Invalid URL in RPC_URL env var"); + .expect("Invalid chain ID in PROVIDER_URL env var"); + let provider_url: Url = value.parse().expect("Invalid URL in PROVIDER_URL env var"); - let chunk_size_key = format!("RPC_CHUNK_SIZE_{}", chain_id); - let rpc_chunk_size: u64 = env::var(&chunk_size_key) + let chunk_size_key = format!("PROVIDER_CHUNK_SIZE_{}", chain_id); + let provider_chunk_size: u64 = env::var(&chunk_size_key) .unwrap_or_else(|_| "40".to_string()) .parse() .unwrap_or_else(|_| panic!("{} must be a number", chunk_size_key)); @@ -70,9 +70,9 @@ impl HdpRunConfig { provider_config.insert( chain_id, ProviderConfig { - rpc_url, + provider_url, chain_id, - max_requests: rpc_chunk_size, + max_requests: provider_chunk_size, }, ); } @@ -98,7 +98,7 @@ impl HdpRunConfig { dry_run_program_path: dry_run_cairo_path, sound_run_program_path: sound_run_cairo_path, program_input_file, - is_cairo_format: cli_is_cairo_format, + is_not_cairo_format: cli_is_not_cairo_format, save_fetch_keys_file, batch_proof_file, cairo_pie_file: cli_cairo_pie_file, @@ -125,10 +125,10 @@ pub async fn run(hdp_run_config: &HdpRunConfig, tasks: Vec) -> Res let preprocessor = PreProcessor::new_with_config(compiler_config); let preprocessor_result = preprocessor.process(tasks).await?; - let input_string = match hdp_run_config.is_cairo_format { - true => serde_json::to_string_pretty(&preprocessor_result.as_cairo_format()) + let input_string = match hdp_run_config.is_not_cairo_format { + false => serde_json::to_string_pretty(&preprocessor_result.as_cairo_format()) .map_err(|e| anyhow::anyhow!("Failed to serialize preprocessor result: {}", e))?, - false => serde_json::to_string_pretty(&preprocessor_result) + true => serde_json::to_string_pretty(&preprocessor_result) .map_err(|e| anyhow::anyhow!("Failed to serialize preprocessor result: {}", e))?, }; @@ -186,10 +186,10 @@ mod tests { #[test] fn test_hdp_run_config_init_with_env() { // Set up environment variables - env::set_var("RPC_URL_ETHEREUM_MAINNET", "https://example.com/rpc1"); - env::set_var("RPC_CHUNK_SIZE_ETHEREUM_MAINNET", "50"); - env::set_var("RPC_URL_STARKNET_MAINNET", "https://example.com/rpc2"); - env::set_var("RPC_CHUNK_SIZE_STARKNET_MAINNET", "60"); + env::set_var("PROVIDER_URL_ETHEREUM_MAINNET", "https://example.com/rpc1"); + env::set_var("PROVIDER_CHUNK_SIZE_ETHEREUM_MAINNET", "50"); + env::set_var("PROVIDER_URL_STARKNET_MAINNET", "https://example.com/rpc2"); + env::set_var("PROVIDER_CHUNK_SIZE_STARKNET_MAINNET", "60"); env::set_var("DRY_RUN_CAIRO_PATH", "/path/to/dry_run.cairo"); env::set_var("SOUND_RUN_CAIRO_PATH", "/path/to/sound_run.cairo"); env::set_var("SAVE_FETCH_KEYS_FILE", "/path/to/save_fetch_keys.json"); @@ -219,7 +219,7 @@ mod tests { .get(&ChainId::EthereumMainnet) .unwrap(); assert_eq!( - provider_config_1.rpc_url.to_string(), + provider_config_1.provider_url.to_string(), "https://example.com/rpc1" ); assert_eq!(provider_config_1.max_requests, 50); @@ -229,7 +229,7 @@ mod tests { .get(&ChainId::StarknetMainnet) .unwrap(); assert_eq!( - provider_config_2.rpc_url.to_string(), + provider_config_2.provider_url.to_string(), "https://example.com/rpc2" ); assert_eq!(provider_config_2.max_requests, 60); @@ -244,7 +244,7 @@ mod tests { PathBuf::from("/path/to/sound_run.cairo") ); assert_eq!(config.program_input_file, PathBuf::from("input.json")); - assert!(!config.is_cairo_format); + assert!(!config.is_not_cairo_format); assert_eq!( config.save_fetch_keys_file, Some(PathBuf::from("/path/to/save_fetch_keys.json")) @@ -253,10 +253,10 @@ mod tests { assert_eq!(config.cairo_pie_file, None); // Clean up environment variables - env::remove_var("RPC_URL_1"); - env::remove_var("RPC_CHUNK_SIZE_1"); - env::remove_var("RPC_URL_2"); - env::remove_var("RPC_CHUNK_SIZE_2"); + env::remove_var("PROVIDER_URL_1"); + env::remove_var("PROVIDER_CHUNK_SIZE_1"); + env::remove_var("PROVIDER_URL_2"); + env::remove_var("PROVIDER_CHUNK_SIZE_2"); env::remove_var("DRY_RUN_CAIRO_PATH"); env::remove_var("SOUND_RUN_CAIRO_PATH"); env::remove_var("SAVE_FETCH_KEYS_FILE"); diff --git a/hdp/src/lib.rs b/hdp/src/lib.rs index 0c64bec9..ac51f953 100644 --- a/hdp/src/lib.rs +++ b/hdp/src/lib.rs @@ -1,3 +1,8 @@ +//! The Data Processor CLI serves as an essential tool for developers working with Cairo programs and zkVM environments. +//! Its primary function is to translate human-readable requests into a format compatible with Cairo programs, +//! enabling commands to be executed over the Cairo VM and generating executable outputs. +//! This transformation is a crucial preprocessing step that prepares data for off-chain computations in zkVM environments. + pub mod cairo_runner; pub mod constant; pub mod hdp_run; diff --git a/hdp/src/preprocessor/compile/datalake.rs b/hdp/src/preprocessor/compile/datalake.rs index 87210156..47f4da05 100644 --- a/hdp/src/preprocessor/compile/datalake.rs +++ b/hdp/src/preprocessor/compile/datalake.rs @@ -10,30 +10,46 @@ impl Compilable for DatalakeCompute { &self, compile_config: &CompilerConfig, ) -> Result { + // Log the target datalake task being processed info!("target task: {:#?}", self); - // ========== datalake ============== + + // ========== Fetch Provider Configuration ============== + // Retrieve the provider configuration for the specific chain ID of the datalake + let chain_id = self.datalake.get_chain_id(); let target_provider_config = compile_config .provider_config - .get(&self.datalake.get_chain_id()) + .get(&chain_id) .expect("target task's chain had not been configured."); + + // Create a new provider instance from the configuration let provider = new_provider_from_config(target_provider_config); + + // ========== Fetch Proofs ============== + // Fetch the proofs from the provider for the given datalake task let compiled_block_sampled = provider.fetch_proofs(self).await?; debug!("values to aggregate : {:#?}", compiled_block_sampled.values); - // ========== compute ============== - let aggregation_fn = &self.compute.aggregate_fn_id; - let fn_context = &self.compute.aggregate_fn_ctx; - let aggregated_result = - aggregation_fn.operation(&compiled_block_sampled.values, Some(fn_context.clone()))?; - - Ok(CompilationResult::new( + // ========== Compute Aggregated Result ============== + // Get the aggregation function and its context from the datalake compute + let aggregation_function = &self.compute.aggregate_fn_id; + let function_context = &self.compute.aggregate_fn_ctx; + + // Compute the aggregated result using the fetched values and context + let aggregated_result = aggregation_function.operation( + &compiled_block_sampled.values, + Some(function_context.clone()), + )?; + + // ========== Return Compilation Result ============== + // Return the compilation result, which is specific to a single chain context + Ok(CompilationResult::from_single_chain( + chain_id.to_numeric_id(), vec![aggregated_result], - compiled_block_sampled.headers, + compiled_block_sampled.mmr_with_headers, compiled_block_sampled.accounts, compiled_block_sampled.storages, compiled_block_sampled.transactions, compiled_block_sampled.transaction_receipts, - compiled_block_sampled.mmr_metas, )) } } @@ -130,14 +146,18 @@ mod tests { .compile(&compiler_config) .await .unwrap(); - assert_eq!(results.headers.len(), 16); - assert_eq!(results.accounts.len(), 2); - assert_eq!(results.storages.len(), 1); + // assert_eq!(results.mmr_with_headers[0].headers.len(), 16); + let account_proofs = results.accounts.iter().next().unwrap(); + assert_eq!(account_proofs.1.len(), 2); let storage_proofs = results.storages.iter().next().unwrap(); + assert_eq!(storage_proofs.1.len(), 1); + let storage_proofs = storage_proofs.1.iter().next().unwrap(); assert_eq!(storage_proofs.proofs.len(), 6); - assert_eq!(results.transactions.len(), 0); - assert_eq!(results.transaction_receipts.len(), 0); - assert_eq!(results.mmr_metas.len(), 1); + let tx_proofs = results.transactions.iter().next().unwrap(); + assert_eq!(tx_proofs.1.len(), 0); + let tx_receipt_proofs = results.transaction_receipts.iter().next().unwrap(); + assert_eq!(tx_receipt_proofs.1.len(), 0); + // assert_eq!(results.mmr_metas.len(), 1); } #[tokio::test] @@ -153,7 +173,7 @@ mod tests { start_index: 0, end_index: 10, increment: 1, - included_types: IncludedTypes::from(&[1, 1, 1, 1]), + included_types: IncludedTypes::ALL, sampled_property: TransactionsCollection::Transactions( TransactionField::GasLimit, ), @@ -167,7 +187,7 @@ mod tests { start_index: 0, end_index: 11, increment: 1, - included_types: IncludedTypes::from(&[1, 1, 1, 1]), + included_types: IncludedTypes::ALL, sampled_property: TransactionsCollection::TranasactionReceipts( TransactionReceiptField::Success, ), @@ -181,11 +201,16 @@ mod tests { .compile(&compiler_config) .await .unwrap(); - assert_eq!(results.headers.len(), 2); - assert_eq!(results.accounts.len(), 0); - assert_eq!(results.storages.len(), 0); - assert_eq!(results.transactions.len(), 10); - assert_eq!(results.transaction_receipts.len(), 11); - assert_eq!(results.mmr_metas.len(), 1); + + // assert_eq!(results.headers.len(), 2); + let accounts_proofs = results.accounts.iter().next().unwrap(); + assert_eq!(accounts_proofs.1.len(), 0); + let storages_proofs = results.storages.iter().next().unwrap(); + assert_eq!(storages_proofs.1.len(), 0); + let tx_proofs = results.transactions.iter().next().unwrap(); + assert_eq!(tx_proofs.1.len(), 10); + let tx_receipt_proofs = results.transaction_receipts.iter().next().unwrap(); + assert_eq!(tx_receipt_proofs.1.len(), 11); + // assert_eq!(results.mmr_metas.len(), 1); } } diff --git a/hdp/src/preprocessor/compile/mod.rs b/hdp/src/preprocessor/compile/mod.rs index ca5eff89..33ff0e61 100644 --- a/hdp/src/preprocessor/compile/mod.rs +++ b/hdp/src/preprocessor/compile/mod.rs @@ -1,13 +1,16 @@ use alloy::primitives::U256; - use config::CompilerConfig; +use std::hash::Hash; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use thiserror::Error; +use crate::primitives::processed_types::block_proofs::{ + convert_to_mmr_with_headers, mmr_with_header_vec_to_map, MMRWithHeader, ProcessedBlockProofs, +}; use crate::primitives::processed_types::{ - account::ProcessedAccount, header::ProcessedHeader, mmr::MMRMeta, receipt::ProcessedReceipt, - storage::ProcessedStorage, transaction::ProcessedTransaction, + account::ProcessedAccount, receipt::ProcessedReceipt, storage::ProcessedStorage, + transaction::ProcessedTransaction, }; use crate::provider::error::ProviderError; @@ -54,49 +57,141 @@ pub trait Compilable { pub struct CompilationResult { /// results of tasks pub task_results: Vec, - /// Headers related to the datalake - pub headers: HashSet, + /// mmr_with_headers related to the datalake + pub mmr_with_headers: HashMap>, /// Accounts related to the datalake - pub accounts: HashSet, + pub accounts: HashMap>, /// Storages related to the datalake - pub storages: HashSet, + pub storages: HashMap>, /// Transactions related to the datalake - pub transactions: HashSet, + pub transactions: HashMap>, /// Transaction receipts related to the datalake - pub transaction_receipts: HashSet, - /// MMR meta data related to the headers - pub mmr_metas: HashSet, + pub transaction_receipts: HashMap>, } impl CompilationResult { pub fn new( task_results: Vec, - headers: HashSet, - accounts: HashSet, - storages: HashSet, - transactions: HashSet, - transaction_receipts: HashSet, - mmr_metas: HashSet, + mmr_with_headers: HashMap>, + accounts: HashMap>, + storages: HashMap>, + transactions: HashMap>, + transaction_receipts: HashMap>, ) -> Self { Self { task_results, - headers, + mmr_with_headers, accounts, storages, transactions, transaction_receipts, - mmr_metas, } } - /// Extend the current compilation results with another compilation results + pub fn from_single_chain( + chain_id: u128, + task_results: Vec, + + mmr_with_headers: HashSet, + accounts: HashSet, + storages: HashSet, + transactions: HashSet, + transaction_receipts: HashSet, + ) -> Self { + Self { + task_results, + mmr_with_headers: HashMap::from_iter(vec![(chain_id, mmr_with_headers)]), + accounts: HashMap::from_iter(vec![(chain_id, accounts)]), + storages: HashMap::from_iter(vec![(chain_id, storages)]), + transactions: HashMap::from_iter(vec![(chain_id, transactions)]), + transaction_receipts: HashMap::from_iter(vec![(chain_id, transaction_receipts)]), + } + } + pub fn extend(&mut self, other: CompilationResult) { - self.headers.extend(other.headers); - self.accounts.extend(other.accounts); - self.storages.extend(other.storages); - self.transactions.extend(other.transactions); - self.transaction_receipts.extend(other.transaction_receipts); self.task_results.extend(other.task_results); - self.mmr_metas.extend(other.mmr_metas); + + // Merge mmr_with_headers + merge_header_mmr_maps(&mut self.mmr_with_headers, other.mmr_with_headers); + + // Merge accounts + merge_hash_maps(&mut self.accounts, other.accounts); + + // Merge storages + merge_hash_maps(&mut self.storages, other.storages); + + // Merge transactions + merge_hash_maps(&mut self.transactions, other.transactions); + + // Merge transaction_receipts + merge_hash_maps(&mut self.transaction_receipts, other.transaction_receipts); + } + + pub fn to_processed_block_vec(self) -> Vec { + let mut processed_block_vec = Vec::new(); + + for (chain_id, mmr_with_headers) in self.mmr_with_headers { + let accounts = self.accounts.get(&chain_id).cloned().unwrap_or_default(); + let storages = self.storages.get(&chain_id).cloned().unwrap_or_default(); + let transactions = self + .transactions + .get(&chain_id) + .cloned() + .unwrap_or_default(); + let transaction_receipts = self + .transaction_receipts + .get(&chain_id) + .cloned() + .unwrap_or_default(); + + let processed_block = ProcessedBlockProofs { + chain_id, + mmr_with_headers: mmr_with_headers.into_iter().collect(), + accounts: accounts.into_iter().collect(), + storages: storages.into_iter().collect(), + transactions: transactions.into_iter().collect(), + transaction_receipts: transaction_receipts.into_iter().collect(), + }; + + processed_block_vec.push(processed_block); + } + + processed_block_vec + } +} + +// Helper function to merge HashMaps with HashSet values +fn merge_hash_maps(base: &mut HashMap>, other: HashMap>) +where + T: Eq + Hash + Clone, +{ + for (key, value) in other { + base.entry(key).or_default().extend(value); + } +} + +// TODO too complicated. refactor with method in MMRWithHeader +fn merge_header_mmr_maps( + base: &mut HashMap>, + other: HashMap>, +) { + for (key, other_headers) in other { + base.entry(key) + .and_modify(|base_headers| { + // Merge using the extend method from MMRWithHeader + let mut new_headers = + mmr_with_header_vec_to_map(base_headers.iter().cloned().collect::>()); + for item in other_headers.clone() { + new_headers + .entry(item.mmr_meta) + .and_modify(|existing_headers| { + existing_headers.extend(item.headers.iter().cloned()); + }) + .or_insert_with(|| item.headers.into_iter().collect()); + } + let new_headers_vec = convert_to_mmr_with_headers(new_headers); + *base_headers = HashSet::from_iter(new_headers_vec); + }) + .or_insert(other_headers); } } diff --git a/hdp/src/preprocessor/compile/module.rs b/hdp/src/preprocessor/compile/module.rs index 1648a24a..9742823c 100644 --- a/hdp/src/preprocessor/compile/module.rs +++ b/hdp/src/preprocessor/compile/module.rs @@ -10,7 +10,7 @@ use crate::provider::key::categorize_fetch_keys; use crate::provider::traits::new_provider_from_config; use core::panic; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use std::path::PathBuf; use tracing::info; @@ -24,48 +24,55 @@ impl Compilable for ModuleVec { &self, compile_config: &CompilerConfig, ) -> Result { + // Log the target task for debugging purposes info!("target task: {:#?}", self[0].task); let dry_run_program_path = compile_config.dry_run_program_path.clone(); - let input = generate_input(self.to_vec(), PathBuf::from(DRY_CAIRO_RUN_OUTPUT_FILE)).await?; + // Generate input for the dry run based on the extended modules + let dry_run_input = + generate_input(self.to_vec(), PathBuf::from(DRY_CAIRO_RUN_OUTPUT_FILE)).await?; let input_string = - serde_json::to_string_pretty(&input).expect("Failed to serialize module class"); + serde_json::to_string_pretty(&dry_run_input).expect("Failed to serialize module class"); - // 2. run the dry run and get the fetch points + // 2. Run the dry run and retrieve the fetch points info!("2. Running dry-run... "); - let keys: DryRunResult = cairo_dry_run( + let dry_run_results: DryRunResult = cairo_dry_run( dry_run_program_path, input_string, compile_config.save_fetch_keys_file.clone(), )?; - if keys[0].program_hash != self[0].task.program_hash { + // Check if the program hash matches the expected hash + if dry_run_results[0].program_hash != self[0].task.program_hash { return Err(CompileError::ClassHashMismatch); } - if keys.len() != 1 { + // Ensure only one module is supported + if dry_run_results.len() != 1 { panic!("Multiple Modules are not supported"); } - let dry_runned_module = keys.into_iter().next().unwrap(); - let commit_results_maps = vec![dry_runned_module.result.to_combined_string().into()]; + // Extract the dry run module result + let dry_run_module = dry_run_results.into_iter().next().unwrap(); + let commit_results = vec![dry_run_module.result.into()]; - // 3. call provider using keys - let keys_maps_chain = categorize_fetch_keys(dry_runned_module.fetch_keys); - if keys_maps_chain.len() > 1 { - // TODO: This is temporary solution. Need to handle multiple chain id in future - panic!("Multiple chain id is not supported yet"); + // 3. Categorize fetch keys by chain ID + let categorized_keys = categorize_fetch_keys(dry_run_module.fetch_keys); + if categorized_keys.len() > 1 { + // TODO: This is a temporary solution. Need to handle multiple chain IDs in the future + panic!("Multiple chain IDs are not supported yet"); } - let mut headers = HashSet::new(); - let mut accounts = HashSet::new(); - let mut storages = HashSet::new(); - let mut transactions = HashSet::new(); - let mut transaction_receipts = HashSet::new(); - let mut mmr_metas = HashSet::new(); + // Initialize maps to store fetched proofs grouped by chain ID + let mut accounts_map = HashMap::new(); + let mut storages_map = HashMap::new(); + let mut transactions_map = HashMap::new(); + let mut transaction_receipts_map = HashMap::new(); + let mut mmr_header_map = HashMap::new(); info!("3. Fetching proofs from provider..."); - for (chain_id, keys) in keys_maps_chain { + // Loop through each chain ID and fetch proofs + for (chain_id, keys) in categorized_keys { info!("target provider chain id: {}", chain_id); let target_provider_config = compile_config .provider_config @@ -74,23 +81,37 @@ impl Compilable for ModuleVec { let provider = new_provider_from_config(target_provider_config); let results = provider.fetch_proofs_from_keys(keys).await?; - // TODO: can we do better? - headers.extend(results.headers.into_iter()); - accounts.extend(results.accounts.into_iter()); - storages.extend(results.storages.into_iter()); - transactions.extend(results.transactions.into_iter()); - transaction_receipts.extend(results.transaction_receipts.into_iter()); - mmr_metas.extend(results.mmr_metas.into_iter()); + // Update the maps with fetched results + mmr_header_map.insert( + chain_id.to_numeric_id(), + HashSet::from_iter(results.mmr_with_headers.into_iter()), + ); + accounts_map.insert( + chain_id.to_numeric_id(), + HashSet::from_iter(results.accounts.into_iter()), + ); + storages_map.insert( + chain_id.to_numeric_id(), + HashSet::from_iter(results.storages.into_iter()), + ); + transactions_map.insert( + chain_id.to_numeric_id(), + HashSet::from_iter(results.transactions.into_iter()), + ); + transaction_receipts_map.insert( + chain_id.to_numeric_id(), + HashSet::from_iter(results.transaction_receipts.into_iter()), + ); } + // Create and return the compilation result containing all relevant proofs let compiled_result = CompilationResult::new( - commit_results_maps, - headers, - accounts, - storages, - transactions, - transaction_receipts, - mmr_metas, + commit_results, + mmr_header_map, + accounts_map, + storages_map, + transactions_map, + transaction_receipts_map, ); Ok(compiled_result) } diff --git a/hdp/src/preprocessor/mod.rs b/hdp/src/preprocessor/mod.rs index 6e3473a6..97784f20 100644 --- a/hdp/src/preprocessor/mod.rs +++ b/hdp/src/preprocessor/mod.rs @@ -3,7 +3,6 @@ use crate::constant::SOUND_CAIRO_RUN_OUTPUT_FILE; use crate::primitives::merkle_tree::{build_result_merkle_tree, build_task_merkle_tree}; -use crate::primitives::processed_types::block_proofs::ProcessedBlockProofs; use crate::primitives::processed_types::datalake_compute::ProcessedDatalakeCompute; use crate::primitives::processed_types::module::ProcessedModule; use crate::primitives::processed_types::query::ProcessorInput; @@ -119,14 +118,8 @@ impl PreProcessor { } } - let proofs = ProcessedBlockProofs { - mmr_metas: Vec::from_iter(compiled_results.mmr_metas), - headers: Vec::from_iter(compiled_results.headers), - accounts: Vec::from_iter(compiled_results.accounts), - storages: Vec::from_iter(compiled_results.storages), - transactions: Vec::from_iter(compiled_results.transactions), - transaction_receipts: Vec::from_iter(compiled_results.transaction_receipts), - }; + // TODO: this chain id need to be fix + let proofs = compiled_results.to_processed_block_vec(); let processed_result = ProcessorInput::new( SOUND_CAIRO_RUN_OUTPUT_FILE.into(), result_merkle_tree.root(), diff --git a/hdp/src/preprocessor/module_registry.rs b/hdp/src/preprocessor/module_registry.rs index bc4cdb36..71237544 100644 --- a/hdp/src/preprocessor/module_registry.rs +++ b/hdp/src/preprocessor/module_registry.rs @@ -13,7 +13,7 @@ use crate::{ }, }; use reqwest::Client; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use std::{path::PathBuf, str::FromStr}; use thiserror::Error; use tracing::info; @@ -64,8 +64,9 @@ impl ModuleRegistry { local_class_path: Option, module_inputs: Vec, ) -> Result { - let program_hash = - program_hash.map(|program_hash| FieldElement::from_hex_be(&program_hash).unwrap()); + let program_hash = program_hash.map(|program_hash| { + Felt::from_hex(&program_hash).expect("program hash cannot be converted to FieldElement") + }); let module_inputs: Result, _> = module_inputs .into_iter() .map(|input| ModuleInput::from_str(&input)) @@ -80,7 +81,7 @@ impl ModuleRegistry { pub async fn get_extended_module_from_class_source( &self, - program_hash: Option, + program_hash: Option, local_class_path: Option, module_inputs: Vec, ) -> Result { @@ -103,7 +104,7 @@ impl ModuleRegistry { }; let program_hash = casm.compiled_class_hash(); - let converted_hash = FieldElement::from_bytes_be(&program_hash.to_bytes_be()).unwrap(); + let converted_hash = Felt::from_bytes_be(&program_hash.to_bytes_be()); info!("program Hash: {:#?}", converted_hash); let module = Module { @@ -138,7 +139,7 @@ impl ModuleRegistry { async fn get_module_class_from_program_hash( &self, - program_hash: FieldElement, + program_hash: Felt, ) -> Result { let program_hash_hex = format!("{:#x}", program_hash); @@ -179,13 +180,12 @@ mod tests { use super::*; - fn init() -> (ModuleRegistry, FieldElement) { + fn init() -> (ModuleRegistry, Felt) { let module_registry = ModuleRegistry::new(); // This is test contract class hash - let program_hash = FieldElement::from_hex_be( - "0x64041a339b1edd10de83cf031cfa938645450f971d2527c90d4c2ce68d7d412", - ) - .unwrap(); + let program_hash = + Felt::from_hex("0x64041a339b1edd10de83cf031cfa938645450f971d2527c90d4c2ce68d7d412") + .unwrap(); (module_registry, program_hash) } @@ -211,10 +211,8 @@ mod tests { assert_eq!( extended_modules.task.program_hash, - FieldElement::from_hex_be( - "0x64041a339b1edd10de83cf031cfa938645450f971d2527c90d4c2ce68d7d412" - ) - .unwrap() + Felt::from_hex("0x64041a339b1edd10de83cf031cfa938645450f971d2527c90d4c2ce68d7d412") + .unwrap() ); assert_eq!(extended_modules.task.inputs, vec![]); } diff --git a/hdp/src/primitives/block/account.rs b/hdp/src/primitives/block/account.rs index 447bb93e..da369862 100644 --- a/hdp/src/primitives/block/account.rs +++ b/hdp/src/primitives/block/account.rs @@ -30,7 +30,7 @@ impl Account { } pub fn rlp_decode(mut rlp: &[u8]) -> Self { - ::decode(&mut rlp).unwrap() + ::decode(&mut rlp).expect("rlp decode failed.") } } @@ -49,18 +49,15 @@ impl From<&EIP1186AccountProofResponse> for Account { mod tests { use super::*; use alloy::hex; - use alloy::primitives::U256; - use std::str::FromStr; + use alloy::primitives::{b256, U256}; #[test] fn test_get_account_rlp() { let account = Account::new( U64::from(1), U256::from(0), - B256::from_str("0x1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185") - .unwrap(), - B256::from_str("0xcd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c") - .unwrap(), + b256!("1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185"), + b256!("cd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c"), ); let account_rlp = account.rlp_encode(); assert_eq!( @@ -71,10 +68,8 @@ mod tests { let account = Account::new( U64::from(2), U256::from(0), - B256::from_str("0x1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185") - .unwrap(), - B256::from_str("0xcd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c") - .unwrap(), + b256!("1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185"), + b256!("cd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c"), ); let account_rlp = account.rlp_encode(); assert_eq!( @@ -85,10 +80,8 @@ mod tests { let account = Account::new( U64::from(2), U256::from(0x1), - B256::from_str("0x1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185") - .unwrap(), - B256::from_str("0xcd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c") - .unwrap(), + b256!("1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185"), + b256!("cd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c"), ); let account_rlp = account.rlp_encode(); assert_eq!( @@ -106,14 +99,8 @@ mod tests { Account::new( U64::from(1), U256::from(0), - B256::from_str( - "0x1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185" - ) - .unwrap(), - B256::from_str( - "0xcd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c" - ) - .unwrap() + b256!("1c35dfde2b62d99d3a74fda76446b60962c4656814bdd7815eb6e5b8be1e7185"), + b256!("cd4f25236fff0ccac15e82bf4581beb08e95e1b5ba89de6031c75893cd91245c") ) ); } diff --git a/hdp/src/primitives/block/header.rs b/hdp/src/primitives/block/header.rs index 249ce349..72b875b6 100644 --- a/hdp/src/primitives/block/header.rs +++ b/hdp/src/primitives/block/header.rs @@ -131,7 +131,6 @@ impl Header { } /// Heavy function that will calculate hash of data and will *not* save the change to metadata. - /// Use [`Header::seal`], [`SealedHeader`] and unlock if you need hash to be persistent. pub fn hash_slow(&self) -> B256 { keccak256(alloy_rlp::encode(self)) } @@ -343,7 +342,7 @@ impl Header { } /// Block header returned from RPC -/// https://ethereum.org/en/developers/docs/apis/json-rpc#eth_getblockbynumber +/// #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct BlockHeaderFromRpc { @@ -378,8 +377,8 @@ impl BlockHeaderFromRpc { } } -impl From<&BlockHeaderFromRpc> for Header { - fn from(value: &BlockHeaderFromRpc) -> Self { +impl From for Header { + fn from(value: BlockHeaderFromRpc) -> Self { Self { parent_hash: B256::from_str(&value.parent_hash).expect("Invalid hex string"), ommers_hash: B256::from_str(&value.sha3_uncles).expect("Invalid hex string"), @@ -400,23 +399,18 @@ impl From<&BlockHeaderFromRpc> for Header { nonce: u64::from_str_radix(&value.nonce[2..], 16).expect("Invalid hex string"), base_fee_per_gas: value .base_fee_per_gas - .clone() .map(|x| u64::from_str_radix(&x[2..], 16).expect("Invalid hex string")), withdrawals_root: value .withdrawals_root - .clone() .map(|x| B256::from_str(&x).expect("Invalid hex string")), blob_gas_used: value .blob_gas_used - .clone() .map(|x| u64::from_str_radix(&x[2..], 16).expect("Invalid hex string")), excess_blob_gas: value .excess_blob_gas - .clone() .map(|x| u64::from_str_radix(&x[2..], 16).expect("Invalid hex string")), parent_beacon_block_root: value .parent_beacon_block_root - .clone() .map(|x| B256::from_str(&x).expect("Invalid hex string")), } } diff --git a/hdp/src/primitives/processed_types/block_proofs.rs b/hdp/src/primitives/processed_types/block_proofs.rs index a0e8f406..a19ce135 100644 --- a/hdp/src/primitives/processed_types/block_proofs.rs +++ b/hdp/src/primitives/processed_types/block_proofs.rs @@ -1,3 +1,5 @@ +use std::collections::{HashMap, HashSet}; + use serde::{Deserialize, Serialize}; use super::{ @@ -7,12 +9,79 @@ use super::{ /// Provider should fetch all the proofs and rlp values from given keys. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)] pub struct ProcessedBlockProofs { - pub mmr_metas: Vec, - pub headers: Vec, + pub chain_id: u128, + pub mmr_with_headers: Vec, pub accounts: Vec, pub storages: Vec, pub transactions: Vec, pub transaction_receipts: Vec, } + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)] +pub struct MMRWithHeader { + pub mmr_meta: MMRMeta, + pub headers: Vec, +} + +pub fn mmr_with_header_vec_to_map( + target: Vec, +) -> HashMap> { + let mut map = HashMap::new(); + for target_item in target { + map.entry(target_item.mmr_meta) + .and_modify(|existing_headers: &mut HashSet| { + existing_headers.extend(target_item.headers.iter().cloned()); + }) + .or_insert_with(|| target_item.headers.into_iter().collect()); + } + map +} + +impl MMRWithHeader { + pub fn to_map(self) -> HashMap> { + let mut map = HashMap::new(); + map.insert(self.mmr_meta, HashSet::from_iter(self.headers)); + map + } + + pub fn extend(self, other: MMRWithHeader) -> Vec { + let mut self_map = self.to_map(); + let other_map = other.to_map(); + for (mmr, headers) in other_map { + self_map + .entry(mmr) + .and_modify(|existing_headers| { + existing_headers.extend(headers.iter().cloned()); + }) + .or_insert_with(|| headers.into_iter().collect()); + } + convert_to_mmr_with_headers(self_map) + } +} + +pub fn convert_to_mmr_with_headers( + map: HashMap>, +) -> Vec { + map.into_iter() + .map(|(mmr_meta, headers)| MMRWithHeader { + mmr_meta, + headers: headers.into_iter().collect(), + }) + .collect() +} + +pub fn convert_to_mmr_meta_set( + mmr_with_headers: Vec, +) -> HashMap> { + mmr_with_headers + .into_iter() + .map(|mmr_with_header| { + ( + mmr_with_header.mmr_meta, + mmr_with_header.headers.into_iter().collect::>(), + ) + }) + .collect() +} diff --git a/hdp/src/primitives/processed_types/cairo_format/account.rs b/hdp/src/primitives/processed_types/cairo_format/account.rs index a568790d..5c8f4827 100644 --- a/hdp/src/primitives/processed_types/cairo_format/account.rs +++ b/hdp/src/primitives/processed_types/cairo_format/account.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use crate::primitives::processed_types::account::ProcessedAccount as BaseProcessedAccount; @@ -14,8 +14,7 @@ impl AsCairoFormat for BaseProcessedAccount { type Output = ProcessedAccount; fn as_cairo_format(&self) -> Self::Output { - let address_chunk_result = - FieldElementVectorUnit::from_bytes(self.address.as_ref()).unwrap(); + let address_chunk_result = FieldElementVectorUnit::from_bytes(self.address.as_ref()); let account_key = &self.account_key; let proofs = self .proofs @@ -34,7 +33,7 @@ impl AsCairoFormat for BaseProcessedAccount { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)] pub struct ProcessedAccount { #[serde_as(as = "Vec")] - pub address: Vec, + pub address: Vec, pub account_key: String, pub proofs: Vec, } diff --git a/hdp/src/primitives/processed_types/cairo_format/block_proofs.rs b/hdp/src/primitives/processed_types/cairo_format/block_proofs.rs index c7f6ee13..f5917c5e 100644 --- a/hdp/src/primitives/processed_types/cairo_format/block_proofs.rs +++ b/hdp/src/primitives/processed_types/cairo_format/block_proofs.rs @@ -14,11 +14,18 @@ impl AsCairoFormat for BaseProcessedBlockProofs { fn as_cairo_format(&self) -> Self::Output { ProcessedBlockProofs { - mmr_metas: self.mmr_metas.clone(), - headers: self - .headers + chain_id: self.chain_id, + mmr_with_headers: self + .mmr_with_headers .iter() - .map(|header| header.as_cairo_format()) + .map(|mmr_with_header| MMRWithHeader { + mmr_meta: mmr_with_header.mmr_meta.clone(), + headers: mmr_with_header + .headers + .iter() + .map(|header| header.as_cairo_format()) + .collect(), + }) .collect(), accounts: self .accounts @@ -46,10 +53,16 @@ impl AsCairoFormat for BaseProcessedBlockProofs { #[derive(Serialize, Deserialize)] pub struct ProcessedBlockProofs { - pub mmr_metas: Vec, - pub headers: Vec, + pub chain_id: u128, + pub mmr_with_headers: Vec, pub accounts: Vec, pub storages: Vec, pub transactions: Vec, pub transaction_receipts: Vec, } + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct MMRWithHeader { + pub mmr_meta: MMRMeta, + pub headers: Vec, +} diff --git a/hdp/src/primitives/processed_types/cairo_format/datalake_compute.rs b/hdp/src/primitives/processed_types/cairo_format/datalake_compute.rs index 1042dc75..b85e479b 100644 --- a/hdp/src/primitives/processed_types/cairo_format/datalake_compute.rs +++ b/hdp/src/primitives/processed_types/cairo_format/datalake_compute.rs @@ -4,15 +4,14 @@ use super::{felt_vec_unit::FieldElementVectorUnit, traits::AsCairoFormat}; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; impl AsCairoFormat for BaseProcessedDatalakeCompute { type Output = ProcessedDatalakeCompute; fn as_cairo_format(&self) -> Self::Output { - let computational_task_felts = - FieldElementVectorUnit::from_bytes(&self.encoded_task).unwrap(); - let datalake_felts = FieldElementVectorUnit::from_bytes(&self.encoded_datalake).unwrap(); + let computational_task_felts = FieldElementVectorUnit::from_bytes(&self.encoded_task); + let datalake_felts = FieldElementVectorUnit::from_bytes(&self.encoded_datalake); ProcessedDatalakeCompute { task_bytes_len: computational_task_felts.bytes_len, encoded_task: computational_task_felts.felts, @@ -29,10 +28,10 @@ impl AsCairoFormat for BaseProcessedDatalakeCompute { pub struct ProcessedDatalakeCompute { pub task_bytes_len: u64, #[serde_as(as = "Vec")] - pub encoded_task: Vec, + pub encoded_task: Vec, pub datalake_bytes_len: u64, #[serde_as(as = "Vec")] - pub encoded_datalake: Vec, + pub encoded_datalake: Vec, pub datalake_type: u8, pub property_type: u8, } diff --git a/hdp/src/primitives/processed_types/cairo_format/felt_vec_unit.rs b/hdp/src/primitives/processed_types/cairo_format/felt_vec_unit.rs index afc4baca..0c4902e7 100644 --- a/hdp/src/primitives/processed_types/cairo_format/felt_vec_unit.rs +++ b/hdp/src/primitives/processed_types/cairo_format/felt_vec_unit.rs @@ -1,21 +1,30 @@ -use anyhow::Result; use serde::Serialize; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; #[serde_as] #[derive(Serialize, Debug)] pub struct FieldElementVectorUnit { + /// Chunked vector of field elements #[serde_as(as = "Vec")] - pub felts: Vec, + pub felts: Vec, + /// Length of the original byte array before chunking into field elements pub bytes_len: u64, } impl FieldElementVectorUnit { - pub fn from_bytes(bytes: &[u8]) -> Result { + /// Converts a byte slice into a `FieldElementVectorUnit`. + /// + /// This function takes a slice of bytes and converts it into a `FieldElementVectorUnit`, + /// which consists of a vector of [`Felt`]s and the length of the original byte slice. + /// + /// # Panics + /// + /// This function will panic if the input byte slice is empty. + pub fn from_bytes(bytes: &[u8]) -> Self { if bytes.is_empty() { - return Err(anyhow::anyhow!("Empty hex input")); + panic!("Cannot convert to FieldElementVectorUnit from empty bytes") } let bytes_len = bytes.len() as u64; let felts = bytes @@ -25,12 +34,11 @@ impl FieldElementVectorUnit { let len = chunk.len(); arr[..len].copy_from_slice(chunk); let le_int = u64::from_le_bytes(arr); - FieldElement::from_dec_str(&le_int.to_string()) - .expect("Invalid to convert FieldElement") + Felt::from_dec_str(&le_int.to_string()).expect("Invalid to convert FieldElement") }) .collect(); - Ok(Self { felts, bytes_len }) + Self { felts, bytes_len } } } @@ -41,46 +49,37 @@ mod tests { use super::*; #[test] + #[should_panic(expected = "Cannot convert to FieldElementVectorUnit from empty bytes")] fn test_empty_bytes() { let bytes = hex::decode("").unwrap(); - let result = FieldElementVectorUnit::from_bytes(&bytes); - assert!(result.is_err()); + FieldElementVectorUnit::from_bytes(&bytes); } #[test] fn test_single_byte_bytes() { let bytes = hex::decode("0x01").unwrap(); - let result = FieldElementVectorUnit::from_bytes(&bytes).unwrap(); + let result = FieldElementVectorUnit::from_bytes(&bytes); assert_eq!(result.bytes_len, 1); assert_eq!(result.felts.len(), 1); - assert_eq!(result.felts[0], FieldElement::from_hex_be("0x1").unwrap()); + assert_eq!(result.felts[0], Felt::from_hex("0x1").unwrap()); } #[test] fn test_single_chunk_bytes() { let bytes = hex::decode("0x1234567890abcdef").unwrap(); - let result = FieldElementVectorUnit::from_bytes(&bytes).unwrap(); + let result = FieldElementVectorUnit::from_bytes(&bytes); assert_eq!(result.bytes_len, 8); assert_eq!(result.felts.len(), 1); - assert_eq!( - result.felts[0], - FieldElement::from_hex_be("efcdab9078563412").unwrap() - ); + assert_eq!(result.felts[0], Felt::from_hex("efcdab9078563412").unwrap()); } #[test] fn test_multiple_chunks_bytes() { let bytes = hex::decode("0x1234567890abcdef1122334455667788").unwrap(); - let result = FieldElementVectorUnit::from_bytes(&bytes).unwrap(); + let result = FieldElementVectorUnit::from_bytes(&bytes); assert_eq!(result.bytes_len, 16); assert_eq!(result.felts.len(), 2); - assert_eq!( - result.felts[0], - FieldElement::from_hex_be("efcdab9078563412").unwrap() - ); - assert_eq!( - result.felts[1], - FieldElement::from_hex_be("8877665544332211").unwrap() - ); + assert_eq!(result.felts[0], Felt::from_hex("efcdab9078563412").unwrap()); + assert_eq!(result.felts[1], Felt::from_hex("8877665544332211").unwrap()); } } diff --git a/hdp/src/primitives/processed_types/cairo_format/header.rs b/hdp/src/primitives/processed_types/cairo_format/header.rs index 6d04873b..395e8e5b 100644 --- a/hdp/src/primitives/processed_types/cairo_format/header.rs +++ b/hdp/src/primitives/processed_types/cairo_format/header.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use crate::primitives::processed_types::header::{ ProcessedHeader as BaseProcessedHeader, ProcessedHeaderProof as BasedProcessedHeaderProof, @@ -13,7 +13,7 @@ impl AsCairoFormat for BaseProcessedHeader { type Output = ProcessedHeader; fn as_cairo_format(&self) -> Self::Output { - let felts_unit = FieldElementVectorUnit::from_bytes(&self.rlp).unwrap(); + let felts_unit = FieldElementVectorUnit::from_bytes(&self.rlp); let proof = self.proof.clone(); ProcessedHeader { rlp: felts_unit.felts, @@ -31,7 +31,7 @@ impl AsCairoFormat for BaseProcessedHeader { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)] pub struct ProcessedHeader { #[serde_as(as = "Vec")] - pub rlp: Vec, + pub rlp: Vec, /// rlp_bytes_len is the byte( 8 bit ) length from rlp string pub rlp_bytes_len: u64, pub proof: BasedProcessedHeaderProof, diff --git a/hdp/src/primitives/processed_types/cairo_format/module.rs b/hdp/src/primitives/processed_types/cairo_format/module.rs index fe55b295..b0c1df9a 100644 --- a/hdp/src/primitives/processed_types/cairo_format/module.rs +++ b/hdp/src/primitives/processed_types/cairo_format/module.rs @@ -5,7 +5,7 @@ use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use super::{AsCairoFormat, FieldElementVectorUnit}; @@ -13,7 +13,7 @@ impl AsCairoFormat for BaseProcessedModule { type Output = ProcessedModule; fn as_cairo_format(&self) -> Self::Output { - let module_task_felts = FieldElementVectorUnit::from_bytes(&self.encoded_task).unwrap(); + let module_task_felts = FieldElementVectorUnit::from_bytes(&self.encoded_task); ProcessedModule { module_class: self.module_class.clone(), encoded_task: module_task_felts.felts, @@ -53,7 +53,7 @@ impl DryRunProcessedModule { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ProcessedModule { #[serde_as(as = "Vec")] - pub encoded_task: Vec, + pub encoded_task: Vec, pub task_bytes_len: u64, pub inputs: Vec, /// Detail class code of the module. @@ -63,7 +63,7 @@ pub struct ProcessedModule { impl ProcessedModule { pub fn new( - encoded_task: Vec, + encoded_task: Vec, task_bytes_len: u64, inputs: Vec, module_class: CasmContractClass, diff --git a/hdp/src/primitives/processed_types/cairo_format/mpt.rs b/hdp/src/primitives/processed_types/cairo_format/mpt.rs index ec2baaaa..93fcc4f5 100644 --- a/hdp/src/primitives/processed_types/cairo_format/mpt.rs +++ b/hdp/src/primitives/processed_types/cairo_format/mpt.rs @@ -4,7 +4,7 @@ use super::{felt_vec_unit::FieldElementVectorUnit, traits::AsCairoFormat}; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; impl AsCairoFormat for BaseProcessedMPTProof { type Output = ProcessedMPTProof; @@ -13,12 +13,11 @@ impl AsCairoFormat for BaseProcessedMPTProof { let proof_felts: Vec = self .proof .iter() - .map(|proof| FieldElementVectorUnit::from_bytes(proof).unwrap()) + .map(|proof| FieldElementVectorUnit::from_bytes(proof)) .collect(); let proof_bytes_len = proof_felts.iter().map(|f| f.bytes_len).collect(); - let proof_result: Vec> = - proof_felts.iter().map(|f| f.felts.clone()).collect(); + let proof_result: Vec> = proof_felts.iter().map(|f| f.felts.clone()).collect(); ProcessedMPTProof { block_number: self.block_number, proof_bytes_len, @@ -34,5 +33,5 @@ pub struct ProcessedMPTProof { /// proof_bytes_len is the byte( 8 bit ) length from each proof string pub proof_bytes_len: Vec, #[serde_as(as = "Vec>")] - pub proof: Vec>, + pub proof: Vec>, } diff --git a/hdp/src/primitives/processed_types/cairo_format/query.rs b/hdp/src/primitives/processed_types/cairo_format/query.rs index 228e7043..e26ec1cd 100644 --- a/hdp/src/primitives/processed_types/cairo_format/query.rs +++ b/hdp/src/primitives/processed_types/cairo_format/query.rs @@ -15,7 +15,11 @@ impl AsCairoFormat for BasedProcessorInput { cairo_run_output_path: self.cairo_run_output_path.clone(), task_root: self.tasks_root, result_root: self.results_root, - proofs: self.proofs.as_cairo_format(), + proofs: self + .proofs + .iter() + .map(|proof| proof.as_cairo_format()) + .collect(), tasks: self .tasks .iter() @@ -34,7 +38,7 @@ pub struct ProcessorInput { /// Batched results root of all tasks. pub result_root: B256, /// Fetched proofs per each fetch point. - pub proofs: ProcessedBlockProofs, + pub proofs: Vec, /// tasks to be executed. pub tasks: Vec, } diff --git a/hdp/src/primitives/processed_types/cairo_format/receipt.rs b/hdp/src/primitives/processed_types/cairo_format/receipt.rs index f5293f1b..b09ebd59 100644 --- a/hdp/src/primitives/processed_types/cairo_format/receipt.rs +++ b/hdp/src/primitives/processed_types/cairo_format/receipt.rs @@ -5,7 +5,7 @@ use crate::primitives::processed_types::receipt::ProcessedReceipt as BaseProcess use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; impl AsCairoFormat for BaseProcessedReceipt { type Output = ProcessedReceipt; @@ -15,12 +15,11 @@ impl AsCairoFormat for BaseProcessedReceipt { let proof_felts: Vec = self .proof .iter() - .map(|proof| FieldElementVectorUnit::from_bytes(proof).unwrap()) + .map(|proof| FieldElementVectorUnit::from_bytes(proof)) .collect(); let proof_bytes_len = proof_felts.iter().map(|f| f.bytes_len).collect(); - let proof_result: Vec> = - proof_felts.iter().map(|f| f.felts.clone()).collect(); + let proof_result: Vec> = proof_felts.iter().map(|f| f.felts.clone()).collect(); ProcessedReceipt { key, block_number: self.block_number, @@ -39,7 +38,7 @@ pub struct ProcessedReceipt { /// proof_bytes_len is the byte( 8 bit ) length from each proof string pub proof_bytes_len: Vec, #[serde_as(as = "Vec>")] - pub proof: Vec>, + pub proof: Vec>, } #[cfg(test)] diff --git a/hdp/src/primitives/processed_types/cairo_format/storage.rs b/hdp/src/primitives/processed_types/cairo_format/storage.rs index 4aba0c1c..b370434b 100644 --- a/hdp/src/primitives/processed_types/cairo_format/storage.rs +++ b/hdp/src/primitives/processed_types/cairo_format/storage.rs @@ -4,7 +4,7 @@ use alloy::primitives::StorageKey; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use crate::primitives::processed_types::storage::ProcessedStorage as BaseProcessedStorage; @@ -14,9 +14,8 @@ impl AsCairoFormat for BaseProcessedStorage { type Output = ProcessedStorage; fn as_cairo_format(&self) -> Self::Output { - let address_chunk_result = - FieldElementVectorUnit::from_bytes(self.address.as_ref()).unwrap(); - let slot_chunk_result = FieldElementVectorUnit::from_bytes(self.slot.as_ref()).unwrap(); + let address_chunk_result = FieldElementVectorUnit::from_bytes(self.address.as_ref()); + let slot_chunk_result = FieldElementVectorUnit::from_bytes(self.slot.as_ref()); let storage_key = self.storage_key; let proofs = self .proofs @@ -37,10 +36,10 @@ impl AsCairoFormat for BaseProcessedStorage { pub struct ProcessedStorage { // chunked address #[serde_as(as = "Vec")] - pub address: Vec, + pub address: Vec, // chunked storage slot #[serde_as(as = "Vec")] - pub slot: Vec, + pub slot: Vec, pub storage_key: StorageKey, pub proofs: Vec, } diff --git a/hdp/src/primitives/processed_types/cairo_format/transaction.rs b/hdp/src/primitives/processed_types/cairo_format/transaction.rs index 39385a9b..80bec172 100644 --- a/hdp/src/primitives/processed_types/cairo_format/transaction.rs +++ b/hdp/src/primitives/processed_types/cairo_format/transaction.rs @@ -5,7 +5,7 @@ use crate::primitives::processed_types::transaction::ProcessedTransaction as Bas use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; impl AsCairoFormat for BaseProcessedTransaction { type Output = ProcessedTransaction; @@ -15,12 +15,11 @@ impl AsCairoFormat for BaseProcessedTransaction { let proof_felts: Vec = self .proof .iter() - .map(|proof| FieldElementVectorUnit::from_bytes(proof).unwrap()) + .map(|proof| FieldElementVectorUnit::from_bytes(proof)) .collect(); let proof_bytes_len = proof_felts.iter().map(|f| f.bytes_len).collect(); - let proof_result: Vec> = - proof_felts.iter().map(|f| f.felts.clone()).collect(); + let proof_result: Vec> = proof_felts.iter().map(|f| f.felts.clone()).collect(); ProcessedTransaction { key, block_number: self.block_number, @@ -38,7 +37,7 @@ pub struct ProcessedTransaction { /// proof_bytes_len is the byte( 8 bit ) length from each proof string pub proof_bytes_len: Vec, #[serde_as(as = "Vec>")] - pub proof: Vec>, + pub proof: Vec>, } #[cfg(test)] diff --git a/hdp/src/primitives/processed_types/mmr.rs b/hdp/src/primitives/processed_types/mmr.rs index 8bd1a4d3..19aef186 100644 --- a/hdp/src/primitives/processed_types/mmr.rs +++ b/hdp/src/primitives/processed_types/mmr.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::primitives::{block::header::MMRMetaFromNewIndexer, utils::hex_string_to_uint, ChainId}; +use crate::primitives::{block::header::MMRMetaFromNewIndexer, utils::hex_string_to_uint}; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)] pub struct MMRMeta { @@ -9,29 +9,26 @@ pub struct MMRMeta { pub size: u64, // hex encoded pub peaks: Vec, - pub chain_id: u128, } impl MMRMeta { - pub fn new(id: u64, root: String, size: u64, peaks: Vec, chain_id: u128) -> Self { + pub fn new(id: u64, root: String, size: u64, peaks: Vec) -> Self { MMRMeta { id, root, size, peaks, - chain_id, } } } impl MMRMeta { - pub fn from_indexer(val: MMRMetaFromNewIndexer, chain_id: ChainId) -> Self { + pub fn from_indexer(val: MMRMetaFromNewIndexer) -> Self { MMRMeta { id: hex_string_to_uint(&val.mmr_id), root: val.mmr_root, size: val.mmr_size, peaks: val.mmr_peaks, - chain_id: chain_id.to_numeric_id(), } } } @@ -61,7 +58,6 @@ mod tests { "0x66c82fce8bfc291095c6c9255b1f7ccf725a1e91e8ae8cd8c43ceb111c21480".to_string(), "0x2e5274895f9cd556bb8dee5b2551e9cda9aa3caa23532f9824abcc62d5ad273".to_string(), ], - 11155111, ); let processed_string = include_str!("../../../../fixtures/primitives/mmr.json"); diff --git a/hdp/src/primitives/processed_types/query.rs b/hdp/src/primitives/processed_types/query.rs index d41e3832..29ad40c3 100644 --- a/hdp/src/primitives/processed_types/query.rs +++ b/hdp/src/primitives/processed_types/query.rs @@ -3,7 +3,8 @@ use alloy::primitives::B256; use std::path::PathBuf; use super::{ - block_proofs::ProcessedBlockProofs, processor_output::ProcessorOutput, task::ProcessedTask, + block_proofs::ProcessedBlockProofs, mmr::MMRMeta, processor_output::ProcessorOutput, + task::ProcessedTask, }; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -14,7 +15,7 @@ pub struct ProcessorInput { pub tasks_root: B256, // U256 type pub results_root: B256, - pub proofs: ProcessedBlockProofs, + pub proofs: Vec, pub tasks: Vec, } @@ -23,7 +24,7 @@ impl ProcessorInput { cairo_run_output_path: PathBuf, results_root: B256, tasks_root: B256, - proofs: ProcessedBlockProofs, + proofs: Vec, tasks: Vec, ) -> Self { Self { @@ -58,6 +59,12 @@ impl ProcessorInput { .iter() .map(|task| task.get_result_proof()) .collect(); + let mmr_metas: Vec = self + .proofs + .iter() + .flat_map(|x| &x.mmr_with_headers) + .map(|mmr_with_header| mmr_with_header.mmr_meta.clone()) + .collect(); ProcessorOutput::new( task_results, @@ -67,7 +74,7 @@ impl ProcessorInput { results_inclusion_proofs, self.results_root, self.tasks_root, - self.proofs.mmr_metas.clone(), + mmr_metas, ) } } diff --git a/hdp/src/primitives/processed_types/uint256.rs b/hdp/src/primitives/processed_types/uint256.rs index 33e51e00..2fde866a 100644 --- a/hdp/src/primitives/processed_types/uint256.rs +++ b/hdp/src/primitives/processed_types/uint256.rs @@ -1,37 +1,91 @@ //! This module contains the `Uint256` type, which is a 256-bit unsigned integer. //! This is compatible with Cairo `uint256` type. -use alloy::primitives::{hex::FromHex, B256}; +use crate::primitives::utils::bytes_to_hex_string; +use alloy::primitives::{hex::FromHex, B256, U256}; use anyhow::Result; +use core::fmt::Display; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use std::str::FromStr; -use crate::primitives::utils::bytes_to_hex_string; - +/// [`Uint256`] represents a 256-bit unsigned integer. +/// It is implemented as a struct with two [`Felt`] values: `high` and `low`. +/// Each [`Felt`] represents 128 bits of the 256-bit integer. #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)] pub struct Uint256 { #[serde_as(as = "UfeHex")] - pub low: FieldElement, + pub low: Felt, // Represents the least significant 128 bits #[serde_as(as = "UfeHex")] - pub high: FieldElement, + pub high: Felt, // Represents the most significant 128 bits +} + +impl Default for Uint256 { + /// Returns a `Uint256` with a value of zero. + fn default() -> Self { + Self::ZERO + } } impl Uint256 { - pub fn from_strs(high: &str, low: &str) -> Result { + /// Constant representing zero as a `Uint256`. + pub const ZERO: Self = Self { + high: Felt::ZERO, + low: Felt::ZERO, + }; + + /// Creates a `Uint256` from two byte slices representing the high and low parts. + /// + /// # Arguments + /// * `high` - A byte slice representing the most significant 128 bits + /// * `low` - A byte slice representing the least significant 128 bits + /// + /// # Returns + /// A `Result` containing the new `Uint256` or an error if conversion fails. + pub fn from_bytes_tuple(high: &[u8], low: &[u8]) -> Result { + Ok(Self { + high: Felt::from_bytes_be_slice(high), + low: Felt::from_bytes_be_slice(low), + }) + } + + /// Creates a `Uint256` from two hexadecimal strings representing the high and low parts. + /// + /// # Arguments + /// * `high` - A string slice representing the most significant 128 bits in hex + /// * `low` - A string slice representing the least significant 128 bits in hex + /// + /// # Returns + /// A `Result` containing the new `Uint256` or an error if conversion fails. + pub fn from_hex_tuple(high: &str, low: &str) -> Result { Ok(Self { - high: FieldElement::from_hex_be(high)?, - low: FieldElement::from_hex_be(low)?, + high: Felt::from_hex(high)?, + low: Felt::from_hex(low)?, }) } - pub fn from_felts(high: FieldElement, low: FieldElement) -> Self { + /// Creates a `Uint256` from two [`Felt`]s representing the high and low parts. + /// + /// # Arguments + /// * `high` - A `Felt` representing the most significant 128 bits + /// * `low` - A `Felt` representing the least significant 128 bits + /// + /// # Returns + /// A new `Uint256` instance. + pub fn from_field_element_tuple(high: Felt, low: Felt) -> Self { Self { high, low } } + /// Creates a `Uint256` from a little-endian hexadecimal string. + /// + /// # Arguments + /// * `hex_str` - A string slice containing the hexadecimal representation + /// + /// # Returns + /// A `Result` containing the new `Uint256` or an error if conversion fails. pub fn from_le_hex_str(hex_str: &str) -> Result { let clean_hex = hex_str.trim_start_matches("0x"); let mut fix_hex: B256 = B256::from_hex(clean_hex)?; @@ -41,23 +95,50 @@ impl Uint256 { let low_part = fix_hex[16..].to_vec(); Ok(Self { - high: FieldElement::from_hex_be(&bytes_to_hex_string(&high_part))?, - low: FieldElement::from_hex_be(&bytes_to_hex_string(&low_part))?, + high: Felt::from_hex(&bytes_to_hex_string(&high_part))?, + low: Felt::from_hex(&bytes_to_hex_string(&low_part))?, }) } + /// Creates a `Uint256` from a big-endian hexadecimal string. + /// + /// # Arguments + /// * `hex_str` - A string slice containing the hexadecimal representation + /// + /// # Returns + /// A `Result` containing the new `Uint256` or an error if conversion fails. pub fn from_be_hex_str(hex_str: &str) -> Result { let clean_hex = hex_str.trim_start_matches("0x"); let padded_hex = format!("{:0>64}", clean_hex); let (high_part, low_part) = padded_hex.split_at(32); Ok(Self { - high: FieldElement::from_hex_be(&format!("0x{}", high_part))?, - low: FieldElement::from_hex_be(&format!("0x{}", low_part))?, + high: Felt::from_hex(&format!("0x{}", high_part))?, + low: Felt::from_hex(&format!("0x{}", low_part))?, + }) + } + + /// Creates a `Uint256` from a big-endian byte slice. + /// + /// # Arguments + /// * `bytes` - A byte slice containing the 256-bit integer representation + /// + /// # Returns + /// A `Result` containing the new `Uint256` or an error if conversion fails. + pub fn from_be_bytes(bytes: &[u8]) -> Result { + let high_part = bytes[..16].to_vec(); + let low_part = bytes[16..].to_vec(); + + Ok(Self { + high: Felt::from_hex(&bytes_to_hex_string(&high_part))?, + low: Felt::from_hex(&bytes_to_hex_string(&low_part))?, }) } +} - /// combine_parts_into_big_endian_hex - pub fn to_combined_string(&self) -> B256 { +impl Display for Uint256 { + /// Formats the `Uint256` as a hexadecimal string. + /// The output is a 0x-prefixed, 64-character hexadecimal string. + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { // Ensure both parts are exactly 32 hex characters long let high_padded = format!( "{:0>32}", @@ -71,48 +152,76 @@ impl Uint256 { ) .trim_start_matches("0x") .to_string(); + write!(f, "0x{}{}", high_padded, low_padded) + } +} - B256::from_str(&format!("0x{}{}", high_padded, low_padded)).unwrap() +impl From for B256 { + /// Converts a `Uint256` to a `B256`. + fn from(value: Uint256) -> B256 { + B256::from_str(&value.to_string()).expect("Invalid value for B256") + } +} + +impl From for Uint256 { + /// Converts a `B256` to a `Uint256`. + fn from(value: B256) -> Self { + Self::from_be_bytes(value.as_slice()).expect("Invalid value for Uint256") + } +} + +impl From for U256 { + /// Converts a `Uint256` to a `U256`. + fn from(value: Uint256) -> U256 { + U256::from_str(&value.to_string()).expect("Invalid value for U256") + } +} + +impl From for Uint256 { + /// Converts a `U256` to a `Uint256`. + fn from(value: U256) -> Self { + Self::from_be_bytes(&value.to_be_bytes_vec()).expect("Invalid value for Uint256") } } #[cfg(test)] mod tests { + use alloy::primitives::b256; use starknet::macros::felt; use super::*; #[test] fn test_combine_parts_into_big_endian_hex() { - let uint256 = Uint256::from_felts( - FieldElement::from_hex_be("0x988c19313bcbfb19fcc4da12e3adb46c").unwrap(), - FieldElement::from_hex_be("0xf6fbdd08af91b1d8df80c6e755159f1").unwrap(), - ); + let result0: B256 = Uint256::from_field_element_tuple( + felt!("0x988c19313bcbfb19fcc4da12e3adb46c"), + felt!("0xf6fbdd08af91b1d8df80c6e755159f1"), + ) + .into(); assert_eq!( - uint256.to_combined_string(), - B256::from_str("0x988c19313bcbfb19fcc4da12e3adb46c0f6fbdd08af91b1d8df80c6e755159f1") - .unwrap() + result0, + b256!("988c19313bcbfb19fcc4da12e3adb46c0f6fbdd08af91b1d8df80c6e755159f1") ); - let uint256 = Uint256::from_felts( + let result1: B256 = Uint256::from_field_element_tuple( felt!("0x988c19313bcbfb19fcc4da12e3adb46"), felt!("0xf6fbdd08af91b1d8df80c6e755159f1"), - ); + ) + .into(); assert_eq!( - uint256.to_combined_string(), - B256::from_str("0x0988c19313bcbfb19fcc4da12e3adb460f6fbdd08af91b1d8df80c6e755159f1") - .unwrap() + result1, + b256!("0988c19313bcbfb19fcc4da12e3adb460f6fbdd08af91b1d8df80c6e755159f1") ); - let uint256 = Uint256::from_felts( + let result2: B256 = Uint256::from_field_element_tuple( felt!("0x988c19313bcbfb19fcc4da12e3adb4"), felt!("0xf6fbdd08af91b1d8df80c6e755159f1"), - ); + ) + .into(); assert_eq!( - uint256.to_combined_string(), - B256::from_str("0x00988c19313bcbfb19fcc4da12e3adb40f6fbdd08af91b1d8df80c6e755159f1") - .unwrap() + result2, + b256!("00988c19313bcbfb19fcc4da12e3adb40f6fbdd08af91b1d8df80c6e755159f1") ); } @@ -122,12 +231,13 @@ mod tests { let result = Uint256::from_be_hex_str(hex_str).unwrap(); assert_eq!( result, - Uint256::from_felts( + Uint256::from_field_element_tuple( felt!("0x60870c80ce4e1d0c35e34f08b1648e8a"), felt!("0x4fdc7818eea7caedbd316c63a3863562"), ) ); - assert_eq!(result.to_combined_string().to_string(), hex_str); + let result_b256: B256 = result.into(); + assert_eq!(result_b256, B256::from_str(hex_str).unwrap()); } #[test] @@ -136,7 +246,7 @@ mod tests { let result = Uint256::from_le_hex_str(hex_str).unwrap(); assert_eq!( result, - Uint256::from_felts( + Uint256::from_field_element_tuple( felt!("0x1d693b26fded2cc4edb9acbf8133f52d"), felt!("0x2a32ca1db17188d788996d243adbda8d"), ) @@ -145,7 +255,7 @@ mod tests { #[test] fn test_uint256_serde() { - let target = Uint256::from_felts( + let target = Uint256::from_field_element_tuple( felt!("0x1d693b26fded2cc4edb9acbf8133f52d"), felt!("0x2a32ca1db17188d788996d243adbda8d"), ); @@ -154,4 +264,11 @@ mod tests { let expected = json_file.trim(); assert_eq!(string, expected); } + + #[test] + fn test_uint256_default() { + let zero: B256 = Uint256::ZERO.into(); + + assert_eq!(zero, B256::ZERO) + } } diff --git a/hdp/src/primitives/solidity_types/datalake_compute/datalake/envelope.rs b/hdp/src/primitives/solidity_types/datalake_compute/datalake/envelope.rs index bf529c3a..d2f1413c 100644 --- a/hdp/src/primitives/solidity_types/datalake_compute/datalake/envelope.rs +++ b/hdp/src/primitives/solidity_types/datalake_compute/datalake/envelope.rs @@ -180,7 +180,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); let transaction_datalake2 = TransactionsInBlockDatalake::new( @@ -190,7 +190,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); let datalakes = vec![ @@ -215,7 +215,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); let transaction_datalake2 = TransactionsInBlockDatalake::new( @@ -225,7 +225,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); assert_eq!( @@ -247,7 +247,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); let transaction_datalake2 = TransactionsInBlockDatalake::new( @@ -257,7 +257,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); let datalakes = vec![ @@ -282,7 +282,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); let transaction_datalake2 = TransactionsInBlockDatalake::new( @@ -292,7 +292,7 @@ mod tests { 1, 100, 1, - IncludedTypes::from(&[0, 0, 1, 1]), + IncludedTypes::from_bytes(&[0, 0, 1, 1]), ); assert_eq!( diff --git a/hdp/src/primitives/solidity_types/datalake_compute/datalake/transactions_in_block.rs b/hdp/src/primitives/solidity_types/datalake_compute/datalake/transactions_in_block.rs index 81c91781..408ad867 100644 --- a/hdp/src/primitives/solidity_types/datalake_compute/datalake/transactions_in_block.rs +++ b/hdp/src/primitives/solidity_types/datalake_compute/datalake/transactions_in_block.rs @@ -7,7 +7,7 @@ use crate::primitives::{ }, ChainId, }; -use alloy::primitives::keccak256; +use alloy::primitives::{keccak256, U256}; use alloy::{ dyn_abi::{DynSolType, DynSolValue}, primitives::B256, @@ -29,7 +29,8 @@ impl DatalakeCodecs for TransactionsInBlockDatalake { let start_index: DynSolValue = self.start_index.into(); let end_index: DynSolValue = self.end_index.into(); let increment: DynSolValue = self.increment.into(); - let included_types: DynSolValue = self.included_types.to_uint256().into(); + let converted: U256 = self.included_types.into(); + let included_types: DynSolValue = converted.into(); let tuple_value = DynSolValue::Tuple(vec![ datalake_code, @@ -48,13 +49,13 @@ impl DatalakeCodecs for TransactionsInBlockDatalake { } } - /// Get the commitment hash of the [`TransactionsDatalake`] + /// Get the commitment hash of the [`TransactionsInBlockDatalake`] fn commit(&self) -> B256 { let encoded_datalake = self.encode().expect("Encoding failed"); keccak256(encoded_datalake) } - /// Decode the encoded transactions datalake hex string into a [`TransactionsDatalake`] + /// Decode the encoded transactions datalake hex string into a [`TransactionsInBlockDatalake`] fn decode(encoded: &[u8]) -> Result { let abi_type: DynSolType = "(uint256,uint256, uint256, uint256, uint256, uint256, uint256, bytes)".parse()?; @@ -73,7 +74,7 @@ impl DatalakeCodecs for TransactionsInBlockDatalake { let start_index = value[3].as_uint().unwrap().0.to_string().parse::()?; let end_index = value[4].as_uint().unwrap().0.to_string().parse::()?; let increment = value[5].as_uint().unwrap().0.to_string().parse::()?; - let included_types = IncludedTypes::from_uint256(value[6].as_uint().unwrap().0); + let included_types = IncludedTypes::from(value[6].as_uint().unwrap().0); let sampled_property = TransactionsCollection::deserialize(value[7].as_bytes().unwrap())?; Ok(Self { diff --git a/hdp/src/primitives/solidity_types/datalake_compute/mod.rs b/hdp/src/primitives/solidity_types/datalake_compute/mod.rs index 36fd4ae6..bbefe0f2 100644 --- a/hdp/src/primitives/solidity_types/datalake_compute/mod.rs +++ b/hdp/src/primitives/solidity_types/datalake_compute/mod.rs @@ -106,6 +106,8 @@ impl BatchedDatalakeComputeCodecs for BatchedDatalakeCompute { mod tests { use std::str::FromStr; + use alloy::primitives::b256; + use crate::primitives::{ aggregate_fn::FunctionContext, task::datalake::{ @@ -140,8 +142,7 @@ mod tests { assert_eq!( datalake_compute.commit(), - B256::from_str("0x931644ee9576d1a377d4c5ba642a9f96361663f31d867d36169623f782a887fc") - .unwrap() + b256!("931644ee9576d1a377d4c5ba642a9f96361663f31d867d36169623f782a887fc") ) } @@ -170,8 +171,7 @@ mod tests { assert_eq!( datalake_compute.commit(), - B256::from_str("0xa15da24b3eb2bb5260f59a71c3934b64e2747d8e934563ad532e7f877a061bed") - .unwrap() + b256!("a15da24b3eb2bb5260f59a71c3934b64e2747d8e934563ad532e7f877a061bed") ) } } diff --git a/hdp/src/primitives/solidity_types/module.rs b/hdp/src/primitives/solidity_types/module.rs index 570b8ced..0916e8d0 100644 --- a/hdp/src/primitives/solidity_types/module.rs +++ b/hdp/src/primitives/solidity_types/module.rs @@ -34,8 +34,8 @@ impl Module { #[cfg(test)] mod tests { - use starknet_crypto::FieldElement; - use std::str::FromStr; + use alloy::primitives::b256; + use starknet_crypto::Felt; use crate::primitives::task::module::{ModuleInput, Visibility}; @@ -44,7 +44,7 @@ mod tests { #[test] pub fn module_encode() { let module = Module { - program_hash: FieldElement::from_hex_be( + program_hash: Felt::from_hex( "0x00af1333b8346c1ac941efe380f3122a71c1f7cbad19301543712e74f765bfca", ) .unwrap(), @@ -62,15 +62,14 @@ mod tests { let expected_commit = module.commit(); assert_eq!( expected_commit, - B256::from_str("0x879869b6d237b92bfdd3f3f7b76baaa9ebb2a3ad5e8478d12cca258d3def05af") - .unwrap() + b256!("879869b6d237b92bfdd3f3f7b76baaa9ebb2a3ad5e8478d12cca258d3def05af") ); } #[test] pub fn module_encode_with_private_input() { let module = Module { - program_hash: FieldElement::from_hex_be( + program_hash: Felt::from_hex( "0x00af1333b8346c1ac941efe380f3122a71c1f7cbad19301543712e74f765bfca", ) .unwrap(), @@ -88,8 +87,7 @@ mod tests { let expected_commit = module.commit(); assert_eq!( expected_commit, - B256::from_str("0xd81ebd27b719967e1df4edf64c9e3ce87635089e3462306af340a393625d8726") - .unwrap() + b256!("d81ebd27b719967e1df4edf64c9e3ce87635089e3462306af340a393625d8726") ); } } diff --git a/hdp/src/primitives/solidity_types/traits.rs b/hdp/src/primitives/solidity_types/traits.rs index 7aa92f93..176cece3 100644 --- a/hdp/src/primitives/solidity_types/traits.rs +++ b/hdp/src/primitives/solidity_types/traits.rs @@ -22,7 +22,7 @@ pub trait Codecs { Self: Sized; } -/// Codecs for [`DatalakeCompute`] +/// Codecs for datalake task pub trait DatalakeComputeCodecs { fn decode(encoded_datalake: &[u8], encoded_compute: &[u8]) -> Result where @@ -31,7 +31,7 @@ pub trait DatalakeComputeCodecs { fn commit(&self) -> B256; } -/// Codecs for [`BatchedDatalakeCompute`] +/// Codecs for vector of datalake task pub trait BatchedDatalakeComputeCodecs { fn decode(encoded_datalake: &[u8], encoded_compute: &[u8]) -> Result where diff --git a/hdp/src/primitives/task/datalake/block_sampled/collection.rs b/hdp/src/primitives/task/datalake/block_sampled/collection.rs index c342eb68..fe3da9e2 100644 --- a/hdp/src/primitives/task/datalake/block_sampled/collection.rs +++ b/hdp/src/primitives/task/datalake/block_sampled/collection.rs @@ -8,7 +8,7 @@ use crate::primitives::task::datalake::{DatalakeCollection, DatalakeField}; use super::rlp_fields::{AccountField, HeaderField}; -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(try_from = "String")] pub enum BlockSampledCollection { Header(HeaderField), diff --git a/hdp/src/primitives/task/datalake/block_sampled/datalake.rs b/hdp/src/primitives/task/datalake/block_sampled/datalake.rs index 7242e98c..850d249c 100644 --- a/hdp/src/primitives/task/datalake/block_sampled/datalake.rs +++ b/hdp/src/primitives/task/datalake/block_sampled/datalake.rs @@ -5,12 +5,13 @@ use crate::primitives::{task::datalake::envelope::default_increment, ChainId}; use super::collection::BlockSampledCollection; /// [`BlockSampledDatalake`] is a struct that represents a block sampled datalake. -/// It contains the block range, the sampled property, and the increment. +/// It contains chain id, block range, the sampled property, and the increment. /// -/// The block range is inclusive, so the block range is from `block_range_start` to `block_range_end` +/// Inclusive block range: [block_range_start..block_range_end] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct BlockSampledDatalake { + /// Chain id of the datalake pub chain_id: ChainId, /// The start of the block range pub block_range_start: u64, diff --git a/hdp/src/primitives/task/datalake/block_sampled/rlp_fields.rs b/hdp/src/primitives/task/datalake/block_sampled/rlp_fields.rs index 138f6333..36936f86 100644 --- a/hdp/src/primitives/task/datalake/block_sampled/rlp_fields.rs +++ b/hdp/src/primitives/task/datalake/block_sampled/rlp_fields.rs @@ -13,7 +13,7 @@ use crate::{ primitives::task::datalake::DatalakeField, }; -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(try_from = "String")] pub enum HeaderField { ParentHash, @@ -138,9 +138,7 @@ impl DatalakeField for HeaderField { match self { HeaderField::ParentHash => decoded.parent_hash.into(), HeaderField::OmmerHash => decoded.ommers_hash.into(), - HeaderField::Beneficiary => { - U256::from_str_radix(&decoded.beneficiary.to_string(), 16).unwrap() - } + HeaderField::Beneficiary => decoded.beneficiary.into_word().into(), HeaderField::StateRoot => decoded.state_root.into(), HeaderField::TransactionsRoot => decoded.transactions_root.into(), HeaderField::ReceiptsRoot => decoded.receipts_root.into(), @@ -240,7 +238,7 @@ impl Display for HeaderField { // == Account Field == -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(try_from = "String")] pub enum AccountField { Nonce, diff --git a/hdp/src/primitives/task/datalake/datalake_type.rs b/hdp/src/primitives/task/datalake/datalake_type.rs index aa16dfd4..1cd1177e 100644 --- a/hdp/src/primitives/task/datalake/datalake_type.rs +++ b/hdp/src/primitives/task/datalake/datalake_type.rs @@ -2,10 +2,10 @@ use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; use std::str::FromStr; -/// Identifier for a [`BlockSampledDatalake`] type. +/// Identifier for a BlockSampledDatalake pub const BLOCK_SAMPLED_DATALAKE_TYPE_ID: u8 = 0; -/// Identifier for an [`TransactionsDatalake`] type. +/// Identifier for a TransactionsDatalake pub const TRANSACTIONS_IN_BLOCK_DATALAKE_TYPE_ID: u8 = 1; #[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq)] diff --git a/hdp/src/primitives/task/datalake/envelope.rs b/hdp/src/primitives/task/datalake/envelope.rs index e592162f..00dfe2de 100644 --- a/hdp/src/primitives/task/datalake/envelope.rs +++ b/hdp/src/primitives/task/datalake/envelope.rs @@ -18,10 +18,8 @@ pub enum DatalakeEnvelope { impl DatalakeEnvelope { pub fn get_collection_type(&self) -> Box { match self { - DatalakeEnvelope::BlockSampled(datalake) => Box::new(datalake.sampled_property.clone()), - DatalakeEnvelope::TransactionsInBlock(datalake) => { - Box::new(datalake.sampled_property.clone()) - } + DatalakeEnvelope::BlockSampled(datalake) => Box::new(datalake.sampled_property), + DatalakeEnvelope::TransactionsInBlock(datalake) => Box::new(datalake.sampled_property), } } diff --git a/hdp/src/primitives/task/datalake/transactions/collection.rs b/hdp/src/primitives/task/datalake/transactions/collection.rs index a31444bd..5e3310c8 100644 --- a/hdp/src/primitives/task/datalake/transactions/collection.rs +++ b/hdp/src/primitives/task/datalake/transactions/collection.rs @@ -37,7 +37,7 @@ impl FromStr for TransactionsCollectionType { } } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(try_from = "String")] pub enum TransactionsCollection { Transactions(TransactionField), diff --git a/hdp/src/primitives/task/datalake/transactions/datalake.rs b/hdp/src/primitives/task/datalake/transactions/datalake.rs index dee89bd6..b64074df 100644 --- a/hdp/src/primitives/task/datalake/transactions/datalake.rs +++ b/hdp/src/primitives/task/datalake/transactions/datalake.rs @@ -5,6 +5,7 @@ //! Example: `TransactionsInBlockDatalake { target_block: 100, sampled_property: "tx.to", increment: 1 }` //! represents all transactions in block 100 with a `tx.to` property sampled with an increment of 1. +use core::fmt::Display; use std::num::ParseIntError; use std::str::FromStr; @@ -17,22 +18,27 @@ use crate::primitives::{task::datalake::envelope::default_increment, ChainId}; use super::TransactionsCollection; +/// [`TransactionsInBlockDatalake`] is a struct that represents a transactions datalake. +/// It contains chain id, target block, transaction range, sampled property, and other properties. +/// +/// Transaction range: [start_index..end_index] with specified increment #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct TransactionsInBlockDatalake { + /// Chain id of the datalake pub chain_id: ChainId, - // target block number + /// Target block number pub target_block: u64, - // start index of transactions range ( default 0 ) + /// Start index of transactions range (default 0) pub start_index: u64, - // end index of transactions range, not included in the range ( default last ) + /// End index of transactions range, not included in the range (default last) pub end_index: u64, - // increment of transactions, Defaults to 1 if not present. + /// Increment of transactions, Defaults to 1 if not present. #[serde(default = "default_increment")] pub increment: u64, - // filter out the specific type of Txs + /// Filter out the specific type of Txs pub included_types: IncludedTypes, - // ex. "tx.to" , "tx.gas_price" or "tx_receipt.success", "tx_receipt.cumulative_gas_used" + /// Sampled property (e.g., "tx.to", "tx.gas_price", "tx_receipt.success", "tx_receipt.cumulative_gas_used") pub sampled_property: TransactionsCollection, } @@ -66,7 +72,7 @@ impl TransactionsInBlockDatalake { /// 1: EIP-2930 /// 2: EIP-1559 /// 3: EIP-4844 -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub struct IncludedTypes { legacy: bool, eip2930: bool, @@ -75,6 +81,14 @@ pub struct IncludedTypes { } impl IncludedTypes { + /// All transaction types(Legacy, EIP-1559, EIP-2930, EIP-4844) are included + pub const ALL: Self = Self { + legacy: true, + eip1559: true, + eip2930: true, + eip4844: true, + }; + pub fn to_be_bytes(&self) -> [u8; 4] { let mut bytes = [0; 4]; if self.legacy { @@ -114,7 +128,15 @@ impl IncludedTypes { included_types } - pub fn from(included_types: &[u8]) -> Self { + /// Converts a slice of bytes into an [`IncludedTypes`] instance. + /// + /// # Panics + /// + /// This function will panic if: + /// - The input slice is not exactly 4 bytes long. + /// - Any byte in the slice is not 0 or 1. + /// - All bytes in the slice are 0 (i.e., no transaction type is included). + pub fn from_bytes(included_types: &[u8]) -> Self { if included_types.len() != 4 { panic!("Included types must be 4 bytes long"); } @@ -134,19 +156,31 @@ impl IncludedTypes { let inner_bytes = self.to_be_bytes(); inner_bytes[target_type as usize] != 0 } +} + +impl Display for IncludedTypes { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let bytes = self.to_be_bytes(); + write!(f, "{},{},{},{}", bytes[0], bytes[1], bytes[2], bytes[3]) + } +} - pub fn to_uint256(&self) -> U256 { +impl From for U256 { + fn from(value: IncludedTypes) -> U256 { let mut bytes = [0; 32]; - let inner_bytes = self.to_be_bytes(); + let inner_bytes = value.to_be_bytes(); bytes[28..32].copy_from_slice(&inner_bytes); U256::from_be_bytes(bytes) } +} - pub fn from_uint256(value: U256) -> Self { +// Implementation of From for Self +impl From for IncludedTypes { + fn from(value: U256) -> IncludedTypes { let bytes: [u8; 32] = value.to_be_bytes(); let mut inner = [0; 4]; inner.copy_from_slice(&bytes[28..32]); - Self::from_be_bytes(inner) + IncludedTypes::from_be_bytes(inner) } } @@ -163,7 +197,7 @@ impl FromStr for IncludedTypes { panic!("Included types must be 4 bytes long"); } - Ok(IncludedTypes::from(&included_types)) + Ok(IncludedTypes::from_bytes(&included_types)) } } @@ -173,16 +207,16 @@ mod tests { #[test] fn test_included_types() { - let included_types = IncludedTypes::from(&[1, 1, 1, 1]); + let included_types = IncludedTypes::ALL; assert!(included_types.is_included(TxType::Legacy)); assert!(included_types.is_included(TxType::Eip2930)); assert!(included_types.is_included(TxType::Eip1559)); assert!(included_types.is_included(TxType::Eip4844)); - let uint256 = included_types.to_uint256(); + let uint256: U256 = included_types.into(); assert_eq!(uint256, U256::from(0x01010101)); - let included_types = IncludedTypes::from_uint256(uint256); + let included_types = IncludedTypes::from(uint256); assert!(included_types.is_included(TxType::Legacy)); assert!(included_types.is_included(TxType::Eip2930)); assert!(included_types.is_included(TxType::Eip1559)); @@ -191,19 +225,32 @@ mod tests { #[test] fn test_included_types_partial() { - let included_types = IncludedTypes::from(&[1, 0, 1, 0]); + let included_types = IncludedTypes::from_bytes(&[1, 0, 1, 0]); assert!(included_types.is_included(TxType::Legacy)); assert!(!included_types.is_included(TxType::Eip2930)); assert!(included_types.is_included(TxType::Eip1559)); assert!(!included_types.is_included(TxType::Eip4844)); - let uint256 = included_types.to_uint256(); + let uint256: U256 = included_types.into(); assert_eq!(uint256, U256::from(0x01000100)); - let included_types = IncludedTypes::from_uint256(uint256); + let included_types = IncludedTypes::from(uint256); assert!(included_types.is_included(TxType::Legacy)); assert!(!included_types.is_included(TxType::Eip2930)); assert!(included_types.is_included(TxType::Eip1559)); assert!(!included_types.is_included(TxType::Eip4844)); } + + #[test] + fn test_included_types_from_str_to_str() { + let input_str = "1,0,1,0"; + let included_types = IncludedTypes::from_str(input_str).unwrap(); + assert!(included_types.is_included(TxType::Legacy)); + assert!(!included_types.is_included(TxType::Eip2930)); + assert!(included_types.is_included(TxType::Eip1559)); + assert!(!included_types.is_included(TxType::Eip4844)); + + let output_str = included_types.to_string(); + assert_eq!(input_str, output_str); + } } diff --git a/hdp/src/primitives/task/datalake/transactions/mod.rs b/hdp/src/primitives/task/datalake/transactions/mod.rs index 3abcef5b..9fb5a93e 100644 --- a/hdp/src/primitives/task/datalake/transactions/mod.rs +++ b/hdp/src/primitives/task/datalake/transactions/mod.rs @@ -9,15 +9,12 @@ pub use rlp_fields::*; #[cfg(test)] mod tests { - - use std::str::FromStr; - use crate::primitives::{ solidity_types::traits::DatalakeCodecs, task::datalake::DatalakeCollection, ChainId, }; use alloy::{ hex, - primitives::{B256, U256}, + primitives::{b256, U256}, }; use super::*; @@ -33,7 +30,7 @@ mod tests { 1, 10, 2, - IncludedTypes::from(&[1, 1, 1, 1]), + IncludedTypes::ALL, ); let encoded = transaction_datalake.encode().unwrap(); @@ -42,8 +39,7 @@ mod tests { assert_eq!( transaction_datalake.commit(), - B256::from_str("0x0a1ad7357827238fdbea5c8f34df65e7313c18388026fad78a75d4b5a6be71b7") - .unwrap() + b256!("0a1ad7357827238fdbea5c8f34df65e7313c18388026fad78a75d4b5a6be71b7") ); assert_eq!( @@ -51,10 +47,8 @@ mod tests { TransactionsCollection::Transactions(TransactionField::Nonce) ); - assert_eq!( - transaction_datalake.included_types.to_uint256(), - U256::from(0x01010101) - ); + let converted: U256 = transaction_datalake.included_types.into(); + assert_eq!(converted, U256::from(0x01010101)); let decoded = TransactionsInBlockDatalake::decode(&encoded).unwrap(); assert_eq!(decoded, transaction_datalake); @@ -72,7 +66,7 @@ mod tests { 1, 10, 2, - IncludedTypes::from(&[1, 0, 0, 1]), + IncludedTypes::from_bytes(&[1, 0, 0, 1]), ); let encoded = transaction_datalake.encode().unwrap(); @@ -81,8 +75,7 @@ mod tests { assert_eq!( transaction_datalake.commit(), - B256::from_str("0x991d3d38a26f54aed67f8391bab26c855dedd2fd810931542625b6ad4f7c1e42") - .unwrap() + b256!("991d3d38a26f54aed67f8391bab26c855dedd2fd810931542625b6ad4f7c1e42") ); assert_eq!( @@ -90,10 +83,8 @@ mod tests { TransactionsCollection::TranasactionReceipts(TransactionReceiptField::Success) ); - assert_eq!( - transaction_datalake.included_types.to_uint256(), - U256::from(0x01000001) - ); + let converted: U256 = transaction_datalake.included_types.into(); + assert_eq!(converted, U256::from(0x01000001)); let decoded = TransactionsInBlockDatalake::decode(&encoded).unwrap(); assert_eq!(decoded, transaction_datalake); diff --git a/hdp/src/primitives/task/datalake/transactions/rlp_fields.rs b/hdp/src/primitives/task/datalake/transactions/rlp_fields.rs index a36c4b73..fe9dddee 100644 --- a/hdp/src/primitives/task/datalake/transactions/rlp_fields.rs +++ b/hdp/src/primitives/task/datalake/transactions/rlp_fields.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; use crate::primitives::task::datalake::DatalakeField; -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub enum TransactionField { // ===== Transaction fields ===== Nonce, @@ -207,7 +207,7 @@ impl Display for TransactionField { } } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub enum TransactionReceiptField { Success, CumulativeGasUsed, diff --git a/hdp/src/primitives/task/module.rs b/hdp/src/primitives/task/module.rs index e1b014a5..1e96b9ef 100644 --- a/hdp/src/primitives/task/module.rs +++ b/hdp/src/primitives/task/module.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet::core::serde::unsigned_field_element::UfeHex; -use starknet_crypto::FieldElement; +use starknet_types_core::felt::Felt; use std::{path::PathBuf, str::FromStr}; #[serde_as] @@ -14,7 +14,7 @@ use std::{path::PathBuf, str::FromStr}; pub struct Module { /// Note that this program_hash is pure cairo program hash #[serde_as(as = "UfeHex")] - pub program_hash: FieldElement, + pub program_hash: Felt, pub inputs: Vec, pub local_class_path: Option, } @@ -24,14 +24,14 @@ pub struct Module { pub struct ModuleInput { pub visibility: Visibility, #[serde_as(as = "UfeHex")] - pub value: FieldElement, + pub value: Felt, } impl ModuleInput { pub fn new(visibility: Visibility, value: &str) -> Self { Self { visibility, - value: FieldElement::from_hex_be(value).unwrap(), + value: Felt::from_hex(value).expect("invalid hex string value to convert Felt"), } } } @@ -62,9 +62,16 @@ impl FromStr for ModuleInput { } } +impl From for ModuleInput { + fn from(s: String) -> Self { + s.parse() + .unwrap_or_else(|_| ModuleInput::new(Visibility::Private, &s)) + } +} + impl Module { pub fn new( - program_hash: FieldElement, + program_hash: Felt, inputs: Vec, local_class_path: Option, ) -> Self { @@ -75,7 +82,7 @@ impl Module { } } - pub fn get_program_hash(&self) -> FieldElement { + pub fn get_program_hash(&self) -> Felt { self.program_hash } @@ -84,7 +91,7 @@ impl Module { } /// Collect all the public inputs - pub fn get_public_inputs(&self) -> Vec { + pub fn get_public_inputs(&self) -> Vec { self.inputs .iter() .filter(|x| x.visibility == Visibility::Public) @@ -104,7 +111,7 @@ mod tests { assert_eq!( module, ModuleInput { - value: FieldElement::from_hex_be("0x123").unwrap(), + value: Felt::from_hex("0x123").unwrap(), visibility: Visibility::Public } ); @@ -114,7 +121,7 @@ mod tests { assert_eq!( module, ModuleInput { - value: FieldElement::from_hex_be("0x1").unwrap(), + value: Felt::from_hex("0x1").unwrap(), visibility: Visibility::Private } ); diff --git a/hdp/src/primitives/utils.rs b/hdp/src/primitives/utils.rs index 63550493..446cf7f8 100644 --- a/hdp/src/primitives/utils.rs +++ b/hdp/src/primitives/utils.rs @@ -1,7 +1,7 @@ use alloy::primitives::hex::{self}; use alloy::primitives::{FixedBytes, B256, U256}; use anyhow::Result; -use starknet_crypto::FieldElement; +use starknet_crypto::Felt; /// Convert a `FixedBytes<32>` which originally encoded from utf8 string into original utf8 string value pub fn fixed_bytes_str_to_utf8_str(input_bytes: FixedBytes<32>) -> Result { @@ -46,8 +46,8 @@ pub fn tx_index_to_tx_key(tx_index: u64) -> String { format!("0x{}", hex::encode(binding)) } -/// Convert a `FieldElement` into a `FixedBytes<32>` -pub fn felt_to_bytes32(felt: FieldElement) -> FixedBytes<32> { +/// Convert a [`Felt`] into a [`FixedBytes<32>` +pub fn felt_to_bytes32(felt: Felt) -> FixedBytes<32> { let felt_bytes = felt.to_bytes_be(); B256::from(felt_bytes) } @@ -60,7 +60,6 @@ pub fn hex_string_to_uint(hex_string: &str) -> u64 { #[cfg(test)] mod tests { - use std::str::FromStr; use super::*; use alloy::primitives::{hex::FromHex, FixedBytes}; @@ -141,10 +140,9 @@ mod tests { #[test] fn test_felt_to_bytes32() { - let felt = FieldElement::from_str( - "0x034d4ff54bc5c6cfee6719bfaa94ffa374071e8d656b74823681a955e9033dd9", - ) - .unwrap(); + let felt = + Felt::from_hex("0x034d4ff54bc5c6cfee6719bfaa94ffa374071e8d656b74823681a955e9033dd9") + .unwrap(); let bytes32 = felt_to_bytes32(felt); assert_eq!(bytes32, felt.to_bytes_be()); } diff --git a/hdp/src/provider/config.rs b/hdp/src/provider/config.rs index cd2bac0e..e76a1988 100644 --- a/hdp/src/provider/config.rs +++ b/hdp/src/provider/config.rs @@ -5,8 +5,8 @@ use crate::primitives::ChainId; /// EVM provider configuration #[derive(Clone, Debug)] pub struct ProviderConfig { - /// RPC url - pub rpc_url: Url, + /// provider url + pub provider_url: Url, /// Chain id pub chain_id: ChainId, /// Max number of requests to send in parallel @@ -27,7 +27,7 @@ const TEST_RPC_URL: &str = "https://eth-sepolia.g.alchemy.com/v2/xar76cftwEtqTBW impl Default for ProviderConfig { fn default() -> Self { Self { - rpc_url: TEST_RPC_URL.parse().unwrap(), + provider_url: TEST_RPC_URL.parse().unwrap(), chain_id: ChainId::EthereumSepolia, max_requests: TEST_MAX_REQUESTS, } diff --git a/hdp/src/provider/error.rs b/hdp/src/provider/error.rs index c82699fb..d35f84d6 100644 --- a/hdp/src/provider/error.rs +++ b/hdp/src/provider/error.rs @@ -1,9 +1,8 @@ +use alloy::primitives::BlockNumber; use thiserror::Error; use crate::provider::indexer::IndexerError; -use super::evm::rpc::RpcProviderError; - /// Error type for provider #[derive(Error, Debug)] pub enum ProviderError { @@ -19,11 +18,11 @@ pub enum ProviderError { #[error("MMR not found")] MmrNotFound, - /// Error from the [`Indexer`] + /// Error from the [`IndexerError`] #[error("Failed from indexer")] IndexerError(#[from] IndexerError), - /// Error from [`RpcProvider`] + /// Error from [`RpcProviderError`] #[error("Failed to get proofs: {0}")] EvmRpcProviderError(#[from] RpcProviderError), @@ -34,3 +33,22 @@ pub enum ProviderError { #[error("Fetch key error: {0}")] FetchKeyError(String), } + +/// Error from rpc +#[derive(Error, Debug)] +pub enum RpcProviderError { + #[error("Failed to send proofs with mpsc")] + MpscError( + #[from] + tokio::sync::mpsc::error::SendError<( + BlockNumber, + alloy::rpc::types::EIP1186AccountProofResponse, + )>, + ), + + #[error("Failed to fetch proofs: {0}")] + ReqwestError(#[from] reqwest::Error), + + #[error("Failed to parse response: {0}")] + SerdeJsonError(#[from] serde_json::Error), +} diff --git a/hdp/src/provider/evm/datalake/block_sampled.rs b/hdp/src/provider/evm/datalake/block_sampled.rs index 84db7c6f..f3ffee92 100644 --- a/hdp/src/provider/evm/datalake/block_sampled.rs +++ b/hdp/src/provider/evm/datalake/block_sampled.rs @@ -2,7 +2,8 @@ use crate::{ primitives::{ block::account::Account, processed_types::{ - account::ProcessedAccount, header::ProcessedHeader, mpt::ProcessedMPTProof, + account::ProcessedAccount, block_proofs::convert_to_mmr_with_headers, + header::ProcessedHeader, mmr::MMRMeta, mpt::ProcessedMPTProof, storage::ProcessedStorage, }, task::datalake::{ @@ -12,7 +13,7 @@ use crate::{ }, provider::{error::ProviderError, evm::provider::EvmProvider, types::FetchedDatalake}, }; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use alloy::primitives::{Bytes, U256}; use anyhow::Result; @@ -24,14 +25,15 @@ impl EvmProvider { ) -> Result { let mut aggregation_set: Vec = Vec::new(); - let (mmr_metas, headers_proofs) = self + let headers_proofs = self .get_range_of_header_proofs( datalake.block_range_start, datalake.block_range_end, datalake.increment, ) .await?; - let mut headers: HashSet = HashSet::new(); + let mut mmr_with_headers: HashMap> = HashMap::new(); + let mut accounts: HashSet = HashSet::new(); let mut storages: HashSet = HashSet::new(); let block_range = (datalake.block_range_start..=datalake.block_range_end) @@ -40,16 +42,26 @@ impl EvmProvider { match &datalake.sampled_property { BlockSampledCollection::Header(property) => { for block in block_range { - let fetched_block = headers_proofs.get(&block).unwrap(); + let (fetched_block, mmr) = headers_proofs.get(&block).unwrap(); let value = property.decode_field_from_rlp(&Bytes::from( fetched_block.rlp_block_header.clone(), )); - headers.insert(ProcessedHeader::new( + let processed_header = ProcessedHeader::new( fetched_block.rlp_block_header.clone(), fetched_block.element_index, fetched_block.siblings_hashes.clone(), - )); + ); aggregation_set.push(value); + mmr_with_headers + .entry(mmr.clone()) + .and_modify(|existing_headers| { + existing_headers.insert(processed_header.clone()); + }) + .or_insert_with(|| { + let mut new_set = HashSet::new(); + new_set.insert(processed_header); + new_set + }); } } BlockSampledCollection::Account(address, property) => { @@ -65,16 +77,16 @@ impl EvmProvider { let mut account_proofs: Vec = vec![]; for block in block_range { - let fetched_block = headers_proofs.get(&block).unwrap().clone(); + let (fetched_block, mmr) = headers_proofs.get(&block).unwrap().clone(); let account_proof = accounts_and_proofs_result.get(&block).unwrap().clone(); let account = Account::from(&account_proof).rlp_encode(); let value = property.decode_field_from_rlp(&account); - headers.insert(ProcessedHeader::new( + let processed_header = ProcessedHeader::new( fetched_block.rlp_block_header.clone(), fetched_block.element_index, fetched_block.siblings_hashes.clone(), - )); + ); let account_proof = ProcessedMPTProof { block_number: block, @@ -83,6 +95,16 @@ impl EvmProvider { account_proofs.push(account_proof); aggregation_set.push(value); + mmr_with_headers + .entry(mmr.clone()) + .and_modify(|existing_headers| { + existing_headers.insert(processed_header.clone()); + }) + .or_insert_with(|| { + let mut new_set = HashSet::new(); + new_set.insert(processed_header); + new_set + }); } accounts.insert(ProcessedAccount::new(*address, account_proofs)); @@ -102,14 +124,14 @@ impl EvmProvider { let mut account_proofs: Vec = vec![]; for i in block_range { - let fetched_block = headers_proofs.get(&i).unwrap().clone(); + let (fetched_block, mmr) = headers_proofs.get(&i).unwrap().clone(); let storage_proof = storages_and_proofs_result.get(&i).unwrap().clone(); - headers.insert(ProcessedHeader::new( + let processed_header = ProcessedHeader::new( fetched_block.rlp_block_header.clone(), fetched_block.element_index, fetched_block.siblings_hashes.clone(), - )); + ); account_proofs.push(ProcessedMPTProof::new(i, storage_proof.account_proof)); @@ -119,6 +141,16 @@ impl EvmProvider { )); aggregation_set.push(storage_proof.storage_proof[0].value); + mmr_with_headers + .entry(mmr.clone()) + .and_modify(|existing_headers| { + existing_headers.insert(processed_header.clone()); + }) + .or_insert_with(|| { + let mut new_set = HashSet::new(); + new_set.insert(processed_header); + new_set + }); } storages.insert(ProcessedStorage::new(*address, *slot, storage_proofs)); @@ -128,12 +160,11 @@ impl EvmProvider { Ok(FetchedDatalake { values: aggregation_set, - headers, + mmr_with_headers: HashSet::from_iter(convert_to_mmr_with_headers(mmr_with_headers)), accounts, storages, transactions: HashSet::new(), transaction_receipts: HashSet::new(), - mmr_metas, }) } } diff --git a/hdp/src/provider/evm/datalake/transactions.rs b/hdp/src/provider/evm/datalake/transactions.rs index 38002edf..e8eb6340 100644 --- a/hdp/src/provider/evm/datalake/transactions.rs +++ b/hdp/src/provider/evm/datalake/transactions.rs @@ -1,7 +1,8 @@ use crate::{ primitives::{ processed_types::{ - header::ProcessedHeader, receipt::ProcessedReceipt, transaction::ProcessedTransaction, + block_proofs::convert_to_mmr_with_headers, header::ProcessedHeader, mmr::MMRMeta, + receipt::ProcessedReceipt, transaction::ProcessedTransaction, }, task::datalake::{ transactions::{TransactionsCollection, TransactionsInBlockDatalake}, @@ -13,7 +14,7 @@ use crate::{ use alloy::primitives::U256; use anyhow::Result; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; impl EvmProvider { pub async fn fetch_transactions( @@ -22,7 +23,7 @@ impl EvmProvider { ) -> Result { let mut aggregation_set: Vec = Vec::new(); - let (mmr_metas, headers_proofs) = self + let headers_proofs = self .get_range_of_header_proofs( datalake.target_block, datalake.target_block, @@ -30,16 +31,17 @@ impl EvmProvider { ) .await?; - let mut headers: HashSet = HashSet::new(); + let mut mmr_with_headers: HashMap> = HashMap::new(); let mut transactions: HashSet = HashSet::new(); let mut transaction_receipts: HashSet = HashSet::new(); - let fetched_block = headers_proofs.get(&datalake.target_block).unwrap(); + let (fetched_block, mmr) = headers_proofs.get(&datalake.target_block).unwrap(); - headers.insert(ProcessedHeader::new( + let processed_header = ProcessedHeader::new( fetched_block.rlp_block_header.clone(), fetched_block.element_index, fetched_block.siblings_hashes.clone(), - )); + ); + mmr_with_headers.insert(mmr.clone(), [processed_header].into_iter().collect()); match &datalake.sampled_property { TransactionsCollection::Transactions(property) => { @@ -92,12 +94,11 @@ impl EvmProvider { Ok(FetchedDatalake { values: aggregation_set, - headers, + mmr_with_headers: HashSet::from_iter(convert_to_mmr_with_headers(mmr_with_headers)), accounts: HashSet::new(), storages: HashSet::new(), transactions, transaction_receipts, - mmr_metas, }) } } diff --git a/hdp/src/provider/evm/from_keys.rs b/hdp/src/provider/evm/from_keys.rs index 358e562d..7697b065 100644 --- a/hdp/src/provider/evm/from_keys.rs +++ b/hdp/src/provider/evm/from_keys.rs @@ -1,6 +1,8 @@ use super::provider::EvmProvider; use crate::primitives::processed_types::account::ProcessedAccount; -use crate::primitives::processed_types::block_proofs::ProcessedBlockProofs; +use crate::primitives::processed_types::block_proofs::{ + convert_to_mmr_with_headers, ProcessedBlockProofs, +}; use crate::primitives::processed_types::header::ProcessedHeader; use crate::primitives::processed_types::mmr::MMRMeta; use crate::primitives::processed_types::mpt::ProcessedMPTProof; @@ -27,8 +29,9 @@ impl EvmProvider { &self, fetch_keys: CategorizedFetchKeys, ) -> Result { + let chain_id = self.header_provider.chain_id.to_numeric_id(); // fetch proofs using keys and construct result - let (headers, mmr_metas) = self.get_headers_from_keys(fetch_keys.headers).await?; + let mmr_with_headers = self.get_headers_from_keys(fetch_keys.headers).await?; let mut accounts = if fetch_keys.accounts.is_empty() { HashSet::new() } else { @@ -53,8 +56,8 @@ impl EvmProvider { accounts.extend(accounts_from_storage_key); let accounts_result: Vec = accounts.into_iter().collect(); Ok(ProcessedBlockProofs { - mmr_metas, - headers: headers.into_iter().collect(), + chain_id, + mmr_with_headers: convert_to_mmr_with_headers(mmr_with_headers), accounts: accounts_result, storages: storages.into_iter().collect(), transactions, @@ -65,7 +68,7 @@ impl EvmProvider { async fn get_headers_from_keys( &self, keys: HashSet, - ) -> Result<(HashSet, Vec), ProviderError> { + ) -> Result>, ProviderError> { let start_fetch = Instant::now(); let block_range = keys.iter().map(|x| x.block_number).collect::>(); @@ -80,9 +83,8 @@ impl EvmProvider { self._chunk_vec_blocks_for_indexer(block_range) }; - let chain_id = keys.iter().next().unwrap().chain_id; - let mut fetched_headers_proofs: HashSet = HashSet::new(); - let mut mmrs = HashSet::new(); + // let chain_id = keys.iter().next().unwrap().chain_id; + let mut fetched_headers_proofs: HashMap> = HashMap::new(); let real_target_blocks = keys.iter().map(|x| x.block_number).collect::>(); for target_blocks in target_blocks_batch { @@ -94,8 +96,8 @@ impl EvmProvider { .get_headers_proof(start_block, end_block) .await?; - // filter only the keys that are in the real target blocks - let keys_in_real_target_blocks = indexer_response + // filter only the keys that are in the real target blocks and create ProcessedHeaders + let keys_in_real_target_blocks: Vec = indexer_response .headers .into_iter() .filter(|(block_number, _)| real_target_blocks.contains(block_number)) @@ -105,20 +107,24 @@ impl EvmProvider { header_proof.element_index, header_proof.siblings_hashes, ) - }); + }) + .collect(); - fetched_headers_proofs.extend(keys_in_real_target_blocks); let fetched_mmr = indexer_response.mmr_meta; - let mmr_meta = MMRMeta::from_indexer(fetched_mmr, chain_id); - mmrs.insert(mmr_meta); + let mmr_meta = MMRMeta::from_indexer(fetched_mmr); + fetched_headers_proofs + .entry(mmr_meta) + .and_modify(|existing_headers| { + existing_headers.extend(keys_in_real_target_blocks.iter().cloned()); + }) + .or_insert_with(|| keys_in_real_target_blocks.into_iter().collect()); } let duration = start_fetch.elapsed(); info!("time taken (Headers Proofs Fetch): {:?}", duration); - if !mmrs.is_empty() { - let vec_mmrs = mmrs.into_iter().collect::>(); - Ok((fetched_headers_proofs, vec_mmrs)) + if !fetched_headers_proofs.is_empty() { + Ok(fetched_headers_proofs) } else { Err(ProviderError::MmrNotFound) } @@ -367,7 +373,7 @@ mod tests { let (chain_id, fetched_keys) = categorize_fetch_keys(keys).into_iter().next().unwrap(); assert_eq!(chain_id, target_chain_id); let proofs = provider.fetch_proofs_from_keys(fetched_keys).await.unwrap(); - assert_eq!(proofs.headers.len(), 3); + assert_eq!(proofs.mmr_with_headers[0].headers.len(), 3); } #[tokio::test] @@ -393,7 +399,7 @@ mod tests { assert_eq!(chain_id, target_chain_id); let proofs = provider.fetch_proofs_from_keys(fetched_keys).await.unwrap(); assert_eq!(proofs.accounts[0].proofs.len(), 3); - assert_eq!(proofs.headers.len(), 3); + assert_eq!(proofs.mmr_with_headers[0].headers.len(), 3); } #[tokio::test] @@ -447,7 +453,7 @@ mod tests { let proofs = provider.fetch_proofs_from_keys(fetched_keys).await.unwrap(); let duration = start_fetch.elapsed(); println!("Time taken (Total Proofs Fetch): {:?}", duration); - assert_eq!(proofs.headers.len(), 6); + assert_eq!(proofs.mmr_with_headers[0].headers.len(), 6); assert_eq!(proofs.accounts[0].proofs.len(), 6); assert_eq!(proofs.storages[0].proofs.len(), 6); } @@ -465,7 +471,7 @@ mod tests { let (chain_id, fetched_keys) = categorize_fetch_keys(keys).into_iter().next().unwrap(); assert_eq!(chain_id, target_chain_id); let proofs = provider.fetch_proofs_from_keys(fetched_keys).await.unwrap(); - assert_eq!(proofs.headers.len(), 2); + assert_eq!(proofs.mmr_with_headers[0].headers.len(), 2); assert_eq!(proofs.transactions.len(), 3); } } diff --git a/hdp/src/provider/evm/provider.rs b/hdp/src/provider/evm/provider.rs index f636c3e7..e8827ecb 100644 --- a/hdp/src/provider/evm/provider.rs +++ b/hdp/src/provider/evm/provider.rs @@ -19,10 +19,7 @@ use eth_trie_proofs::{ }; use itertools::Itertools; use reqwest::Url; -use std::{ - collections::{HashMap, HashSet}, - time::Instant, -}; +use std::{collections::HashMap, time::Instant}; use tracing::info; use crate::{ @@ -32,13 +29,8 @@ use crate::{ use super::rpc::RpcProvider; -type HeaderProofsResult = Result< - ( - HashSet, - HashMap, - ), - ProviderError, ->; +type HeaderProofsResult = + Result, ProviderError>; type AccountProofsResult = Result, ProviderError>; type StorageProofsResult = Result, ProviderError>; type TxProofsResult = Result, ProviderError>; @@ -70,13 +62,13 @@ impl Default for EvmProvider { impl EvmProvider { pub fn new(config: &ProviderConfig) -> Self { - let rpc_provider = RpcProvider::new(config.rpc_url.clone(), config.max_requests); + let rpc_provider = RpcProvider::new(config.provider_url.clone(), config.max_requests); let header_provider = Indexer::new(config.chain_id); Self { rpc_provider, header_provider, - tx_provider_url: config.rpc_url.clone(), + tx_provider_url: config.provider_url.clone(), } } @@ -97,8 +89,10 @@ impl EvmProvider { let target_blocks_batch: Vec> = self._chunk_block_range(from_block, to_block, increment); - let mut fetched_headers_proofs_with_blocks_map = HashMap::new(); - let mut mmrs = HashSet::new(); + let mut fetched_headers_proofs_with_blocks_map: HashMap< + u64, + (MMRProofFromNewIndexer, MMRMeta), + > = HashMap::new(); for target_blocks in target_blocks_batch { let (start_block, end_block) = @@ -108,20 +102,24 @@ impl EvmProvider { .header_provider .get_headers_proof(start_block, end_block) .await?; - - fetched_headers_proofs_with_blocks_map.extend(indexer_response.headers); let fetched_mmr = indexer_response.mmr_meta; - let mmr_meta = MMRMeta::from_indexer(fetched_mmr, self.header_provider.chain_id); - mmrs.insert(mmr_meta); + let mmr_meta = MMRMeta::from_indexer(fetched_mmr); + + // TODO lets think how not clone the mmr_meta + fetched_headers_proofs_with_blocks_map.extend( + indexer_response + .headers + .into_iter() + .map(|(block_number, header_proof)| { + (block_number, (header_proof, mmr_meta.clone())) + }), + ); } let duration = start_fetch.elapsed(); info!("time taken (Headers Proofs Fetch): {:?}", duration); - if !mmrs.is_empty() { - Ok((mmrs, fetched_headers_proofs_with_blocks_map)) - } else { - Err(ProviderError::MmrNotFound) - } + + Ok(fetched_headers_proofs_with_blocks_map) } /// Fetches the account proofs for the given block range. @@ -462,10 +460,11 @@ mod tests { async fn test_get_2000_range_of_header_proofs() -> Result<(), ProviderError> { let start_time = Instant::now(); let provider = EvmProvider::default(); - let (_meta, header_response) = provider + let header_response = provider .get_range_of_header_proofs(6127485, 6127485 + 2000 - 1, 1) .await?; assert_eq!(header_response.len(), 2000); + // assert_eq!(meta.mmr_id, 26); let duration = start_time.elapsed(); println!("Time taken (Header Fetch): {:?}", duration); diff --git a/hdp/src/provider/evm/rpc.rs b/hdp/src/provider/evm/rpc.rs index 24d33e7e..e315b00f 100644 --- a/hdp/src/provider/evm/rpc.rs +++ b/hdp/src/provider/evm/rpc.rs @@ -15,25 +15,13 @@ use alloy::{ }; use futures::future::join_all; use reqwest::Url; -use thiserror::Error; use tokio::sync::{ mpsc::{self, Sender}, RwLock, }; use tracing::debug; -/// Error from [`RpcProvider`] -#[derive(Error, Debug)] -pub enum RpcProviderError { - #[error("Failed to send proofs with mpsc")] - MpscError( - #[from] - tokio::sync::mpsc::error::SendError<( - BlockNumber, - alloy::rpc::types::EIP1186AccountProofResponse, - )>, - ), -} +use crate::provider::error::RpcProviderError; /// RPC provider for fetching data from Ethereum RPC /// It is a wrapper around the alloy provider, using eth_getProof for fetching account and storage proofs diff --git a/hdp/src/provider/indexer.rs b/hdp/src/provider/indexer.rs index 1929fb57..09519a68 100644 --- a/hdp/src/provider/indexer.rs +++ b/hdp/src/provider/indexer.rs @@ -53,13 +53,14 @@ impl ChainId { /// Indexer client for fetching MMR and headers proof from Herodotus Indexer /// -/// For more information, see: https://rs-indexer.api.herodotus.cloud/swagger +/// For more information, see: /// /// How to use: /// ```rust /// use hdp::provider::indexer::{Indexer, IndexerError}; +/// use hdp::primitives::ChainId; /// -/// async fn call_indexer(chain_id: u64, block_range_start: u64, block_range_end: u64) -> Result<(), IndexerError> { +/// async fn call_indexer(chain_id: ChainId, block_range_start: u64, block_range_end: u64) -> Result<(), IndexerError> { /// let indexer = Indexer::new(chain_id); /// let response = indexer.get_headers_proof(block_range_start, block_range_end).await?; /// Ok(()) diff --git a/hdp/src/provider/starknet/mod.rs b/hdp/src/provider/starknet/mod.rs index a8c241cb..93a521a5 100644 --- a/hdp/src/provider/starknet/mod.rs +++ b/hdp/src/provider/starknet/mod.rs @@ -1 +1,3 @@ -pub struct StarknetProvider {} +pub mod provider; +pub mod rpc; +pub mod types; diff --git a/hdp/src/provider/starknet/provider.rs b/hdp/src/provider/starknet/provider.rs new file mode 100644 index 00000000..d9fbdf45 --- /dev/null +++ b/hdp/src/provider/starknet/provider.rs @@ -0,0 +1,121 @@ +use std::{collections::HashMap, time::Instant}; + +use alloy::primitives::BlockNumber; +use itertools::Itertools; +use starknet_types_core::felt::Felt; +use tracing::info; + +use crate::provider::{config::ProviderConfig, error::ProviderError, indexer::Indexer}; + +use super::{rpc::RpcProvider, types::GetProofOutput}; + +type AccountProofsResult = Result, ProviderError>; +type StorageProofsResult = Result, ProviderError>; + +pub struct StarknetProvider { + /// Account and storage trie provider + pub(crate) rpc_provider: RpcProvider, + /// Header provider + //TODO: indexer is not supported for starknet yet + pub(crate) _header_provider: Indexer, +} + +#[cfg(feature = "test_utils")] +impl Default for StarknetProvider { + fn default() -> Self { + Self::new(&ProviderConfig::default()) + } +} + +impl StarknetProvider { + pub fn new(config: &ProviderConfig) -> Self { + let rpc_provider = RpcProvider::new(config.provider_url.to_owned(), config.max_requests); + let indexer = Indexer::new(config.chain_id); + Self { + rpc_provider, + _header_provider: indexer, + } + } + + /// Fetches the account proofs for the given block range. + /// The account proofs are fetched from the RPC provider. + /// + /// Return: + /// - Account proofs mapped by block number + pub async fn get_range_of_account_proofs( + &self, + from_block: BlockNumber, + to_block: BlockNumber, + increment: u64, + address: Felt, + ) -> AccountProofsResult { + let start_fetch = Instant::now(); + + let target_blocks_batch: Vec> = + self._chunk_block_range(from_block, to_block, increment); + + let mut fetched_accounts_proofs_with_blocks_map = HashMap::new(); + for target_blocks in target_blocks_batch { + fetched_accounts_proofs_with_blocks_map.extend( + self.rpc_provider + .get_account_proofs(target_blocks, address) + .await?, + ); + } + + let duration = start_fetch.elapsed(); + info!("time taken (Account Proofs Fetch): {:?}", duration); + + Ok(fetched_accounts_proofs_with_blocks_map) + } + + /// Fetches the storage proofs for the given block range. + /// The storage proofs are fetched from the RPC provider. + /// + /// Return: + /// - Storage proofs mapped by block number + pub async fn get_range_of_storage_proofs( + &self, + from_block: BlockNumber, + to_block: BlockNumber, + increment: u64, + address: Felt, + storage_slot: Felt, + ) -> StorageProofsResult { + let start_fetch = Instant::now(); + + let target_blocks_batch: Vec> = + self._chunk_block_range(from_block, to_block, increment); + + let mut processed_accounts = HashMap::new(); + for target_blocks in target_blocks_batch { + processed_accounts.extend( + self.rpc_provider + .get_storage_proofs(target_blocks, address, storage_slot) + .await?, + ); + } + + let duration = start_fetch.elapsed(); + info!("time taken (Storage Proofs Fetch): {:?}", duration); + + Ok(processed_accounts) + } + + /// Chunks the block range into smaller ranges of 800 blocks. + /// This is to avoid fetching too many blocks at once from the RPC provider. + /// This is meant to use with data lake definition, which have sequential block numbers + pub(crate) fn _chunk_block_range( + &self, + from_block: BlockNumber, + to_block: BlockNumber, + increment: u64, + ) -> Vec> { + (from_block..=to_block) + .step_by(increment as usize) + .chunks(800) + .into_iter() + .map(|chunk| chunk.collect()) + .collect() + } +} diff --git a/hdp/src/provider/starknet/rpc.rs b/hdp/src/provider/starknet/rpc.rs new file mode 100644 index 00000000..bfa6f75a --- /dev/null +++ b/hdp/src/provider/starknet/rpc.rs @@ -0,0 +1,284 @@ +use alloy::primitives::BlockNumber; +use std::{ + collections::{HashMap, HashSet}, + sync::Arc, + time::Instant, +}; + +use futures::future::join_all; +use reqwest::{Client, Url}; +use serde_json::json; +use starknet_types_core::felt::Felt; +use tokio::sync::{ + mpsc::{self, Sender}, + RwLock, +}; +use tracing::{debug, error}; + +use crate::provider::error::RpcProviderError; + +use super::types::GetProofOutput; + +/// !Note: have to use pathfinder node as we need `pathfinder_getProof` +pub struct RpcProvider { + client: reqwest::Client, + url: Url, + chunk_size: u64, +} + +impl RpcProvider { + pub fn new(rpc_url: Url, chunk_size: u64) -> Self { + Self { + client: Client::new(), + url: rpc_url, + chunk_size, + } + } + + /// Get account with proof in given vector of blocks + pub async fn get_account_proofs( + &self, + blocks: Vec, + address: Felt, + ) -> Result, RpcProviderError> { + self.get_proofs(blocks, address, None).await + } + + /// Get storage with proof in given vector of blocks and slot + pub async fn get_storage_proofs( + &self, + block_range: Vec, + address: Felt, + storage_key: Felt, + ) -> Result, RpcProviderError> { + self.get_proofs(block_range, address, Some(storage_key)) + .await + } + + async fn get_proofs( + &self, + blocks: Vec, + address: Felt, + storage_key: Option, + ) -> Result, RpcProviderError> { + let start_fetch = Instant::now(); + let (rpc_sender, mut rx) = mpsc::channel::<(BlockNumber, GetProofOutput)>(32); + self.spawn_proof_fetcher(rpc_sender, blocks, address, storage_key); + + let mut fetched_proofs = HashMap::new(); + while let Some((block_number, proof)) = rx.recv().await { + fetched_proofs.insert(block_number, proof); + } + let duration = start_fetch.elapsed(); + debug!("time taken (Fetch): {:?}", duration); + + Ok(fetched_proofs) + } + + fn spawn_proof_fetcher( + &self, + rpc_sender: Sender<(BlockNumber, GetProofOutput)>, + blocks: Vec, + address: Felt, + storage_key: Option, + ) { + let chunk_size = self.chunk_size; + let provider_clone = self.client.clone(); + let target_blocks_length = blocks.len(); + let url = self.url.clone(); + + debug!( + "fetching proofs for {}, with chunk size: {}", + address, chunk_size + ); + + tokio::spawn(async move { + let mut try_count = 0; + let blocks_map = Arc::new(RwLock::new(HashSet::::new())); + + while blocks_map.read().await.len() < target_blocks_length { + try_count += 1; + if try_count > 50 { + panic!("❗️❗️❗️ Too many retries, failed to fetch all blocks") + } + let fetched_blocks_clone = blocks_map.read().await.clone(); + + let blocks_to_fetch: Vec = blocks + .iter() + .filter(|block_number| !fetched_blocks_clone.contains(block_number)) + .take(chunk_size as usize) + .cloned() + .collect(); + + let fetch_futures = blocks_to_fetch + .into_iter() + .map(|block_number| { + let fetched_blocks_clone = blocks_map.clone(); + let rpc_sender = rpc_sender.clone(); + let provider_clone = provider_clone.clone(); + let url = url.clone(); + async move { + let proof = pathfinder_get_proof( + &provider_clone, + url, + address, + block_number, + storage_key, + ) + .await; + handle_proof_result( + proof, + block_number, + fetched_blocks_clone, + rpc_sender, + ) + .await; + } + }) + .collect::>(); + + join_all(fetch_futures).await; + } + }); + } +} + +/// Fetches proof (account or storage) for a given block number +async fn pathfinder_get_proof( + provider: &reqwest::Client, + url: Url, + address: Felt, + block_number: BlockNumber, + storage_key: Option, +) -> Result { + let mut keys = Vec::new(); + if let Some(key) = storage_key { + keys.push(key.to_hex_string()); + } + + let request = json!({ + "jsonrpc": "2.0", + "id": "0", + "method": "pathfinder_getProof", + "params": { + "block_id": {"block_number": block_number}, + "contract_address": format!("{}", address.to_hex_string()), + "keys": keys + } + }); + + let response = provider.post(url).json(&request).send().await?; + let response_json = + serde_json::from_str::(&response.text().await?)?["result"].clone(); + println!("response_json: {:?}", response_json); + let get_proof_output: GetProofOutput = serde_json::from_value(response_json)?; + Ok(get_proof_output) +} + +async fn handle_proof_result( + proof: Result, + block_number: BlockNumber, + blocks_map: Arc>>, + rpc_sender: Sender<(BlockNumber, GetProofOutput)>, +) { + match proof { + Ok(proof) => { + blocks_map.write().await.insert(block_number); + rpc_sender.send((block_number, proof)).await.unwrap(); + } + Err(e) => { + error!("❗️❗️❗️ Error fetching proof: {:?}", e); + } + } +} +#[cfg(test)] +mod tests { + use core::str::FromStr; + + use super::*; + use reqwest::Url; + + const PATHFINDER_URL: &str = "https://pathfinder.sepolia.iosis.tech/"; + + fn test_provider() -> RpcProvider { + RpcProvider::new(Url::from_str(PATHFINDER_URL).unwrap(), 100) + } + + #[tokio::test] + async fn test_get_100_range_storage_with_proof() { + let target_block_start = 56400; + let target_block_end = 56500; + let target_block_range = (target_block_start..=target_block_end).collect::>(); + let provider = test_provider(); + let proof = provider + .get_storage_proofs( + target_block_range.clone(), + Felt::from_str( + "0x017E2D0662675DD83B4B58A0A659EAFA131FDD01FA6DABD5002D8815DD2D17A5", + ) + .unwrap(), + Felt::from_str( + "0x004C4FB1AB068F6039D5780C68DD0FA2F8742CCEB3426D19667778CA7F3518A9", + ) + .unwrap(), + ) + .await + .unwrap(); + + assert_eq!(proof.len(), target_block_range.len()); + let output = proof.get(&target_block_start).unwrap(); + + assert_eq!( + output.state_commitment.unwrap(), + Felt::from_str("0x598cf91d9a3a7176d01926e8442b8bd83299168f723cb2d52080e895400d9a1") + .unwrap() + ); + + assert_eq!(output.contract_proof.len(), 17); + + assert_eq!( + output.class_commitment.unwrap(), + Felt::from_str("0x324d06b207f2891ef395ba1e7a0ef92b61a5772a294a289362dc37b0469c453") + .unwrap() + ); + + assert_eq!( + output.contract_data.clone().unwrap().storage_proofs[0].len(), + 5 + ); + } + + #[tokio::test] + async fn test_get_100_range_account_with_proof() { + let target_block_start = 156600; + let target_block_end = 156700; + let target_block_range = (target_block_start..=target_block_end).collect::>(); + let provider = test_provider(); + let proof = provider + .get_account_proofs( + target_block_range.clone(), + Felt::from_str("0x23371b227eaecd8e8920cd429d2cd0f3fee6abaacca08d3ab82a7cdd") + .unwrap(), + ) + .await + .unwrap(); + + assert_eq!(proof.len(), target_block_range.len()); + let output = proof.get(&target_block_start).unwrap(); + println!("Proof: {:?}", output); + assert_eq!( + output.state_commitment.unwrap(), + Felt::from_str("0x26da0f5f0849cf69b4872ef5dced3ec68ce28c5e3f53207280113abb7feb158") + .unwrap() + ); + assert_eq!(output.contract_proof.len(), 23); + + assert_eq!( + output.class_commitment.unwrap(), + Felt::from_str("0x46c1a0374b8ccf8d928e62ef40974304732c8a28f10b2c494adfabfcff0fa0a") + .unwrap() + ); + + assert!(output.contract_data.is_none()); + } +} diff --git a/hdp/src/provider/starknet/types.rs b/hdp/src/provider/starknet/types.rs new file mode 100644 index 00000000..a827823b --- /dev/null +++ b/hdp/src/provider/starknet/types.rs @@ -0,0 +1,82 @@ +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +use starknet_types_core::{felt::Felt, hash::StarkHash}; + +/// Codebase is from + +/// Holds the membership/non-membership of a contract and its associated +/// contract contract if the contract exists. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[skip_serializing_none] +pub struct GetProofOutput { + /// The global state commitment for Starknet 0.11.0 blocks onwards, if + /// absent the hash of the first node in the + /// [contract_proof](GetProofOutput#contract_proof) is the global state + /// commitment. + pub state_commitment: Option, + /// Required to verify that the hash of the class commitment and the root of + /// the [contract_proof](GetProofOutput::contract_proof) matches the + /// [state_commitment](Self#state_commitment). Present only for Starknet + /// blocks 0.11.0 onwards. + pub class_commitment: Option, + + /// Membership / Non-membership proof for the queried contract + pub contract_proof: Vec, + + /// Additional contract data if it exists. + pub contract_data: Option, +} + +/// A node in a Starknet patricia-merkle trie. +/// +/// See pathfinders merkle-tree crate for more information. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum TrieNode { + #[serde(rename = "binary")] + Binary { left: Felt, right: Felt }, + #[serde(rename = "edge")] + Edge { child: Felt, path: Path }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct Path { + len: u64, + value: String, +} + +impl TrieNode { + pub fn hash(&self) -> Felt { + match self { + TrieNode::Binary { left, right } => H::hash(left, right), + TrieNode::Edge { child, path } => { + let bytes: [u8; 32] = path.value.as_bytes().try_into().unwrap(); + let mut length = [0; 32]; + // Safe as len() is guaranteed to be <= 251 + length[31] = bytes.len() as u8; + + let length = Felt::from_bytes_be(&length); + let path = Felt::from_bytes_be(&bytes); + H::hash(child, &path) + length + } + } + } +} + +/// Holds the data and proofs for a specific contract. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ContractData { + /// Required to verify the contract state hash to contract root calculation. + class_hash: Felt, + /// Required to verify the contract state hash to contract root calculation. + nonce: Felt, + + /// Root of the Contract state tree + root: Felt, + + /// This is currently just a constant = 0, however it might change in the + /// future. + contract_state_hash_version: Felt, + + /// The proofs associated with the queried storage values + pub storage_proofs: Vec>, +} diff --git a/hdp/src/provider/types.rs b/hdp/src/provider/types.rs index 6c610e9d..836a4a66 100644 --- a/hdp/src/provider/types.rs +++ b/hdp/src/provider/types.rs @@ -5,9 +5,10 @@ use std::collections::HashSet; +use crate::primitives::processed_types::block_proofs::MMRWithHeader; use crate::primitives::processed_types::{ - account::ProcessedAccount, header::ProcessedHeader, mmr::MMRMeta, receipt::ProcessedReceipt, - storage::ProcessedStorage, transaction::ProcessedTransaction, + account::ProcessedAccount, receipt::ProcessedReceipt, storage::ProcessedStorage, + transaction::ProcessedTransaction, }; use alloy::primitives::U256; @@ -73,8 +74,8 @@ impl FetchedTransactionReceiptProof { pub struct FetchedDatalake { /// Targeted datalake's compiled results pub values: Vec, - /// Headers related to the datalake - pub headers: HashSet, + /// mmr_with_headers related to the datalake + pub mmr_with_headers: HashSet, /// Accounts related to the datalake pub accounts: HashSet, /// Storages related to the datalake @@ -83,6 +84,4 @@ pub struct FetchedDatalake { pub transactions: HashSet, /// Transaction receipts related to the datalake pub transaction_receipts: HashSet, - /// MMR meta data related to the headers - pub mmr_metas: HashSet, } diff --git a/input.json b/input.json new file mode 100644 index 00000000..d2908917 --- /dev/null +++ b/input.json @@ -0,0 +1,121 @@ +{ + "cairo_run_output_path": "cairo_run_output.json", + "tasks_root": "0x914cb49c66560929b7c2d89cb61a01af234eb6317bd8fcfa3215979cd8479484", + "results_root": "0x6b2b1f8a44a9a263aaab7dc8456d03ec2365c535f6e34d249992dcf10c2c9009", + "proofs": [ + { + "chain_id": 11155111, + "mmr_with_headers": [ + { + "mmr_meta": { + "id": 27, + "root": "0x492627ffa5084ec078f4d461408dfaa50b504a022c5471452d598da0040c066", + "size": 13024091, + "peaks": [ + "0x262c4c9b1cb2a036924aecf563dc9952e5f8b41004310adde86f22abb793eb1", + "0x10b39aed56c8f244a1df559c944ada6f12b7238f8c06a2c243ba4276b8059b0", + "0x46f45f218ea3aec481f350cda528a6f9f926a2dd53dae302e2cb610e5f152c7", + "0x1d52a06e6d02569893a1d842c00bb67c044be541c614e88613d7fc7187e18c1", + "0x770ebf618a589c17e3dc05bda7121acbedc0b48cd25f2943dc43f395f8bf0db", + "0x7263e878f7deafdc49b47da57f8594d477e572d3ac2bec27bb73860a35b1899", + "0x7b9e99f008949f9ee33d2965708ac6773a57965514df6383d55de104a39ab8c", + "0x28f6ccdcd38f6be6c437d100fcd62604c3293e31342a777dc37c712869ab08c", + "0x13d87197fe5d6f646a57dc918dcbef210737020dca9b89537fd8718ac69da3e", + "0x7eef4b790b56858c0232b494034d4c8699112d88f358209f71f02d5e93a7084", + "0x25cd2f0b579c902c41ac26df96ed5b21e16a3127dce2b471973dc86eb4c099f", + "0x5fdedfd0123b7461d5b3162fe82f7f3172c42fda6209415367870086f7c7918", + "0x7c0a415d5a6c4c90fd2dde1b340c3be305a72aa3b758dd26b8d7b4a78b53681" + ] + }, + "headers": [ + { + "rlp": "f90264a0d0dbb039df7728af964ecc414930adaf57c762df78e7818c5e29bdaf98bc30a6a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000006916a87b82333f4245046623b23794c65ca0fe5710ac36eae31f8fd741ec4646295805efde7d5af87f75b6c9f3b478264c03a02351a6bd671aa027fb78d3bfb0e154fe86a39b64050eb9260fae4ae4e9f39488a04432f18e1b2ff54ce5296d462ae0586a71641906412c7e600780953edd1e8c48b901008804404e86016c08119966222d18870c08157b050006544441c05a76c6e28418045100622128069e4936248c041c089a1001130e2a26990416997904927c6491d162d2c30c2f0b08421e806a2438c885562f2b033806657b78228a48802072a3ab2400c2a6212152054c0675708adb824c8800c6511a76e40268a87d00300b64aa46c9949b614428ec20b4d7572247b012914ea7682c14fc030bbcb825c4e881620a04b7ea04ce56480682102200452c00d826a7a04a8d5a49a10036170b4096e12ed52304215a1090210d95ac1654140f600315a14a500e32059106d86162a112123280c0b0200a82062042a0842317040880f06b742256602012b3197d502c808356152c8401c9c38084013ca856846611559099d883010d0d846765746888676f312e32322e30856c696e7578a0a03574c090365f7581fd16fd2144c0de59d64c03bcbfc761ad3cb0e8c567cb438800000000000000008308e316a0c6d2ec3bda594dc497c3092ca167e4449c1b6747a076c8849bcd351add59e68e830600008405240000a07625dff7a19154e26778df000ae2e3de826d28a60f749e453e3ded6e367eeed4", + "proof": { + "leaf_idx": 610913, + "mmr_path": [ + "0x67bb6da1531c91c2b51b54b9bcb0fe93321ceecadacd47cdc45805138aa0c0f", + "0x18415c3a306222178570cab74cd5e8db1a935dfb86e839202392a1c7dee60c9", + "0x6c5135cd9037d88377e346ca8882e6876bc7b5945fa931e16f5eb3946ead75c", + "0x7d7300fdfc4c65dc059dae89bdfd6e731b5fc062180f15b45febd1255854b36", + "0x252be25930f8949bb4fd8b43e0266ed3a28b41a6c0d3e81867ee0c89ee4ac7d", + "0x52010174d874a9c7eba65a4ea897880ddd088d31293707a39602cd2d3f706f4", + "0x7eb952b3bd5405896ee1deb4949358d7552e79048fc10d53aba5ee648bd56f7", + "0x0f5476cde3c3e21ed03cc5d11b18b30fa7d2c7559bb0fb2ccdb83221eaee608", + "0x1d7cf65ee48d755009128bb883ea61807f7575452cd4dcf4082711518dac515", + "0x6f92dd6c8b9be832f6aef1211e932d8171c813c97d005383e5b82135721d5b7", + "0x42784e988bfd6911b429213d5b33ea9bdc345ac7659dc77f7e0d034b22237ce", + "0x24fc37f1e0a37d80b67d170b4e3448a0acee5ce2aa7fc43f694946173974854", + "0x4878d7b06f8232c5967ec8e922391b3f35c673a30242d3713f64dc47fe7e938", + "0x31fa2b3c9cd30abaea46699f13d0aaf206e757cfc8ac4bd1712df615a6a4d3b", + "0x5fabc7c3150eab1aab7351dcd43da933b60d054f7cbcf53695793e9ffe72c6e", + "0x742a60a5320bd43a962089f6e070f4a34ef848a2b7ae6fab2508942de5e3d8f", + "0x0b9dbeee6951197b79802d726e108d2e456ac0ccb7100ebe4c11a8e1dedc738", + "0x611e7980af5de71d4221bf6f49c40e9decdcc6ca953f06d23479202cc83b1c6", + "0x773c94cdebd60f0647c690c7379e603dacb0dc712ad8551c0445cef9f1811cd", + "0x59bbae3d1cfd74546dfe68c264341cee9f95c3b3b61eeacead3bd4cb3ae232a", + "0x546455f57f4ee848d3952148e3b94700f387ee2c36730bfeda09379ce8fa509", + "0x08808a106dc9e09c29afd24be7cee31edd9f0d27ce0a3469839ef3d09ddfb43" + ] + } + } + ] + } + ], + "accounts": [ + { + "address": "0x75cec1db9dceb703200eaa6595f66885c962b920", + "account_key": "0x962f445fc8476432660877b666f653759ea69189b60d2f4a7008e70555746ad1", + "proofs": [ + { + "block_number": 5641516, + "proof": [ + "0xf90211a0dcbd475dd9c177f568ddcdc319c6397b522f9f0477f02c6f5d40f9a676d72817a00bd4f5aa23dff4b6bc82a30b7f06e299a4190e5dc145de56ebccf7b392187a09a0d61af80cd5cb39dc63864ca43eece1e0c75f3921a897e76d9749aebc53c3df8aa0864c73b1fcb6c20c7a3dc987b995a197d3970a60776b69fe86d2e8e47ea94c34a07a968065710e1a0487b9ba027fe8b4e75c48f808fa4df0e8b2e790d68af1c7a1a0415df25f69223af7620a8ae632dd96f0a266de38c7669450ccc1266e6d9f28e1a0169b43699e8685d580bf8544569306755efd3faf8ee9c573d8fc3b765716dff2a04fbb7e84242d6ebc993d1722bd4da3c8f7933c2197dc7e004029d5ecac5472dea00598724879d324152dba334b881e3ec51ab434b0f5160e501f27e41eb081a9faa0b80e76258879b1cc1553ca8fecaa7156a4bbeeae3a46e48af60f16c78b08dcc4a0cc4d6c7a08755dc1a1deeed0705ab80e722b5c26f49484052021c9afcc9f0c8da0e16df8444c1c2b049779688485f147f62074c3f74b3af089c4eda8dd71e45b77a0f3963f892598d2d4c58dc1b26ecc22670f9d6456e36682e63c10f28a6d17c19ea08e0108cf433e3125ac5e6a175171a410f4f16f3fec51752a27b6f0d32d00027fa06142d171f73708046ddc01d7a1303d875ade53e4b354a314ef031bfb2d35374ca093fb99dbe11b40160a862e9c654f6374f6e5c9e24685488a262df35175c83a8780", + "0xf90211a085874b8d020224e2ef3bd88570ab5c06d45decde1754f26c8d4d8008e0ccd113a003db289fe33b3b8d8c26b21562e42c050d680960ec99ef5bb315c1d636fa46eca013df832fe4094fa9df8f7a13beb8babb9874ec04c11cf0d170ad2b55869314e4a027760fd8d42862a7c2709031af97c6b34b7ad73af02bf7e0e8573da746e5d672a0e5e42a2564de948a79a3584e601c523f2a8d2f63fab6285d58a76ada5b7a94caa0b280c353d94aa1b0a94da9a2c27766cfe15dbf0299aaa0647e24dabd80e42f81a0ed48ca0484a3345f1e84d2f8a7a0d1e8549ff231ff6bffd9a46d6c0d0ab3683ca0635a725706435ff7c28ac67e918a077147acc3a8272989e2f565c00cfe49900aa09813dfd235a1906b75234a4ea7c0a2537bdc6297ece7628f10b92df4f38fccf0a09a1fec84542b2b2ea02e9f664a30b970043ff2ce93db423bc8e671db2acc5942a0e6459861abcab3d672bacfbcd0038cbaf48c2db6ff6168ebc5f32a024ae9414ea0e5da62361bea1124afcfc1908b58ba4171a2ecb9041500df3564eadfae0865c0a01d0ec6d9747a31adac893f02d7dd9e4d4de50423a758a5d0e9005d3c5a4f4e5aa04fbeca911091ce452276d951fa5d75d202c3c39bd8cad76100d40cc192382e4aa0ed06eb4338923d982930fd9ef71f51124e281f3db032094bee2e171ea5c95c69a02574cb976bb8877c1d22451852f470c0561a30ccb0a9f0b4de060d943f25a77a80", + "0xf90211a0084de79b5e883c52b17995d2e0acc42672f5c655d6af15eefa49383cfeff7f4fa0445910a988ca4f62953b07a03032d4018c686160c48bbcd8b4a90dd69fbde0cda05577225cb64372d7e288773beab518921e402946977279f6ea43f0cc01b134cba0280baa1097cec29878b9f6e3ddd7b6e941d66aa1ae68188e377530f2816a87c2a0c4ff1b28e2f879ec95e217d623e1e7e9a862540306b1702e1b90df84e72c8af9a0c82365017d560783befa31d24472e2239ee9f07c2c96e531e3b71d29834dd87ba08c6c2ce740933f17d0e50730c4a90ce1c44127c0c95fa2668a8177a4cb636130a03c39ea857e88d2038809d04bdd720599f88d713a0749e6fc4aae0c868e4db3a0a028249731b03a575f0676c649411a88cf93684e2990fa3ba3f922df5937fd0239a0d730b73f1924349103f07d7675f031799894108625ad258ab906359f1b45f071a0c9272cb00358e0272f80667ae90348ec7a655df30692e5410ff3cdfdd0c74f04a015b2a43f4ec90d5870821683cf4a2cdc935e6061cc6465ae459682715f9fdea9a09bd6271ddf98dbb976d85e8fdf0c8fef73377a4cb0e312f7a6e17227d0614040a0c772ab406ca4b22d2d25d9fc2e8969b02d1699cafdcacf8a1a44ddb0505019e8a061683a17e7cb9118d7d9083260df11b5d2b4a05986c5b0423a4940bf58c6c2bfa0368010c59a191f3867c91195be126b12cd3a264ae66b3ff235b827c42bc5a37f80", + "0xf90211a030d16cf8968685e1fe09ecb3512a4693214b06516219522769f5a3bd61b37be0a023ef708630714cf8f1e3f3976be52a5466e4a98499a53ff82601b58ec5757063a0ac9c8d3c1e7a5161fef97bea92515a17ac26e44fd2378921482c106756a800ada0db27b9f7fc9979b2668c32c5c0248198417a4149310f872cd056b4872e59318ca042457bb6d51d099607184742c05e63595f2560f1e19074e2d85057c30a5eef90a09cce0b54c3a682f7fb3f8cff6c8f3ec26db4dc374ef5fd2e264dd1a65e18d75da009cf5dceddf7fdb5e1b9bbd2f98403e7383039d7e3bc1647a92e8d9da54670aca0b876e4ec048c5a62c713da59da80a5b0c5fcb1c2fb42fc27a50ba29f2c44d0bca0660498eab6d6f8af7f5c787083dbcff9c11a680ad7b95c5911ba3eac220fb85da0ce4da32c4c975b5a8c9525457de86141de21c5a10c87f50ac8e7f789f0f7610ba0c6c553a41dc8e0efb4b2861c5629badf4024e783f3e86c64027dacd8a6b81939a0754ff70bc9d39995034b21918c09e82622e1d5454e23f1d536c9da249e251c49a0f70fdd04323bbe0c3b54e8d1bf1cd3486f07806592e3fb709e0d09b3b6215a60a07a15f0c9006c2c39c0104e3bbc6638b46ec97cb247273b305a6cb4e1571406f4a0f245157f960b827c6e16e1cb0a8dc0ec52c308317d5745bbd526ab1132eb7675a09a6fb7cc3bcabe9d69b07b9d642e14fa28e5b0880c0a93687bdebe1e9adbc65a80", + "0xf90211a0bab0d0089f9b71981ee144eab1eb87260863d7c0e8860fc50baa123cd57e1076a0b32055007377e4ebece59e67dd1bdef2fab8090fe602e426a17b989b24cee030a097213247b21d1775d0e0a9fceb5cd8bf089b565e0b12aeb87c4cf5ea3b9ef647a0fb10491ba8d4b7f3ab3aef2d239e47d05f905989ba886914de453260cca87a25a0fed0c810a8f3bb9060ceaa1e0e3b60bd2cac8aa3925f257821ffd1a6c045d019a02d579a264ff31036f717769ed3f6ee42710abba3ef9c6208fff18e906f941baaa086f017b4aa106b297a4c2ff4d7d2df9b59ab2ec7542b954df44948b3a85e710aa06d8d9c4bea4ba3b6b10dddc3394b4862067b96fc6dfd17828813a5d7472ee55da03b3bcad80eebdb117e2959dedb15f20cbae17bd7c8a2efbd7faba34bc1e0d142a076f365c75ad50cdf2a3576be0650168face12d535126685fece5d2940587d82ba028d9e77aa5602c1751028395ebed9c7f23febd2336acbe30c18b7d30b9449746a0dc0ab69dba2c48c9e72774ecab8bc336cf24ae1114545620ebd497d873d29ab9a0a34fa0b0b9ed3180b42db497dd324bfbd11f76e019a5404b82f94262572c199da01c8267bd384ec055d22e28973cb5e1a6602ad4eb1c6bb2e6012cd3239710fc16a04dbfb0a097f406c15ab7947441fb164796a12932b4d88676fd1b2cd7b1d95bc2a0fa35a1f36a579056bed3cf33830d34938d92199a27b487c3cd6c7206234a0f4480", + "0xf901d1a06d6223af2401971b5d3667a3a58a872ea759e76582fb375e4f2de0e420df275ea0f158252d20b99f3aa36e5b97c87644eaabc50f582e769ea41cf18f7ae3602227a0a4faeacc33284fdd0eafce32e0776543e3ac349de68dfcb7abcc40b0ae82df5fa0245f6fda91c1d0dd6036c8799a9338cbf85cbbca8a3a45f35a27bb076d10cb65a080d306d21c5efccfa655b98f48b2811000fe6f60a9aebd8fdcbde7589c748e96a077499f3ba879737a73d6628cbe5d5b8ad598430031ca879cdcb3a2509d3f7d5fa0c91ebaef1a0e560845ba673efd813a313e8b9e870524adc4aa4cb6ce4eb47358a078db9a4d7a85f223a7e7b0b4e22c8f0b0c1e976d6197f0ab565b16d7d2143852a02aaaa42933c19eec648bef646eda705a1e84cffbe4ecd62a31862aee16e05241a06e516cdf1f81d33ffae52ca5bf785219501710b5302738b2c405127406ef3c94a0c8ed1799c413fefe7f902fd41911193db6378456ac10eb218c8f7a137b7b50b4a0e412c32035edec4058b02f8137c18a403f5d0274e1ca1f0beff3257f61788af8a0be49c166207007fd651f379fdd6a16bea5854e57e6fcf0109551e5d7f28f883680a017f79411b196fbea4295e681196191c969174d02a467bfd6699ef4c3c6d4fb2a8080", + "0xf8518080808080a01922ad14def89076bde0011d514a50cae7632d617136bb83c1b2fcbed3383c7380808080808080a0e81a4320e846af94db949f1a5298f425864e8eecbe8b72342b0aea33c0ea6e3c808080", + "0xf86c9d3fc8476432660877b666f653759ea69189b60d2f4a7008e70555746ad1b84cf84a018612309ce54000a069bbf0407f9d5438512c6218768a9581f377fa5dc119ea1409b917b75c242e1ca0eab3448e22d0f75e09ed849b2e87ac6739db4104db4eaeeffcc66cfa819755fd" + ] + } + ] + } + ], + "storages": [ + { + "address": "0x75cec1db9dceb703200eaa6595f66885c962b920", + "slot": "0x0000000000000000000000000000000000000000000000000000000000000001", + "storage_key": "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6", + "proofs": [ + { + "block_number": 5641516, + "proof": [ + "0xf8918080a0b7a7c859e6ddbad6c18adb60b9f48842e652021b4f8b875894b8b879568629f880a0e7f9c6d331c7d110c992550a7baa3e051adc1e26a53d928dbd517a313d221863808080808080a0e40cf9c20b1e8e4aaf3201dd3cb84ab06d2bac34e8dc3e918626e5c44c4f0707808080a0c01a2f302bfc71151daac60eeb4c1b73470845d4fe219e71644752abaafb02ab80", + "0xe9a0310e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6878612309ce54000" + ] + } + ] + } + ], + "transactions": [], + "transaction_receipts": [] + } + ], + "tasks": [ + { + "type": "datalake_compute", + "context": { + "encoded_task": "0xa53ae67b29c59c71fea2ff536bf46d09c07f40f2d9fe4365aba6342bb222c5a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "task_commitment": "0xa9420109bac8cb6b5e8e1e92120dc4d15abc6915024ed2e8d8e0c427d91e1e91", + "compiled_result": "0x12309ce54000", + "result_commitment": "0xfe22879bf0cec62207a65426fd87f413f75880825b5bdc3e57cb343e9ca42c99", + "task_proof": [], + "result_proof": [], + "encoded_datalake": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000000000000000000000000000000000000056152c000000000000000000000000000000000000000000000000000000000056152c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000350375cec1db9dceb703200eaa6595f66885c962b92000000000000000000000000000000000000000000000000000000000000000010000000000000000000000", + "datalake_type": 0, + "property_type": 3 + } + } + ] +} \ No newline at end of file diff --git a/justfile b/justfile new file mode 100644 index 00000000..c1730a61 --- /dev/null +++ b/justfile @@ -0,0 +1,26 @@ +# Set environment variable +export CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE := "true" + +# Run rustfmt to check the code formatting without making changes +format: + cargo fmt -- --check + +# Clean up the project by removing the target directory +clean: + cargo clean + +# Run clippy to catch common mistakes and improve your Rust code +clippy: + cargo clippy --all-targets --all-features -- -Dwarnings + +# Generate documentation for the project +docs: + cargo doc --no-deps + +# Execute all unit tests in the workspace +test: + cargo llvm-cov nextest --features test_utils + +# Run the entire CI pipeline including format, clippy, docs, and test checks +run-ci-flow: format clippy docs test + @echo "CI flow completed" diff --git a/request.json b/request.json index fff3447e..f15f46a8 100644 --- a/request.json +++ b/request.json @@ -1,18 +1,27 @@ { + "id": "bq_01J8F5S491GZKFPJ3GP0FR1V10", + "clientId": "01J178YH1TZG8HB88H9BHD7X1H", + "taskHashes": [ + "0xc99705277aa57d3284fdc76c135a76d9c3289bb3ea5a411526af719f7baba6cc" + ], + "complexity": 12771, "destinationChainId": "ETHEREUM_SEPOLIA", "tasks": [ { + "id": "0xc99705277aa57d3284fdc76c135a76d9c3289bb3ea5a411526af719f7baba6cc", + "datalakeId": "0xdad5db5401deec72457d0e88ac68089ae075ad57e3e41d1328850fe4ac5d2c1c", + "complexity": 12771, "type": "DatalakeCompute", "datalake": { "type": "BlockSampled", "chainId": "ETHEREUM_SEPOLIA", - "blockRangeStart": 6375109, - "blockRangeEnd": 6375109, + "blockRangeStart": 5641516, + "blockRangeEnd": 5641516, "increment": 1, - "sampledProperty": "storage.0xaFE8A72C86d5895DD6616daB26d4b736Cf22472f.0x0000000000000000000000000000000000000000000000000000000000000010" + "sampledProperty": "storage.0x75cec1db9dceb703200eaa6595f66885c962b920.0x0000000000000000000000000000000000000000000000000000000000000001" }, "compute": { - "aggregateFnId": "avg" + "aggregateFnId": "sum" } } ]