diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e3bcd5e..b05c128 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,7 +4,7 @@ the requirements below. Bug fixes and new features should include tests. -Contributors guide: https://github.com/paradigmxyz/flood/blob/master/CONTRIBUTING.md +Contributors guide: https://github.com/paradigmxyz/cryo/blob/master/CONTRIBUTING.md The contributors guide includes instructions for running ruff and building the documentation. diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e524aee..df716ab 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -2,63 +2,53 @@ name: Rust on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] env: CARGO_TERM_COLOR: always +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: build: - runs-on: ubuntu-latest - + timeout-minutes: 30 steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - lint: - name: code lint - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@nightly - with: - components: rustfmt, clippy + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true + - name: Build + run: cargo build --workspace + - name: Run tests + run: cargo test --workspace - - name: cargo clippy - uses: actions-rs/clippy-check@v1 + clippy: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: - args: --all --all-features - token: ${{ secrets.GITHUB_TOKEN }} + components: clippy + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: cargo clippy --workspace --all-targets --all-features + env: + RUSTFLAGS: -Dwarnings fmt: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install toolchain - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly - profile: minimal - components: rustfmt, clippy - override: true - - - uses: Swatinem/rust-cache@v1 - with: - cache-on-failure: true - - - name: cargo fmt - run: cargo +nightly fmt --all -- --check - + components: rustfmt + - run: cargo fmt --all --check diff --git a/.github/workflows/python_release.yml b/.github/workflows/python_release.yml new file mode 100644 index 0000000..04c8cee --- /dev/null +++ b/.github/workflows/python_release.yml @@ -0,0 +1,147 @@ +# This file is autogenerated by maturin v1.4.0 +# To update, run +# +# maturin generate-ci github +# +name: python-release + +on: + workflow_dispatch: + inputs: + sha: + description: "The full sha of the commit to be released. If omitted, the latest commit on the default branch will be used." + default: "" + type: string + release: + description: 'Set to true to run the release on pypi, dry run otherwise' + required: true + default: 'false' + pull_request: + paths: + - .github/workflows/python_release.yaml + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + target: [x86_64] + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --interpreter python${{ matrix.python-version }} --manifest-path crates/python/Cargo.toml + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + windows: + runs-on: windows-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + target: [x64] + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --interpreter python${{ matrix.python-version }} --manifest-path crates/python/Cargo.toml + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + macos: + runs-on: macos-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --interpreter python${{ matrix.python-version }} --manifest-path crates/python/Cargo.toml + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist --manifest-path crates/python/Cargo.toml + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: "github.event.inputs.release == 'true'" + needs: + - linux + - windows + - macos + - sdist + environment: + name: pypi + url: https://pypi.org/p/cryo-python + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + packages-dir: ./ + diff --git a/.gitignore b/.gitignore index 72e2430..f20260e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ target *.parquet_tmp *.json *.json_tmp +*.env *._tmp TODO.md graveyard diff --git a/Cargo.lock b/Cargo.lock index 9bab55f..c48c4cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,48 +1,27 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] +version = 4 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" 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" - -[[package]] -name = "aes" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -53,9 +32,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -77,9 +56,615 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" + +[[package]] +name = "alloy" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b524b8c28a7145d1fe4950f84360b5de3e307601679ff0558ddc20ea229399" +dependencies = [ + "alloy-consensus", + "alloy-contract", + "alloy-core", + "alloy-eips", + "alloy-genesis", + "alloy-network", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-serde", + "alloy-signer", + "alloy-signer-local", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", +] + +[[package]] +name = "alloy-chains" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18c5c520273946ecf715c0010b4e3503d7eba9893cd9ce6b7fff5654c4a3c470" +dependencies = [ + "alloy-primitives", + "num_enum", + "strum", +] + +[[package]] +name = "alloy-consensus" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae09ffd7c29062431dd86061deefe4e3c6f07fa0d674930095f8dcedb0baf02c" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "auto_impl", + "c-kzg", + "derive_more", + "k256", + "serde", +] + +[[package]] +name = "alloy-contract" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66430a72d5bf5edead101c8c2f0a24bada5ec9f3cf9909b3e08b6d6899b4803e" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-network", + "alloy-network-primitives", + "alloy-primitives", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-types-eth", + "alloy-sol-types", + "alloy-transport", + "futures", + "futures-util", + "thiserror", +] + +[[package]] +name = "alloy-core" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d22df68fa7d9744be0b1a9be3260e9aa089fbf41903ab182328333061ed186" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-rlp", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cf633ae9a1f0c82fdb9e559ed2be1c8e415c3e48fc47e1feaf32c6078ec0cdd" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "const-hex", + "itoa", + "serde", + "serde_json", + "winnow", +] + +[[package]] +name = "alloy-eip2930" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6cee6a35793f3db8a5ffe60e86c695f321d081a567211245f503e8c498fce8" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "derive_more", + "k256", + "serde", +] + +[[package]] +name = "alloy-eips" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b6aa3961694b30ba53d41006131a2fca3bdab22e4c344e46db2c639e7c2dfdd" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "derive_more", + "once_cell", + "serde", + "sha2", +] + +[[package]] +name = "alloy-genesis" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e53f7877ded3921d18a0a9556d55bedf84535567198c9edab2aa23106da91855" +dependencies = [ + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a500037938085feed8a20dbfc8fce58c599db68c948cfae711147175dee392c" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3694b7e480728c0b3e228384f223937f14c10caef5a4c766021190fc8f283d35" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-network" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea94b8ceb5c75d7df0a93ba0acc53b55a22b47b532b600a800a87ef04eb5b0b4" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "alloy-signer", + "alloy-sol-types", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-network-primitives" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9f3e281005943944d15ee8491534a1c7b3cbf7a7de26f8c433b842b93eb5f9" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aeeb5825c2fc8c2662167058347cd0cafc3cb15bcb5cdb1758a63c2dca0409e" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "foldhash", + "hashbrown 0.15.2", + "hex-literal", + "indexmap", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand", + "ruint", + "rustc-hash", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-provider" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c1f9eede27bf4c13c099e8e64d54efd7ce80ef6ea47478aa75d5d74e2dba3b" +dependencies = [ + "alloy-chains", + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network", + "alloy-network-primitives", + "alloy-primitives", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types-eth", + "alloy-rpc-types-trace", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", + "async-stream", + "async-trait", + "auto_impl", + "dashmap 6.1.0", + "futures", + "futures-utils-wasm", + "lru", + "parking_lot", + "pin-project", + "reqwest", + "schnellru", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "url", + "wasmtimer", +] + +[[package]] +name = "alloy-pubsub" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f1f34232f77341076541c405482e4ae12f0ee7153d8f9969fc1691201b2247" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-transport", + "bimap", + "futures", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "alloy-rpc-client" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374dbe0dc3abdc2c964f36b3d3edf9cdb3db29d16bda34aa123f03d810bec1dd" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-pubsub", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", + "futures", + "pin-project", + "reqwest", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", + "url", + "wasmtimer", +] + +[[package]] +name = "alloy-rpc-types" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c74832aa474b670309c20fffc2a869fa141edab7c79ff7963fad0a08de60bae1" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-engine", + "alloy-rpc-types-eth", + "alloy-rpc-types-trace", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-rpc-types-engine" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56294dce86af23ad6ee8df46cf8b0d292eb5d1ff67dc88a0886051e32b1faf" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "derive_more", + "serde", + "strum", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a477281940d82d29315846c7216db45b15e90bcd52309da9f54bcf7ad94a11" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types", + "derive_more", + "itertools 0.13.0", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-rpc-types-trace" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd8b4877ef520c138af702097477cdd19504a8e1e4675ba37e92ba40f2d3c6f" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-serde" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dfa4a7ccf15b2492bb68088692481fd6b2604ccbee1d0d6c44c21427ae4df83" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-signer" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e10aec39d60dc27edcac447302c7803d2371946fb737245320a05b78eb2fafd" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve", + "k256", + "thiserror", +] + +[[package]] +name = "alloy-signer-local" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8396f6dff60700bc1d215ee03d86ff56de268af96e2bf833a14d0bafcab9882" +dependencies = [ + "alloy-consensus", + "alloy-network", + "alloy-primitives", + "alloy-signer", + "async-trait", + "k256", + "rand", + "thiserror", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0279d09463a4695788a3622fd95443625f7be307422deba4b55dd491a9c7a1" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feea540fc8233df2ad1156efd744b2075372f43a8f942a68b3b19c8a00e2c12" +dependencies = [ + "alloy-json-abi", + "alloy-sol-macro-input", + "const-hex", + "heck 0.5.0", + "indexmap", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.89", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0ad281f3d1b613af814b66977ee698e443d4644a1510962d0241f26e0e53ae" +dependencies = [ + "alloy-json-abi", + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.89", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96eff16c797438add6c37bb335839d015b186c5421ee5626f5559a7bfeb38ef5" +dependencies = [ + "serde", + "winnow", +] + +[[package]] +name = "alloy-sol-types" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff34e0682d6665da243a3e81da96f07a2dd50f7e64073e382b1a141f5a2a2f6" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", +] + +[[package]] +name = "alloy-transport" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f99acddb34000d104961897dbb0240298e8b775a7efffb9fda2a1a3efedd65b3" +dependencies = [ + "alloy-json-rpc", + "base64 0.22.1", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", + "wasmtimer", +] + +[[package]] +name = "alloy-transport-http" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dc013132e34eeadaa0add7e74164c1503988bfba8bae885b32e0918ba85a8a6" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest", + "serde_json", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-transport-ipc" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063edc0660e81260653cc6a95777c29d54c2543a668aa5da2359fb450d25a1ba" +dependencies = [ + "alloy-json-rpc", + "alloy-pubsub", + "alloy-transport", + "bytes", + "futures", + "interprocess", + "pin-project", + "serde", + "serde_json", + "tempfile", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "alloy-transport-ws" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abd170e600801116d5efe64f74a4fc073dbbb35c807013a7d0a388742aeebba0" +dependencies = [ + "alloy-pubsub", + "alloy-transport", + "futures", + "http", + "rustls", + "serde_json", + "tokio", + "tokio-tungstenite", + "tracing", + "ws_stream_wasm", +] [[package]] name = "android-tzdata" @@ -113,26 +698,26 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -147,13 +732,137 @@ dependencies = [ [[package]] name = "argminmax" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202108b46429b765ef483f8a24d5c46f48c14acfdacc086dd4ab6dddf6bcdbd2" +checksum = "52424b59d69d69d5056d508b260553afd91c57e21849579cd1f50ee8b8b88eaa" dependencies = [ "num-traits", ] +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "array-init-cursor" version = "0.2.0" @@ -162,34 +871,15 @@ checksum = "bf7d0a018de4f6aa429b9d33d69edf69072b1c5b1cb8d3e4a5f7ef898fc3eb76" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "arrow-format" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07884ea216994cdc32a2d5f8274a8bee979cfe90274b83f86f440866ee3132c7" -dependencies = [ - "planus", - "serde", -] - -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -198,24 +888,24 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] @@ -226,7 +916,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version", + "rustc_version 0.4.1", ] [[package]] @@ -240,41 +930,40 @@ dependencies = [ [[package]] name = "atoi_simd" -version = "0.15.3" +version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc41b65e01b6851bdcd2d741824e6b310d571396bf3915e31e4792034ee65126" +checksum = "9ae037714f313c1353189ead58ef9eec30a8e8dc101b2622d461418fd59e28a9" [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -285,15 +974,15 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.21.5" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -302,10 +991,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] -name = "bech32" -version = "0.9.1" +name = "bimap" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bit-set" @@ -324,15 +1013,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -356,10 +1039,22 @@ dependencies = [ ] [[package]] -name = "brotli" -version = "3.4.0" +name = "blst" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "brotli" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -376,21 +1071,11 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" -dependencies = [ - "sha2", - "tinyvec", -] - [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-slice-cast" @@ -400,22 +1085,22 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.5.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] @@ -426,74 +1111,37 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" dependencies = [ "serde", ] [[package]] -name = "bzip2" -version = "0.4.4" +name = "c-kzg" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" dependencies = [ + "blst", "cc", + "glob", + "hex", "libc", - "pkg-config", -] - -[[package]] -name = "camino" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" -dependencies = [ + "once_cell", "serde", ] -[[package]] -name = "cargo-platform" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "cc" -version = "1.0.83" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -504,9 +1152,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -514,17 +1162,29 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] -name = "cipher" -version = "0.4.4" +name = "chrono-tz" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e" dependencies = [ - "crypto-common", - "inout", + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", ] [[package]] @@ -556,10 +1216,10 @@ version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1cd2cebdb1ec98182edb745382a2b65d6bc254782de26316e4366d83d39988" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] @@ -568,126 +1228,73 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98979652585ac7c8d6267e363229b6a26bc4bf469c69e96442f85830ebc89f45" -[[package]] -name = "coins-bip32" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" -dependencies = [ - "bs58", - "coins-core", - "digest", - "hmac", - "k256", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-bip39" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" -dependencies = [ - "bitvec", - "coins-bip32", - "hmac", - "once_cell", - "pbkdf2 0.12.2", - "rand", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-core" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" -dependencies = [ - "base64 0.21.5", - "bech32", - "bs58", - "digest", - "generic-array", - "hex", - "ripemd", - "serde", - "serde_derive", - "sha2", - "sha3", - "thiserror", -] - [[package]] name = "color-print" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a858372ff14bab9b1b30ea504f2a4bc534582aee3e42ba2d41d2a7baba63d5d" +checksum = "3aa954171903797d5623e047d9ab69d91b493657917bdfb8c2c80ecaf9cdb6f4" dependencies = [ "color-print-proc-macro", ] [[package]] name = "color-print-proc-macro" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e37866456a721d0a404439a1adae37a31be4e0055590d053dfe6981e05003f" +checksum = "692186b5ebe54007e45a59aea47ece9eb4108e141326c304cdc91699a7118a22" dependencies = [ "nom", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", "windows-sys 0.48.0", ] [[package]] name = "comfy-table" -version = "7.1.0" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" +checksum = "24f165e7b643266ea80cb858aed492ad9280e3e05ce24d4a99d7d7b889b6a4d9" dependencies = [ "crossterm", "strum", - "strum_macros", - "unicode-width", + "strum_macros 0.26.4", + "unicode-width 0.2.0", ] [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", - "windows-sys 0.45.0", + "unicode-width 0.1.14", + "windows-sys 0.52.0", ] [[package]] name = "const-hex" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +checksum = "487981fa1af147182687064d0a2c336586d337a606595ced9ffb0c685c250c73" dependencies = [ "cfg-if", "cpufeatures", @@ -698,21 +1305,15 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -720,91 +1321,81 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crossterm" -version = "0.27.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.4.1", + "bitflags", "crossterm_winapi", - "libc", "parking_lot", + "rustix", "winapi", ] @@ -825,17 +1416,18 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "cryo_cli" -version = "0.3.0" +version = "0.3.2" dependencies = [ + "alloy", "anstyle", "clap_cryo", "color-print", "colored", "cryo_freeze", - "ethers", "eyre", "governor", "hex", + "mesc", "polars", "rand", "serde", @@ -845,20 +1437,19 @@ dependencies = [ [[package]] name = "cryo_freeze" -version = "0.3.0" +version = "0.3.2" dependencies = [ + "alloy", "async-trait", "chrono", "colored", "cryo_to_df", - "ethers", - "ethers-core", "futures", "governor", - "heck", - "indexmap 2.1.0", + "heck 0.4.1", + "indexmap", "indicatif", - "lazy_static", + "mesc", "polars", "prefix-hex", "regex", @@ -867,11 +1458,12 @@ dependencies = [ "thiserror", "thousands", "tokio", + "url", ] [[package]] name = "cryo_python" -version = "0.2.0" +version = "0.3.2" dependencies = [ "cryo_cli", "cryo_freeze", @@ -885,9 +1477,9 @@ dependencies = [ [[package]] name = "cryo_to_df" -version = "0.3.0" +version = "0.3.2" dependencies = [ - "indexmap 2.1.0", + "indexmap", "proc-macro2", "quote", "syn 1.0.109", @@ -895,9 +1487,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core", @@ -915,15 +1507,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -931,7 +1514,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.2", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -939,34 +1536,25 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", ] [[package]] -name = "deranged" -version = "0.3.9" +name = "derivative" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", @@ -974,10 +1562,34 @@ dependencies = [ ] [[package]] -name = "diff" -version = "0.1.13" +name = "derive_more" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] [[package]] name = "digest" @@ -992,67 +1604,42 @@ dependencies = [ ] [[package]] -name = "dirs" -version = "5.0.1" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "dirs-sys", + "proc-macro2", + "quote", + "syn 2.0.89", ] [[package]] -name = "dirs-next" -version = "2.0.0" +name = "doctest-file" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" [[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" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -1061,19 +1648,19 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" -version = "0.13.6" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -1084,58 +1671,22 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", -] - [[package]] name = "encode_unicode" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enr" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" -dependencies = [ - "base64 0.21.5", - "bytes", - "hex", - "k256", - "log", - "rand", - "rlp", - "serde", - "sha3", - "zeroize", -] - [[package]] name = "enum_dispatch" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] @@ -1146,331 +1697,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "eth-keystore" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" -dependencies = [ - "aes", - "ctr", - "digest", - "hex", - "hmac", - "pbkdf2 0.11.0", - "rand", - "scrypt", - "serde", - "serde_json", - "sha2", - "sha3", - "thiserror", - "uuid", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", - "once_cell", - "regex", - "serde", - "serde_json", - "sha3", - "thiserror", - "uint", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types", - "scale-info", - "uint", -] - -[[package]] -name = "ethers" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad13497f6e0a24292fc7b408e30d22fe9dc262da1f40d7b542c3a44e7fc0476" -dependencies = [ - "ethers-addressbook", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-middleware", - "ethers-providers", - "ethers-signers", - "ethers-solc", -] - -[[package]] -name = "ethers-addressbook" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e9e8acd0ed348403cc73a670c24daba3226c40b98dc1a41903766b3ab6240a" -dependencies = [ - "ethers-core", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "ethers-contract" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79269278125006bb0552349c03593ffa9702112ca88bc7046cc669f148fb47c" -dependencies = [ - "const-hex", - "ethers-contract-abigen", - "ethers-contract-derive", - "ethers-core", - "ethers-providers", - "futures-util", - "once_cell", - "pin-project", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ethers-contract-abigen" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" -dependencies = [ - "Inflector", - "const-hex", - "dunce", - "ethers-core", - "ethers-etherscan", - "eyre", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "reqwest", - "serde", - "serde_json", - "syn 2.0.38", - "toml", - "walkdir", -] - -[[package]] -name = "ethers-contract-derive" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" -dependencies = [ - "Inflector", - "const-hex", - "ethers-contract-abigen", - "ethers-core", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.38", -] - -[[package]] -name = "ethers-core" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" -dependencies = [ - "arrayvec", - "bytes", - "cargo_metadata", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "once_cell", - "open-fastrlp", - "rand", - "rlp", - "serde", - "serde_json", - "strum", - "syn 2.0.38", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "ethers-etherscan" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" -dependencies = [ - "ethers-core", - "reqwest", - "semver", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-middleware" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473f1ccd0c793871bbc248729fa8df7e6d2981d6226e4343e3bbaa9281074d5d" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-providers", - "ethers-signers", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", -] - -[[package]] -name = "ethers-providers" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" -dependencies = [ - "async-trait", - "auto_impl", - "base64 0.21.5", - "bytes", - "const-hex", - "enr", - "ethers-core", - "futures-channel", - "futures-core", - "futures-timer", - "futures-util", - "hashers", - "http", - "instant", - "jsonwebtoken", - "once_cell", - "pin-project", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-tungstenite", - "tracing", - "tracing-futures", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winapi", - "ws_stream_wasm", -] - -[[package]] -name = "ethers-signers" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea44bec930f12292866166f9ddbea6aa76304850e4d8dcd66dc492b43d00ff1" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "const-hex", - "elliptic-curve", - "eth-keystore", - "ethers-core", - "rand", - "sha2", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-solc" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de34e484e7ae3cab99fbfd013d6c5dc7f9013676a4e0e414d8b12e1213e8b3ba" -dependencies = [ - "cfg-if", - "const-hex", - "dirs", - "dunce", - "ethers-core", - "glob", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver", - "serde", - "serde_json", - "solang-parser", - "svm-rs", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", + "windows-sys 0.52.0", ] [[package]] @@ -1481,9 +1713,9 @@ checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" [[package]] name = "eyre" -version = "0.6.8" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ "indenter", "once_cell", @@ -1503,9 +1735,20 @@ checksum = "95765f67b4b18863968b4a1bd5bb576f732b29a4a28c7cd84c09fa3e2875f33c" [[package]] name = "fastrand" -version = "2.0.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] [[package]] name = "ff" @@ -1529,17 +1772,11 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -1560,6 +1797,27 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign_vec" version = "0.1.0" @@ -1568,23 +1826,13 @@ checksum = "ee1b05cbd864bcaecbd3455d6d967862d446e4ebfc3c2e5e5b9841e53cba6673" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "funty" version = "2.0.0" @@ -1593,9 +1841,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1608,9 +1856,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1618,15 +1866,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1635,58 +1883,44 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" - -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", -] +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" -dependencies = [ - "gloo-timers", - "send_wrapper 0.4.0", -] +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1701,13 +1935,10 @@ dependencies = [ ] [[package]] -name = "fxhash" -version = "0.2.1" +name = "futures-utils-wasm" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] +checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" [[package]] name = "generic-array" @@ -1722,9 +1953,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -1735,9 +1966,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" @@ -1745,34 +1976,24 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "governor" -version = "0.6.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ "cfg-if", - "dashmap", + "dashmap 5.5.3", "futures", "futures-timer", "no-std-compat", "nonzero_ext", "parking_lot", + "portable-atomic", "quanta", "rand", "smallvec", + "spinning_top", ] [[package]] @@ -1786,55 +2007,27 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 1.9.3", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "halfbrown" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5681137554ddff44396e5f149892c769d45301dd9aa19c51602a89ee214cb0ec" +checksum = "8588661a8607108a5ca69cab034063441a0413a0b041c13618a7dd348021ef6f" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.5", "serde", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -1842,12 +2035,15 @@ dependencies = [ ] [[package]] -name = "hashers" -version = "1.0.1" +name = "hashbrown" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "fxhash", + "allocator-api2", + "equivalent", + "foldhash", + "serde", ] [[package]] @@ -1857,16 +2053,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "hermit-abi" -version = "0.3.3" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hmac" @@ -1874,23 +2091,23 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "http" -version = "0.2.9" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1899,70 +2116,92 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "hyper" -version = "0.14.27" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", - "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] -name = "hyper-rustls" -version = "0.24.2" +name = "hyper-tls" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", "futures-util", "http", + "http-body", "hyper", - "rustls", + "pin-project-lite", + "socket2", "tokio", - "tokio-rustls", + "tower-service", + "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1982,13 +2221,142 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.4.0" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -2000,33 +2368,15 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] @@ -2037,76 +2387,64 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.9.3" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.15.2", + "serde", ] [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" dependencies = [ "console", - "instant", "number_prefix", "portable-atomic", - "unicode-width", + "unicode-width 0.2.0", + "web-time", ] [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] -name = "inout" -version = "0.1.3" +name = "interprocess" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "894148491d817cb36b6f778017b8ac46b17408d522dd90f539d677ea938362eb" dependencies = [ - "generic-array", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.52.0", ] [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -2120,113 +2458,97 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + +[[package]] +name = "itoap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] -name = "jsonwebtoken" -version = "8.3.0" +name = "jsonpath_lib_polars_vendor" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +checksum = "f4bd9354947622f7471ff713eacaabdb683ccb13bba4edccaab9860abf480b7d" dependencies = [ - "base64 0.21.5", - "pem", - "ring 0.16.20", + "log", "serde", "serde_json", - "simple_asn1", ] [[package]] name = "k256" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", "once_cell", "sha2", - "signature", ] [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] [[package]] -name = "lalrpop" -version = "0.20.0" +name = "keccak-asm" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools 0.10.5", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax 0.7.5", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", + "digest 0.10.7", + "sha3-asm", ] -[[package]] -name = "lalrpop-util" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" - [[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 = "lexical-core" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" +checksum = "0431c65b318a590c1de6b8fd6e72798c92291d27762d94c9e6c37ed7a73d8458" dependencies = [ "lexical-parse-float", "lexical-parse-integer", @@ -2237,9 +2559,9 @@ dependencies = [ [[package]] name = "lexical-parse-float" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +checksum = "eb17a4bdb9b418051aa59d41d65b1c9be5affab314a872e5ad7f06231fb3b4e0" dependencies = [ "lexical-parse-integer", "lexical-util", @@ -2248,9 +2570,9 @@ dependencies = [ [[package]] name = "lexical-parse-integer" -version = "0.8.6" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +checksum = "5df98f4a4ab53bf8b175b363a34c7af608fe31f93cc1fb1bf07130622ca4ef61" dependencies = [ "lexical-util", "static_assertions", @@ -2258,18 +2580,18 @@ dependencies = [ [[package]] name = "lexical-util" -version = "0.8.5" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +checksum = "85314db53332e5c192b6bca611fb10c114a80d1b831ddac0af1e9be1b9232ca0" dependencies = [ "static_assertions", ] [[package]] name = "lexical-write-float" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +checksum = "6e7c3ad4e37db81c1cbe7cf34610340adc09c322871972f74877a712abc6c809" dependencies = [ "lexical-util", "lexical-write-integer", @@ -2278,9 +2600,9 @@ dependencies = [ [[package]] name = "lexical-write-integer" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +checksum = "eb89e9f6958b83258afa3deed90b5de9ef68eef090ad5086c791cd2345610162" dependencies = [ "lexical-util", "static_assertions", @@ -2288,27 +2610,33 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.149" +version = "0.2.165" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -2316,54 +2644,43 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.2", +] [[package]] name = "lz4" -version = "1.24.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ - "libc", "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.9.4" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", ] -[[package]] -name = "mach2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" -dependencies = [ - "libc", -] - -[[package]] -name = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if", - "digest", -] - [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" @@ -2376,13 +2693,24 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] +[[package]] +name = "mesc" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4effaaca264c057c870afd19cf7137ef000ca64fc7292d5a0634ce5ebbb6e27" +dependencies = [ + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "mime" version = "0.3.17" @@ -2397,29 +2725,30 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "0.8.9" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "multiversion" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c7b9d7fe61760ce5ea19532ead98541f6b4c495d87247aff9826445cf6872a" +checksum = "c4851161a11d3ad0bf9402d90ffc3967bf231768bfd7aeb61755ad06dbf1a142" dependencies = [ "multiversion-macros", "target-features", @@ -2427,9 +2756,9 @@ dependencies = [ [[package]] name = "multiversion-macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a83d8500ed06d68877e9de1dde76c1dbb83885dcdbda4ef44ccbc3fbda2ac8" +checksum = "79a74ddee9e0c27d2578323c13905793e91622148f138ba29738f9dddb835e90" dependencies = [ "proc-macro2", "quote", @@ -2438,10 +2767,21 @@ dependencies = [ ] [[package]] -name = "new_debug_unreachable" -version = "1.0.4" +name = "native-tls" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] [[package]] name = "no-std-compat" @@ -2485,30 +2825,28 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -2520,29 +2858,28 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] [[package]] name = "num_enum" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] @@ -2553,81 +2890,95 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.32.1" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] -name = "open-fastrlp" -version = "0.1.4" +name = "openssl" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", ] [[package]] -name = "open-fastrlp-derive" +name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "bytes", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] -name = "option-ext" -version = "0.2.0" +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "parity-scale-codec" -version = "3.6.5" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +checksum = "8be4817d39f3272f69c59fe05d0535ae6456c2dc2fa1ba02910296c7e0a5c590" dependencies = [ "arrayvec", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive", + "rustversion", "serde", ] [[package]] name = "parity-scale-codec-derive" -version = "3.6.5" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -2635,15 +2986,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2657,67 +3008,35 @@ dependencies = [ ] [[package]] -name = "password-hash" -version = "0.4.2" +name = "parse-zoneinfo" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" dependencies = [ - "base64ct", - "rand_core", - "subtle", + "regex", ] [[package]] -name = "path-slash" -version = "0.2.1" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest", - "hmac", - "password-hash", - "sha2", -] - -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", -] - -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "petgraph" -version = "0.6.4" +name = "pest" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ - "fixedbitset", - "indexmap 2.1.0", + "memchr", + "thiserror", + "ucd-trie", ] [[package]] @@ -2727,7 +3046,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version", + "rustc_version 0.4.1", ] [[package]] @@ -2736,8 +3055,17 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_macros", - "phf_shared 0.11.2", + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator", + "phf_shared", ] [[package]] @@ -2746,32 +3074,10 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared 0.11.2", + "phf_shared", "rand", ] -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.11.2" @@ -2783,29 +3089,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -2825,9 +3131,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "planus" @@ -2840,31 +3146,36 @@ dependencies = [ [[package]] name = "polars" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8e52f9236eb722da0990a70bbb1216dcc7a77bcb00c63439d2d982823e90d5" +checksum = "f01006048a264047d6cba081fed8e11adbd69c15956f9e53185a9ac4a541853c" dependencies = [ "getrandom", + "polars-arrow", "polars-core", + "polars-error", "polars-io", "polars-lazy", "polars-ops", + "polars-parquet", "polars-sql", "polars-time", + "polars-utils", "version_check", ] [[package]] name = "polars-arrow" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd503430a6d9779b07915d858865fe998317ef3cfef8973881f578ac5d4baae7" +checksum = "25197f40d71f82b2f79bb394f03e555d3cc1ce4db1dd052c28318721c71e96ad" dependencies = [ "ahash", - "arrow-format", + "atoi", "atoi_simd", "bytemuck", "chrono", + "chrono-tz", "dyn-clone", "either", "ethnum", @@ -2872,38 +3183,68 @@ dependencies = [ "foreign_vec", "futures", "getrandom", - "hashbrown 0.14.2", + "hashbrown 0.14.5", "itoa", + "itoap", "lz4", "multiversion", "num-traits", + "polars-arrow-format", "polars-error", "polars-utils", - "rustc_version", "ryu", "simdutf8", "streaming-iterator", "strength_reduce", - "zstd 0.13.0", + "version_check", + "zstd", +] + +[[package]] +name = "polars-arrow-format" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b0ef2474af9396b19025b189d96e992311e6a47f90c53cd998b36c4c64b84c" +dependencies = [ + "planus", + "serde", +] + +[[package]] +name = "polars-compute" +version = "0.38.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c354515f73cdbbad03c2bf723fcd68e6825943b3ec503055abc8a8cb08ce46bb" +dependencies = [ + "bytemuck", + "either", + "num-traits", + "polars-arrow", + "polars-error", + "polars-utils", + "strength_reduce", + "version_check", ] [[package]] name = "polars-core" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae73d5b8e55decde670caba1cc82b61f14bfb9a72503198f0997d657a98dcfd6" +checksum = "6f20d3c227186f74aa3c228c64ef72f5a15617322fed30b4323eaf53b25f8e7b" dependencies = [ "ahash", - "bitflags 2.4.1", + "bitflags", "bytemuck", "chrono", + "chrono-tz", "comfy-table", "either", - "hashbrown 0.14.2", - "indexmap 2.1.0", + "hashbrown 0.14.5", + "indexmap", "num-traits", "once_cell", "polars-arrow", + "polars-compute", "polars-error", "polars-row", "polars-utils", @@ -2919,11 +3260,11 @@ dependencies = [ [[package]] name = "polars-error" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb0520d68eaa9993ae0c741409d1526beff5b8f48e1d73e4381616f8152cf488" +checksum = "d66dd0ce51f8bd620eb8bd376502fe68a2b1a446d5433ecd2e75270b0755ce76" dependencies = [ - "arrow-format", + "polars-arrow-format", "regex", "simdutf8", "thiserror", @@ -2931,9 +3272,9 @@ dependencies = [ [[package]] name = "polars-io" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e10a0745acd6009db64bef0ceb9e23a70b1c27b26a0a6517c91f3e6363bc06" +checksum = "b40bef2edcdc58394792c4d779465144283a09ff1836324e7b72df7978a6e992" dependencies = [ "ahash", "async-trait", @@ -2969,15 +3310,15 @@ dependencies = [ [[package]] name = "polars-json" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93b9cb83c19daf334c398e56a9361bd79c8ad0718296db2afab08d476bd84559" +checksum = "ef86aca08f10ddc939fe95aabb44e1d2582dcb08b55d4dadb93353ce42adc248" dependencies = [ "ahash", "chrono", "fallible-streaming-iterator", - "hashbrown 0.14.2", - "indexmap 2.1.0", + "hashbrown 0.14.5", + "indexmap", "itoa", "num-traits", "polars-arrow", @@ -2990,12 +3331,12 @@ dependencies = [ [[package]] name = "polars-lazy" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3555f759705be6dd0d3762d16a0b8787b2dc4da73b57465f3b2bf1a070ba8f20" +checksum = "c27df26a19d3092298d31d47614ad84dc330c106e38aa8cd53727cd91c07cf56" dependencies = [ "ahash", - "bitflags 2.4.1", + "bitflags", "glob", "once_cell", "polars-arrow", @@ -3014,39 +3355,46 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7eb218296aaa7f79945f08288ca32ca3cf25fa505649eeee689ec21eebf636" +checksum = "7f8a51c3bdc9e7c34196ff6f5c3cb17da134e5aafb1756aaf24b76c7118e63dc" dependencies = [ "ahash", "argminmax", - "base64 0.21.5", + "base64 0.21.7", "bytemuck", + "chrono", + "chrono-tz", "either", - "hashbrown 0.14.2", + "hashbrown 0.14.5", "hex", - "indexmap 2.1.0", + "indexmap", + "jsonpath_lib_polars_vendor", "memchr", "num-traits", "polars-arrow", + "polars-compute", "polars-core", "polars-error", + "polars-json", "polars-utils", "rayon", "regex", + "serde_json", "smartstring", + "unicode-reverse", "version_check", ] [[package]] name = "polars-parquet" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146010e4b7dd4d2d0e58ddc762f6361f77d7a0385c54471199370c17164f67dd" +checksum = "b8824ee00fbbe83d69553f2711014c50361238d210ed81a7a297695b7db97d42" dependencies = [ "ahash", "async-stream", - "base64 0.21.5", + "base64 0.21.7", "brotli", "ethnum", "flate2", @@ -3061,21 +3409,22 @@ dependencies = [ "simdutf8", "snap", "streaming-decompression", - "zstd 0.13.0", + "zstd", ] [[package]] name = "polars-pipe" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66094e7df64c932a9a7bdfe7df0c65efdcb192096e11a6a765a9778f78b4bdec" +checksum = "0c5e2c1f14e81d60cfa9afe4e611a9bad9631a2cb7cd19b7c0094d0dc32f0231" dependencies = [ "crossbeam-channel", "crossbeam-queue", "enum_dispatch", - "hashbrown 0.14.2", + "hashbrown 0.14.5", "num-traits", "polars-arrow", + "polars-compute", "polars-core", "polars-io", "polars-ops", @@ -3084,22 +3433,25 @@ dependencies = [ "polars-utils", "rayon", "smartstring", + "uuid", "version_check", ] [[package]] name = "polars-plan" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10e32a0958ef854b132bad7f8369cb3237254635d5e864c99505bc0bc1035fbc" +checksum = "ff48362bd1b078bbbec7e7ba9ec01fea58fee2887db22a8e3deaf78f322fa3c4" dependencies = [ "ahash", "bytemuck", + "chrono-tz", "once_cell", "percent-encoding", "polars-arrow", "polars-core", "polars-io", + "polars-json", "polars-ops", "polars-parquet", "polars-time", @@ -3107,16 +3459,17 @@ dependencies = [ "rayon", "regex", "smartstring", - "strum_macros", + "strum_macros 0.25.3", "version_check", ] [[package]] name = "polars-row" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d135ab81cac2906ba74ea8984c7e6025d081ae5867615bcefb4d84dfdb456dac" +checksum = "63029da56ff6a720b190490bbc7b6263f9b72d1134311b1f381fc8d306d37770" dependencies = [ + "bytemuck", "polars-arrow", "polars-error", "polars-utils", @@ -3124,10 +3477,11 @@ dependencies = [ [[package]] name = "polars-sql" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dbd7786849a5e3ad1fde188bf38141632f626e3a57319b0bbf7a5f1d75519e" +checksum = "3652c362959f608d1297196b973d1e3acb508a9562b886ac39bf7606b841052b" dependencies = [ + "hex", "polars-arrow", "polars-core", "polars-error", @@ -3141,12 +3495,13 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae56f79e9cedd617773c1c8f5ca84a31a8b1d593714959d5f799e7bdd98fe51" +checksum = "86eb74ea6ddfe675aa5c3f33c00dadbe2b85f0e8e3887b85db1fd5a3397267fd" dependencies = [ "atoi", "chrono", + "chrono-tz", "now", "once_cell", "polars-arrow", @@ -3160,17 +3515,18 @@ dependencies = [ [[package]] name = "polars-utils" -version = "0.35.4" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da6ce68169fe61d46958c8eab7447360f30f2f23f6e24a0ce703a14b0a3cfbfc" +checksum = "694656a7d2b0cd8f07660dbc8d0fb7a81066ff57a452264907531d805c1e58c4" dependencies = [ "ahash", "bytemuck", - "hashbrown 0.14.2", - "indexmap 2.1.0", + "hashbrown 0.14.5", + "indexmap", "num-traits", "once_cell", "polars-error", + "raw-cpuid", "rayon", "smartstring", "sysinfo", @@ -3179,27 +3535,18 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.5.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "prefix-hex" @@ -3210,16 +3557,6 @@ dependencies = [ "hex", ] -[[package]] -name = "prettyplease" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" -dependencies = [ - "proc-macro2", - "syn 2.0.38", -] - [[package]] name = "primitive-types" version = "0.12.2" @@ -3228,91 +3565,81 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", "uint", ] [[package]] name = "proc-macro-crate" -version = "1.3.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "once_cell", - "toml_edit 0.19.15", + "toml_edit", ] [[package]] -name = "proc-macro-crate" +name = "proc-macro-error-attr2" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ "proc-macro2", "quote", - "version_check", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.89", ] [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ - "bitflags 2.4.1", + "bit-set", + "bit-vec", + "bitflags", "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.7.5", + "regex-syntax", + "rusty-fork", + "tempfile", "unarray", ] [[package]] name = "pyo3" -version = "0.20.0" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b" +checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233" dependencies = [ "cfg-if", "indoc", "libc", "memoffset", "parking_lot", + "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -3334,9 +3661,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.20.0" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96fe70b176a89cff78f2fa7b3c930081e163d5379b4dcdf993e3ae29ca662e5" +checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7" dependencies = [ "once_cell", "target-lexicon", @@ -3344,9 +3671,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.20.0" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "214929900fd25e6604661ed9cf349727c8920d47deff196c4e28165a6ef2a96b" +checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa" dependencies = [ "libc", "pyo3-build-config", @@ -3354,33 +3681,34 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.20.0" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac53072f717aa1bfa4db832b39de8c875b7c7af4f4a6fe93cdbf9264cf8383b" +checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "pyo3-macros-backend" -version = "0.20.0" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7774b5a8282bd4f25f803b1f0d945120be959a36c72e08e7cd031c792fdfd424" +checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", + "pyo3-build-config", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "pyo3-polars" -version = "0.9.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37da190c68036cb620bbde9a8933839addfa4b66e9903b9b1dc751b2b00e7d7" +checksum = "c6ab8ad08494161085fb0d2d9de82c7fde7398da1778ee7e7a5a596ff4201f5b" dependencies = [ "polars", "polars-core", @@ -3390,13 +3718,12 @@ dependencies = [ [[package]] name = "quanta" -version = "0.11.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" dependencies = [ "crossbeam-utils", "libc", - "mach2", "once_cell", "raw-cpuid", "wasi", @@ -3405,10 +3732,16 @@ dependencies = [ ] [[package]] -name = "quote" -version = "1.0.33" +name = "quick-error" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -3428,6 +3761,7 @@ dependencies = [ "libc", "rand_chacha", "rand_core", + "serde", ] [[package]] @@ -3470,18 +3804,18 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "10.7.0" +version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -3489,136 +3823,115 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", ] [[package]] -name = "redox_syscall" -version = "0.2.16" +name = "recvmsg" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", + "bitflags", ] [[package]] name = "ref-cast" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ - "base64 0.21.5", + "base64 0.22.1", "bytes", - "encoding_rs", "futures-core", "futures-util", - "h2", "http", "http-body", + "http-body-util", "hyper", - "hyper-rustls", + "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", - "system-configuration", + "sync_wrapper 1.0.2", "tokio", - "tokio-rustls", + "tokio-native-tls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", - "winreg", + "windows-registry", ] [[package]] @@ -3633,40 +3946,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - -[[package]] -name = "ring" -version = "0.17.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", - "spin 0.9.8", - "untrusted 0.9.0", - "windows-sys 0.48.0", -] - -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest", + "spin", + "untrusted", + "windows-sys 0.52.0", ] [[package]] @@ -3676,26 +3966,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", - "rlp-derive", "rustc-hex", ] [[package]] -name = "rlp-derive" -version = "0.1.0" +name = "ruint" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", ] [[package]] -name = "rustc-demangle" -version = "0.1.23" +name = "ruint-macro" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustc-hex" @@ -3705,109 +4019,117 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver", + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.23", ] [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ - "bitflags 2.4.1", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.8" +version = "0.23.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ - "log", - "ring 0.17.5", + "once_cell", + "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.21.5", + "rustls-pki-types", ] [[package]] -name = "rustls-webpki" -version = "0.101.7" +name = "rustls-pki-types" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "ring 0.17.5", - "untrusted 0.9.0", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] -name = "salsa20" -version = "0.10.2" +name = "schannel" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "cipher", + "windows-sys 0.59.0", ] [[package]] -name = "same-file" -version = "1.0.6" +name = "schnellru" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scale-info" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" dependencies = [ + "ahash", "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "hashbrown 0.13.2", ] [[package]] @@ -3816,28 +4138,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scrypt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" -dependencies = [ - "hmac", - "pbkdf2 0.11.0", - "salsa20", - "sha2", -] - -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring 0.17.5", - "untrusted 0.9.0", -] - [[package]] name = "sec1" version = "0.7.3" @@ -3853,19 +4153,51 @@ dependencies = [ ] [[package]] -name = "semver" -version = "1.0.20" +name = "security-framework" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "serde", + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", ] [[package]] -name = "send_wrapper" -version = "0.4.0" +name = "security-framework-sys" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" +dependencies = [ + "pest", +] [[package]] name = "send_wrapper" @@ -3881,44 +4213,37 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" [[package]] name = "serde" -version = "1.0.191" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.191" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ + "indexmap", "itoa", + "memchr", "ryu", "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3939,7 +4264,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3950,7 +4275,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3959,25 +4284,41 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] [[package]] -name = "signature" -version = "2.1.0" +name = "sha3-asm" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" dependencies = [ - "digest", + "cc", + "cfg-if", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", "rand_core", ] [[package]] name = "simd-json" -version = "0.13.4" +version = "0.13.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a3720326b20bf5b95b72dbbd133caae7e0dcf71eae8f6e6656e71a7e5c9aaa" +checksum = "a0228a564470f81724e30996bbc2b171713b37b15254a6440c7e2d5449b95691" dependencies = [ "ahash", "getrandom", @@ -3993,21 +4334,9 @@ dependencies = [ [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time", -] +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" @@ -4026,9 +4355,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smartstring" @@ -4043,50 +4372,20 @@ dependencies = [ [[package]] name = "snap" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" +checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" [[package]] name = "socket2" -version = "0.4.10" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "solang-parser" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb9fa2fa2fa6837be8a2495486ff92e3ffe68a99b6eeba288e139efdd842457" -dependencies = [ - "itertools 0.11.0", - "lalrpop", - "lalrpop-util", - "phf", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -4094,10 +4393,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] -name = "spki" -version = "0.7.2" +name = "spinning_top" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -4112,6 +4420,12 @@ dependencies = [ "log", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -4139,19 +4453,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.10.0" @@ -4160,11 +4461,11 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.25.0" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros", + "strum_macros 0.26.4", ] [[package]] @@ -4173,38 +4474,31 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.38", + "syn 2.0.89", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.89", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "svm-rs" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0cc95be7cc2c384a2f57cac56548d2178650905ebe5725bc8970ccc25529060" -dependencies = [ - "dirs", - "fs2", - "hex", - "once_cell", - "reqwest", - "semver", - "serde", - "serde_json", - "sha2", - "thiserror", - "url", - "zip", -] +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -4219,9 +4513,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -4229,38 +4523,55 @@ dependencies = [ ] [[package]] -name = "sysinfo" -version = "0.29.10" +name = "syn-solidity" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a18d114d420ada3a891e6bc8e96a2023402203296a47cdd65083377dad18ba5" +checksum = "6bdaa7b9e815582ba343a20c66627437cf45f1c6fba7f69772cbfd1358c7e197" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "sysinfo" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" dependencies = [ "cfg-if", "core-foundation-sys", "libc", "ntapi", "once_cell", - "winapi", -] - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", + "windows", ] [[package]] @@ -4271,58 +4582,47 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-features" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb5fa503293557c5158bd215fdc225695e567a77e453f5d4452a50a193969bd" +checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5" [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", + "once_cell", "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", + "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] @@ -4332,32 +4632,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" [[package]] -name = "time" -version = "0.3.30" +name = "threadpool" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" -dependencies = [ - "time-core", + "num_cpus", ] [[package]] @@ -4370,67 +4650,85 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.33.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] -name = "tokio-rustls" -version = "0.24.1" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ - "rustls", + "native-tls", "tokio", ] [[package]] -name = "tokio-tungstenite" -version = "0.20.1" +name = "tokio-rustls" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" dependencies = [ "futures-util", "log", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", "tungstenite", @@ -4439,68 +4737,59 @@ dependencies = [ [[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" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_spanned", + "indexmap", "toml_datetime", "winnow", ] [[package]] -name = "toml_edit" -version = "0.20.7" +name = "tower" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", ] +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -4521,39 +4810,29 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", ] [[package]] -name = "tracing-futures" +name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.20.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" dependencies = [ "byteorder", "bytes", @@ -4563,9 +4842,9 @@ dependencies = [ "log", "rand", "rustls", + "rustls-pki-types", "sha1", "thiserror", - "url", "utf-8", ] @@ -4575,6 +4854,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "uint" version = "0.9.5" @@ -4593,38 +4878,44 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] -name = "unicode-normalization" -version = "0.1.22" +name = "unicode-reverse" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "4b6f4888ebc23094adfb574fdca9fdc891826287a6397d2cd28802ffd6f20c76" dependencies = [ - "tinyvec", + "unicode-segmentation", ] [[package]] -name = "unicode-width" -version = "0.1.11" +name = "unicode-segmentation" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "unindent" @@ -4632,12 +4923,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -4646,9 +4931,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -4662,26 +4947,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] -name = "utf8parse" -version = "0.2.1" +name = "utf16_iter" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "0.8.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", - "serde", ] [[package]] -name = "value-trait" -version = "0.8.0" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea87257cfcbedcb9444eda79c59fdfea71217e6305afee8ee33f500375c2ac97" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "value-trait" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad8db98c1e677797df21ba03fca7d3bf9bec3ca38db930954e4fe6e1ea27eb4" dependencies = [ "float-cmp", "halfbrown", @@ -4690,19 +4992,24 @@ dependencies = [ ] [[package]] -name = "version_check" -version = "0.9.4" +name = "vcpkg" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] -name = "walkdir" -version = "2.4.0" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" dependencies = [ - "same-file", - "winapi-util", + "libc", ] [[package]] @@ -4722,34 +5029,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -4759,9 +5067,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4769,28 +5077,52 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "wasmtimer" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23" +dependencies = [ + "futures", + "js-sys", + "parking_lot", + "pin-utils", + "slab", + "wasm-bindgen", +] [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -4798,9 +5130,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -4818,15 +5159,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -4834,21 +5166,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-core" -version = "0.51.1" +name = "windows" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-targets 0.48.5", + "windows-core", + "windows-targets 0.52.6", ] [[package]] -name = "windows-sys" -version = "0.45.0" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.42.2", + "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]] @@ -4861,18 +5224,21 @@ dependencies = [ ] [[package]] -name = "windows-targets" -version = "0.42.2" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "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]] @@ -4891,10 +5257,20 @@ dependencies = [ ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] [[package]] name = "windows_aarch64_gnullvm" @@ -4903,10 +5279,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" +name = "windows_aarch64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -4915,10 +5291,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] -name = "windows_i686_gnu" -version = "0.42.2" +name = "windows_aarch64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -4927,10 +5303,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] -name = "windows_i686_msvc" -version = "0.42.2" +name = "windows_i686_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -4939,10 +5321,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -4951,10 +5333,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" +name = "windows_x86_64_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -4963,10 +5345,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -4975,23 +5357,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] -name = "winnow" -version = "0.5.18" +name = "windows_x86_64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] [[package]] -name = "winreg" -version = "0.50.0" +name = "write16" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "ws_stream_wasm" @@ -5004,8 +5394,8 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version", - "send_wrapper 0.6.0", + "rustc_version 0.4.1", + "send_wrapper", "thiserror", "wasm-bindgen", "wasm-bindgen-futures", @@ -5023,104 +5413,141 @@ dependencies = [ [[package]] name = "xxhash-rust" -version = "0.8.7" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" +checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" [[package]] -name = "yansi" -version = "0.5.1" +name = "yoke" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", + "synstructure", +] [[package]] name = "zerocopy" -version = "0.7.21" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.21" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.89", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", + "synstructure", ] [[package]] name = "zeroize" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] [[package]] -name = "zip" -version = "0.6.6" +name = "zeroize_derive" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2 0.11.0", - "sha1", - "time", - "zstd 0.11.2+zstd.1.5.2", + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", ] [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ - "zstd-safe 5.0.2+zstd.1.5.2", -] - -[[package]] -name = "zstd" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" -dependencies = [ - "zstd-safe 7.0.0", + "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-safe" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index c1d70d5..d473642 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,14 +7,26 @@ members = ["crates/cli", "crates/freeze", "crates/to_df", "crates/python"] resolver = "2" [workspace.package] -version = "0.3.0" +version = "0.3.2" edition = "2021" license = "MIT OR Apache-2.0" -homepage = "https://github.com/paradigmxyz/cryo" repository = "https://github.com/paradigmxyz/cryo" exclude = [".github/"] [workspace.dependencies] +cryo_cli = { version = "0.3.2", path = "./crates/cli" } +cryo_freeze = { version = "0.3.2", path = "./crates/freeze" } +cryo_to_df = { version = "0.3.2", path = "./crates/to_df" } + +alloy = { version = "0.6.4", features = [ + "full", + "rpc-types-trace", + "provider-ws", + "provider-ipc", + "provider-debug-api", + "provider-trace-api", + "transport-ipc-mock", +] } anstyle = "1.0.4" async-trait = "0.1.74" chrono = { version = "0.4.31", features = ["serde"] } @@ -25,8 +37,6 @@ clap_cryo = { version = "4.3.21-cryo", features = [ ] } colored = "2.0.4" color-print = "0.3.5" -ethers = { version = "2.0.10", features = ["rustls", "ws", "ipc"] } -ethers-core = "2.0.10" eyre = "0.6.8" futures = "0.3.29" governor = "0.6.0" @@ -35,7 +45,8 @@ heck = "0.4.1" indexmap = "2.1.0" indicatif = "0.17.7" lazy_static = "1.4.0" -polars = { version = "0.35.0", features = [ +mesc = "0.1.4" +polars = { version = "0.38.3", features = [ "parquet", "string_encoding", "polars-lazy", @@ -48,7 +59,7 @@ prefix-hex = "0.7.1" pyo3 = { version = "0.20.0", features = ["extension-module"] } pyo3-build-config = "0.20.0" pyo3-asyncio = { version = "0.20.0", features = ["tokio-runtime"] } -pyo3-polars = "0.9.0" +pyo3-polars = "0.12.0" rand = "0.8.5" regex = "1.10.2" serde = { version = "1.0.191", features = ["derive"] } diff --git a/README.md b/README.md index 4e8c564..f819001 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ to discuss cryo, check out [the telegram group](https://t.me/paradigm_data) 2. [Installation](#installation) 3. [Data Schema](#data-schemas) 4. [Code Guide](#code-guide) -5. [Documenation](#documentation) +5. [Documentation](#documentation) 1. [Basics](#cryo-help) 2. [Syntax](#cryo-syntax) 3. [Datasets](#cryo-datasets) @@ -42,6 +42,8 @@ For a more complex example, see the [Uniswap Example](./examples/uniswap.sh). ## Installation +The simplest way to use `cryo` is as a cli tool: + #### Method 1: install from source ```bash @@ -62,16 +64,20 @@ This method requires having rust installed. See [rustup](https://rustup.rs/) for Make sure that `~/.cargo/bin` is on your `PATH`. One way to do this is by adding the line `export PATH="$HOME/.cargo/bin:$PATH"` to your `~/.bashrc` or `~/.profile`. -#### Installing `cryo_python` from pypi +### Python Installation + +`cryo` can also be installed as a python package: + +#### Installing `cryo` python from pypi (make sure rust is installed first, see [rustup](https://www.rust-lang.org/tools/install)) ```bash pip install maturin -pip install cryo_python +pip install cryo ``` -#### Installing `cryo_python` from source +#### Installing `cryo` python from source ```bash pip install maturin @@ -160,7 +166,7 @@ Options: Content Options: -b, --blocks ... Block numbers, see syntax below - --timestamps ... Timestamp numbers in unix, overriden by blocks + --timestamps ... Timestamp numbers in unix, overridden by blocks -t, --txs ... Transaction hashes, see syntax below -a, --align Align chunk boundaries to regular intervals, e.g. (1000 2000 3000), not (1106 2106 3106) @@ -290,6 +296,7 @@ cryo datasets - erc20_metadata - erc20_supplies - erc20_transfers +- erc20_approvals - erc721_metadata - erc721_transfers - eth_calls diff --git a/book.toml b/book.toml new file mode 100644 index 0000000..7cf7206 --- /dev/null +++ b/book.toml @@ -0,0 +1,14 @@ +[book] +authors = ["sslivkoff"] +language = "en" +multilingual = false +src = "book" +title = "cryo" +description = "field manual for cryo" + +[build] +build-dir = "target/book" + +[output.html.fold] +enable = true +level = 1 diff --git a/book/SUMMARY.md b/book/SUMMARY.md new file mode 100644 index 0000000..eca243b --- /dev/null +++ b/book/SUMMARY.md @@ -0,0 +1,68 @@ +# Summary +- [Intro](./intro/intro.md) + - [Quickstart](./intro/quickstart.md) + - [Installation](./intro/installation.md) + - [Example Usage](./intro/example_usage.md) +- [Concepts](./intro/concepts.md) + - [Interfaces: CLI, Rust Python](./intro/interfaces.md) + - [RPC Data Sources](./intro/data_sources.md) + - [Speed](./cryo_python/speed.md) +- [Basic Usage](./basic_usage/basic_usage.md) + - [Data Selection](./basic_usage/data_selection.md) + - [Data Acquisition](./basic_usage/data_acquisition.md) + - [Data Formatting](./basic_usage/data_formatting.md) + - [Data Querying](./basic_usage/data_querying.md) +- [Cryo Python](./cryo_python/overview.md) + - [Installation](./cryo_python/installation.md) + - [Example Usage](./cryo_python/example_usage.md) + - [Reference](./cryo_python/reference.md) +- [Cookbook](./cookbook/cookbook.md) + - [Reorgs](./cookbook/reorgs.md) + - [Uniswap](./cookbook/uniswap.md) +- [Contributing](./contributing/contributing.md) + - [Repository Layout](./contributing/repository_layout.md) + - [Adding a Dataset](./contributing/adding_a_dataset.md) +- [Reference](./reference/reference.md) + - [Overview of each interface](./reference/interfaces/interfaces.md) + - [cli](./reference/interfaces/cli.md) + - [python](./reference/interfaces/python.md) + - [rust](./reference/interfaces/rust.md) + - [Overview of each dataset](./datasets/dataset_reference.md) + - [address_appearances](./datasets/address_appearances.md) + - [balance_diffs](./datasets/balance_diffs.md) + - [balance_reads](./datasets/balance_reads.md) + - [balances](./datasets/balances.md) + - [blocks](./datasets/blocks.md) + - [code_diffs](./datasets/code_diffs.md) + - [code_reads](./datasets/code_reads.md) + - [codes](./datasets/codes.md) + - [contracts](./datasets/contracts.md) + - [erc20_balances](./datasets/erc20_balances.md) + - [erc20_metadata](./datasets/erc20_metadata.md) + - [erc20_supplies](./datasets/erc20_supplies.md) + - [erc20_transfers](./datasets/erc20_transfers.md) + - [erc721_metadata](./datasets/erc721_metadata.md) + - [erc721_transfers](./datasets/erc721_transfers.md) + - [eth_calls](./datasets/eth_calls.md) + - [four_byte_counts](./datasets/four_byte_counts.md) + - [geth_calls](./datasets/geth_calls.md) + - [geth_code_diffs](./datasets/geth_code_diffs.md) + - [geth_balance_diffs](./datasets/geth_balance_diffs.md) + - [geth_storage_diffs](./datasets/geth_storage_diffs.md) + - [geth_nonce_diffs](./datasets/geth_nonce_diffs.md) + - [geth_opcodes](./datasets/geth_opcodes.md) + - [javascript_traces](./datasets/javascript_traces.md) + - [logs](./datasets/logs.md) + - [native_transfers](./datasets/native_transfers.md) + - [nonce_diffs](./datasets/nonce_diffs.md) + - [nonce_reads](./datasets/nonce_reads.md) + - [nonces](./datasets/nonces.md) + - [slots](./datasets/slots.md) + - [storage_reads](./datasets/storage_reads.md) + - [slot_diffs](./datasets/slot_diffs.md) + - [slot_reads](./datasets/slot_reads.md) + - [traces](./datasets/traces.md) + - [trace_calls](./datasets/trace_calls.md) + - [transactions](./datasets/transactions.md) + - [vm_traces](./datasets/vm_traces.md) +- [Additional Reading](./additional_reading/additional_reading.md) diff --git a/book/additional_reading/additional_reading.md b/book/additional_reading/additional_reading.md new file mode 100644 index 0000000..23058c0 --- /dev/null +++ b/book/additional_reading/additional_reading.md @@ -0,0 +1,15 @@ +# Additional Reading + +### RPC Information +- [Ultimate tracing reference](https://github.com/paradigmxyz/ultimate_evm_tracing_reference) + +### Cryo Tutorials +- [cryo: Your gateway to blockchain data](https://docs.chainstack.com/docs/cryo-your-gateway-to-blockchain-data) +- [Analyzing ethereum with cryo](https://mteam88.github.io/posts/analyzing-ethereum-with-cryo/) +- [Extracting blockchain data with cryo](https://www.degencode.com/p/extracting-blockchain-data-with-cryo) +- [Getting Started with Cryo Data Analysis in AWS SageMaker](https://hackmd.io/@shield3/rJpNocEga) + +### Articles using cryo +- [Ethereum Transfers Heatmap](https://banteg.xyz/posts/heatmap/) +- [Minimal Proxy Compendium](https://banteg.xyz/posts/minimal-proxies/) + diff --git a/book/basic_usage/basic_usage.md b/book/basic_usage/basic_usage.md new file mode 100644 index 0000000..e2a86b0 --- /dev/null +++ b/book/basic_usage/basic_usage.md @@ -0,0 +1 @@ +# Basic Usage diff --git a/book/basic_usage/data_acquisition.md b/book/basic_usage/data_acquisition.md new file mode 100644 index 0000000..35a836a --- /dev/null +++ b/book/basic_usage/data_acquisition.md @@ -0,0 +1,6 @@ +# Data Acquisition + +Chapter: Data Acquisition + - Ratelimits and Concurrency Limits + - Staying Close to Tip + - Logging diff --git a/book/basic_usage/data_formatting.md b/book/basic_usage/data_formatting.md new file mode 100644 index 0000000..c384dba --- /dev/null +++ b/book/basic_usage/data_formatting.md @@ -0,0 +1,7 @@ +# Data Formatting + +Chapter: Data Output Formatting + - Formatting Binary + - Formatting u256 + - Parquet Options + - Partitioning diff --git a/book/basic_usage/data_querying.md b/book/basic_usage/data_querying.md new file mode 100644 index 0000000..6f278a6 --- /dev/null +++ b/book/basic_usage/data_querying.md @@ -0,0 +1 @@ +# Data Querying diff --git a/book/basic_usage/data_selection.md b/book/basic_usage/data_selection.md new file mode 100644 index 0000000..957f841 --- /dev/null +++ b/book/basic_usage/data_selection.md @@ -0,0 +1,7 @@ +# Data Selection + +Chapter: Data Selection + - Block queries + - Filtering rows + - Filtering columns + - Command Chaining diff --git a/book/contributing/adding_a_dataset.md b/book/contributing/adding_a_dataset.md new file mode 100644 index 0000000..3ad35b9 --- /dev/null +++ b/book/contributing/adding_a_dataset.md @@ -0,0 +1 @@ +# Adding a Dataset diff --git a/book/contributing/contributing.md b/book/contributing/contributing.md new file mode 100644 index 0000000..854139a --- /dev/null +++ b/book/contributing/contributing.md @@ -0,0 +1 @@ +# Contributing diff --git a/book/contributing/repository_layout.md b/book/contributing/repository_layout.md new file mode 100644 index 0000000..583c56b --- /dev/null +++ b/book/contributing/repository_layout.md @@ -0,0 +1,5 @@ +# Repository Layout + + + + diff --git a/book/cookbook/cookbook.md b/book/cookbook/cookbook.md new file mode 100644 index 0000000..1ae5a04 --- /dev/null +++ b/book/cookbook/cookbook.md @@ -0,0 +1,6 @@ +# Cookbook + +Chapter: Specific Protocols + - ENS + - Chainlink + - Uniswap diff --git a/book/cookbook/reorgs.md b/book/cookbook/reorgs.md new file mode 100644 index 0000000..69bc211 --- /dev/null +++ b/book/cookbook/reorgs.md @@ -0,0 +1 @@ +# Reorg Management diff --git a/book/cookbook/uniswap.md b/book/cookbook/uniswap.md new file mode 100644 index 0000000..522ee9e --- /dev/null +++ b/book/cookbook/uniswap.md @@ -0,0 +1 @@ +# Uniswap diff --git a/book/cryo_python.md b/book/cryo_python.md new file mode 100644 index 0000000..4193ef4 --- /dev/null +++ b/book/cryo_python.md @@ -0,0 +1 @@ +# Python diff --git a/book/cryo_python/example_usage.md b/book/cryo_python/example_usage.md new file mode 100644 index 0000000..a5512fd --- /dev/null +++ b/book/cryo_python/example_usage.md @@ -0,0 +1 @@ +# example usage diff --git a/book/cryo_python/installation.md b/book/cryo_python/installation.md new file mode 100644 index 0000000..bd73f79 --- /dev/null +++ b/book/cryo_python/installation.md @@ -0,0 +1,29 @@ + +## Installation + +There are two main options for installing `cryo`. + +Installing from pip is faster and does not require rust to be installed. + +Installing from source allows using the latest unreleased version of cryo. + +#### Option 1: Install from pip + +``` +pip install cryo +``` + +#### Option 2: Install from source + +``` +pip install maturin +git clone https://github.com/paradigmxyz/cryo +cd cryo/crates/python +maturin build --release +pip install --force-reinstall .whl +``` + +#### Other notes + +If you would like `cryo` to output results using pandas instead of polars, also install pandas: `pip install pandas` + diff --git a/book/cryo_python/overview.md b/book/cryo_python/overview.md new file mode 100644 index 0000000..4193ef4 --- /dev/null +++ b/book/cryo_python/overview.md @@ -0,0 +1 @@ +# Python diff --git a/book/cryo_python/reference.md b/book/cryo_python/reference.md new file mode 100644 index 0000000..c770408 --- /dev/null +++ b/book/cryo_python/reference.md @@ -0,0 +1 @@ +# reference diff --git a/book/cryo_python/speed.md b/book/cryo_python/speed.md new file mode 100644 index 0000000..9a012c2 --- /dev/null +++ b/book/cryo_python/speed.md @@ -0,0 +1 @@ +# Speed diff --git a/book/datasets/address_appearances.md b/book/datasets/address_appearances.md new file mode 100644 index 0000000..55c021a --- /dev/null +++ b/book/datasets/address_appearances.md @@ -0,0 +1 @@ +# address_appearances diff --git a/book/datasets/balance_diffs.md b/book/datasets/balance_diffs.md new file mode 100644 index 0000000..1fac778 --- /dev/null +++ b/book/datasets/balance_diffs.md @@ -0,0 +1 @@ +# balance_diffs diff --git a/book/datasets/balance_reads.md b/book/datasets/balance_reads.md new file mode 100644 index 0000000..4e1616e --- /dev/null +++ b/book/datasets/balance_reads.md @@ -0,0 +1 @@ +# balance_reads diff --git a/book/datasets/balances.md b/book/datasets/balances.md new file mode 100644 index 0000000..9383b5f --- /dev/null +++ b/book/datasets/balances.md @@ -0,0 +1 @@ +# balances diff --git a/book/datasets/blocks.md b/book/datasets/blocks.md new file mode 100644 index 0000000..f8ef254 --- /dev/null +++ b/book/datasets/blocks.md @@ -0,0 +1 @@ +# calls diff --git a/book/datasets/code_diffs.md b/book/datasets/code_diffs.md new file mode 100644 index 0000000..600a3af --- /dev/null +++ b/book/datasets/code_diffs.md @@ -0,0 +1 @@ +# code_diffs diff --git a/book/datasets/code_reads.md b/book/datasets/code_reads.md new file mode 100644 index 0000000..df05379 --- /dev/null +++ b/book/datasets/code_reads.md @@ -0,0 +1 @@ +# code_reads diff --git a/book/datasets/codes.md b/book/datasets/codes.md new file mode 100644 index 0000000..00f9a3d --- /dev/null +++ b/book/datasets/codes.md @@ -0,0 +1 @@ +# codes diff --git a/book/datasets/contracts.md b/book/datasets/contracts.md new file mode 100644 index 0000000..b8bdce9 --- /dev/null +++ b/book/datasets/contracts.md @@ -0,0 +1 @@ +# contracts diff --git a/book/datasets/dataset_guide.md b/book/datasets/dataset_guide.md new file mode 100644 index 0000000..6fc8f73 --- /dev/null +++ b/book/datasets/dataset_guide.md @@ -0,0 +1,9 @@ +# Dataset Reference + +- for each dataset: + - semantic description + - schema + - tips and tricks + - available options + - examples in cli and python + - possibly: byte size and collection time diff --git a/book/datasets/dataset_reference.md b/book/datasets/dataset_reference.md new file mode 100644 index 0000000..451585e --- /dev/null +++ b/book/datasets/dataset_reference.md @@ -0,0 +1 @@ +# Dataset Reference diff --git a/book/datasets/erc20_balances.md b/book/datasets/erc20_balances.md new file mode 100644 index 0000000..21434f4 --- /dev/null +++ b/book/datasets/erc20_balances.md @@ -0,0 +1 @@ +# erc20_balances diff --git a/book/datasets/erc20_metadata.md b/book/datasets/erc20_metadata.md new file mode 100644 index 0000000..c807bf0 --- /dev/null +++ b/book/datasets/erc20_metadata.md @@ -0,0 +1 @@ +# erc20_metadata diff --git a/book/datasets/erc20_supplies.md b/book/datasets/erc20_supplies.md new file mode 100644 index 0000000..70d82f3 --- /dev/null +++ b/book/datasets/erc20_supplies.md @@ -0,0 +1 @@ +# erc20_supplies diff --git a/book/datasets/erc20_transfers.md b/book/datasets/erc20_transfers.md new file mode 100644 index 0000000..83c4c34 --- /dev/null +++ b/book/datasets/erc20_transfers.md @@ -0,0 +1 @@ +# erc20_transfers diff --git a/book/datasets/erc721_metadata.md b/book/datasets/erc721_metadata.md new file mode 100644 index 0000000..67a6c0e --- /dev/null +++ b/book/datasets/erc721_metadata.md @@ -0,0 +1 @@ +# erc721_metadata diff --git a/book/datasets/erc721_transfers.md b/book/datasets/erc721_transfers.md new file mode 100644 index 0000000..50d6ecc --- /dev/null +++ b/book/datasets/erc721_transfers.md @@ -0,0 +1 @@ +# erc721_transfers diff --git a/book/datasets/eth_calls.md b/book/datasets/eth_calls.md new file mode 100644 index 0000000..1a97bc5 --- /dev/null +++ b/book/datasets/eth_calls.md @@ -0,0 +1 @@ +# eth_calls diff --git a/book/datasets/four_byte_counts.md b/book/datasets/four_byte_counts.md new file mode 100644 index 0000000..fcc4082 --- /dev/null +++ b/book/datasets/four_byte_counts.md @@ -0,0 +1 @@ +# four_byte_counts diff --git a/book/datasets/geth_balance_diffs.md b/book/datasets/geth_balance_diffs.md new file mode 100644 index 0000000..1bf49de --- /dev/null +++ b/book/datasets/geth_balance_diffs.md @@ -0,0 +1 @@ +# geth_balance_diffs diff --git a/book/datasets/geth_calls.md b/book/datasets/geth_calls.md new file mode 100644 index 0000000..d569552 --- /dev/null +++ b/book/datasets/geth_calls.md @@ -0,0 +1 @@ +# geth_calls diff --git a/book/datasets/geth_code_diffs.md b/book/datasets/geth_code_diffs.md new file mode 100644 index 0000000..b40c109 --- /dev/null +++ b/book/datasets/geth_code_diffs.md @@ -0,0 +1 @@ +# geth_code_diffs diff --git a/book/datasets/geth_nonce_diffs.md b/book/datasets/geth_nonce_diffs.md new file mode 100644 index 0000000..30fdf88 --- /dev/null +++ b/book/datasets/geth_nonce_diffs.md @@ -0,0 +1 @@ +# geth_nonce_diffs diff --git a/book/datasets/geth_opcodes.md b/book/datasets/geth_opcodes.md new file mode 100644 index 0000000..dabcf2d --- /dev/null +++ b/book/datasets/geth_opcodes.md @@ -0,0 +1 @@ +# geth_opcodes diff --git a/book/datasets/geth_storage_diffs.md b/book/datasets/geth_storage_diffs.md new file mode 100644 index 0000000..528aa2f --- /dev/null +++ b/book/datasets/geth_storage_diffs.md @@ -0,0 +1 @@ +# geth_storage_diffs diff --git a/book/datasets/javascript_traces.md b/book/datasets/javascript_traces.md new file mode 100644 index 0000000..dddf27e --- /dev/null +++ b/book/datasets/javascript_traces.md @@ -0,0 +1 @@ +# javascript_traces diff --git a/book/datasets/logs.md b/book/datasets/logs.md new file mode 100644 index 0000000..5d22875 --- /dev/null +++ b/book/datasets/logs.md @@ -0,0 +1 @@ +# logs diff --git a/book/datasets/native_transfers.md b/book/datasets/native_transfers.md new file mode 100644 index 0000000..9ad5436 --- /dev/null +++ b/book/datasets/native_transfers.md @@ -0,0 +1 @@ +# native_transfers diff --git a/book/datasets/nonce_diffs.md b/book/datasets/nonce_diffs.md new file mode 100644 index 0000000..3b4d0c0 --- /dev/null +++ b/book/datasets/nonce_diffs.md @@ -0,0 +1 @@ +# nonce_diffs diff --git a/book/datasets/nonce_reads.md b/book/datasets/nonce_reads.md new file mode 100644 index 0000000..3c7409b --- /dev/null +++ b/book/datasets/nonce_reads.md @@ -0,0 +1 @@ +# nonce_reads diff --git a/book/datasets/nonces.md b/book/datasets/nonces.md new file mode 100644 index 0000000..deafc3d --- /dev/null +++ b/book/datasets/nonces.md @@ -0,0 +1 @@ +# nonces diff --git a/book/datasets/slot_diffs.md b/book/datasets/slot_diffs.md new file mode 100644 index 0000000..262ccca --- /dev/null +++ b/book/datasets/slot_diffs.md @@ -0,0 +1 @@ +# slot_diffs diff --git a/book/datasets/slot_reads.md b/book/datasets/slot_reads.md new file mode 100644 index 0000000..35eda6a --- /dev/null +++ b/book/datasets/slot_reads.md @@ -0,0 +1 @@ +# slot_reads diff --git a/book/datasets/slots.md b/book/datasets/slots.md new file mode 100644 index 0000000..e081a45 --- /dev/null +++ b/book/datasets/slots.md @@ -0,0 +1 @@ +# slots diff --git a/book/datasets/storage_reads.md b/book/datasets/storage_reads.md new file mode 100644 index 0000000..503b919 --- /dev/null +++ b/book/datasets/storage_reads.md @@ -0,0 +1 @@ +# storage_reads diff --git a/book/datasets/trace_calls.md b/book/datasets/trace_calls.md new file mode 100644 index 0000000..c335f0f --- /dev/null +++ b/book/datasets/trace_calls.md @@ -0,0 +1 @@ +# trace_calls diff --git a/book/datasets/traces.md b/book/datasets/traces.md new file mode 100644 index 0000000..6d82ffc --- /dev/null +++ b/book/datasets/traces.md @@ -0,0 +1 @@ +# traces diff --git a/book/datasets/transactions.md b/book/datasets/transactions.md new file mode 100644 index 0000000..2959e69 --- /dev/null +++ b/book/datasets/transactions.md @@ -0,0 +1 @@ +# transactions diff --git a/book/datasets/vm_traces.md b/book/datasets/vm_traces.md new file mode 100644 index 0000000..6389424 --- /dev/null +++ b/book/datasets/vm_traces.md @@ -0,0 +1 @@ +# vm_traces diff --git a/book/intro/concepts.md b/book/intro/concepts.md new file mode 100644 index 0000000..2bbaba2 --- /dev/null +++ b/book/intro/concepts.md @@ -0,0 +1,2 @@ +# Concepts +- Time dimension: Blocks vs Transactions vs Timestamps (and Ranges) diff --git a/book/intro/data_sources.md b/book/intro/data_sources.md new file mode 100644 index 0000000..4c7519c --- /dev/null +++ b/book/intro/data_sources.md @@ -0,0 +1 @@ +# RPC Data Sources diff --git a/book/intro/example_usage.md b/book/intro/example_usage.md new file mode 100644 index 0000000..a56da81 --- /dev/null +++ b/book/intro/example_usage.md @@ -0,0 +1 @@ +# Example Usage diff --git a/book/intro/installation.md b/book/intro/installation.md new file mode 100644 index 0000000..25267fe --- /dev/null +++ b/book/intro/installation.md @@ -0,0 +1 @@ +# Installation diff --git a/book/intro/interfaces.md b/book/intro/interfaces.md new file mode 100644 index 0000000..f0b0a81 --- /dev/null +++ b/book/intro/interfaces.md @@ -0,0 +1 @@ +# Interfaces: CLI, Rust Python diff --git a/book/intro/intro.md b/book/intro/intro.md new file mode 100644 index 0000000..1e0981f --- /dev/null +++ b/book/intro/intro.md @@ -0,0 +1 @@ +# Intro diff --git a/book/intro/quickstart.md b/book/intro/quickstart.md new file mode 100644 index 0000000..acb9843 --- /dev/null +++ b/book/intro/quickstart.md @@ -0,0 +1 @@ +# Quickstart diff --git a/book/quickstart.md b/book/quickstart.md new file mode 100644 index 0000000..acb9843 --- /dev/null +++ b/book/quickstart.md @@ -0,0 +1 @@ +# Quickstart diff --git a/book/reference/interfaces/cli.md b/book/reference/interfaces/cli.md new file mode 100644 index 0000000..ecfe9df --- /dev/null +++ b/book/reference/interfaces/cli.md @@ -0,0 +1 @@ +# cli diff --git a/book/reference/interfaces/interfaces.md b/book/reference/interfaces/interfaces.md new file mode 100644 index 0000000..31897c8 --- /dev/null +++ b/book/reference/interfaces/interfaces.md @@ -0,0 +1 @@ +# Overview of each interface diff --git a/book/reference/interfaces/python.md b/book/reference/interfaces/python.md new file mode 100644 index 0000000..ebf14b2 --- /dev/null +++ b/book/reference/interfaces/python.md @@ -0,0 +1 @@ +# python diff --git a/book/reference/interfaces/rust.md b/book/reference/interfaces/rust.md new file mode 100644 index 0000000..27f2574 --- /dev/null +++ b/book/reference/interfaces/rust.md @@ -0,0 +1 @@ +# rust diff --git a/book/reference/reference.md b/book/reference/reference.md new file mode 100644 index 0000000..cf5aa07 --- /dev/null +++ b/book/reference/reference.md @@ -0,0 +1 @@ +# Reference diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 3421947..9e430b1 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -4,7 +4,6 @@ description = "cryo is the easiest way to extract blockchain data to parquet, cs version.workspace = true edition.workspace = true license.workspace = true -homepage.workspace = true repository.workspace = true [lib] @@ -18,16 +17,16 @@ path = "src/main.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cryo_freeze = { version = "0.3.0", path = "../freeze" } - +alloy = { workspace = true } anstyle = { workspace = true } clap_cryo = { workspace = true } color-print = { workspace = true } colored = { workspace = true } -ethers = { workspace = true } +cryo_freeze = { workspace = true } eyre = { workspace = true } governor = { workspace = true } hex = { workspace = true } +mesc = { workspace = true } polars = { workspace = true } rand = { workspace = true } serde = { workspace = true } diff --git a/crates/cli/src/args.rs b/crates/cli/src/args.rs index a147845..238db4e 100644 --- a/crates/cli/src/args.rs +++ b/crates/cli/src/args.rs @@ -86,7 +86,7 @@ pub struct Args { #[arg(long, help_heading = "Content Options")] pub exclude_failed: bool, - /// RPC url [default: ETH_RPC_URL env var] + /// RPC url [default: 1. MESC 2. ETH_RPC_URL] #[arg(short, long, help_heading = "Source Options")] pub rpc: Option, @@ -106,6 +106,10 @@ pub struct Args { #[arg(long, default_value_t = 500, value_name = "B", help_heading = "Acquisition Options")] pub initial_backoff: u64, + /// The number of compute units per second for this provider + #[arg(long, default_value_t = 50, value_name = "U", help_heading = "Acquisition Options")] + pub compute_units_per_second: u64, + /// Global number of concurrent requests #[arg(long, value_name = "M", help_heading = "Acquisition Options")] pub max_concurrent_requests: Option, @@ -114,7 +118,7 @@ pub struct Args { #[arg(long, value_name = "M", help_heading = "Acquisition Options")] pub max_concurrent_chunks: Option, - /// Chunk collection order (normal, reverse, or random) + /// Chunk collection order (normal, reverse, random) #[arg(long, help_heading = "Acquisition Options")] pub chunk_order: Option, diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 8fcebe2..516f23d 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -1,4 +1,4 @@ -//! utilties for parsing user inputs to run cryo +//! utilities for parsing user inputs to run cryo #![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] #![deny(unused_must_use, rust_2018_idioms)] diff --git a/crates/cli/src/parse/args.rs b/crates/cli/src/parse/args.rs index f2b03e2..2e6ad87 100644 --- a/crates/cli/src/parse/args.rs +++ b/crates/cli/src/parse/args.rs @@ -12,7 +12,7 @@ pub async fn parse_args( args: &Args, ) -> Result<(Query, Source, FileOutput, ExecutionEnv), ParseError> { let source = source::parse_source(args).await?; - let query = query::parse_query(args, Arc::clone(&source.fetcher)).await?; + let query = query::parse_query(args, Arc::new(source.clone())).await?; let sink = file_output::parse_file_output(args, &source)?; let env = execution::parse_execution_env(args, query.n_tasks() as u64)?; Ok((query, source, sink, env)) diff --git a/crates/cli/src/parse/blocks.rs b/crates/cli/src/parse/blocks.rs index 8cd355c..a9e75df 100644 --- a/crates/cli/src/parse/blocks.rs +++ b/crates/cli/src/parse/blocks.rs @@ -1,14 +1,13 @@ -use ethers::prelude::*; use polars::prelude::*; use std::collections::HashMap; -use cryo_freeze::{BlockChunk, ChunkData, Datatype, Fetcher, ParseError, Subchunk, Table}; +use cryo_freeze::{BlockChunk, ChunkData, Datatype, ParseError, Source, Subchunk, Table}; use crate::args::Args; -pub(crate) async fn parse_blocks( +pub(crate) async fn parse_blocks( args: &Args, - fetcher: Arc>, + source: Arc, ) -> Result<(Option>>, Option>), ParseError> { let (files, explicit_numbers): (Vec<&String>, Vec<&String>) = match &args.blocks { Some(blocks) => blocks.iter().partition(|tx| std::path::Path::new(tx).exists()), @@ -45,10 +44,10 @@ pub(crate) async fn parse_blocks( // parse inputs into BlockChunks let mut block_chunks = Vec::new(); for explicit_number in explicit_numbers { - let outputs = parse_block_inputs(explicit_number, &fetcher).await?; + let outputs = parse_block_inputs(explicit_number, source.clone()).await?; block_chunks.extend(outputs); } - postprocess_block_chunks(block_chunks, args, fetcher).await? + postprocess_block_chunks(block_chunks, args, source).await? } else { Vec::new() }; @@ -105,10 +104,10 @@ fn read_integer_column(path: &str, column: &str) -> Result, ParseError> } } -pub(crate) async fn postprocess_block_chunks( +pub(crate) async fn postprocess_block_chunks( block_chunks: Vec, args: &Args, - fetcher: Arc>, + source: Arc, ) -> Result, ParseError> { // align let block_chunks = if args.align { @@ -124,14 +123,14 @@ pub(crate) async fn postprocess_block_chunks( }; // apply reorg buffer - let block_chunks = apply_reorg_buffer(block_chunks, args.reorg_buffer, &fetcher).await?; + let block_chunks = apply_reorg_buffer(block_chunks, args.reorg_buffer, source).await?; Ok(block_chunks) } -pub(crate) async fn get_default_block_chunks( +pub(crate) async fn get_default_block_chunks( args: &Args, - fetcher: Arc>, + source: Arc, schemas: &HashMap, ) -> Result, ParseError> { let default_blocks = match schemas @@ -142,14 +141,14 @@ pub(crate) async fn get_default_block_chunks( Some(Some(blocks)) => blocks, _ => "0:latest".to_string(), }; - let block_chunks = parse_block_inputs(&default_blocks, &fetcher).await?; - postprocess_block_chunks(block_chunks, args, fetcher).await + let block_chunks = parse_block_inputs(&default_blocks, source.clone()).await?; + postprocess_block_chunks(block_chunks, args, source).await } /// parse block numbers to freeze -async fn parse_block_inputs( +async fn parse_block_inputs( inputs: &str, - fetcher: &Fetcher

, + source: Arc, ) -> Result, ParseError> { let parts: Vec<&str> = inputs.split(' ').collect(); match parts.len() { @@ -157,35 +156,36 @@ async fn parse_block_inputs( let first_input = parts.first().ok_or_else(|| { ParseError::ParseError("Failed to get the first input".to_string()) })?; - parse_block_token(first_input, true, fetcher).await.map(|x| vec![x]) + parse_block_token(first_input, true, source).await.map(|x| vec![x]) } _ => { let mut chunks = Vec::new(); for part in parts { - chunks.push(parse_block_token(part, false, fetcher).await?); + chunks.push(parse_block_token(part, false, source.clone()).await?); } Ok(chunks) } } } +#[derive(Clone, Debug)] enum RangePosition { First, Last, None, } -async fn parse_block_token( +async fn parse_block_token( s: &str, as_range: bool, - fetcher: &Fetcher

, + source: Arc, ) -> Result { let s = s.replace('_', ""); let parts: Vec<&str> = s.split(':').collect(); match parts.as_slice() { [block_ref] => { - let block = parse_block_number(block_ref, RangePosition::None, fetcher).await?; + let block = parse_block_number(block_ref, RangePosition::None, source).await?; Ok(BlockChunk::Numbers(vec![block])) } [first_ref, second_ref] => { @@ -199,13 +199,11 @@ async fn parse_block_token( (*second_ref, None) }; - let (start_block, end_block) = - parse_block_range(first_ref, second_ref, fetcher).await?; + let (start_block, end_block) = parse_block_range(first_ref, second_ref, source).await?; block_range_to_block_chunk(start_block, end_block, as_range, None, n_keep) } [first_ref, second_ref, third_ref] => { - let (start_block, end_block) = - parse_block_range(first_ref, second_ref, fetcher).await?; + let (start_block, end_block) = parse_block_range(first_ref, second_ref, source).await?; let range_size = third_ref .parse::() .map_err(|_e| ParseError::ParseError("start_block parse error".to_string()))?; @@ -251,11 +249,11 @@ pub(crate) fn block_range_to_block_chunk( fn evenly_spaced_subset(items: Vec, subset_length: usize) -> Vec { if subset_length == 0 || items.is_empty() { - return Vec::new() + return Vec::new(); } if subset_length >= items.len() { - return items.to_vec() + return items.to_vec(); } let original_length = items.len(); @@ -273,17 +271,14 @@ fn evenly_spaced_subset(items: Vec, subset_length: usize) -> Vec subset } -async fn parse_block_range

( +async fn parse_block_range( first_ref: &str, second_ref: &str, - fetcher: &Fetcher

, -) -> Result<(u64, u64), ParseError> -where - P: JsonRpcClient, -{ + source: Arc, +) -> Result<(u64, u64), ParseError> { let (start_block, end_block) = match (first_ref, second_ref) { _ if first_ref.starts_with('-') => { - let end_block = parse_block_number(second_ref, RangePosition::Last, fetcher).await?; + let end_block = parse_block_number(second_ref, RangePosition::Last, source).await?; let start_block = end_block .checked_sub(first_ref[1..].parse::().map_err(|_e| { @@ -293,7 +288,7 @@ where (start_block, end_block) } _ if second_ref.starts_with('+') => { - let start_block = parse_block_number(first_ref, RangePosition::First, fetcher).await?; + let start_block = parse_block_number(first_ref, RangePosition::First, source).await?; let end_block = start_block .checked_add(second_ref[1..].parse::().map_err(|_e| { @@ -303,8 +298,9 @@ where (start_block, end_block) } _ => { - let start_block = parse_block_number(first_ref, RangePosition::First, fetcher).await?; - let end_block = parse_block_number(second_ref, RangePosition::Last, fetcher).await?; + let start_block = + parse_block_number(first_ref, RangePosition::First, source.clone()).await?; + let end_block = parse_block_number(second_ref, RangePosition::Last, source).await?; (start_block, end_block) } }; @@ -321,38 +317,37 @@ where Ok((start_block, end_block)) } -async fn parse_block_number( +async fn parse_block_number( block_ref: &str, range_position: RangePosition, - fetcher: &Fetcher

, + source: Arc, ) -> Result { match (block_ref, range_position) { - ("latest", _) => fetcher.get_block_number().await.map(|n| n.as_u64()).map_err(|_e| { + ("latest", _) => source.get_block_number().await.map_err(|_e| { ParseError::ParseError("Error retrieving latest block number".to_string()) }), ("", RangePosition::First) => Ok(0), - ("", RangePosition::Last) => { - fetcher.get_block_number().await.map(|n| n.as_u64()).map_err(|_e| { - ParseError::ParseError("Error retrieving last block number".to_string()) - }) - } + ("", RangePosition::Last) => source + .get_block_number() + .await + .map_err(|_e| ParseError::ParseError("Error retrieving last block number".to_string())), ("", RangePosition::None) => Err(ParseError::ParseError("invalid input".to_string())), _ if block_ref.ends_with('B') | block_ref.ends_with('b') => { let s = &block_ref[..block_ref.len() - 1]; s.parse::() - .map(|n| (1e9 * n) as u64) + .map(|n| (1e9 * n).round() as u64) .map_err(|_e| ParseError::ParseError("Error parsing block ref".to_string())) } _ if block_ref.ends_with('M') | block_ref.ends_with('m') => { let s = &block_ref[..block_ref.len() - 1]; s.parse::() - .map(|n| (1e6 * n) as u64) + .map(|n| (1e6 * n).round() as u64) .map_err(|_e| ParseError::ParseError("Error parsing block ref".to_string())) } _ if block_ref.ends_with('K') | block_ref.ends_with('k') => { let s = &block_ref[..block_ref.len() - 1]; s.parse::() - .map(|n| (1e3 * n) as u64) + .map(|n| (1e3 * n).round() as u64) .map_err(|_e| ParseError::ParseError("Error parsing block ref".to_string())) } _ => block_ref @@ -362,16 +357,16 @@ async fn parse_block_number( } } -async fn apply_reorg_buffer( +async fn apply_reorg_buffer( block_chunks: Vec, reorg_filter: u64, - fetcher: &Fetcher

, + source: Arc, ) -> Result, ParseError> { match reorg_filter { 0 => Ok(block_chunks), reorg_filter => { - let latest_block = match fetcher.get_block_number().await { - Ok(result) => result.as_u64(), + let latest_block = match source.get_block_number().await { + Ok(result) => result, Err(_e) => { return Err(ParseError::ParseError("reorg buffer parse error".to_string())) } @@ -388,49 +383,73 @@ async fn apply_reorg_buffer( } } -pub(crate) async fn get_latest_block_number( - fetcher: &Fetcher

, -) -> Result { - fetcher +pub(crate) async fn get_latest_block_number(source: Arc) -> Result { + source .get_block_number() .await - .map(|n| n.as_u64()) .map_err(|_e| ParseError::ParseError("Error retrieving latest block number".to_string())) } #[cfg(test)] mod tests { + use std::path::PathBuf; + + use alloy::{ + providers::{IpcConnect, ProviderBuilder}, + transports::ipc::MockIpcServer, + }; + use super::*; + #[derive(Clone, Debug)] enum BlockTokenTest<'a> { WithoutMock((&'a str, BlockChunk)), // Token | Expected WithMock((&'a str, BlockChunk, u64)), // Token | Expected | Mock Block Response } - async fn block_token_test_helper(tests: Vec<(BlockTokenTest<'_>, bool)>) { - let (provider, mock) = Provider::mocked(); - let fetcher = Fetcher { provider, semaphore: None, rate_limiter: None }; + async fn block_token_test_helper( + tests: Vec<(BlockTokenTest<'_>, bool)>, + mock_ipc_path: PathBuf, + ) { + let ipc = IpcConnect::new(mock_ipc_path); + let provider = ProviderBuilder::new().on_ipc(ipc).await.unwrap().boxed(); + let source = Source { + provider, + semaphore: Arc::new(None), + rate_limiter: Arc::new(None), + chain_id: 1, + inner_request_size: 1, + max_concurrent_chunks: None, + rpc_url: "".to_string(), + labels: cryo_freeze::SourceLabels::default(), + }; + let source = Arc::new(source); for (test, res) in tests { match test { - BlockTokenTest::WithMock((token, expected, latest)) => { - mock.push(U64::from(latest)).unwrap(); - assert_eq!(block_token_test_executor(token, expected, &fetcher).await, res); + BlockTokenTest::WithMock((token, expected, _latest)) => { + assert_eq!( + block_token_test_executor(token, expected, source.clone()).await, + res + ); } BlockTokenTest::WithoutMock((token, expected)) => { - assert_eq!(block_token_test_executor(token, expected, &fetcher).await, res); + assert_eq!( + block_token_test_executor(token, expected, source.clone()).await, + res + ); } } } } - async fn block_token_test_executor( + async fn block_token_test_executor( token: &str, expected: BlockChunk, - fetcher: &Fetcher

, + source: Arc, ) -> bool { match expected { BlockChunk::Numbers(expected_block_numbers) => { - let block_chunks = parse_block_token(token, false, fetcher).await.unwrap(); + let block_chunks = parse_block_token(token, false, source).await.unwrap(); assert!(matches!(block_chunks, BlockChunk::Numbers { .. })); let BlockChunk::Numbers(block_numbers) = block_chunks else { panic!("Unexpected shape") @@ -438,7 +457,7 @@ mod tests { block_numbers == expected_block_numbers } BlockChunk::Range(expected_range_start, expected_range_end) => { - let block_chunks = parse_block_token(token, true, fetcher).await.unwrap(); + let block_chunks = parse_block_token(token, true, source).await.unwrap(); assert!(matches!(block_chunks, BlockChunk::Range { .. })); let BlockChunk::Range(range_start, range_end) = block_chunks else { panic!("Unexpected shape") @@ -448,25 +467,41 @@ mod tests { } } + #[derive(Clone, Debug)] enum BlockInputTest<'a> { WithoutMock((&'a String, Vec)), // Token | Expected WithMock((&'a String, Vec, u64)), // Token | Expected | Mock Block Response } - async fn block_input_test_helper(tests: Vec<(BlockInputTest<'_>, bool)>) { - let (provider, mock) = Provider::mocked(); - let fetcher = Fetcher { provider, semaphore: None, rate_limiter: None }; + async fn block_input_test_helper( + tests: Vec<(BlockInputTest<'_>, bool)>, + mock_ipc_path: PathBuf, + ) { + let ipc = IpcConnect::new(mock_ipc_path); + let provider = ProviderBuilder::new().on_ipc(ipc).await.unwrap().boxed(); + let source = Arc::new(Source { + provider, + chain_id: 1, + rpc_url: "".to_string(), + inner_request_size: 1, + semaphore: Arc::new(None), + max_concurrent_chunks: Some(1), + rate_limiter: Arc::new(None), + labels: cryo_freeze::SourceLabels::default(), + }); for (test, res) in tests { match test { - BlockInputTest::WithMock((inputs, expected, latest)) => { - mock.push(U64::from(latest)).unwrap(); - assert_eq!(block_input_test_executor(inputs, expected, &fetcher).await, res); + BlockInputTest::WithMock((inputs, expected, _latest)) => { + assert_eq!( + block_input_test_executor(inputs, expected, source.clone()).await, + res + ); } BlockInputTest::WithoutMock((inputs, expected)) => { println!("RES {:?}", res); println!("inputs {:?}", inputs); println!("EXPECTED {:?}", expected); - let actual = block_input_test_executor(inputs, expected, &fetcher).await; + let actual = block_input_test_executor(inputs, expected, source.clone()).await; println!("ACTUAL {:?}", actual); assert_eq!(actual, res); } @@ -474,12 +509,12 @@ mod tests { } } - async fn block_input_test_executor( + async fn block_input_test_executor( inputs: &str, expected: Vec, - fetcher: &Fetcher

, + source: Arc, ) -> bool { - let block_chunks = parse_block_inputs(inputs, fetcher).await.unwrap(); + let block_chunks = parse_block_inputs(inputs, source).await.unwrap(); assert_eq!(block_chunks.len(), expected.len()); for (i, block_chunk) in block_chunks.iter().enumerate() { let expected_chunk = &expected[i]; @@ -492,7 +527,7 @@ mod tests { panic!("Unexpected shape") }; if expected_block_numbers != block_numbers { - return false + return false; } } BlockChunk::Range(expected_range_start, expected_range_end) => { @@ -501,7 +536,7 @@ mod tests { panic!("Unexpected shape") }; if expected_range_start != range_start || expected_range_end != range_end { - return false + return false; } } } @@ -509,28 +544,52 @@ mod tests { true } + #[derive(Clone, Debug)] enum BlockNumberTest<'a> { WithoutMock((&'a str, RangePosition, u64)), WithMock((&'a str, RangePosition, u64, u64)), } - async fn block_number_test_helper(tests: Vec<(BlockNumberTest<'_>, bool)>) { - let (provider, mock) = Provider::mocked(); - let fetcher = Fetcher { provider, semaphore: None, rate_limiter: None }; + async fn block_number_test_helper( + tests: Vec<(BlockNumberTest<'_>, bool)>, + mock_ipc_path: PathBuf, + ) { + let provider = + ProviderBuilder::new().on_ipc(IpcConnect::new(mock_ipc_path)).await.unwrap().boxed(); + let source = Source { + provider, + semaphore: Arc::new(None), + rate_limiter: Arc::new(None), + chain_id: 1, + inner_request_size: 1, + max_concurrent_chunks: Some(1), + rpc_url: "".to_string(), + labels: cryo_freeze::SourceLabels::default(), + }; + let source = Arc::new(source); for (test, res) in tests { match test { - BlockNumberTest::WithMock((block_ref, range_position, expected, latest)) => { - mock.push(U64::from(latest)).unwrap(); + BlockNumberTest::WithMock((block_ref, range_position, expected, _latest)) => { assert_eq!( - block_number_test_executor(block_ref, range_position, expected, &fetcher) - .await, + block_number_test_executor( + block_ref, + range_position, + expected, + source.clone() + ) + .await, res ); } BlockNumberTest::WithoutMock((block_ref, range_position, expected)) => { assert_eq!( - block_number_test_executor(block_ref, range_position, expected, &fetcher) - .await, + block_number_test_executor( + block_ref, + range_position, + expected, + source.clone() + ) + .await, res ); } @@ -538,13 +597,13 @@ mod tests { } } - async fn block_number_test_executor( + async fn block_number_test_executor( block_ref: &str, range_position: RangePosition, expected: u64, - fetcher: &Fetcher

, + source: Arc, ) -> bool { - let block_number = parse_block_number(block_ref, range_position, fetcher).await.unwrap(); + let block_number = parse_block_number(block_ref, range_position, source).await.unwrap(); block_number == expected } @@ -562,7 +621,18 @@ mod tests { // Number type (BlockTokenTest::WithoutMock((r"1", BlockChunk::Numbers(vec![1]))), true), /* Single block */ ]; - block_token_test_helper(tests).await; + let mut mock_server = MockIpcServer::new(); + let mock_ipc_path = mock_server.path().clone(); + for (test, _) in tests.clone().into_iter() { + match test { + BlockTokenTest::WithoutMock(_) => {} + BlockTokenTest::WithMock((_, _, mock_response)) => { + mock_server.add_reply(mock_response) + } + } + } + mock_server.spawn().await; + block_token_test_helper(tests, mock_ipc_path).await; } #[tokio::test] @@ -606,7 +676,16 @@ mod tests { true, ), // Multi input complex ]; - block_input_test_helper(tests).await; + let mut mock_server = MockIpcServer::new(); + let mock_ipc_path = mock_server.path().clone(); + for (test, _) in tests.clone() { + match test { + BlockInputTest::WithMock((_, _, expected)) => mock_server.add_reply(expected), + BlockInputTest::WithoutMock(_) => {} + } + } + mock_server.spawn().await; + block_input_test_helper(tests, mock_ipc_path).await; } #[tokio::test] @@ -614,7 +693,7 @@ mod tests { // Ranges let tests: Vec<(BlockNumberTest<'_>, bool)> = vec![ (BlockNumberTest::WithoutMock((r"1", RangePosition::None, 1)), true), // Integer - (BlockNumberTest::WithMock((r"latest", RangePosition::None, 12, 12)), true), /* Lastest block */ + (BlockNumberTest::WithMock((r"latest", RangePosition::None, 12, 12)), true), /* Latest block */ (BlockNumberTest::WithoutMock((r"", RangePosition::First, 0)), true), // First block (BlockNumberTest::WithMock((r"", RangePosition::Last, 12, 12)), true), // Last block (BlockNumberTest::WithoutMock((r"1B", RangePosition::None, 1000000000)), true), // B @@ -624,6 +703,15 @@ mod tests { (BlockNumberTest::WithoutMock((r"1m", RangePosition::None, 1000000)), true), // m (BlockNumberTest::WithoutMock((r"1k", RangePosition::None, 1000)), true), // k ]; - block_number_test_helper(tests).await; + let mut mock_server = MockIpcServer::new(); + let mock_ipc_path = mock_server.path().clone(); + for (test, _) in tests.clone() { + match test { + BlockNumberTest::WithMock((_, _, _, expected)) => mock_server.add_reply(expected), + BlockNumberTest::WithoutMock(_) => {} + } + } + mock_server.spawn().await; + block_number_test_helper(tests, mock_ipc_path).await; } } diff --git a/crates/cli/src/parse/file_output.rs b/crates/cli/src/parse/file_output.rs index e5d0417..db6430b 100644 --- a/crates/cli/src/parse/file_output.rs +++ b/crates/cli/src/parse/file_output.rs @@ -142,7 +142,7 @@ fn parse_row_group_size( ) -> Option { match (row_group_size, n_row_groups, chunk_size) { (Some(row_group_size), _, _) => Some(row_group_size), - (_, Some(n_row_groups), Some(cs)) => Some((cs + n_row_groups - 1) / n_row_groups), + (_, Some(n_row_groups), Some(cs)) => Some(cs.div_ceil(n_row_groups)), _ => None, } } diff --git a/crates/cli/src/parse/parse_utils.rs b/crates/cli/src/parse/parse_utils.rs index 35313e9..d445df4 100644 --- a/crates/cli/src/parse/parse_utils.rs +++ b/crates/cli/src/parse/parse_utils.rs @@ -1,7 +1,7 @@ use cryo_freeze::ParseError; use std::collections::HashMap; -pub(crate) fn hex_string_to_binary(hex_string: &String) -> Result, ParseError> { +pub(crate) fn hex_string_to_binary(hex_string: &str) -> Result, ParseError> { let hex_string = hex_string.strip_prefix("0x").unwrap_or(hex_string); hex::decode(hex_string) .map_err(|_| ParseError::ParseError("could not parse data as hex".to_string())) @@ -51,8 +51,13 @@ pub(crate) fn parse_binary_arg( let mut parsed = HashMap::new(); // separate into files vs explicit - let (files, hex_strings): (Vec<&String>, Vec<&String>) = - inputs.iter().partition(|tx| std::path::Path::new(tx).exists()); + let (files, hex_strings): (Vec<&String>, Vec<&String>) = inputs.iter().partition(|tx| { + // strip off column name if present + match parse_file_column_reference(tx, default_column) { + Ok(reference) => std::path::Path::new(&reference.path).exists(), + _ => false, + } + }); // files columns for path in files { diff --git a/crates/cli/src/parse/partitions.rs b/crates/cli/src/parse/partitions.rs index 4acaa92..0816435 100644 --- a/crates/cli/src/parse/partitions.rs +++ b/crates/cli/src/parse/partitions.rs @@ -5,27 +5,26 @@ use super::{ }; use crate::args::Args; use cryo_freeze::{ - AddressChunk, CallDataChunk, Datatype, Dim, Fetcher, ParseError, Partition, PartitionLabels, - SlotChunk, Table, TimeDimension, TopicChunk, TransactionChunk, + AddressChunk, CallDataChunk, Datatype, Dim, ParseError, Partition, PartitionLabels, SlotChunk, + Source, Table, TimeDimension, TopicChunk, TransactionChunk, }; -use ethers::prelude::*; use rand::{seq::SliceRandom, thread_rng}; use std::{collections::HashMap, str::FromStr, sync::Arc}; type ChunkLabels = Vec>; -pub(crate) async fn parse_partitions( +pub(crate) async fn parse_partitions( args: &Args, - fetcher: Arc>, + source: Arc, schemas: &HashMap, ) -> Result<(Vec, Vec, TimeDimension), ParseError> { // TODO: if wanting to chunk these non-block dimensions, do it in parse_binary_arg() // TODO: map from args to dim is not exhaustive // parse chunk data - let (block_number_labels, block_numbers) = blocks::parse_blocks(args, fetcher.clone()).await?; + let (block_number_labels, block_numbers) = blocks::parse_blocks(args, source.clone()).await?; let (block_number_labels, block_numbers) = if block_numbers.is_none() { - timestamps::parse_timestamps(args, fetcher.clone()).await? + timestamps::parse_timestamps(args, source.clone()).await? } else { (block_number_labels, block_numbers) }; @@ -46,7 +45,7 @@ pub(crate) async fn parse_partitions( // set default blocks let block_numbers = if block_numbers.is_none() && transactions.is_none() { - Some(blocks::get_default_block_chunks(args, fetcher, schemas).await?) + Some(blocks::get_default_block_chunks(args, source, schemas).await?) } else { block_numbers }; diff --git a/crates/cli/src/parse/query.rs b/crates/cli/src/parse/query.rs index 7f0f495..329319e 100644 --- a/crates/cli/src/parse/query.rs +++ b/crates/cli/src/parse/query.rs @@ -1,14 +1,10 @@ use super::{parse_schemas, partitions}; use crate::args::Args; -use cryo_freeze::{Dim, Fetcher, ParseError, Query, QueryLabels, Schemas}; -use ethers::prelude::*; +use cryo_freeze::{Dim, ParseError, Query, QueryLabels, Schemas, Source}; use std::sync::Arc; /// parse Query struct from cli Args -pub async fn parse_query( - args: &Args, - fetcher: Arc>, -) -> Result { +pub async fn parse_query(args: &Args, source: Arc) -> Result { let (datatypes, schemas) = parse_schemas(args)?; let arg_aliases = find_arg_aliases(args, &schemas); @@ -17,7 +13,7 @@ pub async fn parse_query( let args = new_args.as_ref().unwrap_or(args); let (partitions, partitioned_by, time_dimension) = - partitions::parse_partitions(args, fetcher, &schemas).await?; + partitions::parse_partitions(args, source, &schemas).await?; let datatypes = cryo_freeze::cluster_datatypes(datatypes); let labels = QueryLabels { align: args.align, reorg_buffer: args.reorg_buffer }; Ok(Query { @@ -79,20 +75,7 @@ impl DimIsNone for Args { } fn dim_is_none(&self, dim: &Dim) -> bool { - match dim { - Dim::BlockNumber => self.blocks.is_none(), - Dim::TransactionHash => self.txs.is_none(), - Dim::Address => self.address.is_none(), - Dim::FromAddress => self.from_address.is_none(), - Dim::ToAddress => self.to_address.is_none(), - Dim::Contract => self.contract.is_none(), - Dim::CallData => self.call_data.is_none(), - Dim::Slot => self.slot.is_none(), - Dim::Topic0 => self.topic0.is_none(), - Dim::Topic1 => self.topic1.is_none(), - Dim::Topic2 => self.topic2.is_none(), - Dim::Topic3 => self.topic3.is_none(), - } + !self.dim_is_some(dim) } } diff --git a/crates/cli/src/parse/schemas.rs b/crates/cli/src/parse/schemas.rs index a4e04ec..4590bbe 100644 --- a/crates/cli/src/parse/schemas.rs +++ b/crates/cli/src/parse/schemas.rs @@ -85,32 +85,27 @@ pub(crate) fn parse_schemas( } fn parse_u256_types(args: &Args) -> Result, ParseError> { - if let Some(raw_u256_types) = args.u256_types.clone() { - let mut u256_types: Vec = Vec::new(); - for raw in raw_u256_types.iter() { - let u256_type = match raw.to_lowercase() { - raw if raw == "binary" => U256Type::Binary, - raw if raw == "string" => U256Type::String, - raw if raw == "str" => U256Type::String, - raw if raw == "f32" => U256Type::F32, - raw if raw == "float32" => U256Type::F32, - raw if raw == "f64" => U256Type::F64, - raw if raw == "float64" => U256Type::F64, - raw if raw == "float" => U256Type::F64, - raw if raw == "u32" => U256Type::U32, - raw if raw == "uint32" => U256Type::U32, - raw if raw == "u64" => U256Type::U64, - raw if raw == "uint64" => U256Type::U64, - raw if raw == "decimal128" => U256Type::Decimal128, - raw if raw == "d128" => U256Type::Decimal128, - _ => return Err(ParseError::ParseError("bad u256 type".to_string())), - }; - u256_types.push(u256_type); - } - Ok(u256_types) - } else { - Ok(vec![U256Type::Binary, U256Type::String, U256Type::F64]) - } + args.u256_types.as_ref().map_or( + Ok(vec![U256Type::Binary, U256Type::String, U256Type::F64]), + |raw_u256_types| { + raw_u256_types + .iter() + .map(|raw| { + let lower_case = raw.to_lowercase(); + match lower_case.as_str() { + "binary" => Ok(U256Type::Binary), + "string" | "str" => Ok(U256Type::String), + "f32" | "float32" => Ok(U256Type::F32), + "f64" | "float64" | "float" => Ok(U256Type::F64), + "u32" | "uint32" => Ok(U256Type::U32), + "u64" | "uint64" => Ok(U256Type::U64), + "decimal128" | "d128" => Ok(U256Type::Decimal128), + _ => Err(ParseError::ParseError(format!("invalid u256 type: {}", raw))), + } + }) + .collect() + }, + ) } fn ensure_included_columns( @@ -171,7 +166,7 @@ fn ensure_excluded_columns( fn parse_sort_columns( raw_sort: &Option>, - datatypes: &Vec, + datatypes: &[Datatype], ) -> Result>>, ParseError> { match raw_sort { None => Ok(HashMap::from_iter( diff --git a/crates/cli/src/parse/source.rs b/crates/cli/src/parse/source.rs index 133466b..6b62515 100644 --- a/crates/cli/src/parse/source.rs +++ b/crates/cli/src/parse/source.rs @@ -1,22 +1,33 @@ use std::env; -use ethers::prelude::*; +use crate::args::Args; +use alloy::{ + providers::{Provider, ProviderBuilder, RootProvider}, + rpc::client::{BuiltInConnectionString, ClientBuilder, RpcClient}, + transports::{layers::RetryBackoffLayer, BoxTransport}, +}; +use cryo_freeze::{ParseError, Source, SourceLabels}; use governor::{Quota, RateLimiter}; use polars::prelude::*; use std::num::NonZeroU32; -use cryo_freeze::{Fetcher, ParseError, Source, SourceLabels}; - -use crate::args::Args; - pub(crate) async fn parse_source(args: &Args) -> Result { // parse network info - let rpc_url = parse_rpc_url(args); - let provider = - Provider::>::new_client(&rpc_url, args.max_retries, args.initial_backoff) - .map_err(|_e| ParseError::ParseError("could not connect to provider".to_string()))?; - let chain_id = provider.get_chainid().await.map_err(ParseError::ProviderError)?.as_u64(); - + let rpc_url = parse_rpc_url(args)?; + let retry_layer = RetryBackoffLayer::new( + args.max_retries, + args.initial_backoff, + args.compute_units_per_second, + ); + let connect: BuiltInConnectionString = rpc_url.parse().map_err(ParseError::ProviderError)?; + let client: RpcClient = ClientBuilder::default() + .layer(retry_layer) + .connect_boxed(connect) + .await + .map_err(ParseError::ProviderError)? + .boxed(); + let provider: RootProvider = ProviderBuilder::default().on_client(client); + let chain_id = provider.get_chain_id().await.map_err(ParseError::ProviderError)?; let rate_limiter = match args.requests_per_second { Some(rate_limit) => match (NonZeroU32::new(1), NonZeroU32::new(rate_limit)) { (Some(one), Some(value)) => { @@ -37,17 +48,18 @@ pub(crate) async fn parse_source(args: &Args) -> Result { }; let semaphore = tokio::sync::Semaphore::new(max_concurrent_requests as usize); - let semaphore = Some(semaphore); + let semaphore = Arc::new(Some(semaphore)); - let fetcher = Fetcher { provider, semaphore, rate_limiter }; let output = Source { - fetcher: Arc::new(fetcher), chain_id, inner_request_size: args.inner_request_size, max_concurrent_chunks, + semaphore, + rate_limiter: rate_limiter.into(), rpc_url, + provider, labels: SourceLabels { - max_concurrent_requests: args.requests_per_second.map(|x| x as u64), + max_concurrent_requests: args.max_concurrent_requests, max_requests_per_second: args.requests_per_second.map(|x| x as u64), max_retries: Some(args.max_retries), initial_backoff: Some(args.initial_backoff), @@ -57,19 +69,40 @@ pub(crate) async fn parse_source(args: &Args) -> Result { Ok(output) } -fn parse_rpc_url(args: &Args) -> String { - let mut url = match &args.rpc { - Some(url) => url.clone(), - _ => match env::var("ETH_RPC_URL") { - Ok(url) => url, - Err(_e) => { - println!("must provide --rpc or set ETH_RPC_URL"); - std::process::exit(0); +pub(crate) fn parse_rpc_url(args: &Args) -> Result { + // get MESC url + let mesc_url = if mesc::is_mesc_enabled() { + let endpoint = match &args.rpc { + Some(url) => mesc::get_endpoint_by_query(url, Some("cryo")), + None => mesc::get_default_endpoint(Some("cryo")), + }; + match endpoint { + Ok(endpoint) => endpoint.map(|endpoint| endpoint.url), + Err(e) => { + eprintln!("Could not load MESC data: {}", e); + None } - }, + } + } else { + None }; - if !url.starts_with("http") { - url = "http://".to_string() + url.as_str(); + + // use ETH_RPC_URL if no MESC url found + let url = if let Some(url) = mesc_url { + url + } else if let Some(url) = &args.rpc { + url.clone() + } else if let Ok(url) = env::var("ETH_RPC_URL") { + url + } else { + let message = "must provide --rpc or setup MESC or set ETH_RPC_URL"; + return Err(ParseError::ParseError(message.to_string())) }; - url + + // prepend http or https if need be + if !url.starts_with("http") & !url.starts_with("ws") & !url.ends_with(".ipc") { + Ok("http://".to_string() + url.as_str()) + } else { + Ok(url) + } } diff --git a/crates/cli/src/parse/timestamps.rs b/crates/cli/src/parse/timestamps.rs index a9342c6..35b54ab 100644 --- a/crates/cli/src/parse/timestamps.rs +++ b/crates/cli/src/parse/timestamps.rs @@ -1,5 +1,5 @@ -use cryo_freeze::{BlockChunk, Fetcher, ParseError}; -use ethers::prelude::*; +use alloy::rpc::types::BlockTransactionsKind; +use cryo_freeze::{BlockChunk, ParseError, Source}; use polars::prelude::*; use crate::{ @@ -9,9 +9,9 @@ use crate::{ use super::blocks::get_latest_block_number; -pub(crate) async fn parse_timestamps( +pub(crate) async fn parse_timestamps( args: &Args, - fetcher: Arc>, + source: Arc, ) -> Result<(Option>>, Option>), ParseError> { let (files, explicit_numbers): (Vec<&String>, Vec<&String>) = match &args.timestamps { Some(timestamp) => timestamp.iter().partition(|tx| std::path::Path::new(tx).exists()), @@ -48,10 +48,10 @@ pub(crate) async fn parse_timestamps( // parse inputs into BlockChunks let mut block_chunks = Vec::new(); for explicit_number in explicit_numbers { - let outputs = parse_timestamp_inputs(explicit_number, &fetcher).await?; + let outputs = parse_timestamp_inputs(explicit_number, source.clone()).await?; block_chunks.extend(outputs); } - postprocess_block_chunks(block_chunks, args, fetcher).await? + postprocess_block_chunks(block_chunks, args, source).await? } else { Vec::new() }; @@ -107,9 +107,9 @@ fn read_integer_column(path: &str, column: &str) -> Result, ParseError> } /// parse timestamp numbers to freeze -async fn parse_timestamp_inputs( +async fn parse_timestamp_inputs( inputs: &str, - fetcher: &Fetcher

, + source: Arc, ) -> Result, ParseError> { let parts: Vec<&str> = inputs.split(' ').collect(); match parts.len() { @@ -117,12 +117,12 @@ async fn parse_timestamp_inputs( let first_input = parts.first().ok_or_else(|| { ParseError::ParseError("Failed to get the first input".to_string()) })?; - parse_timestamp_token(first_input, true, fetcher).await.map(|x| vec![x]) + parse_timestamp_token(first_input, true, source).await.map(|x| vec![x]) } _ => { let mut chunks = Vec::new(); for part in parts { - chunks.push(parse_timestamp_token(part, false, fetcher).await?); + chunks.push(parse_timestamp_token(part, false, source.clone()).await?); } Ok(chunks) } @@ -134,10 +134,10 @@ enum RangePosition { None, } -async fn parse_timestamp_token( +async fn parse_timestamp_token( s: &str, as_range: bool, - fetcher: &Fetcher

, + source: Arc, ) -> Result { let s = s.replace('_', ""); @@ -145,8 +145,8 @@ async fn parse_timestamp_token( match parts.as_slice() { [timestamp_ref] => { let timestamp = - parse_timestamp_number(timestamp_ref, RangePosition::None, fetcher).await?; - let block = timestamp_to_block_number(timestamp, fetcher).await?; + parse_timestamp_number(timestamp_ref, RangePosition::None, source.clone()).await?; + let block = timestamp_to_block_number(timestamp, source).await?; Ok(BlockChunk::Numbers(vec![block])) } @@ -162,10 +162,10 @@ async fn parse_timestamp_token( }; let (start_timestamp, end_timestamp) = - parse_timestamp_range(first_ref, second_ref, fetcher).await?; + parse_timestamp_range(first_ref, second_ref, source.clone()).await?; let (start_block, end_block) = ( - timestamp_to_block_number(start_timestamp, fetcher).await?, - timestamp_to_block_number(end_timestamp, fetcher).await?, + timestamp_to_block_number(start_timestamp, source.clone()).await?, + timestamp_to_block_number(end_timestamp, source).await?, ); block_range_to_block_chunk(start_block, end_block, as_range, None, n_keep) } @@ -175,22 +175,19 @@ async fn parse_timestamp_token( } } -async fn parse_timestamp_range

( +async fn parse_timestamp_range( first_ref: &str, second_ref: &str, - fetcher: &Fetcher

, -) -> Result<(u64, u64), ParseError> -where - P: JsonRpcClient, -{ + source: Arc, +) -> Result<(u64, u64), ParseError> { let (start_timestamp, end_timestamp) = match (first_ref, second_ref) { _ if first_ref.starts_with('-') => { let end_timestamp = - parse_timestamp_number(second_ref, RangePosition::Last, fetcher).await?; + parse_timestamp_number(second_ref, RangePosition::Last, source.clone()).await?; let start_timestamp = end_timestamp .checked_sub( - parse_timestamp_number(&first_ref[1..], RangePosition::None, fetcher).await?, + parse_timestamp_number(&first_ref[1..], RangePosition::None, source).await?, ) .ok_or_else(|| ParseError::ParseError("start_timestamp underflow".to_string()))?; @@ -198,11 +195,11 @@ where } _ if second_ref.starts_with('+') => { let start_timestamp = - parse_timestamp_number(first_ref, RangePosition::First, fetcher).await?; + parse_timestamp_number(first_ref, RangePosition::First, source.clone()).await?; let end_timestamp = start_timestamp .checked_add( - parse_timestamp_number(&second_ref[1..], RangePosition::None, fetcher).await?, + parse_timestamp_number(&second_ref[1..], RangePosition::None, source).await?, ) .ok_or_else(|| ParseError::ParseError("end_timestamp overflow".to_string()))?; @@ -210,10 +207,10 @@ where } _ => { let start_timestamp = - parse_timestamp_number(first_ref, RangePosition::First, fetcher).await?; + parse_timestamp_number(first_ref, RangePosition::First, source.clone()).await?; let end_timestamp = - parse_timestamp_number(second_ref, RangePosition::Last, fetcher).await?; + parse_timestamp_number(second_ref, RangePosition::Last, source).await?; (start_timestamp, end_timestamp) } @@ -229,15 +226,15 @@ where Ok((start_timestamp, end_timestamp)) } -async fn parse_timestamp_number( +async fn parse_timestamp_number( timestamp_ref: &str, range_position: RangePosition, - fetcher: &Fetcher

, + source: Arc, ) -> Result { match (timestamp_ref, range_position) { - ("latest", _) => get_latest_timestamp(fetcher).await, + ("latest", _) => get_latest_timestamp(source).await, ("", RangePosition::First) => Ok(0), - ("", RangePosition::Last) => get_latest_timestamp(fetcher).await, + ("", RangePosition::Last) => get_latest_timestamp(source).await, ("", RangePosition::None) => Err(ParseError::ParseError("invalid input".to_string())), _ if timestamp_ref.ends_with('m') => scale_timestamp_str_by_metric_unit(timestamp_ref, 60), _ if timestamp_ref.ends_with('h') => { @@ -274,33 +271,30 @@ fn scale_timestamp_str_by_metric_unit( // perform binary search to determine the closest block number smaller than or equal to a given // timestamp -async fn timestamp_to_block_number( - timestamp: u64, - fetcher: &Fetcher

, -) -> Result { - let latest_block_number = get_latest_block_number(fetcher).await?; +async fn timestamp_to_block_number(timestamp: u64, source: Arc) -> Result { + let latest_block_number = get_latest_block_number(source.clone()).await?; let mut l = 0; let mut r = latest_block_number; let mut mid = (l + r) / 2; - let mut block = fetcher - .get_block(mid) + let mut block = source + .get_block(mid, BlockTransactionsKind::Hashes) .await .map_err(|_e| ParseError::ParseError("Error fetching block for timestamp".to_string()))? .unwrap(); while l <= r { mid = (l + r) / 2; - block = fetcher - .get_block(mid) + block = source + .get_block(mid, BlockTransactionsKind::Hashes) .await .map_err(|_e| ParseError::ParseError("Error fetching block for timestamp".to_string()))? .unwrap(); - #[warn(clippy::comparison_chain)] - if block.timestamp == timestamp.into() { + #[allow(clippy::comparison_chain)] + if block.header.timestamp == timestamp { return Ok(mid); - } else if block.timestamp < timestamp.into() { + } else if block.header.timestamp < timestamp { l = mid + 1; } else { r = mid - 1; @@ -308,169 +302,212 @@ async fn timestamp_to_block_number( } // If timestamp is between two different blocks, return the lower block. - if mid > 0 && block.timestamp > ethers::types::U256::from(timestamp) { + if mid > 0 && block.header.timestamp > timestamp { Ok(mid - 1) } else { Ok(mid) } } -async fn get_latest_timestamp(fetcher: &Fetcher

) -> Result { - let latest_block_number = get_latest_block_number(fetcher).await?; - let latest_block = fetcher - .get_block(latest_block_number) +async fn get_latest_timestamp(source: Arc) -> Result { + let latest_block_number = get_latest_block_number(source.clone()).await?; + let latest_block = source + .get_block(latest_block_number, BlockTransactionsKind::Hashes) .await .map_err(|_e| ParseError::ParseError("Error fetching latest block".to_string()))? .unwrap(); - Ok(latest_block.timestamp.as_u64()) + Ok(latest_block.header.timestamp) } #[cfg(test)] mod tests { use std::num::NonZeroU32; + use alloy::{ + providers::ProviderBuilder, + rpc::client::{BuiltInConnectionString, ClientBuilder, RpcClient}, + transports::{layers::RetryBackoffLayer, BoxTransport}, + }; use governor::{Quota, RateLimiter}; use super::*; + use cryo_freeze::SourceLabels; - async fn setup_fetcher() -> Fetcher> { - let rpc_url = String::from("https://eth.merkle.io"); + async fn setup_source() -> Source { + let rpc_url = match crate::parse::source::parse_rpc_url(&Args::default()) { + Ok(url) => url, + Err(_) => std::process::exit(0), + }; let max_retry = 5; let initial_backoff = 500; + let compute_units_per_second = 50; let max_concurrent_requests = 100; - let provider = - Provider::>::new_client(&rpc_url, max_retry, initial_backoff) - .map_err(|_e| ParseError::ParseError("could not connect to provider".to_string())) - .unwrap(); - + let retry_layer = + RetryBackoffLayer::new(max_retry, initial_backoff, compute_units_per_second); + let connect: BuiltInConnectionString = + rpc_url.parse().map_err(ParseError::ProviderError).unwrap(); + let client: RpcClient = ClientBuilder::default() + .layer(retry_layer) + .connect_boxed(connect) + .await + .map_err(ParseError::ProviderError) + .unwrap() + .boxed(); + let provider = ProviderBuilder::default().on_client(client); let quota = Quota::per_second(NonZeroU32::new(15).unwrap()) .allow_burst(NonZeroU32::new(1).unwrap()); let rate_limiter = Some(RateLimiter::direct(quota)); let semaphore = tokio::sync::Semaphore::new(max_concurrent_requests as usize); - Fetcher { provider, semaphore: Some(semaphore), rate_limiter } + Source { + provider, + semaphore: Arc::new(Some(semaphore)), + rate_limiter: Arc::new(rate_limiter), + chain_id: 1, + inner_request_size: 1, + max_concurrent_chunks: None, + rpc_url: "".to_string(), + labels: SourceLabels::default(), + } } #[tokio::test] async fn test_extrema_timestamp_to_block_number() { - let fetcher = setup_fetcher().await; + let source = setup_source().await; + let source = Arc::new(source); // Before genesis block - assert!(timestamp_to_block_number(1438260000, &fetcher).await.unwrap() == 0); + assert!(timestamp_to_block_number(1438260000, source).await.unwrap() == 0); } #[tokio::test] async fn test_latest_timestamp_to_block_number() { - let fetcher = setup_fetcher().await; - let latest_block_number = get_latest_block_number(&fetcher).await.unwrap(); - let latest_block = fetcher.get_block(latest_block_number).await.unwrap().unwrap(); - let latest_timestamp = latest_block.timestamp.as_u64(); + let source = setup_source().await; + let source = Arc::new(source); + let latest_block_number = get_latest_block_number(source.clone()).await.unwrap(); + let latest_block = source + .get_block(latest_block_number, BlockTransactionsKind::Hashes) + .await + .unwrap() + .unwrap(); + let latest_timestamp = latest_block.header.timestamp; assert_eq!( - timestamp_to_block_number(latest_timestamp, &fetcher).await.unwrap(), + timestamp_to_block_number(latest_timestamp, source).await.unwrap(), latest_block_number ); } #[tokio::test] async fn test_timestamp_between_blocks() { - let fetcher = setup_fetcher().await; + let source = setup_source().await; + let source = Arc::new(source); // Block 1000, and the timestamp surrounding block 1020 - assert!(timestamp_to_block_number(1438272177, &fetcher).await.unwrap() == 1020); - assert!(timestamp_to_block_number(1438272178, &fetcher).await.unwrap() == 1020); + assert!(timestamp_to_block_number(1438272177, source.clone()).await.unwrap() == 1020); + assert!(timestamp_to_block_number(1438272178, source.clone()).await.unwrap() == 1020); // Timestamp 1438272176 is 1 seconds after block 1019 and 1 second before block 1020. Lower // block is returned - assert!(timestamp_to_block_number(1438272176, &fetcher).await.unwrap() == 1019); + assert!(timestamp_to_block_number(1438272176, source.clone()).await.unwrap() == 1019); // Timestamp 1438272187 is 1 seconds after block 1024 and 1 second before block 1025. Lower // block is returned - assert!(timestamp_to_block_number(1438272187, &fetcher).await.unwrap() == 1024); + assert!(timestamp_to_block_number(1438272187, source.clone()).await.unwrap() == 1024); // Timestamp 1438272169 is 4 seconds after block 1016 and 4 seconds before block 1017. Lower // block is returned - assert!(timestamp_to_block_number(1438272169, &fetcher).await.unwrap() == 1016); + assert!(timestamp_to_block_number(1438272169, source.clone()).await.unwrap() == 1016); } #[tokio::test] async fn test_parse_timestamp_number() { - let fetcher = setup_fetcher().await; + let source = setup_source().await; + let source = Arc::new(source); let latest_timestamp = - parse_timestamp_number("latest", RangePosition::None, &fetcher).await.unwrap(); - assert_eq!(latest_timestamp, get_latest_timestamp(&fetcher).await.unwrap()); - - assert_eq!(parse_timestamp_number("", RangePosition::First, &fetcher).await.unwrap(), 0); + parse_timestamp_number("latest", RangePosition::None, source.clone()).await.unwrap(); + assert_eq!(latest_timestamp, get_latest_timestamp(source.clone()).await.unwrap()); assert_eq!( - parse_timestamp_number("", RangePosition::Last, &fetcher).await.unwrap(), - get_latest_timestamp(&fetcher).await.unwrap() + parse_timestamp_number("", RangePosition::First, source.clone()).await.unwrap(), + 0 ); assert_eq!( - parse_timestamp_number("1700000000", RangePosition::None, &fetcher).await.unwrap(), + parse_timestamp_number("", RangePosition::Last, source.clone()).await.unwrap(), + get_latest_timestamp(source.clone()).await.unwrap() + ); + + assert_eq!( + parse_timestamp_number("1700000000", RangePosition::None, source.clone()) + .await + .unwrap(), 1700000000 ); - assert_eq!(parse_timestamp_number("1m", RangePosition::None, &fetcher).await.unwrap(), 60); + assert_eq!( + parse_timestamp_number("1m", RangePosition::None, source.clone()).await.unwrap(), + 60 + ); assert_eq!( - parse_timestamp_number("8760h", RangePosition::None, &fetcher).await.unwrap(), + parse_timestamp_number("8760h", RangePosition::None, source.clone()).await.unwrap(), 8760 * 3600 ); assert_eq!( - parse_timestamp_number("365d", RangePosition::None, &fetcher).await.unwrap(), + parse_timestamp_number("365d", RangePosition::None, source.clone()).await.unwrap(), 365 * 86400 ); assert_eq!( - parse_timestamp_number("52w", RangePosition::None, &fetcher).await.unwrap(), + parse_timestamp_number("52w", RangePosition::None, source.clone()).await.unwrap(), 52 * 86400 * 7 ); assert_eq!( - parse_timestamp_number("12M", RangePosition::None, &fetcher).await.unwrap(), + parse_timestamp_number("12M", RangePosition::None, source.clone()).await.unwrap(), 12 * 86400 * 30 ); assert_eq!( - parse_timestamp_number("1y", RangePosition::None, &fetcher).await.unwrap(), + parse_timestamp_number("1y", RangePosition::None, source.clone()).await.unwrap(), 86400 * 365 ); } #[tokio::test] async fn test_parse_timestamp_range_to_block_number_range() { - let fetcher = setup_fetcher().await; + let source = setup_source().await; + let source = Arc::new(source); let (start_timestamp, end_timestamp) = - parse_timestamp_range("1700000000", "1700000015", &fetcher).await.unwrap(); + parse_timestamp_range("1700000000", "1700000015", source.clone()).await.unwrap(); assert_eq!( ( - timestamp_to_block_number(start_timestamp, &fetcher).await.unwrap(), - timestamp_to_block_number(end_timestamp, &fetcher).await.unwrap() + timestamp_to_block_number(start_timestamp, source.clone()).await.unwrap(), + timestamp_to_block_number(end_timestamp, source.clone()).await.unwrap() ), (18573050, 18573051) ); let (start_timestamp, end_timestamp) = - parse_timestamp_range("-15", "1700000015", &fetcher).await.unwrap(); + parse_timestamp_range("-15", "1700000015", source.clone()).await.unwrap(); assert_eq!( ( - timestamp_to_block_number(start_timestamp, &fetcher).await.unwrap(), - timestamp_to_block_number(end_timestamp, &fetcher).await.unwrap() + timestamp_to_block_number(start_timestamp, source.clone()).await.unwrap(), + timestamp_to_block_number(end_timestamp, source.clone()).await.unwrap() ), (18573050, 18573052) ); let (start_timestamp, end_timestamp) = - parse_timestamp_range("1700000000", "+15", &fetcher).await.unwrap(); + parse_timestamp_range("1700000000", "+15", source.clone()).await.unwrap(); assert_eq!( ( - timestamp_to_block_number(start_timestamp, &fetcher).await.unwrap(), - timestamp_to_block_number(end_timestamp, &fetcher).await.unwrap() + timestamp_to_block_number(start_timestamp, source.clone()).await.unwrap(), + timestamp_to_block_number(end_timestamp, source.clone()).await.unwrap() ), (18573050, 18573051) ); diff --git a/crates/cli/src/remember.rs b/crates/cli/src/remember.rs index 5dd0879..aa9ca1f 100644 --- a/crates/cli/src/remember.rs +++ b/crates/cli/src/remember.rs @@ -46,7 +46,7 @@ pub(crate) fn load_remembered_command(cryo_dir: PathBuf) -> Result Result, CollectError> { - // handle subcommands - if args.datatype.first() == Some(&"help".to_string()) { - return handle_help_subcommands(args).await + if is_help_command(&args) { + return handle_help_subcommands(args); } - let cryo_dir: std::path::PathBuf = args.output_dir.clone().into(); - let cryo_dir = cryo_dir.join(".cryo"); + let cryo_dir = build_cryo_directory(std::path::Path::new(&args.output_dir)); - // remember previous command - let args = if args.datatype.is_empty() { - let remembered = remember::load_remembered_command(cryo_dir.clone())?; - if remembered.cryo_version != cryo_freeze::CRYO_VERSION { - eprintln!("remembered command comes from different cryo version, proceed with caution"); - eprintln!(); - }; - println!( - "{} {} {}", - "remembering previous command:".truecolor(170, 170, 170), - "cryo".bold().white(), - remembered.command.into_iter().skip(1).collect::>().join(" ").white().bold() - ); - println!(); - args.merge_with_precedence(remembered.args) - } else { - args - }; + let args = + if args.datatype.is_empty() { load_or_remember_command(args, &cryo_dir)? } else { args }; - // remember current command if args.remember { - println!("remembering this command for future use"); - println!(); + println!("remembering this command for future use\n"); remember::save_remembered_command(cryo_dir, &args)?; } // handle regular flow + run_freeze_process(args).await +} + +/// Check if the command is a help command. +fn is_help_command(args: &args::Args) -> bool { + args.datatype.first() == Some(&"help".to_string()) +} + +/// Build the cryo directory path. +fn build_cryo_directory(output_dir: &std::path::Path) -> std::path::PathBuf { + output_dir.join(".cryo") +} + +/// Load a previously remembered command or return the current args. +fn load_or_remember_command( + mut args: args::Args, + cryo_dir: &std::path::Path, +) -> Result { + let remembered = remember::load_remembered_command(cryo_dir.to_path_buf())?; + // Warn if the remembered command comes from a different Cryo version. + if remembered.cryo_version != cryo_freeze::CRYO_VERSION { + eprintln!("remembered command comes from a different Cryo version, proceed with caution\n"); + } + print_remembered_command(&remembered.command); + args = args.merge_with_precedence(remembered.args); + Ok(args) +} + +/// Print the remembered command to the console. +fn print_remembered_command(command: &[String]) { + println!( + "{} {} {}", + "remembering previous command:".truecolor(170, 170, 170), + "cryo".bold().white(), + command.iter().skip(1).cloned().collect::>().join(" ").white().bold() + ); + println!(); +} + +/// Run the main freezing process with the provided arguments. +async fn run_freeze_process(args: args::Args) -> Result, CollectError> { let t_start_parse = Some(SystemTime::now()); - let (query, source, sink, env) = match parse::parse_args(&args).await { - Ok(opts) => opts, - Err(e) => return Err(e.into()), - }; + let (query, source, sink, env) = parse::parse_args(&args).await?; let source = Arc::new(source); - let env = ExecutionEnv { t_start_parse, ..env }; - let env = env.set_start_time(); + let env = ExecutionEnv { t_start_parse, ..env }.set_start_time(); + cryo_freeze::freeze(&query, &source, &sink, &env).await } -async fn handle_help_subcommands(args: args::Args) -> Result, CollectError> { - if args.datatype.len() == 1 { - args::Args::parse_from(vec!["cryo", "-h"]); - } else if args.datatype.len() == 2 && args.datatype[1] == "syntax" { - let content = cstr!( - r#"Block specification syntax +/// Handle help-related subcommands. +fn handle_help_subcommands(args: args::Args) -> Result, CollectError> { + match args.datatype.len() { + // if only "help" is provided, print general help + 1 => print_general_help(), + // if "syntax help" is provided, print syntax help + 2 if args.datatype[1] == "syntax" => print_syntax_help(), + // if "help datasets" is provided, print dataset information + 2 if args.datatype.contains(&"datasets".to_string()) => cryo_freeze::print_all_datasets(), + // if "help " is provided, print detailed help + _ => handle_detailed_help(args)?, + } + Ok(None) +} + +/// Print general help for the CLI tool. +fn print_general_help() { + args::Args::parse_from(vec!["cryo", "-h"]); +} + +/// Print syntax help for block and transaction specification. +fn print_syntax_help() { + let content = cstr!( + r#"Block specification syntax - can use numbers --blocks 5000 6000 7000 - can use ranges --blocks 12M:13M 15M:16M - can use a parquet file --blocks ./path/to/file.parquet[:COLUMN_NAME] @@ -77,24 +113,62 @@ async fn handle_help_subcommands(args: args::Args) -> Result--txs ./path/to/file.parquet[:COLUMN_NAME] (default column name is transaction_hash) - can use multiple parquet files --txs ./path/to/ethereum__logs*.parquet"# - ); - println!("{}", content); - } else if args.datatype.len() == 2 && args.datatype.contains(&"datasets".to_string()) { - cryo_freeze::print_all_datasets(); - } else { - let args = args::Args { datatype: args.datatype[1..].to_vec(), ..args }; - let (datatypes, schemas) = super::parse::schemas::parse_schemas(&args)?; - for datatype in datatypes.into_iter() { - if schemas.len() > 1 { - println!(); - println!(); - }; - if let Some(schema) = schemas.get(&datatype) { - cryo_freeze::print_dataset_info(datatype, schema); - } else { - return Err(err("missing schema for datatype")) - } + ); + println!("{}", content); +} + +/// Handle detailed help by parsing schemas and printing dataset information. +fn handle_detailed_help(args: args::Args) -> Result<(), CollectError> { + let args = args::Args { datatype: args.datatype[1..].to_vec(), ..args }; + let (datatypes, schemas) = super::parse::schemas::parse_schemas(&args)?; + + for datatype in datatypes.into_iter() { + if schemas.len() > 1 { + println!("\n"); + } + if let Some(schema) = schemas.get(&datatype) { + cryo_freeze::print_dataset_info(datatype, schema); + } else { + return Err(err(format!("missing schema for datatype: {:?}", datatype).as_str())); } } - Ok(None) + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::args::Args; + + #[test] + fn test_handle_help_subcommands_general_help() { + let args = Args { datatype: vec!["help".to_string()], ..Default::default() }; + + let result = handle_help_subcommands(args); + + assert!(result.is_ok()); + } + + #[test] + fn test_handle_help_subcommands_syntax_help() { + let args = + Args { datatype: vec!["help".to_string(), "syntax".to_string()], ..Default::default() }; + + let result = handle_help_subcommands(args); + + assert!(result.is_ok()); + } + + #[test] + fn test_handle_help_subcommands_datasets_help() { + let args = Args { + datatype: vec!["help".to_string(), "datasets".to_string()], + ..Default::default() + }; + + let result = handle_help_subcommands(args); + + assert!(result.is_ok()); + } } diff --git a/crates/freeze/Cargo.toml b/crates/freeze/Cargo.toml index b5edde3..55701e8 100644 --- a/crates/freeze/Cargo.toml +++ b/crates/freeze/Cargo.toml @@ -5,29 +5,28 @@ description = "cryo is the easiest way to extract blockchain data to parquet, cs version.workspace = true edition.workspace = true license.workspace = true -homepage.workspace = true repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cryo_to_df = { version = "0.3.0", path = "../to_df" } +alloy = { workspace = true } async-trait = { workspace = true } -ethers = { workspace = true } -ethers-core = { workspace = true } +chrono = { workspace = true } +colored = { workspace = true } +cryo_to_df = { workspace = true } futures = { workspace = true } governor = { workspace = true } heck = { workspace = true } indexmap = { workspace = true } indicatif = { workspace = true } -lazy_static = { workspace = true } +mesc = { workspace = true } polars = { workspace = true } prefix-hex = { workspace = true } regex = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } -tokio = { workspace = true } -chrono = { workspace = true } -colored = { workspace = true } thousands = { workspace = true } +tokio = { workspace = true } +url = "2.5.2" diff --git a/crates/freeze/src/datasets/address_appearances.rs b/crates/freeze/src/datasets/address_appearances.rs index 897f969..c360010 100644 --- a/crates/freeze/src/datasets/address_appearances.rs +++ b/crates/freeze/src/datasets/address_appearances.rs @@ -1,5 +1,13 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, TxHash}, + rpc::types::{ + eth::{Block, Log}, + trace::parity::{Action, LocalizedTransactionTrace, TraceOutput}, + BlockTransactionsKind, Filter, FilterBlockOption, + }, + sol_types::SolEvent, +}; use polars::prelude::*; use std::collections::HashMap; @@ -9,6 +17,7 @@ use std::collections::HashMap; pub struct AddressAppearances { n_rows: usize, block_number: Vec, + block_hash: Vec>, transaction_hash: Vec>, address: Vec>, relationship: Vec, @@ -17,12 +26,23 @@ pub struct AddressAppearances { #[async_trait::async_trait] impl Dataset for AddressAppearances { + fn default_columns() -> Option> { + Some(vec![ + "block_number", + // "block_hash", + "transaction_hash", + "address", + "relationship", + "chain_id", + ]) + } + fn default_sort() -> Option> { Some(vec!["block_number", "transaction_hash", "address", "relationship"]) } } -type BlockLogsTraces = (Block, Vec, Vec); +type BlockLogsTraces = (Block, Vec, Vec); #[async_trait::async_trait] impl CollectByBlock for AddressAppearances { @@ -30,17 +50,18 @@ impl CollectByBlock for AddressAppearances { async fn extract(request: Params, source: Arc, _: Arc) -> R { let block_number = request.ethers_block_number()?; - let block = source.fetcher.get_block(request.block_number()?).await?; + let block = + source.get_block(request.block_number()?, BlockTransactionsKind::Hashes).await?; let block = block.ok_or(CollectError::CollectError("block not found".to_string()))?; let filter = Filter { block_option: FilterBlockOption::Range { - from_block: Some(block_number), - to_block: Some(block_number), + from_block: Some(block_number.into()), + to_block: Some(block_number.into()), }, ..Default::default() }; - let logs = source.fetcher.get_logs(&filter).await?; - let traces = source.fetcher.trace_block(request.block_number()?.into()).await?; + let logs = source.get_logs(&filter).await?; + let traces = source.trace_block(request.block_number()?).await?; Ok((block, logs, traces)) } @@ -57,30 +78,29 @@ impl CollectByTransaction for AddressAppearances { async fn extract(request: Params, source: Arc, _: Arc) -> R { let tx_hash = request.ethers_transaction_hash()?; - let tx_data = source.fetcher.get_transaction(tx_hash).await?.ok_or_else(|| { + let tx_data = source.get_transaction_by_hash(tx_hash).await?.ok_or_else(|| { CollectError::CollectError("could not find transaction data".to_string()) })?; let block_number = tx_data .block_number - .ok_or_else(|| CollectError::CollectError("block not found".to_string()))? - .as_u64(); + .ok_or_else(|| CollectError::CollectError("block not found".to_string()))?; let block = source - .fetcher - .get_block(block_number) + .get_block(block_number, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("could not get block".to_string()))?; // logs let logs = source - .fetcher .get_transaction_receipt(tx_hash) .await? .ok_or(CollectError::CollectError("could not get tx receipt".to_string()))? - .logs; + .inner + .logs() + .to_vec(); // traces - let traces = source.fetcher.trace_transaction(request.ethers_transaction_hash()?).await?; + let traces = source.trace_transaction(request.ethers_transaction_hash()?).await?; Ok((block, logs, traces)) } @@ -92,11 +112,11 @@ impl CollectByTransaction for AddressAppearances { } fn name(log: &Log) -> Option<&'static str> { - let event = log.topics[0]; - if event == *EVENT_ERC20_TRANSFER { - if log.data.len() > 0 { + let event = log.topic0().unwrap(); + if event == *ERC20::Transfer::SIGNATURE_HASH { + if log.data().data.len() > 0 { Some("erc20_transfer") - } else if log.topics.len() == 4 { + } else if log.topics().len() == 4 { Some("erc721_transfer") } else { None @@ -109,93 +129,187 @@ fn name(log: &Log) -> Option<&'static str> { impl AddressAppearances { fn process_first_transaction( &mut self, - block_author: H160, - trace: &Trace, + block_author: Address, + trace: &LocalizedTransactionTrace, schema: &Table, - tx_hash: H256, - logs_by_tx: &HashMap>, + tx_hash: TxHash, + logs_by_tx: &HashMap>, ) { - let block_number = trace.block_number as u32; - self.process_address(block_author, "miner_fee", block_number, tx_hash, schema); + let block_number = trace.block_number.unwrap() as u32; + let block_hash = trace.block_hash.unwrap().to_vec(); + self.process_address(block_author, "miner_fee", block_number, &block_hash, tx_hash, schema); if let Some(logs) = logs_by_tx.get(&tx_hash) { for log in logs.iter() { - if log.topics.len() >= 3 { + if log.topics().len() >= 3 { if let Some(name) = name(log) { let mut from: [u8; 20] = [0; 20]; - from.copy_from_slice(&log.topics[1].to_fixed_bytes()[12..32]); + from.copy_from_slice(&log.topics()[1][12..32]); let name = &(name.to_string() + "_from"); - self.process_address(H160(from), name, block_number, tx_hash, schema); + self.process_address( + Address::from_slice(&from), + name, + block_number, + &block_hash, + tx_hash, + schema, + ); let mut to: [u8; 20] = [0; 20]; - to.copy_from_slice(&log.topics[1].to_fixed_bytes()[12..32]); + to.copy_from_slice(&log.topics()[1][12..32]); let name = &(name.to_string() + "_to"); - self.process_address(H160(to), name, block_number, tx_hash, schema); + self.process_address( + Address::from_slice(&to), + name, + block_number, + &block_hash, + tx_hash, + schema, + ); } } } } - match &trace.action { + match &trace.trace.action { Action::Call(action) => { - self.process_address(action.from, "tx_from", block_number, tx_hash, schema); - self.process_address(action.to, "tx_to", block_number, tx_hash, schema); + self.process_address( + action.from, + "tx_from", + block_number, + &block_hash, + tx_hash, + schema, + ); + self.process_address( + action.to, + "tx_to", + block_number, + &block_hash, + tx_hash, + schema, + ); } Action::Create(action) => { - self.process_address(action.from, "tx_from", block_number, tx_hash, schema); + self.process_address( + action.from, + "tx_from", + block_number, + &block_hash, + tx_hash, + schema, + ); } _ => {} } - if let Some(Res::Create(result)) = &trace.result { - self.process_address(result.address, "tx_to", block_number, tx_hash, schema); + if let Some(TraceOutput::Create(result)) = &trace.trace.result { + self.process_address( + result.address, + "tx_to", + block_number, + &block_hash, + tx_hash, + schema, + ); } } - fn process_trace(&mut self, trace: &Trace, schema: &Table, tx_hash: H256) { - let block_number = trace.block_number as u32; - match &trace.action { + fn process_trace( + &mut self, + trace: &LocalizedTransactionTrace, + schema: &Table, + tx_hash: TxHash, + ) { + let block_number = trace.block_number.unwrap() as u32; + let block_hash = trace.block_hash.unwrap().to_vec(); + match &trace.trace.action { Action::Call(action) => { - self.process_address(action.from, "call_from", block_number, tx_hash, schema); - self.process_address(action.to, "call_to", block_number, tx_hash, schema); + self.process_address( + action.from, + "call_from", + block_number, + &block_hash, + tx_hash, + schema, + ); + self.process_address( + action.to, + "call_to", + block_number, + &block_hash, + tx_hash, + schema, + ); } Action::Create(action) => { - self.process_address(action.from, "factory", block_number, tx_hash, schema); + self.process_address( + action.from, + "factory", + block_number, + &block_hash, + tx_hash, + schema, + ); } - Action::Suicide(action) => { - self.process_address(action.address, "suicide", block_number, tx_hash, schema); + Action::Selfdestruct(action) => { + self.process_address( + action.address, + "suicide", + block_number, + &block_hash, + tx_hash, + schema, + ); self.process_address( action.refund_address, "suicide_refund", block_number, + &block_hash, tx_hash, schema, ); } Action::Reward(action) => { - self.process_address(action.author, "author", block_number, tx_hash, schema); + self.process_address( + action.author, + "author", + block_number, + &block_hash, + tx_hash, + schema, + ); } } - if let Some(Res::Create(result)) = &trace.result { - self.process_address(result.address, "create", block_number, tx_hash, schema); + if let Some(TraceOutput::Create(result)) = &trace.trace.result { + self.process_address( + result.address, + "create", + block_number, + &block_hash, + tx_hash, + schema, + ); }; } fn process_address( &mut self, - address: H160, + address: Address, relationship: &str, block_number: u32, - transaction_hash: H256, + block_hash: &[u8], + transaction_hash: TxHash, schema: &Table, ) { self.n_rows += 1; - store!(schema, self, address, address.as_bytes().to_vec()); + store!(schema, self, address, address.to_vec()); store!(schema, self, relationship, relationship.to_string()); store!(schema, self, block_number, block_number); - store!(schema, self, transaction_hash, transaction_hash.as_bytes().to_vec()); + store!(schema, self, block_hash, block_hash.to_vec()); + store!(schema, self, transaction_hash, transaction_hash.to_vec()); } } @@ -205,19 +319,16 @@ fn process_appearances( schema: &Table, ) -> R<()> { let (block, logs, traces) = traces; - let mut logs_by_tx: HashMap> = HashMap::new(); + let mut logs_by_tx: HashMap> = HashMap::new(); for log in logs.into_iter() { if let Some(tx_hash) = log.transaction_hash { logs_by_tx.entry(tx_hash).or_default().push(log); } } - let (_block_number, block_author) = match (block.number, block.author) { - (Some(number), Some(author)) => (number.as_u64(), author), - _ => return Ok(()), - }; + let (_block_number, block_author) = (block.header.number, block.header.beneficiary); - let mut current_tx_hash = H256([0; 32]); + let mut current_tx_hash = TxHash::ZERO; for trace in traces.iter() { if let (Some(tx_hash), Some(_tx_pos)) = (trace.transaction_hash, trace.transaction_position) { diff --git a/crates/freeze/src/datasets/balance_diffs.rs b/crates/freeze/src/datasets/balance_diffs.rs index 5d48471..595f0d3 100644 --- a/crates/freeze/src/datasets/balance_diffs.rs +++ b/crates/freeze/src/datasets/balance_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, U256}, + rpc::types::trace::parity::{ChangedType, Delta, TraceResults}, +}; use polars::prelude::*; /// columns for transactions @@ -19,7 +22,7 @@ pub struct BalanceDiffs { #[async_trait::async_trait] impl Dataset for BalanceDiffs {} -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for BalanceDiffs { @@ -29,7 +32,10 @@ impl CollectByBlock for BalanceDiffs { let schema = query.schemas.get(&Datatype::BalanceDiffs).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source.fetcher.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -42,7 +48,7 @@ impl CollectByTransaction for BalanceDiffs { type Response = BlockTxsTraces; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction_state_diffs(request.transaction_hash()?).await + source.trace_transaction_state_diffs(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -58,7 +64,7 @@ pub(crate) fn process_balance_diffs( let schema = schemas.get(&Datatype::BalanceDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_balance_diff(addr, &diff.balance, block_number, tx, index, columns, schema); } @@ -68,8 +74,8 @@ pub(crate) fn process_balance_diffs( } pub(crate) fn process_balance_diff( - addr: &H160, - diff: &Diff, + addr: &Address, + diff: &Delta, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -77,16 +83,16 @@ pub(crate) fn process_balance_diff( schema: &Table, ) { let (from, to) = match diff { - Diff::Same => return, - Diff::Born(value) => (U256::zero(), *value), - Diff::Died(value) => (*value, U256::zero()), - Diff::Changed(ChangedType { from, to }) => (*from, *to), + Delta::Unchanged => return, + Delta::Added(value) => (U256::ZERO, *value), + Delta::Removed(value) => (*value, U256::ZERO), + Delta::Changed(ChangedType { from, to }) => (*from, *to), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); + store!(schema, columns, address, addr.to_vec()); store!(schema, columns, from_value, from); store!(schema, columns, to_value, to); } diff --git a/crates/freeze/src/datasets/balance_reads.rs b/crates/freeze/src/datasets/balance_reads.rs index 8109b9f..6f9ba0a 100644 --- a/crates/freeze/src/datasets/balance_reads.rs +++ b/crates/freeze/src/datasets/balance_reads.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, U256}, + rpc::types::trace::geth::AccountState, +}; use polars::prelude::*; use std::collections::BTreeMap; @@ -19,7 +22,7 @@ pub struct BalanceReads { #[async_trait::async_trait] impl Dataset for BalanceReads {} -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for BalanceReads { @@ -29,10 +32,7 @@ impl CollectByBlock for BalanceReads { let schema = query.schemas.get(&Datatype::BalanceReads).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source - .fetcher - .geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs) - .await + source.geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -49,7 +49,7 @@ impl CollectByTransaction for BalanceReads { query.schemas.get(&Datatype::BalanceReads).ok_or(err("schema not provided"))?; let include_block_number = schema.has_column("block_number"); let tx = request.transaction_hash()?; - source.fetcher.geth_debug_trace_transaction_prestate(tx, include_block_number).await + source.geth_debug_trace_transaction_prestate(tx, include_block_number).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -73,7 +73,7 @@ pub(crate) fn process_balance_reads( } pub(crate) fn process_balance_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -86,7 +86,7 @@ pub(crate) fn process_balance_read( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); + store!(schema, columns, address, addr.to_vec()); store!(schema, columns, balance, *balance); } } diff --git a/crates/freeze/src/datasets/balances.rs b/crates/freeze/src/datasets/balances.rs index fdb4f96..5b0583a 100644 --- a/crates/freeze/src/datasets/balances.rs +++ b/crates/freeze/src/datasets/balances.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::{Address, U256}; use polars::prelude::*; /// columns for balances @@ -38,7 +38,7 @@ impl CollectByBlock for Balances { let address = request.address()?; let block_number = request.block_number()? as u32; let balance = - source.fetcher.get_balance(H160::from_slice(&address), block_number.into()).await?; + source.get_balance(Address::from_slice(&address), block_number.into()).await?; Ok((block_number, None, address, balance)) } diff --git a/crates/freeze/src/datasets/blocks.rs b/crates/freeze/src/datasets/blocks.rs index 6a93444..d259a79 100644 --- a/crates/freeze/src/datasets/blocks.rs +++ b/crates/freeze/src/datasets/blocks.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::U256, + rpc::types::{Block, BlockTransactionsKind}, +}; use polars::prelude::*; /// columns for transactions @@ -9,18 +12,24 @@ pub struct Blocks { n_rows: u64, block_hash: Vec>>, parent_hash: Vec>, + uncles_hash: Vec>, author: Vec>>, state_root: Vec>, transactions_root: Vec>, receipts_root: Vec>, block_number: Vec>, gas_used: Vec, + gas_limit: Vec, extra_data: Vec>, logs_bloom: Vec>>, timestamp: Vec, + difficulty: Vec, total_difficulty: Vec>, - size: Vec>, + size: Vec>, + mix_hash: Vec>>, + nonce: Vec>>, base_fee_per_gas: Vec>, + withdrawals_root: Vec>>, chain_id: Vec, } @@ -42,12 +51,11 @@ impl Dataset for Blocks { #[async_trait::async_trait] impl CollectByBlock for Blocks { - type Response = Block; + type Response = Block; async fn extract(request: Params, source: Arc, _: Arc) -> R { let block = source - .fetcher - .get_block(request.block_number()?) + .get_block(request.block_number()?, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; Ok(block) @@ -61,17 +69,18 @@ impl CollectByBlock for Blocks { #[async_trait::async_trait] impl CollectByTransaction for Blocks { - type Response = Block; + type Response = Block; async fn extract(request: Params, source: Arc, _: Arc) -> R { let transaction = source - .fetcher - .get_transaction(request.ethers_transaction_hash()?) + .get_transaction_by_hash(request.ethers_transaction_hash()?) .await? .ok_or(CollectError::CollectError("transaction not found".to_string()))?; let block = source - .fetcher - .get_block_by_hash(transaction.block_hash.ok_or(err("no block block_hash found"))?) + .get_block_by_hash( + transaction.block_hash.ok_or(err("no block block_hash found"))?, + BlockTransactionsKind::Hashes, + ) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; Ok(block) @@ -87,19 +96,30 @@ impl CollectByTransaction for Blocks { pub(crate) fn process_block(block: Block, columns: &mut Blocks, schema: &Table) -> R<()> { columns.n_rows += 1; - store!(schema, columns, block_hash, block.hash.map(|x| x.0.to_vec())); - store!(schema, columns, parent_hash, block.parent_hash.0.to_vec()); - store!(schema, columns, author, block.author.map(|x| x.0.to_vec())); - store!(schema, columns, state_root, block.state_root.0.to_vec()); - store!(schema, columns, transactions_root, block.transactions_root.0.to_vec()); - store!(schema, columns, receipts_root, block.receipts_root.0.to_vec()); - store!(schema, columns, block_number, block.number.map(|x| x.as_u32())); - store!(schema, columns, gas_used, block.gas_used.as_u64()); - store!(schema, columns, extra_data, block.extra_data.to_vec()); - store!(schema, columns, logs_bloom, block.logs_bloom.map(|x| x.0.to_vec())); - store!(schema, columns, timestamp, block.timestamp.as_u32()); - store!(schema, columns, total_difficulty, block.total_difficulty); - store!(schema, columns, base_fee_per_gas, block.base_fee_per_gas.map(|x| x.as_u64())); - store!(schema, columns, size, block.size.map(|x| x.as_u32())); + store!(schema, columns, block_hash, Some(block.header.hash.to_vec())); + store!(schema, columns, parent_hash, block.header.parent_hash.0.to_vec()); + store!( + schema, + columns, + uncles_hash, + block.uncles.into_iter().flat_map(|s| s.to_vec()).collect() + ); + store!(schema, columns, author, Some(block.header.beneficiary.to_vec())); + store!(schema, columns, state_root, block.header.state_root.0.to_vec()); + store!(schema, columns, transactions_root, block.header.transactions_root.0.to_vec()); + store!(schema, columns, receipts_root, block.header.receipts_root.0.to_vec()); + store!(schema, columns, block_number, Some(block.header.number as u32)); + store!(schema, columns, gas_used, block.header.gas_used); + store!(schema, columns, gas_limit, block.header.gas_limit); + store!(schema, columns, extra_data, block.header.extra_data.to_vec()); + store!(schema, columns, logs_bloom, Some(block.header.logs_bloom.to_vec())); + store!(schema, columns, timestamp, block.header.timestamp as u32); + store!(schema, columns, difficulty, block.header.difficulty.wrapping_to::()); + store!(schema, columns, total_difficulty, block.header.total_difficulty); + store!(schema, columns, base_fee_per_gas, block.header.base_fee_per_gas); + store!(schema, columns, size, block.header.size.map(|v| v.wrapping_to::())); + store!(schema, columns, mix_hash, Some(block.header.mix_hash.to_vec())); + store!(schema, columns, nonce, Some(block.header.nonce.0.to_vec())); + store!(schema, columns, withdrawals_root, block.header.withdrawals_root.map(|x| x.0.to_vec())); Ok(()) } diff --git a/crates/freeze/src/datasets/code_diffs.rs b/crates/freeze/src/datasets/code_diffs.rs index a0dcc27..f8893b3 100644 --- a/crates/freeze/src/datasets/code_diffs.rs +++ b/crates/freeze/src/datasets/code_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, Bytes}, + rpc::types::trace::parity::{ChangedType, Delta, TraceResults}, +}; use polars::prelude::*; /// columns for transactions @@ -19,7 +22,7 @@ pub struct CodeDiffs { #[async_trait::async_trait] impl Dataset for CodeDiffs {} -type BlockTxTraces = (Option, Vec>>, Vec); +type BlockTxTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for CodeDiffs { @@ -28,7 +31,10 @@ impl CollectByBlock for CodeDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get(&Datatype::CodeDiffs).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source.fetcher.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -41,7 +47,7 @@ impl CollectByTransaction for CodeDiffs { type Response = BlockTxTraces; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction_state_diffs(request.transaction_hash()?).await + source.trace_transaction_state_diffs(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -57,7 +63,7 @@ pub(crate) fn process_code_diffs( let schema = schemas.get(&Datatype::CodeDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_code_diff(addr, &diff.code, block_number, tx, index, columns, schema); } @@ -67,8 +73,8 @@ pub(crate) fn process_code_diffs( } pub(crate) fn process_code_diff( - addr: &H160, - diff: &Diff, + addr: &Address, + diff: &Delta, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -77,21 +83,21 @@ pub(crate) fn process_code_diff( ) { // this code will skip self-destructs and EOAs let (from, to) = match diff { - Diff::Same => return, - Diff::Born(value) => { + Delta::Unchanged => return, + Delta::Added(value) => { if value.is_empty() { return }; (Vec::new(), value.to_vec()) } - Diff::Died(value) => (value.to_vec(), Vec::new()), - Diff::Changed(ChangedType { from, to }) => (from.to_vec(), to.to_vec()), + Delta::Removed(value) => (value.to_vec(), Vec::new()), + Delta::Changed(ChangedType { from, to }) => (from.to_vec(), to.to_vec()), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); + store!(schema, columns, address, addr.to_vec()); store!(schema, columns, from_value, from); store!(schema, columns, to_value, to); } diff --git a/crates/freeze/src/datasets/code_reads.rs b/crates/freeze/src/datasets/code_reads.rs index 12be1be..1127e5c 100644 --- a/crates/freeze/src/datasets/code_reads.rs +++ b/crates/freeze/src/datasets/code_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -19,7 +19,7 @@ pub struct CodeReads { #[async_trait::async_trait] impl Dataset for CodeReads {} -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for CodeReads { @@ -28,10 +28,7 @@ impl CollectByBlock for CodeReads { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get(&Datatype::CodeReads).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source - .fetcher - .geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs) - .await + source.geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -47,7 +44,7 @@ impl CollectByTransaction for CodeReads { let schema = query.schemas.get(&Datatype::CodeReads).ok_or(err("schema not provided"))?; let include_block_number = schema.has_column("block_number"); let tx = request.transaction_hash()?; - source.fetcher.geth_debug_trace_transaction_prestate(tx, include_block_number).await + source.geth_debug_trace_transaction_prestate(tx, include_block_number).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -71,7 +68,7 @@ pub(crate) fn process_code_reads( } pub(crate) fn process_code_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -84,7 +81,7 @@ pub(crate) fn process_code_read( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, contract_address, addr.as_bytes().to_vec()); - store!(schema, columns, code, code.as_bytes().to_vec()); + store!(schema, columns, contract_address, addr.to_vec()); + store!(schema, columns, code, code.to_vec()); } } diff --git a/crates/freeze/src/datasets/codes.rs b/crates/freeze/src/datasets/codes.rs index 5c3ecb6..16bc5dc 100644 --- a/crates/freeze/src/datasets/codes.rs +++ b/crates/freeze/src/datasets/codes.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::Address; use polars::prelude::*; /// columns for balances @@ -41,8 +41,7 @@ impl CollectByBlock for Codes { async fn extract(request: Params, source: Arc, _: Arc) -> R { let address = request.address()?; let block_number = request.block_number()? as u32; - let output = - source.fetcher.get_code(H160::from_slice(&address), block_number.into()).await?; + let output = source.get_code(Address::from_slice(&address), block_number.into()).await?; Ok((block_number, None, address, output.to_vec())) } diff --git a/crates/freeze/src/datasets/contracts.rs b/crates/freeze/src/datasets/contracts.rs index e6a3d20..7df089a 100644 --- a/crates/freeze/src/datasets/contracts.rs +++ b/crates/freeze/src/datasets/contracts.rs @@ -1,7 +1,9 @@ use super::traces; use crate::*; -use ethers::prelude::*; -use ethers_core::utils::keccak256; +use alloy::{ + primitives::{keccak256, Address}, + rpc::types::trace::parity::{Action, LocalizedTransactionTrace, TraceOutput}, +}; use polars::prelude::*; /// columns for transactions @@ -10,6 +12,7 @@ use polars::prelude::*; pub struct Contracts { n_rows: u64, block_number: Vec, + block_hash: Vec>, create_index: Vec, transaction_hash: Vec>>, contract_address: Vec>, @@ -18,6 +21,8 @@ pub struct Contracts { init_code: Vec>, code: Vec>, init_code_hash: Vec>, + n_init_code_bytes: Vec, + n_code_bytes: Vec, code_hash: Vec>, chain_id: Vec, } @@ -31,10 +36,10 @@ impl Dataset for Contracts { #[async_trait::async_trait] impl CollectByBlock for Contracts { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_block(request.ethers_block_number()?).await + source.trace_block(request.ethers_block_number()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -46,10 +51,10 @@ impl CollectByBlock for Contracts { #[async_trait::async_trait] impl CollectByTransaction for Contracts { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction(request.ethers_transaction_hash()?).await + source.trace_transaction(request.ethers_transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -61,38 +66,42 @@ impl CollectByTransaction for Contracts { /// process block into columns pub(crate) fn process_contracts( - traces: &[Trace], + traces: &[LocalizedTransactionTrace], columns: &mut Contracts, schemas: &Schemas, ) -> R<()> { let schema = schemas.get(&Datatype::Contracts).ok_or(err("schema not provided"))?; - let mut deployer = H160([0; 20]); + let mut deployer = Address::ZERO; let mut create_index = 0; for trace in traces.iter() { - if trace.trace_address.is_empty() { - deployer = match &trace.action { + if trace.trace.trace_address.is_empty() { + deployer = match &trace.trace.action { Action::Call(call) => call.from, Action::Create(create) => create.from, - Action::Suicide(suicide) => suicide.refund_address, + Action::Selfdestruct(suicide) => suicide.refund_address, Action::Reward(reward) => reward.author, }; }; - if let (Action::Create(create), Some(Res::Create(result))) = (&trace.action, &trace.result) + if let (Action::Create(create), Some(TraceOutput::Create(result))) = + (&trace.trace.action, &trace.trace.result) { columns.n_rows += 1; - store!(schema, columns, block_number, trace.block_number as u32); + store!(schema, columns, block_number, trace.block_number.unwrap() as u32); + store!(schema, columns, block_hash, trace.block_hash.unwrap().to_vec()); store!(schema, columns, create_index, create_index); create_index += 1; let tx = trace.transaction_hash; - store!(schema, columns, transaction_hash, tx.map(|x| x.as_bytes().to_vec())); - store!(schema, columns, contract_address, result.address.as_bytes().into()); - store!(schema, columns, deployer, deployer.as_bytes().into()); - store!(schema, columns, factory, create.from.as_bytes().into()); + store!(schema, columns, transaction_hash, tx.map(|x| x.to_vec())); + store!(schema, columns, contract_address, result.address.to_vec()); + store!(schema, columns, deployer, deployer.to_vec()); + store!(schema, columns, factory, create.from.to_vec()); store!(schema, columns, init_code, create.init.to_vec()); store!(schema, columns, code, result.code.to_vec()); - store!(schema, columns, code_hash, keccak256(create.init.clone()).into()); - store!(schema, columns, init_code_hash, keccak256(result.code.clone()).into()); + store!(schema, columns, init_code_hash, keccak256(result.code.clone()).to_vec()); + store!(schema, columns, code_hash, keccak256(create.init.clone()).to_vec()); + store!(schema, columns, n_init_code_bytes, create.init.len() as u32); + store!(schema, columns, n_code_bytes, result.code.len() as u32); } } Ok(()) diff --git a/crates/freeze/src/datasets/erc20_approvals.rs b/crates/freeze/src/datasets/erc20_approvals.rs new file mode 100644 index 0000000..acba313 --- /dev/null +++ b/crates/freeze/src/datasets/erc20_approvals.rs @@ -0,0 +1,126 @@ +use crate::*; +use alloy::{ + primitives::{B256, U256}, + rpc::types::{Filter, Log, Topic}, + sol_types::SolEvent, +}; +use polars::prelude::*; + +/// columns for transactions +#[cryo_to_df::to_df(Datatype::Erc20Approvals)] +#[derive(Default)] +pub struct Erc20Approvals { + n_rows: u64, + block_number: Vec, + block_hash: Vec>>, + transaction_index: Vec, + log_index: Vec, + transaction_hash: Vec>, + erc20: Vec>, + from_address: Vec>, + to_address: Vec>, + value: Vec, + chain_id: Vec, +} + +#[async_trait::async_trait] +impl Dataset for Erc20Approvals { + fn default_columns() -> Option> { + Some(vec![ + "block_number", + // "block_hash", + "transaction_index", + "log_index", + "transaction_hash", + "erc20", + "from_address", + "to_address", + "value", + "chain_id", + ]) + } + + fn optional_parameters() -> Vec { + vec![Dim::Address, Dim::Topic0, Dim::Topic1, Dim::Topic2, Dim::FromAddress, Dim::ToAddress] + } + + fn use_block_ranges() -> bool { + true + } + + fn arg_aliases() -> Option> { + Some([(Dim::Contract, Dim::Address)].into_iter().collect()) + } +} + +#[async_trait::async_trait] +impl CollectByBlock for Erc20Approvals { + type Response = Vec; + + async fn extract(request: Params, source: Arc, _: Arc) -> R { + let mut topics: [Topic; 4] = Default::default(); + topics[0] = ERC20::Approval::SIGNATURE_HASH.into(); + if let Some(from_address) = &request.from_address { + let v = B256::from_slice(from_address); + topics[1] = v.into(); + } + if let Some(to_address) = &request.to_address { + let v = B256::from_slice(to_address); + topics[2] = v.into(); + } + let filter = Filter { topics, ..request.ethers_log_filter()? }; + + let logs = source.get_logs(&filter).await?; + + Ok(logs + .into_iter() + .filter(|x| x.topics().len() == 3 && x.data().data.len() == 32) + .collect()) + } + + fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { + let schema = query.schemas.get_schema(&Datatype::Erc20Approvals)?; + process_erc20_approval(response, columns, schema) + } +} + +#[async_trait::async_trait] +impl CollectByTransaction for Erc20Approvals { + type Response = Vec; + + async fn extract(request: Params, source: Arc, _: Arc) -> R { + let logs = source.get_transaction_logs(request.transaction_hash()?).await?; + Ok(logs.into_iter().filter(is_erc20_approval).collect()) + } +} + +fn is_erc20_approval(log: &Log) -> bool { + log.topics().len() == 3 && + log.data().data.len() == 32 && + log.topics()[0] == ERC20::Approval::SIGNATURE_HASH +} + +fn process_erc20_approval(logs: Vec, columns: &mut Erc20Approvals, schema: &Table) -> R<()> { + for log in logs.iter() { + if let (Some(bn), Some(tx), Some(ti), Some(li)) = + (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) + { + columns.n_rows += 1; + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, erc20, log.address().to_vec()); + store!(schema, columns, from_address, log.topics()[1][12..].to_vec()); + store!(schema, columns, to_address, log.topics()[2][12..].to_vec()); + store!( + schema, + columns, + value, + U256::from_be_slice(log.data().data.to_vec().as_slice()) + ); + } + } + Ok(()) +} diff --git a/crates/freeze/src/datasets/erc20_balances.rs b/crates/freeze/src/datasets/erc20_balances.rs index 60794a5..70fd4f8 100644 --- a/crates/freeze/src/datasets/erc20_balances.rs +++ b/crates/freeze/src/datasets/erc20_balances.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, sol_types::SolCall}; use polars::prelude::*; /// columns for transactions @@ -30,14 +30,14 @@ impl CollectByBlock for Erc20Balances { type Response = (u32, Vec, Vec, Option); async fn extract(request: Params, source: Arc, _: Arc) -> R { - let signature = FUNCTION_ERC20_BALANCE_OF.clone(); - let mut call_data = signature.clone(); + let signature = ERC20::balanceOfCall::SELECTOR; + let mut call_data = signature.clone().to_vec(); call_data.extend(vec![0; 12]); call_data.extend(request.address()?); let block_number = request.ethers_block_number()?; let contract = request.ethers_contract()?; - let balance = source.fetcher.call2(contract, call_data, block_number).await.ok(); - let balance = balance.map(|x| x.to_vec().as_slice().into()); + let balance = source.call2(contract, call_data, block_number).await.ok(); + let balance = balance.map(|x| U256::from_be_slice(x.as_ref())); Ok((request.block_number()? as u32, request.contract()?, request.address()?, balance)) } diff --git a/crates/freeze/src/datasets/erc20_metadata.rs b/crates/freeze/src/datasets/erc20_metadata.rs index 4fdccc3..ec254c9 100644 --- a/crates/freeze/src/datasets/erc20_metadata.rs +++ b/crates/freeze/src/datasets/erc20_metadata.rs @@ -1,4 +1,5 @@ use crate::*; +use alloy::sol_types::SolCall; use polars::prelude::*; /// columns for transactions @@ -47,8 +48,8 @@ impl CollectByBlock for Erc20Metadata { let address = request.ethers_address()?; // name - let call_data = FUNCTION_ERC20_NAME.clone(); - let name = match source.fetcher.call2(address, call_data, block_number).await { + let call_data = ERC20::nameCall::SELECTOR.to_vec(); + let name = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) } @@ -56,8 +57,8 @@ impl CollectByBlock for Erc20Metadata { }; // symbol - let call_data = FUNCTION_ERC20_SYMBOL.clone(); - let symbol = match source.fetcher.call2(address, call_data, block_number).await { + let call_data = ERC20::symbolCall::SELECTOR.to_vec(); + let symbol = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) } @@ -65,8 +66,8 @@ impl CollectByBlock for Erc20Metadata { }; // decimals - let call_data = FUNCTION_ERC20_DECIMALS.clone(); - let decimals = match source.fetcher.call2(address, call_data, block_number).await { + let call_data = ERC20::decimalsCall::SELECTOR.to_vec(); + let decimals = match source.call2(address, call_data, block_number).await { Ok(output) => bytes_to_u32(output).ok(), Err(_) => None, }; diff --git a/crates/freeze/src/datasets/erc20_supplies.rs b/crates/freeze/src/datasets/erc20_supplies.rs index be37b62..d02f1ca 100644 --- a/crates/freeze/src/datasets/erc20_supplies.rs +++ b/crates/freeze/src/datasets/erc20_supplies.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, sol_types::SolCall}; use polars::prelude::*; /// columns for transactions @@ -37,13 +37,13 @@ impl CollectByBlock for Erc20Supplies { type Response = (u32, Vec, Option); async fn extract(request: Params, source: Arc, _: Arc) -> R { - let signature: Vec = FUNCTION_ERC20_TOTAL_SUPPLY.clone(); + let signature: Vec = ERC20::totalSupplyCall::SELECTOR.to_vec(); let mut call_data = signature.clone(); call_data.extend(request.address()?); let block_number = request.ethers_block_number()?; let contract = request.ethers_address()?; - let output = source.fetcher.call2(contract, call_data, block_number).await.ok(); - let output = output.map(|x| x.to_vec().as_slice().into()); + let output = source.call2(contract, call_data, block_number).await.ok(); + let output = output.map(|x| U256::from_be_slice(x.as_ref())); Ok((request.block_number()? as u32, request.address()?, output)) } diff --git a/crates/freeze/src/datasets/erc20_transfers.rs b/crates/freeze/src/datasets/erc20_transfers.rs index 7d7ba24..6881266 100644 --- a/crates/freeze/src/datasets/erc20_transfers.rs +++ b/crates/freeze/src/datasets/erc20_transfers.rs @@ -1,5 +1,9 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{B256, U256}, + rpc::types::{Filter, Log, Topic}, + sol_types::SolEvent, +}; use polars::prelude::*; /// columns for transactions @@ -8,6 +12,7 @@ use polars::prelude::*; pub struct Erc20Transfers { n_rows: u64, block_number: Vec, + block_hash: Vec>>, transaction_index: Vec, log_index: Vec, transaction_hash: Vec>, @@ -20,6 +25,21 @@ pub struct Erc20Transfers { #[async_trait::async_trait] impl Dataset for Erc20Transfers { + fn default_columns() -> Option> { + Some(vec![ + "block_number", + // "block_hash", + "transaction_index", + "log_index", + "transaction_hash", + "erc20", + "from_address", + "to_address", + "value", + "chain_id", + ]) + } + fn optional_parameters() -> Vec { vec![Dim::Address, Dim::Topic0, Dim::Topic1, Dim::Topic2, Dim::FromAddress, Dim::ToAddress] } @@ -38,21 +58,23 @@ impl CollectByBlock for Erc20Transfers { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let mut topics = [Some(ValueOrArray::Value(Some(*EVENT_ERC20_TRANSFER))), None, None, None]; + let mut topics: [Topic; 4] = Default::default(); + topics[0] = ERC20::Transfer::SIGNATURE_HASH.into(); if let Some(from_address) = &request.from_address { - let mut v = vec![0u8; 12]; - v.append(&mut from_address.to_owned()); - topics[1] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); + let v = B256::from_slice(from_address); + topics[1] = v.into(); } if let Some(to_address) = &request.to_address { - let mut v = vec![0u8; 12]; - v.append(&mut to_address.to_owned()); - topics[2] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); + let v = B256::from_slice(to_address); + topics[2] = v.into(); } let filter = Filter { topics, ..request.ethers_log_filter()? }; - let logs = source.fetcher.get_logs(&filter).await?; + let logs = source.get_logs(&filter).await?; - Ok(logs.into_iter().filter(|x| x.topics.len() == 3 && x.data.len() == 32).collect()) + Ok(logs + .into_iter() + .filter(|x| x.topics().len() == 3 && x.data().data.len() == 32) + .collect()) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -66,7 +88,7 @@ impl CollectByTransaction for Erc20Transfers { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let logs = source.fetcher.get_transaction_logs(request.transaction_hash()?).await?; + let logs = source.get_transaction_logs(request.transaction_hash()?).await?; Ok(logs.into_iter().filter(is_erc20_transfer).collect()) } @@ -77,7 +99,9 @@ impl CollectByTransaction for Erc20Transfers { } fn is_erc20_transfer(log: &Log) -> bool { - log.topics.len() == 3 && log.data.len() == 32 && log.topics[0] == *EVENT_ERC20_TRANSFER + log.topics().len() == 3 && + log.data().data.len() == 32 && + log.topics()[0] == ERC20::Approval::SIGNATURE_HASH } /// process block into columns @@ -87,14 +111,20 @@ fn process_erc20_transfers(logs: Vec, columns: &mut Erc20Transfers, schema: (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, erc20, log.address.as_bytes().to_vec()); - store!(schema, columns, from_address, log.topics[1].as_bytes()[12..].to_vec()); - store!(schema, columns, to_address, log.topics[2].as_bytes()[12..].to_vec()); - store!(schema, columns, value, log.data.to_vec().as_slice().into()); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, erc20, log.address().to_vec()); + store!(schema, columns, from_address, log.topics()[1][12..].to_vec()); + store!(schema, columns, to_address, log.topics()[2][12..].to_vec()); + store!( + schema, + columns, + value, + U256::from_be_slice(log.data().data.to_vec().as_slice()) + ); } } Ok(()) diff --git a/crates/freeze/src/datasets/erc721_metadata.rs b/crates/freeze/src/datasets/erc721_metadata.rs index ef6b7b3..734f2d7 100644 --- a/crates/freeze/src/datasets/erc721_metadata.rs +++ b/crates/freeze/src/datasets/erc721_metadata.rs @@ -1,5 +1,6 @@ use super::erc20_metadata::remove_control_characters; use crate::*; +use alloy::sol_types::SolCall; use polars::prelude::*; /// columns for transactions @@ -37,8 +38,8 @@ impl CollectByBlock for Erc721Metadata { let address = request.ethers_address()?; // name - let call_data = FUNCTION_ERC20_NAME.clone(); - let name = match source.fetcher.call2(address, call_data, block_number).await { + let call_data = ERC721::nameCall::SELECTOR.to_vec(); + let name = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) } @@ -46,8 +47,8 @@ impl CollectByBlock for Erc721Metadata { }; // symbol - let call_data = FUNCTION_ERC20_SYMBOL.clone(); - let symbol = match source.fetcher.call2(address, call_data, block_number).await { + let call_data = ERC721::symbolCall::SELECTOR.to_vec(); + let symbol = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) } diff --git a/crates/freeze/src/datasets/erc721_transfers.rs b/crates/freeze/src/datasets/erc721_transfers.rs index b01b337..065dc17 100644 --- a/crates/freeze/src/datasets/erc721_transfers.rs +++ b/crates/freeze/src/datasets/erc721_transfers.rs @@ -1,5 +1,9 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{B256, U256}, + rpc::types::{Filter, Log, Topic}, + sol_types::SolEvent, +}; use polars::prelude::*; /// columns for transactions @@ -8,6 +12,7 @@ use polars::prelude::*; pub struct Erc721Transfers { n_rows: u64, block_number: Vec, + block_hash: Vec>>, transaction_index: Vec, log_index: Vec, transaction_hash: Vec>, @@ -20,6 +25,21 @@ pub struct Erc721Transfers { #[async_trait::async_trait] impl Dataset for Erc721Transfers { + fn default_columns() -> Option> { + Some(vec![ + "block_number", + // "block_hash", + "transaction_index", + "log_index", + "transaction_hash", + "erc20", + "from_address", + "to_address", + "token_id", + "chain_id", + ]) + } + fn optional_parameters() -> Vec { vec![Dim::Address, Dim::FromAddress, Dim::ToAddress] } @@ -38,22 +58,20 @@ impl CollectByBlock for Erc721Transfers { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let mut topics = - [Some(ValueOrArray::Value(Some(*EVENT_ERC721_TRANSFER))), None, None, None]; + let mut topics: [Topic; 4] = Default::default(); + topics[0] = ERC721::Transfer::SIGNATURE_HASH.into(); if let Some(from_address) = &request.from_address { - let mut v = vec![0u8; 12]; - v.append(&mut from_address.to_owned()); - topics[1] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); - } + let v = B256::from_slice(from_address); + topics[1] = v.into(); + }; if let Some(to_address) = &request.to_address { - let mut v = vec![0u8; 12]; - v.append(&mut to_address.to_owned()); - topics[2] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); - } + let v = B256::from_slice(to_address); + topics[2] = v.into(); + }; let filter = Filter { topics, ..request.ethers_log_filter()? }; - let logs = source.fetcher.get_logs(&filter).await?; + let logs = source.get_logs(&filter).await?; - Ok(logs.into_iter().filter(|x| x.topics.len() == 4 && x.data.len() == 0).collect()) + Ok(logs.into_iter().filter(|x| x.topics().len() == 4 && x.data().data.len() == 0).collect()) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -67,7 +85,7 @@ impl CollectByTransaction for Erc721Transfers { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let logs = source.fetcher.get_transaction_logs(request.transaction_hash()?).await?; + let logs = source.get_transaction_logs(request.transaction_hash()?).await?; Ok(logs.into_iter().filter(is_erc721_transfer).collect()) } @@ -78,7 +96,9 @@ impl CollectByTransaction for Erc721Transfers { } fn is_erc721_transfer(log: &Log) -> bool { - log.topics.len() == 4 && log.data.len() == 0 && log.topics[0] == *EVENT_ERC721_TRANSFER + log.topics().len() == 4 && + log.data().data.len() == 0 && + log.topics()[0] == ERC721::Transfer::SIGNATURE_HASH } /// process block into columns @@ -92,14 +112,15 @@ fn process_erc721_transfers( (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, erc20, log.address.as_bytes().to_vec()); - store!(schema, columns, from_address, log.topics[1].as_bytes()[12..].to_vec()); - store!(schema, columns, to_address, log.topics[2].as_bytes()[12..].to_vec()); - store!(schema, columns, token_id, log.topics[3].as_bytes().into()); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, erc20, log.address().to_vec()); + store!(schema, columns, from_address, log.topics()[1][12..].to_vec()); + store!(schema, columns, to_address, log.topics()[2][12..].to_vec()); + store!(schema, columns, token_id, log.topics()[3].into()); } } Ok(()) diff --git a/crates/freeze/src/datasets/eth_calls.rs b/crates/freeze/src/datasets/eth_calls.rs index 5f19392..203528f 100644 --- a/crates/freeze/src/datasets/eth_calls.rs +++ b/crates/freeze/src/datasets/eth_calls.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{keccak256, TxKind}, + rpc::types::{TransactionInput, TransactionRequest}, +}; use polars::prelude::*; /// columns for transactions @@ -11,8 +14,8 @@ pub struct EthCalls { contract_address: Vec>, call_data: Vec>, call_data_hash: Vec>, - output_data: Vec>, - output_data_hash: Vec>, + output_data: Vec>>, + output_data_hash: Vec>>, chain_id: Vec, } @@ -39,7 +42,7 @@ impl Dataset for EthCalls { } } -type EthCallsResponse = (u32, Vec, Vec, Vec); +type EthCallsResponse = (u32, Vec, Vec, Option>); #[async_trait::async_trait] impl CollectByBlock for EthCalls { @@ -47,13 +50,13 @@ impl CollectByBlock for EthCalls { async fn extract(request: Params, source: Arc, _: Arc) -> R { let transaction = TransactionRequest { - to: Some(request.ethers_contract()?.into()), - data: Some(request.call_data()?.into()), + to: Some(TxKind::Call(request.ethers_contract()?)), + input: TransactionInput::new(request.call_data()?.into()), ..Default::default() }; let number = request.block_number()?; - let output = source.fetcher.call(transaction, number.into()).await?; - Ok((number as u32, request.contract()?, request.call_data()?, output.to_vec())) + let output = source.call(transaction, number).await.ok().map(|x| x.to_vec()); + Ok((number as u32, request.contract()?, request.call_data()?, output)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -73,7 +76,7 @@ fn process_eth_call(response: EthCallsResponse, columns: &mut EthCalls, schema: store!(schema, columns, block_number, block_number); store!(schema, columns, contract_address, contract_address); store!(schema, columns, call_data, call_data.clone()); - store!(schema, columns, call_data_hash, ethers_core::utils::keccak256(call_data).into()); - store!(schema, columns, output_data, output_data.to_vec()); - store!(schema, columns, output_data_hash, ethers_core::utils::keccak256(output_data).into()); + store!(schema, columns, call_data_hash, keccak256(call_data).to_vec()); + store!(schema, columns, output_data, output_data.clone()); + store!(schema, columns, output_data_hash, output_data.map(|data| keccak256(data).to_vec())); } diff --git a/crates/freeze/src/datasets/four_byte_counts.rs b/crates/freeze/src/datasets/four_byte_counts.rs index 2903675..01d7145 100644 --- a/crates/freeze/src/datasets/four_byte_counts.rs +++ b/crates/freeze/src/datasets/four_byte_counts.rs @@ -34,7 +34,6 @@ impl CollectByBlock for FourByteCounts { query.schemas.get(&Datatype::FourByteCounts).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); source - .fetcher .geth_debug_trace_block_4byte_traces(request.block_number()? as u32, include_txs) .await } @@ -53,7 +52,7 @@ impl CollectByTransaction for FourByteCounts { query.schemas.get(&Datatype::FourByteCounts).ok_or(err("schema not provided"))?; let include_block_number = schema.has_column("block_number"); let tx = request.transaction_hash()?; - source.fetcher.geth_debug_trace_transaction_4byte_traces(tx, include_block_number).await + source.geth_debug_trace_transaction_4byte_traces(tx, include_block_number).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/datasets/geth_balance_diffs.rs b/crates/freeze/src/datasets/geth_balance_diffs.rs index ef87240..a719715 100644 --- a/crates/freeze/src/datasets/geth_balance_diffs.rs +++ b/crates/freeze/src/datasets/geth_balance_diffs.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::U256; use polars::prelude::*; /// columns for transactions diff --git a/crates/freeze/src/datasets/geth_calls.rs b/crates/freeze/src/datasets/geth_calls.rs index af14eef..db5df39 100644 --- a/crates/freeze/src/datasets/geth_calls.rs +++ b/crates/freeze/src/datasets/geth_calls.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, rpc::types::trace::geth::CallFrame}; use polars::prelude::*; /// columns for geth traces @@ -34,7 +34,7 @@ impl CollectByBlock for GethCalls { let schema = query.schemas.get_schema(&Datatype::GethCalls)?; let include_transaction = schema.has_column("block_number"); let block_number = request.block_number()? as u32; - source.fetcher.geth_debug_trace_block_calls(block_number, include_transaction).await + source.geth_debug_trace_block_calls(block_number, include_transaction).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -50,7 +50,6 @@ impl CollectByTransaction for GethCalls { let schema = query.schemas.get_schema(&Datatype::GethCalls)?; let include_block_number = schema.has_column("block_number"); source - .fetcher .geth_debug_trace_transaction_calls(request.transaction_hash()?, include_block_number) .await } @@ -84,8 +83,8 @@ fn process_trace( ) -> R<()> { columns.n_rows += 1; store!(schema, columns, typ, trace.typ); - store!(schema, columns, from_address, trace.from.as_bytes().to_vec()); - store!(schema, columns, to_address, noa_to_vec_u8(trace.to)?); + store!(schema, columns, from_address, trace.from.to_vec()); + store!(schema, columns, to_address, trace.to.map(|x| x.to_vec())); store!(schema, columns, value, trace.value); store!(schema, columns, gas, trace.gas); store!(schema, columns, gas_used, trace.gas_used); @@ -102,21 +101,11 @@ fn process_trace( trace_address.iter().map(|&n| n.to_string()).collect::>().join(" ") ); - if let Some(subcalls) = trace.calls { - for (s, subcall) in subcalls.into_iter().enumerate() { - let mut sub_trace_address = trace_address.clone(); - sub_trace_address.push(s as u32); - process_trace(subcall, columns, schema, block_number, tx, tx_index, sub_trace_address)? - } + for (s, subcall) in trace.calls.into_iter().enumerate() { + let mut sub_trace_address = trace_address.clone(); + sub_trace_address.push(s as u32); + process_trace(subcall, columns, schema, block_number, tx, tx_index, sub_trace_address)? } Ok(()) } - -fn noa_to_vec_u8(value: Option) -> R>> { - match value { - Some(NameOrAddress::Address(address)) => Ok(Some(address.as_bytes().to_vec())), - Some(NameOrAddress::Name(_)) => Err(err("block name string not allowed")), - None => Ok(None), - } -} diff --git a/crates/freeze/src/datasets/geth_nonce_diffs.rs b/crates/freeze/src/datasets/geth_nonce_diffs.rs index 027e32b..47a86b0 100644 --- a/crates/freeze/src/datasets/geth_nonce_diffs.rs +++ b/crates/freeze/src/datasets/geth_nonce_diffs.rs @@ -1,5 +1,4 @@ use crate::*; -use ethers::prelude::*; use polars::prelude::*; /// columns for transactions @@ -11,8 +10,8 @@ pub struct GethNonceDiffs { pub(crate) transaction_index: Vec>, pub(crate) transaction_hash: Vec>>, pub(crate) address: Vec>, - pub(crate) from_value: Vec, - pub(crate) to_value: Vec, + pub(crate) from_value: Vec, + pub(crate) to_value: Vec, pub(crate) chain_id: Vec, } diff --git a/crates/freeze/src/datasets/geth_opcodes.rs b/crates/freeze/src/datasets/geth_opcodes.rs index b320728..95f519b 100644 --- a/crates/freeze/src/datasets/geth_opcodes.rs +++ b/crates/freeze/src/datasets/geth_opcodes.rs @@ -1,5 +1,7 @@ use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::geth::{ + DefaultFrame, GethDebugTracingOptions, GethDefaultTracingOptions, +}; use polars::prelude::*; /// columns for geth traces @@ -40,19 +42,24 @@ impl CollectByBlock for GethOpcodes { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::GethOpcodes)?; - let options = GethDebugTracingOptions { + // let options = GethDebugTracingOptions { + // disable_storage: Some(!schema.has_column("storage")), + // disable_stack: Some(!schema.has_column("stack")), + // enable_memory: Some(schema.has_column("memory")), + // enable_return_data: Some(schema.has_column("return_data")), + // ..Default::default() + // }; + let config = GethDefaultTracingOptions { disable_storage: Some(!schema.has_column("storage")), disable_stack: Some(!schema.has_column("stack")), enable_memory: Some(schema.has_column("memory")), enable_return_data: Some(schema.has_column("return_data")), ..Default::default() }; + let options = GethDebugTracingOptions { config, ..Default::default() }; let include_transaction = schema.has_column("block_number"); let block_number = request.block_number()? as u32; - source - .fetcher - .geth_debug_trace_block_opcodes(block_number, include_transaction, options) - .await + source.geth_debug_trace_block_opcodes(block_number, include_transaction, options).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -66,16 +73,16 @@ impl CollectByTransaction for GethOpcodes { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::GethOpcodes)?; - let options = GethDebugTracingOptions { + let include_block_number = schema.has_column("block_number"); + let config = GethDefaultTracingOptions { disable_storage: Some(!schema.has_column("storage")), disable_stack: Some(!schema.has_column("stack")), enable_memory: Some(schema.has_column("memory")), enable_return_data: Some(schema.has_column("return_data")), ..Default::default() }; - let include_block_number = schema.has_column("block_number"); + let options = GethDebugTracingOptions { config, ..Default::default() }; source - .fetcher .geth_debug_trace_transaction_opcodes( request.transaction_hash()?, include_block_number, diff --git a/crates/freeze/src/datasets/javascript_traces.rs b/crates/freeze/src/datasets/javascript_traces.rs index 04468e9..056d354 100644 --- a/crates/freeze/src/datasets/javascript_traces.rs +++ b/crates/freeze/src/datasets/javascript_traces.rs @@ -33,7 +33,6 @@ impl CollectByBlock for JavascriptTraces { let block = request.block_number()? as u32; if let Some(js_tracer) = &query.js_tracer { source - .fetcher .geth_debug_trace_block_javascript_traces(js_tracer.clone(), block, include_txs) .await } else { @@ -57,7 +56,6 @@ impl CollectByTransaction for JavascriptTraces { let tx = request.transaction_hash()?; if let Some(js_tracer) = &query.js_tracer { source - .fetcher .geth_debug_trace_transaction_javascript_traces( js_tracer.clone(), tx, diff --git a/crates/freeze/src/datasets/logs.rs b/crates/freeze/src/datasets/logs.rs index 322f3c7..01313f6 100644 --- a/crates/freeze/src/datasets/logs.rs +++ b/crates/freeze/src/datasets/logs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + dyn_abi::{DynSolType, DynSolValue, EventExt}, + rpc::types::Log, +}; use polars::prelude::*; /// columns for transactions @@ -8,6 +11,7 @@ use polars::prelude::*; pub struct Logs { n_rows: u64, block_number: Vec, + block_hash: Vec>>, transaction_index: Vec, log_index: Vec, transaction_hash: Vec>, @@ -17,7 +21,8 @@ pub struct Logs { topic2: Vec>>, topic3: Vec>>, data: Vec>, - event_cols: indexmap::IndexMap>, + n_data_bytes: Vec, + event_cols: indexmap::IndexMap>, chain_id: Vec, } @@ -27,6 +32,25 @@ impl Dataset for Logs { vec!["events"] } + fn default_columns() -> Option> { + Some(vec![ + "block_number", + // "block_hash", + "transaction_index", + "log_index", + "transaction_hash", + "address", + "topic0", + "topic1", + "topic2", + "topic3", + "data", + "n_data_bytes", + // "event_cols", + "chain_id", + ]) + } + fn optional_parameters() -> Vec { vec![Dim::Address, Dim::Topic0, Dim::Topic1, Dim::Topic2, Dim::Topic3] } @@ -45,7 +69,7 @@ impl CollectByBlock for Logs { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.get_logs(&request.ethers_log_filter()?).await + source.get_logs(&request.ethers_log_filter()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -59,7 +83,7 @@ impl CollectByTransaction for Logs { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.get_transaction_logs(request.transaction_hash()?).await + source.get_transaction_logs(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -70,17 +94,37 @@ impl CollectByTransaction for Logs { /// process block into columns fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { - let decode_keys = match &schema.log_decoder { - None => None, + // let decode_keys = match &schema.log_decoder { + // None => None, + // Some(decoder) => { + // let keys = decoder + // .event + // .inputs + // .clone() + // .into_iter() + // .map(|i| i.name) + // .collect::>(); + // Some(keys) + // } + // }; + let (indexed_keys, body_keys) = match &schema.log_decoder { + None => (None, None), Some(decoder) => { - let keys = decoder + let indexed: Vec = decoder .event .inputs .clone() .into_iter() - .map(|i| i.name) - .collect::>(); - Some(keys) + .filter_map(|x| if x.indexed { Some(x.name) } else { None }) + .collect(); + let body: Vec = decoder + .event + .inputs + .clone() + .into_iter() + .filter_map(|x| if x.indexed { None } else { Some(x.name) }) + .collect(); + (Some(indexed), Some(body)) } }; @@ -89,13 +133,29 @@ fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { // decode event - if let (Some(decoder), Some(decode_keys)) = (&schema.log_decoder, &decode_keys) { - match decoder.event.parse_log(log.clone().into()) { + if let (Some(decoder), Some(indexed_keys), Some(body_keys)) = + (&schema.log_decoder, &indexed_keys, &body_keys) + { + match decoder.event.decode_log(&log.inner.data, true) { Ok(log) => { - for param in log.params { - if decode_keys.contains(param.name.as_str()) { - columns.event_cols.entry(param.name).or_default().push(param.value); - } + // for param in log.indexed { + // if decode_keys.contains(param.name.as_str()) { + // columns.event_cols.entry(param.name).or_default().push(param. + // value); } + // } + for (idx, indexed_param) in log.indexed.into_iter().enumerate() { + columns + .event_cols + .entry(indexed_keys[idx].clone()) + .or_default() + .push(indexed_param); + } + for (idx, body_param) in log.body.into_iter().enumerate() { + columns + .event_cols + .entry(body_keys[idx].clone()) + .or_default() + .push(body_param); } } Err(_) => continue, @@ -103,20 +163,19 @@ fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { }; columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, address, log.address.as_bytes().to_vec()); - store!(schema, columns, data, log.data.to_vec()); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, address, log.address().to_vec()); + store!(schema, columns, data, log.data().data.to_vec()); + store!(schema, columns, n_data_bytes, log.data().data.len() as u32); // topics for i in 0..4 { - let topic = if i < log.topics.len() { - Some(log.topics[i].as_bytes().to_vec()) - } else { - None - }; + let topic = + if i < log.topics().len() { Some(log.topics()[i].to_vec()) } else { None }; match i { 0 => store!(schema, columns, topic0, topic), 1 => store!(schema, columns, topic1, topic), diff --git a/crates/freeze/src/datasets/mod.rs b/crates/freeze/src/datasets/mod.rs index 4c168ae..b7dd607 100644 --- a/crates/freeze/src/datasets/mod.rs +++ b/crates/freeze/src/datasets/mod.rs @@ -16,6 +16,8 @@ pub mod code_reads; pub mod codes; /// contracts pub mod contracts; +/// erc20 approval +pub mod erc20_approvals; /// erc20 balances pub mod erc20_balances; /// erc20 metadata @@ -80,6 +82,7 @@ pub use code_diffs::*; pub use code_reads::*; pub use codes::*; pub use contracts::*; +pub use erc20_approvals::*; pub use erc20_balances::*; pub use erc20_metadata::*; pub use erc20_supplies::*; diff --git a/crates/freeze/src/datasets/native_transfers.rs b/crates/freeze/src/datasets/native_transfers.rs index 53bbbd2..a8f2704 100644 --- a/crates/freeze/src/datasets/native_transfers.rs +++ b/crates/freeze/src/datasets/native_transfers.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::U256, + rpc::types::trace::parity::{Action, LocalizedTransactionTrace, TraceOutput}, +}; use polars::prelude::*; /// columns for transactions @@ -8,6 +11,7 @@ use polars::prelude::*; pub struct NativeTransfers { n_rows: u64, block_number: Vec, + block_hash: Vec>, transaction_index: Vec>, transfer_index: Vec, transaction_hash: Vec>>, @@ -26,10 +30,10 @@ impl Dataset for NativeTransfers { #[async_trait::async_trait] impl CollectByBlock for NativeTransfers { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let traces = source.fetcher.trace_block(request.block_number()?.into()).await?; + let traces = source.trace_block(request.block_number()?).await?; Ok(filter_traces_by_from_to_addresses(traces, &request.from_address, &request.to_address)) } @@ -42,10 +46,10 @@ impl CollectByBlock for NativeTransfers { #[async_trait::async_trait] impl CollectByTransaction for NativeTransfers { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let traces = source.fetcher.trace_transaction(request.ethers_transaction_hash()?).await?; + let traces = source.trace_transaction(request.ethers_transaction_hash()?).await?; Ok(filter_traces_by_from_to_addresses(traces, &request.from_address, &request.to_address)) } @@ -58,47 +62,43 @@ impl CollectByTransaction for NativeTransfers { /// process block into columns pub(crate) fn process_native_transfers( - traces: &[Trace], + traces: &[LocalizedTransactionTrace], columns: &mut NativeTransfers, schemas: &Schemas, ) -> R<()> { let schema = schemas.get(&Datatype::NativeTransfers).ok_or(err("schema not provided"))?; for (transfer_index, trace) in traces.iter().enumerate() { columns.n_rows += 1; - store!(schema, columns, block_number, trace.block_number as u32); + store!(schema, columns, block_number, trace.block_number.unwrap_or(0) as u32); store!(schema, columns, transaction_index, trace.transaction_position.map(|x| x as u32)); + store!(schema, columns, block_hash, trace.block_hash.unwrap().to_vec()); store!(schema, columns, transfer_index, transfer_index as u32); - store!( - schema, - columns, - transaction_hash, - trace.transaction_hash.map(|x| x.as_bytes().to_vec()) - ); + store!(schema, columns, transaction_hash, trace.transaction_hash.map(|x| x.to_vec())); - match &trace.action { + match &trace.trace.action { Action::Call(action) => { - store!(schema, columns, from_address, action.from.as_bytes().to_vec()); - store!(schema, columns, to_address, action.to.as_bytes().to_vec()); + store!(schema, columns, from_address, action.from.to_vec()); + store!(schema, columns, to_address, action.to.to_vec()); store!(schema, columns, value, action.value); } Action::Create(action) => { - store!(schema, columns, from_address, action.from.as_bytes().to_vec()); - match &trace.result.as_ref() { - Some(Res::Create(res)) => { - store!(schema, columns, to_address, res.address.0.into()) + store!(schema, columns, from_address, action.from.to_vec()); + match &trace.trace.result.as_ref() { + Some(TraceOutput::Create(res)) => { + store!(schema, columns, to_address, res.address.0.to_vec()) } _ => store!(schema, columns, to_address, vec![0; 32]), } store!(schema, columns, value, action.value); } - Action::Suicide(action) => { - store!(schema, columns, from_address, action.address.as_bytes().to_vec()); - store!(schema, columns, to_address, action.refund_address.as_bytes().to_vec()); + Action::Selfdestruct(action) => { + store!(schema, columns, from_address, action.address.to_vec()); + store!(schema, columns, to_address, action.refund_address.to_vec()); store!(schema, columns, value, action.balance); } Action::Reward(action) => { store!(schema, columns, from_address, vec![0; 20]); - store!(schema, columns, to_address, action.author.as_bytes().to_vec()); + store!(schema, columns, to_address, action.author.to_vec()); store!(schema, columns, value, action.value); } } diff --git a/crates/freeze/src/datasets/nonce_diffs.rs b/crates/freeze/src/datasets/nonce_diffs.rs index 90c77fc..c17e7f7 100644 --- a/crates/freeze/src/datasets/nonce_diffs.rs +++ b/crates/freeze/src/datasets/nonce_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, U64}, + rpc::types::trace::parity::{ChangedType, Delta, TraceResults}, +}; use polars::prelude::*; /// columns for transactions @@ -19,7 +22,7 @@ pub struct NonceDiffs { #[async_trait::async_trait] impl Dataset for NonceDiffs {} -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for NonceDiffs { @@ -28,7 +31,9 @@ impl CollectByBlock for NonceDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::NonceDiffs)?; let include_txs = schema.has_column("transaction_hash"); - source.fetcher.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (block_number, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + Ok((block_number, txs, traces.into_iter().map(|t| t.full_trace).collect())) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -41,7 +46,7 @@ impl CollectByTransaction for NonceDiffs { type Response = BlockTxsTraces; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction_state_diffs(request.transaction_hash()?).await + source.trace_transaction_state_diffs(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -57,7 +62,7 @@ pub(crate) fn process_nonce_diffs( let schema = schemas.get(&Datatype::NonceDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_nonce_diff(addr, &diff.nonce, block_number, tx, index, columns, schema); } @@ -67,8 +72,8 @@ pub(crate) fn process_nonce_diffs( } pub(crate) fn process_nonce_diff( - addr: &H160, - diff: &Diff, + addr: &Address, + diff: &Delta, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -76,16 +81,16 @@ pub(crate) fn process_nonce_diff( schema: &Table, ) { let (from, to) = match diff { - Diff::Same => return, - Diff::Born(value) => (U256::zero(), *value), - Diff::Died(value) => (*value, U256::zero()), - Diff::Changed(ChangedType { from, to }) => (*from, *to), + Delta::Unchanged => return, + Delta::Added(value) => (U64::ZERO, *value), + Delta::Removed(value) => (*value, U64::ZERO), + Delta::Changed(ChangedType { from, to }) => (*from, *to), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); - store!(schema, columns, from_value, from.as_u64()); - store!(schema, columns, to_value, to.as_u64()); + store!(schema, columns, address, addr.to_vec()); + store!(schema, columns, from_value, from.wrapping_to::()); + store!(schema, columns, to_value, to.wrapping_to::()); } diff --git a/crates/freeze/src/datasets/nonce_reads.rs b/crates/freeze/src/datasets/nonce_reads.rs index 2d478b8..052c2eb 100644 --- a/crates/freeze/src/datasets/nonce_reads.rs +++ b/crates/freeze/src/datasets/nonce_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -19,7 +19,7 @@ pub struct NonceReads { #[async_trait::async_trait] impl Dataset for NonceReads {} -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for NonceReads { @@ -28,10 +28,7 @@ impl CollectByBlock for NonceReads { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get(&Datatype::NonceReads).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source - .fetcher - .geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs) - .await + source.geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -47,7 +44,7 @@ impl CollectByTransaction for NonceReads { let schema = query.schemas.get(&Datatype::NonceReads).ok_or(err("schema not provided"))?; let include_block_number = schema.has_column("block_number"); let tx = request.transaction_hash()?; - source.fetcher.geth_debug_trace_transaction_prestate(tx, include_block_number).await + source.geth_debug_trace_transaction_prestate(tx, include_block_number).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -71,7 +68,7 @@ pub(crate) fn process_nonce_reads( } pub(crate) fn process_nonce_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -84,7 +81,7 @@ pub(crate) fn process_nonce_read( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); - store!(schema, columns, nonce, nonce.as_u64()); + store!(schema, columns, address, addr.to_vec()); + store!(schema, columns, nonce, *nonce); } } diff --git a/crates/freeze/src/datasets/nonces.rs b/crates/freeze/src/datasets/nonces.rs index d1a163e..e44c904 100644 --- a/crates/freeze/src/datasets/nonces.rs +++ b/crates/freeze/src/datasets/nonces.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::Address; use polars::prelude::*; /// columns for balances @@ -38,10 +38,9 @@ impl CollectByBlock for Nonces { let address = request.address()?; let block_number = request.block_number()? as u32; let output = source - .fetcher - .get_transaction_count(H160::from_slice(&address), block_number.into()) + .get_transaction_count(Address::from_slice(&address), block_number.into()) .await?; - Ok((block_number, None, address, output.as_u64())) + Ok((block_number, None, address, output)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/datasets/slots.rs b/crates/freeze/src/datasets/slots.rs index 7bc6ba6..14f292a 100644 --- a/crates/freeze/src/datasets/slots.rs +++ b/crates/freeze/src/datasets/slots.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::{Address, U256}; use polars::prelude::*; /// columns for balances @@ -48,14 +48,13 @@ impl CollectByBlock for Slots { let block_number = request.block_number()? as u32; let slot = request.slot()?; let output = source - .fetcher .get_storage_at( - H160::from_slice(&address), - H256::from_slice(&slot), + Address::from_slice(&address), + U256::from_be_slice(&slot), block_number.into(), ) .await?; - Ok((block_number, None, address, slot, output.as_bytes().to_vec())) + Ok((block_number, None, address, slot, output.to_vec_u8())) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/datasets/storage_diffs.rs b/crates/freeze/src/datasets/storage_diffs.rs index 217faad..b4ebfff 100644 --- a/crates/freeze/src/datasets/storage_diffs.rs +++ b/crates/freeze/src/datasets/storage_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, B256}, + rpc::types::trace::parity::{ChangedType, Delta, TraceResults}, +}; use polars::prelude::*; /// columns for transactions @@ -24,7 +27,7 @@ impl Dataset for StorageDiffs { } } -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for StorageDiffs { @@ -33,7 +36,10 @@ impl CollectByBlock for StorageDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::StorageDiffs)?; let include_txs = schema.has_column("transaction_hash"); - source.fetcher.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results: Vec = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -46,7 +52,7 @@ impl CollectByTransaction for StorageDiffs { type Response = BlockTxsTraces; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction_state_diffs(request.transaction_hash()?).await + source.trace_transaction_state_diffs(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -62,7 +68,7 @@ pub(crate) fn process_storage_diffs( let schema = schemas.get(&Datatype::StorageDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_storage_diff(addr, &diff.storage, block_number, tx, index, columns, schema); } @@ -72,8 +78,8 @@ pub(crate) fn process_storage_diffs( } pub(crate) fn process_storage_diff( - addr: &H160, - diff: &std::collections::BTreeMap>, + addr: &Address, + diff: &std::collections::BTreeMap>, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -82,18 +88,18 @@ pub(crate) fn process_storage_diff( ) { for (s, sub_diff) in diff.iter() { let (from, to) = match sub_diff { - Diff::Same => continue, - Diff::Born(value) => (H256::zero(), *value), - Diff::Died(value) => (*value, H256::zero()), - Diff::Changed(ChangedType { from, to }) => (*from, *to), + Delta::Unchanged => continue, + Delta::Added(value) => (B256::ZERO, *value), + Delta::Removed(value) => (*value, B256::ZERO), + Delta::Changed(ChangedType { from, to }) => (*from, *to), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, slot, s.as_bytes().to_vec()); - store!(schema, columns, address, addr.as_bytes().to_vec()); - store!(schema, columns, from_value, from.as_bytes().to_vec()); - store!(schema, columns, to_value, to.as_bytes().to_vec()); + store!(schema, columns, slot, s.to_vec()); + store!(schema, columns, address, addr.to_vec()); + store!(schema, columns, from_value, from.to_vec()); + store!(schema, columns, to_value, to.to_vec()); } } diff --git a/crates/freeze/src/datasets/storage_reads.rs b/crates/freeze/src/datasets/storage_reads.rs index f4d13cb..d276956 100644 --- a/crates/freeze/src/datasets/storage_reads.rs +++ b/crates/freeze/src/datasets/storage_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -24,7 +24,7 @@ impl Dataset for StorageReads { } } -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for StorageReads { @@ -34,10 +34,7 @@ impl CollectByBlock for StorageReads { let schema = query.schemas.get(&Datatype::StorageReads).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source - .fetcher - .geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs) - .await + source.geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -54,7 +51,7 @@ impl CollectByTransaction for StorageReads { query.schemas.get(&Datatype::StorageReads).ok_or(err("schema not provided"))?; let include_block_number = schema.has_column("block_number"); let tx = request.transaction_hash()?; - source.fetcher.geth_debug_trace_transaction_prestate(tx, include_block_number).await + source.geth_debug_trace_transaction_prestate(tx, include_block_number).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -78,7 +75,7 @@ pub(crate) fn process_storage_reads( } pub(crate) fn process_storage_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -86,15 +83,13 @@ pub(crate) fn process_storage_read( columns: &mut StorageReads, schema: &Table, ) { - if let Some(storage) = &account_state.storage { - for (slot, value) in storage.iter() { - columns.n_rows += 1; - store!(schema, columns, block_number, *block_number); - store!(schema, columns, transaction_index, Some(transaction_index as u32)); - store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, contract_address, addr.as_bytes().to_vec()); - store!(schema, columns, slot, slot.as_bytes().to_vec()); - store!(schema, columns, value, value.as_bytes().to_vec()); - } + for (slot, value) in account_state.storage.iter() { + columns.n_rows += 1; + store!(schema, columns, block_number, *block_number); + store!(schema, columns, transaction_index, Some(transaction_index as u32)); + store!(schema, columns, transaction_hash, transaction_hash.clone()); + store!(schema, columns, contract_address, addr.to_vec()); + store!(schema, columns, slot, slot.to_vec()); + store!(schema, columns, value, value.to_vec()); } } diff --git a/crates/freeze/src/datasets/trace_calls.rs b/crates/freeze/src/datasets/trace_calls.rs index e97392f..c77f4ad 100644 --- a/crates/freeze/src/datasets/trace_calls.rs +++ b/crates/freeze/src/datasets/trace_calls.rs @@ -1,6 +1,6 @@ use super::traces; use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::parity::{Action, TraceOutput, TraceType, TransactionTrace}; use polars::prelude::*; /// columns for transactions @@ -51,7 +51,6 @@ impl CollectByBlock for TraceCalls { async fn extract(request: Params, source: Arc, _: Arc) -> R { let traces: Vec = source - .fetcher .trace_call2( request.ethers_contract()?, request.call_data()?, @@ -59,8 +58,7 @@ impl CollectByBlock for TraceCalls { Some(request.ethers_block_number()?), ) .await? - .trace - .ok_or(CollectError::CollectError("traces missing".to_string()))?; + .trace; Ok((request.block_number()? as u32, request.contract()?, request.call_data()?, traces)) } @@ -86,7 +84,7 @@ fn process_transaction_traces( process_action(&trace.action, columns, schema); process_result(&trace.result, columns, schema); - store!(schema, columns, action_type, traces::action_type_to_string(&trace.action_type)); + store!(schema, columns, action_type, traces::action_type_to_string(&trace.action.kind())); store!( schema, columns, @@ -105,10 +103,10 @@ fn process_transaction_traces( fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { match action { Action::Call(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.to.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); + store!(schema, columns, action_to, Some(action.to.to_vec())); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas as u32)); store!(schema, columns, action_input, Some(action.input.to_vec())); store!( schema, @@ -120,18 +118,18 @@ fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Create(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas as u32)); store!(schema, columns, action_input, None); store!(schema, columns, action_call_type, None); store!(schema, columns, action_init, Some(action.init.to_vec())); store!(schema, columns, action_reward_type, None); } - Action::Suicide(action) => { - store!(schema, columns, action_from, Some(action.address.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.refund_address.as_bytes().to_vec())); + Action::Selfdestruct(action) => { + store!(schema, columns, action_from, Some(action.address.to_vec())); + store!(schema, columns, action_to, Some(action.refund_address.to_vec())); store!(schema, columns, action_value, action.balance.to_string()); store!(schema, columns, action_gas, None); store!(schema, columns, action_input, None); @@ -140,7 +138,7 @@ fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Reward(action) => { - store!(schema, columns, action_from, Some(action.author.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.author.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); store!(schema, columns, action_gas, None); @@ -157,21 +155,21 @@ fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { } } -fn process_result(result: &Option, columns: &mut TraceCalls, schema: &Table) { +fn process_result(result: &Option, columns: &mut TraceCalls, schema: &Table) { match result { - Some(Res::Call(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Call(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used as u32)); store!(schema, columns, result_output, Some(result.output.to_vec())); store!(schema, columns, result_code, None); store!(schema, columns, result_address, None); } - Some(Res::Create(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Create(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used as u32)); store!(schema, columns, result_output, None); store!(schema, columns, result_code, Some(result.code.to_vec())); - store!(schema, columns, result_address, Some(result.address.as_bytes().to_vec())); + store!(schema, columns, result_address, Some(result.address.to_vec())); } - Some(Res::None) | None => { + None => { store!(schema, columns, result_gas_used, None); store!(schema, columns, result_output, None); store!(schema, columns, result_code, None); diff --git a/crates/freeze/src/datasets/traces.rs b/crates/freeze/src/datasets/traces.rs index d619cdb..5bde18f 100644 --- a/crates/freeze/src/datasets/traces.rs +++ b/crates/freeze/src/datasets/traces.rs @@ -1,5 +1,10 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::Address, + rpc::types::trace::parity::{ + Action, ActionType, CallType, LocalizedTransactionTrace, RewardType, TraceOutput, + }, +}; use polars::prelude::*; /// columns for transactions @@ -39,10 +44,10 @@ impl Dataset for Traces { #[async_trait::async_trait] impl CollectByBlock for Traces { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let traces = source.fetcher.trace_block(request.block_number()?.into()).await?; + let traces = source.trace_block(request.block_number()?).await?; Ok(filter_traces_by_from_to_addresses(traces, &request.from_address, &request.to_address)) } @@ -55,10 +60,10 @@ impl CollectByBlock for Traces { #[async_trait::async_trait] impl CollectByTransaction for Traces { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let traces = source.fetcher.trace_transaction(request.ethers_transaction_hash()?).await?; + let traces = source.trace_transaction(request.ethers_transaction_hash()?).await?; Ok(filter_traces_by_from_to_addresses(traces, &request.from_address, &request.to_address)) } @@ -70,66 +75,73 @@ impl CollectByTransaction for Traces { } pub(crate) fn filter_traces_by_from_to_addresses( - traces: Vec, + traces: Vec, from_address: &Option>, to_address: &Option>, -) -> Vec { +) -> Vec { // filter by from_address - let from_filter: Box bool + Send> = if let Some(from_address) = from_address { - Box::new(move |trace| { - let from = match &trace.action { - Action::Call(action) => action.from, - Action::Create(action) => action.from, - Action::Suicide(action) => action.address, - _ => return false, - }; - from.as_bytes() == from_address - }) - } else { - Box::new(|_| true) - }; + let from_filter: Box bool + Send> = + if let Some(from_address) = from_address { + Box::new(move |trace| { + let from = match &trace.trace.action { + Action::Call(action) => action.from, + Action::Create(action) => action.from, + Action::Selfdestruct(action) => action.address, + _ => return false, + }; + from == Address::from_slice(from_address) + }) + } else { + Box::new(|_| true) + }; // filter by to_address - let to_filter: Box bool + Send> = if let Some(to_address) = to_address { - Box::new(move |trace| { - let to = match &trace.action { - Action::Call(action) => action.to, - Action::Suicide(action) => action.refund_address, - Action::Reward(action) => action.author, - _ => return false, - }; - to.as_bytes() == to_address - }) - } else { - Box::new(|_| true) - }; + let to_filter: Box bool + Send> = + if let Some(to_address) = to_address { + Box::new(move |trace| { + let to = match &trace.trace.action { + Action::Call(action) => action.to, + Action::Selfdestruct(action) => action.refund_address, + Action::Reward(action) => action.author, + _ => return false, + }; + to == Address::from_slice(to_address) + }) + } else { + Box::new(|_| true) + }; traces.into_iter().filter(from_filter).filter(to_filter).collect() } /// process block into columns -pub(crate) fn process_traces(traces: &[Trace], columns: &mut Traces, schemas: &Schemas) -> R<()> { +pub(crate) fn process_traces( + traces: &[LocalizedTransactionTrace], + columns: &mut Traces, + schemas: &Schemas, +) -> R<()> { let schema = schemas.get(&Datatype::Traces).ok_or(err("schema not provided"))?; for trace in traces.iter() { columns.n_rows += 1; - process_action(&trace.action, columns, schema); - process_result(&trace.result, columns, schema); - store!(schema, columns, action_type, action_type_to_string(&trace.action_type)); + process_action(&trace.trace.action, columns, schema); + process_result(&trace.trace.result, columns, schema); + store!(schema, columns, action_type, action_type_to_string(&trace.trace.action.kind())); store!( schema, columns, trace_address, - trace.trace_address.iter().map(|n| n.to_string()).collect::>().join("_") + trace + .trace + .trace_address + .iter() + .map(|n| n.to_string()) + .collect::>() + .join("_") ); - store!(schema, columns, subtraces, trace.subtraces as u32); + store!(schema, columns, subtraces, trace.trace.subtraces as u32); store!(schema, columns, transaction_index, trace.transaction_position.map(|x| x as u32)); - store!( - schema, - columns, - transaction_hash, - trace.transaction_hash.map(|x| x.as_bytes().to_vec()) - ); - store!(schema, columns, block_number, trace.block_number as u32); - store!(schema, columns, block_hash, trace.block_hash.as_bytes().to_vec()); - store!(schema, columns, error, trace.error.clone()); + store!(schema, columns, transaction_hash, trace.transaction_hash.map(|x| x.to_vec())); + store!(schema, columns, block_number, trace.block_number.unwrap() as u32); + store!(schema, columns, block_hash, trace.block_hash.unwrap().to_vec()); + store!(schema, columns, error, trace.trace.error.clone()); } Ok(()) } @@ -137,10 +149,10 @@ pub(crate) fn process_traces(traces: &[Trace], columns: &mut Traces, schemas: &S fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { match action { Action::Call(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.to.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); + store!(schema, columns, action_to, Some(action.to.to_vec())); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas as u32)); store!(schema, columns, action_input, Some(action.input.to_vec())); store!( schema, @@ -152,18 +164,18 @@ fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Create(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas as u32)); store!(schema, columns, action_input, None); store!(schema, columns, action_call_type, None); store!(schema, columns, action_init, Some(action.init.to_vec())); store!(schema, columns, action_reward_type, None); } - Action::Suicide(action) => { - store!(schema, columns, action_from, Some(action.address.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.refund_address.as_bytes().to_vec())); + Action::Selfdestruct(action) => { + store!(schema, columns, action_from, Some(action.address.to_vec())); + store!(schema, columns, action_to, Some(action.refund_address.to_vec())); store!(schema, columns, action_value, action.balance.to_string()); store!(schema, columns, action_gas, None); store!(schema, columns, action_input, None); @@ -172,7 +184,7 @@ fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Reward(action) => { - store!(schema, columns, action_from, Some(action.author.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.author.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); store!(schema, columns, action_gas, None); @@ -189,21 +201,21 @@ fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { } } -fn process_result(result: &Option, columns: &mut Traces, schema: &Table) { +fn process_result(result: &Option, columns: &mut Traces, schema: &Table) { match result { - Some(Res::Call(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Call(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used as u32)); store!(schema, columns, result_output, Some(result.output.to_vec())); store!(schema, columns, result_code, None); store!(schema, columns, result_address, None); } - Some(Res::Create(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Create(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used as u32)); store!(schema, columns, result_output, None); store!(schema, columns, result_code, Some(result.code.to_vec())); - store!(schema, columns, result_address, Some(result.address.as_bytes().to_vec())); + store!(schema, columns, result_address, Some(result.address.to_vec())); } - Some(Res::None) | None => { + None => { store!(schema, columns, result_gas_used, None); store!(schema, columns, result_output, None); store!(schema, columns, result_code, None); @@ -216,8 +228,9 @@ pub(crate) fn reward_type_to_string(reward_type: &RewardType) -> String { match reward_type { RewardType::Block => "reward".to_string(), RewardType::Uncle => "uncle".to_string(), - RewardType::EmptyStep => "empty_step".to_string(), - RewardType::External => "external".to_string(), + // below arms not exist in alloy + // RewardType::EmptyStep => "empty_step".to_string(), + // RewardType::External => "external".to_string(), } } @@ -226,7 +239,7 @@ pub(crate) fn action_type_to_string(action_type: &ActionType) -> String { ActionType::Call => "call".to_string(), ActionType::Create => "create".to_string(), ActionType::Reward => "reward".to_string(), - ActionType::Suicide => "suicide".to_string(), + ActionType::Selfdestruct => "suicide".to_string(), } } @@ -237,24 +250,27 @@ pub(crate) fn action_call_type_to_string(action_call_type: &CallType) -> String CallType::CallCode => "call_code".to_string(), CallType::DelegateCall => "delegate_call".to_string(), CallType::StaticCall => "static_call".to_string(), + CallType::AuthCall => "auth_call".to_string(), } } /// filter out error traces -pub(crate) fn filter_failed_traces(traces: Vec) -> Vec { +pub(crate) fn filter_failed_traces( + traces: Vec, +) -> Vec { let mut error_address: Option> = None; - let mut filtered: Vec = Vec::new(); + let mut filtered: Vec = Vec::new(); for trace in traces.into_iter() { // restart for each transaction - if trace.trace_address.is_empty() { + if trace.trace.trace_address.is_empty() { error_address = None; }; // if in an error, check if next trace is still in error if let Some(ref e_address) = error_address { - if trace.trace_address.len() >= e_address.len() && - trace.trace_address[0..e_address.len()] == e_address[..] + if trace.trace.trace_address.len() >= e_address.len() && + trace.trace.trace_address[0..e_address.len()] == e_address[..] { continue } else { @@ -263,8 +279,8 @@ pub(crate) fn filter_failed_traces(traces: Vec) -> Vec { } // check if current trace is start of an error - match trace.error { - Some(_) => error_address = Some(trace.trace_address), + match trace.trace.error { + Some(_) => error_address = Some(trace.trace.trace_address), None => filtered.push(trace), } } diff --git a/crates/freeze/src/datasets/transactions.rs b/crates/freeze/src/datasets/transactions.rs index 896b12a..a2c7ac0 100644 --- a/crates/freeze/src/datasets/transactions.rs +++ b/crates/freeze/src/datasets/transactions.rs @@ -1,5 +1,11 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + consensus::Transaction as ConsensusTransaction, + primitives::{Address, TxKind, U256}, + rpc::types::{ + Block, BlockTransactions, BlockTransactionsKind, Transaction, TransactionReceipt, + }, +}; use polars::prelude::*; /// columns for transactions @@ -18,13 +24,20 @@ pub struct Transactions { gas_limit: Vec, gas_used: Vec>, gas_price: Vec>, - transaction_type: Vec>, + transaction_type: Vec, max_priority_fee_per_gas: Vec>, max_fee_per_gas: Vec>, success: Vec, + n_input_bytes: Vec, + n_input_zero_bytes: Vec, + n_input_nonzero_bytes: Vec, + n_rlp_bytes: Vec, + block_hash: Vec>, chain_id: Vec, timestamp: Vec, - block_hash: Vec>, + r: Vec>, + s: Vec>, + v: Vec, } #[async_trait::async_trait] @@ -50,6 +63,9 @@ impl Dataset for Transactions { "max_priority_fee_per_gas", "max_fee_per_gas", "success", + "n_input_bytes", + "n_input_zero_bytes", + "n_input_nonzero_bytes", "chain_id", ]) } @@ -64,12 +80,11 @@ pub type TransactionAndReceipt = (Transaction, Option); #[async_trait::async_trait] impl CollectByBlock for Transactions { - type Response = (Block, Vec, bool); + type Response = (Block, Vec, bool); async fn extract(request: Params, source: Arc, query: Arc) -> R { let block = source - .fetcher - .get_block_with_txs(request.block_number()?) + .get_block(request.block_number()?, BlockTransactionsKind::Full) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; let schema = query.schemas.get_schema(&Datatype::Transactions)?; @@ -78,19 +93,30 @@ impl CollectByBlock for Transactions { // filter by from_address let from_filter: Box bool + Send> = if let Some(from_address) = &request.from_address { - Box::new(move |tx| tx.from.as_bytes() == from_address) + Box::new(move |tx| tx.from == Address::from_slice(from_address)) } else { Box::new(|_| true) }; // filter by to_address let to_filter: Box bool + Send> = if let Some(to_address) = &request.to_address { - Box::new(move |tx| tx.to.as_ref().map_or(false, |x| x.as_bytes() == to_address)) + Box::new(move |tx| match tx.inner.kind() { + TxKind::Create => false, + TxKind::Call(address) => address == Address::from_slice(to_address), + }) } else { Box::new(|_| true) }; - let transactions = - block.transactions.clone().into_iter().filter(from_filter).filter(to_filter).collect(); + let transactions: Vec = block + .transactions + .clone() + .as_transactions() + .unwrap() + .iter() + .filter(|&x| from_filter(x)) + .filter(|&x| to_filter(x)) + .cloned() + .collect(); // 2. collect receipts if necessary // if transactions are filtered fetch by set of transaction hashes, else fetch all receipts @@ -99,7 +125,7 @@ impl CollectByBlock for Transactions { if schema.has_column("gas_used") | schema.has_column("success") { // receipts required let receipts = if request.from_address.is_some() || request.to_address.is_some() { - source.get_tx_receipts(&transactions).await? + source.get_tx_receipts(BlockTransactions::Full(transactions.clone())).await? } else { source.get_tx_receipts_in_block(&block).await? }; @@ -116,13 +142,15 @@ impl CollectByBlock for Transactions { let schema = query.schemas.get_schema(&Datatype::Transactions)?; let (block, transactions_with_receipts, exclude_failed) = response; for (tx, receipt) in transactions_with_receipts.into_iter() { + let gas_price = get_gas_price(&block, &tx); process_transaction( tx, receipt, columns, schema, exclude_failed, - block.timestamp.as_u32(), + block.header.timestamp as u32, + gas_price, )?; } Ok(()) @@ -131,18 +159,17 @@ impl CollectByBlock for Transactions { #[async_trait::async_trait] impl CollectByTransaction for Transactions { - type Response = (TransactionAndReceipt, bool, u32); + type Response = (TransactionAndReceipt, Block, bool, u32); async fn extract(request: Params, source: Arc, query: Arc) -> R { let tx_hash = request.ethers_transaction_hash()?; let schema = query.schemas.get_schema(&Datatype::Transactions)?; let transaction = source - .fetcher - .get_transaction(tx_hash) + .get_transaction_by_hash(tx_hash) .await? .ok_or(CollectError::CollectError("transaction not found".to_string()))?; let receipt = if schema.has_column("gas_used") { - source.fetcher.get_transaction_receipt(tx_hash).await? + source.get_transaction_receipt(tx_hash).await? } else { None }; @@ -152,20 +179,28 @@ impl CollectByTransaction for Transactions { .ok_or(CollectError::CollectError("no block number for tx".to_string()))?; let block = source - .fetcher - .get_block(block_number.as_u64()) + .get_block(block_number, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; - let timestamp = block.timestamp.as_u32(); + let timestamp = block.header.timestamp as u32; - Ok(((transaction, receipt), query.exclude_failed, timestamp)) + Ok(((transaction, receipt), block, query.exclude_failed, timestamp)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { let schema = query.schemas.get_schema(&Datatype::Transactions)?; - let ((transaction, receipt), exclude_failed, timestamp) = response; - process_transaction(transaction, receipt, columns, schema, exclude_failed, timestamp)?; + let ((transaction, receipt), block, exclude_failed, timestamp) = response; + let gas_price = get_gas_price(&block, &transaction); + process_transaction( + transaction, + receipt, + columns, + schema, + exclude_failed, + timestamp, + gas_price, + )?; Ok(()) } } @@ -177,6 +212,7 @@ pub(crate) fn process_transaction( schema: &Table, exclude_failed: bool, timestamp: u32, + gas_price: Option, ) -> R<()> { let success = if exclude_failed | schema.has_column("success") { let success = tx_success(&tx, &receipt)?; @@ -189,40 +225,90 @@ pub(crate) fn process_transaction( }; columns.n_rows += 1; - store!(schema, columns, block_number, tx.block_number.map(|x| x.as_u32())); - store!(schema, columns, transaction_index, tx.transaction_index.map(|x| x.as_u64())); - store!(schema, columns, transaction_hash, tx.hash.as_bytes().to_vec()); - store!(schema, columns, from_address, tx.from.as_bytes().to_vec()); - store!(schema, columns, to_address, tx.to.map(|x| x.as_bytes().to_vec())); - store!(schema, columns, nonce, tx.nonce.as_u64()); - store!(schema, columns, value, tx.value); - store!(schema, columns, input, tx.input.to_vec()); - store!(schema, columns, gas_limit, tx.gas.as_u64()); + store!(schema, columns, block_number, tx.block_number.map(|x| x as u32)); + store!(schema, columns, transaction_index, tx.transaction_index); + store!(schema, columns, transaction_hash, tx.inner.tx_hash().to_vec()); + store!(schema, columns, from_address, tx.from.to_vec()); + store!( + schema, + columns, + to_address, + match tx.inner.kind() { + TxKind::Create => None, + TxKind::Call(address) => Some(address.to_vec()), + } + ); + store!(schema, columns, nonce, tx.inner.nonce()); + store!(schema, columns, value, tx.inner.value()); + store!(schema, columns, input, tx.inner.input().to_vec()); + store!(schema, columns, gas_limit, tx.inner.gas_limit()); store!(schema, columns, success, success); - store!(schema, columns, gas_used, receipt.and_then(|r| r.gas_used.map(|x| x.as_u64()))); - store!(schema, columns, gas_price, tx.gas_price.map(|gas_price| gas_price.as_u64())); - store!(schema, columns, transaction_type, tx.transaction_type.map(|value| value.as_u32())); - store!(schema, columns, max_fee_per_gas, tx.max_fee_per_gas.map(|value| value.as_u64())); + if schema.has_column("n_input_bytes") | + schema.has_column("n_input_zero_bytes") | + schema.has_column("n_input_nonzero_bytes") + { + let n_input_bytes = tx.inner.input().len() as u32; + let n_input_zero_bytes = tx.inner.input().iter().filter(|&&x| x == 0).count() as u32; + store!(schema, columns, n_input_bytes, n_input_bytes); + store!(schema, columns, n_input_zero_bytes, n_input_zero_bytes); + store!(schema, columns, n_input_nonzero_bytes, n_input_bytes - n_input_zero_bytes); + } + // in alloy eip2718_encoded_length is rlp_encoded_length + store!(schema, columns, n_rlp_bytes, tx.inner.eip2718_encoded_length() as u32); + store!(schema, columns, gas_used, receipt.as_ref().map(|r| r.gas_used as u64)); + // store!(schema, columns, gas_price, Some(receipt.unwrap().effective_gas_price as u64)); + store!(schema, columns, gas_price, gas_price); + store!(schema, columns, transaction_type, tx.inner.tx_type() as u32); + store!(schema, columns, max_fee_per_gas, get_max_fee_per_gas(&tx)); store!( schema, columns, max_priority_fee_per_gas, - tx.max_priority_fee_per_gas.map(|value| value.as_u64()) + tx.inner.max_priority_fee_per_gas().map(|value| value as u64) ); store!(schema, columns, timestamp, timestamp); - store!(schema, columns, block_hash, tx.block_hash.unwrap_or_default().as_bytes().to_vec()); + store!(schema, columns, block_hash, tx.block_hash.unwrap_or_default().to_vec()); + + store!(schema, columns, v, tx.inner.signature().v()); + store!(schema, columns, r, tx.inner.signature().r().to_vec_u8()); + store!(schema, columns, s, tx.inner.signature().s().to_vec_u8()); Ok(()) } +fn get_max_fee_per_gas(tx: &Transaction) -> Option { + match &tx.inner { + alloy::consensus::TxEnvelope::Legacy(_) => None, + alloy::consensus::TxEnvelope::Eip2930(_) => None, + _ => Some(tx.inner.max_fee_per_gas() as u64), + } +} + +pub(crate) fn get_gas_price(block: &Block, tx: &Transaction) -> Option { + match &tx.inner { + alloy::consensus::TxEnvelope::Legacy(_) => tx.gas_price().map(|gas_price| gas_price as u64), + alloy::consensus::TxEnvelope::Eip2930(_) => { + tx.gas_price().map(|gas_price| gas_price as u64) + } + _ => { + let base_fee_per_gas = block.header.inner.base_fee_per_gas.unwrap(); + let priority_fee = std::cmp::min( + tx.inner.max_priority_fee_per_gas().unwrap() as u64, + tx.inner.max_fee_per_gas() as u64 - base_fee_per_gas, + ); + Some(base_fee_per_gas + priority_fee) + } + } +} + fn tx_success(tx: &Transaction, receipt: &Option) -> R { - if let Some(status) = receipt.as_ref().and_then(|x| x.status) { - Ok(status.as_u64() == 1) + if let Some(r) = receipt { + Ok(r.status()) } else if let (Some(1), Some(true)) = - (tx.chain_id.map(|x| x.as_u64()), tx.block_number.map(|x| x.as_u64() < 4370000)) + (tx.inner.chain_id(), tx.block_number.map(|x| x < 4370000)) { - if let Some(gas_used) = receipt.as_ref().and_then(|x| x.gas_used.map(|x| x.as_u64())) { - Ok(gas_used == 0) + if let Some(r) = receipt { + Ok(r.gas_used == 0) } else { return Err(err("could not determine status of transaction")) } diff --git a/crates/freeze/src/datasets/vm_traces.rs b/crates/freeze/src/datasets/vm_traces.rs index 18466d4..1ede0df 100644 --- a/crates/freeze/src/datasets/vm_traces.rs +++ b/crates/freeze/src/datasets/vm_traces.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::parity::{TraceResults, VmTrace}; use polars::prelude::*; /// columns for transactions @@ -17,7 +17,7 @@ pub struct VmTraces { mem_data: Vec>>, storage_key: Vec>>, storage_val: Vec>>, - op: Vec, + op: Vec>, n_rows: usize, chain_id: Vec, } @@ -39,10 +39,13 @@ impl Dataset for VmTraces { #[async_trait::async_trait] impl CollectByBlock for VmTraces { - type Response = (Option, Option>, Vec); + type Response = (Option, Option>, Vec); async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_block_vm_traces(request.block_number()? as u32).await + let (bn, txs, traces) = + source.trace_block_vm_traces(request.block_number()? as u32).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -52,10 +55,10 @@ impl CollectByBlock for VmTraces { #[async_trait::async_trait] impl CollectByTransaction for VmTraces { - type Response = (Option, Option>, Vec); + type Response = (Option, Option>, Vec); async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction_vm_traces(request.transaction_hash()?).await + source.trace_transaction_vm_traces(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -64,7 +67,7 @@ impl CollectByTransaction for VmTraces { } fn process_vm_traces( - response: (Option, Option>, Vec), + response: (Option, Option>, Vec), columns: &mut VmTraces, schemas: &Schemas, ) -> R<()> { @@ -79,7 +82,7 @@ fn process_vm_traces( } fn add_ops( - vm_trace: VMTrace, + vm_trace: VmTrace, schema: &Table, columns: &mut VmTraces, number: Option, @@ -120,12 +123,7 @@ fn add_ops( store!(schema, columns, storage_key, None); store!(schema, columns, storage_val, None); } - if schema.has_column("op") { - match opcode.op { - ExecutedInstruction::Known(op) => store!(schema, columns, op, op.to_string()), - ExecutedInstruction::Unknown(op) => store!(schema, columns, op, op), - } - }; + store!(schema, columns, op, opcode.op); if let Some(sub) = opcode.sub { add_ops(sub, schema, columns, number, tx_hash.clone(), tx_pos) diff --git a/crates/freeze/src/freeze.rs b/crates/freeze/src/freeze.rs index a9b3f82..f80bc62 100644 --- a/crates/freeze/src/freeze.rs +++ b/crates/freeze/src/freeze.rs @@ -85,7 +85,7 @@ fn get_payloads( let semaphore = source .max_concurrent_chunks .map(|x| std::sync::Arc::new(tokio::sync::Semaphore::new(x as usize))); - let source = Arc::new(source.clone()); + let source: Arc = Arc::new(source.clone()); let arc_query = Arc::new(query.clone()); let mut payloads = Vec::new(); let mut skipping = Vec::new(); @@ -149,11 +149,15 @@ async fn freeze_partitions( // aggregate results let mut completed = Vec::new(); let mut errored = Vec::new(); + let mut n_rows = 0; while let Some(result) = futures.next().await { match result { - Ok((partition, Ok(()))) => completed.push(partition), + Ok((partition, Ok(chunk_n_rows))) => { + n_rows += chunk_n_rows; + completed.push(partition) + } Ok((partition, Err(e))) => errored.push((Some(partition), e)), - Err(_e) => errored.push((None, err("error joining chunks"))), + Err(e) => errored.push((None, err(format!("error joining chunks: {:?}", e).as_str()))), } } @@ -161,10 +165,10 @@ async fn freeze_partitions( bar.finish_and_clear(); } - FreezeSummary { completed, errored, skipped } + FreezeSummary { completed, errored, skipped, n_rows } } -async fn freeze_partition(payload: PartitionPayload) -> Result<(), CollectError> { +async fn freeze_partition(payload: PartitionPayload) -> Result { let (partition, datatype, paths, query, source, sink, env, semaphore) = payload; // acquire chunk semaphore @@ -177,7 +181,9 @@ async fn freeze_partition(payload: PartitionPayload) -> Result<(), CollectError> let dfs = collect_partition(datatype, partition, query, source).await?; // write dataframes to disk + let mut n_rows = 0; for (datatype, mut df) in dfs { + n_rows += df.height() as u64; let path = paths.get(&datatype).ok_or_else(|| { CollectError::CollectError("could not get path for datatype".to_string()) })?; @@ -190,5 +196,5 @@ async fn freeze_partition(payload: PartitionPayload) -> Result<(), CollectError> bar.inc(1); } - Ok(()) + Ok(n_rows) } diff --git a/crates/freeze/src/multi_datasets/blocks_and_transactions.rs b/crates/freeze/src/multi_datasets/blocks_and_transactions.rs index 1fd604a..169aeed 100644 --- a/crates/freeze/src/multi_datasets/blocks_and_transactions.rs +++ b/crates/freeze/src/multi_datasets/blocks_and_transactions.rs @@ -46,20 +46,15 @@ impl CollectByTransaction for BlocksAndTransactions { ); async fn extract(request: Params, source: Arc, query: Arc) -> R { - let ((tx, receipt), exclude_failed, timestamp) = + let ((tx, receipt), block, exclude_failed, timestamp) = ::extract(request, source.clone(), query).await?; - let block_number = tx.block_number.ok_or(err("no block number for tx"))?.as_u64(); - let block = source - .fetcher - .get_block(block_number) - .await? - .ok_or(CollectError::CollectError("block not found".to_string()))?; - Ok((block, ((tx, receipt), exclude_failed, timestamp))) + Ok((block.clone(), ((tx, receipt), block, exclude_failed, timestamp))) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { let BlocksAndTransactions(blocks, transactions) = columns; - let (block, ((tx, receipt), exclude_failed, timestamp)) = response; + let (block, ((tx, receipt), _, exclude_failed, timestamp)) = response; + let gas_price = transactions::get_gas_price(&block, &tx); let schema = query.schemas.get_schema(&Datatype::Blocks)?; blocks::process_block(block, blocks, schema)?; let schema = query.schemas.get_schema(&Datatype::Transactions)?; @@ -70,6 +65,7 @@ impl CollectByTransaction for BlocksAndTransactions { schema, exclude_failed, timestamp, + gas_price, )?; Ok(()) } diff --git a/crates/freeze/src/multi_datasets/call_trace_derivatives.rs b/crates/freeze/src/multi_datasets/call_trace_derivatives.rs index df53eb0..53ad5c6 100644 --- a/crates/freeze/src/multi_datasets/call_trace_derivatives.rs +++ b/crates/freeze/src/multi_datasets/call_trace_derivatives.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::parity::LocalizedTransactionTrace; use polars::prelude::*; use std::collections::HashMap; @@ -34,10 +34,10 @@ impl ToDataFrames for CallTraceDerivatives { #[async_trait::async_trait] impl CollectByBlock for CallTraceDerivatives { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_block(request.block_number()?.into()).await + source.trace_block(request.block_number()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -49,10 +49,10 @@ impl CollectByBlock for CallTraceDerivatives { #[async_trait::async_trait] impl CollectByTransaction for CallTraceDerivatives { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction(request.ethers_transaction_hash()?).await + source.trace_transaction(request.ethers_transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -63,7 +63,7 @@ impl CollectByTransaction for CallTraceDerivatives { } fn process_call_trace_derivatives( - response: Vec, + response: Vec, columns: &mut CallTraceDerivatives, schemas: &HashMap, ) -> R<()> { diff --git a/crates/freeze/src/multi_datasets/geth_state_diffs.rs b/crates/freeze/src/multi_datasets/geth_state_diffs.rs index dad661c..bd2f16c 100644 --- a/crates/freeze/src/multi_datasets/geth_state_diffs.rs +++ b/crates/freeze/src/multi_datasets/geth_state_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, Bytes, B256, U256}, + rpc::types::trace::geth::{AccountState, DiffMode}, +}; use polars::prelude::*; use std::collections::{BTreeMap, HashMap, HashSet}; @@ -46,7 +49,7 @@ impl ToDataFrames for GethStateDiffs { } } -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for GethStateDiffs { @@ -55,7 +58,7 @@ impl CollectByBlock for GethStateDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let block_number = request.block_number()? as u32; let include_txs = query.schemas.values().any(|x| x.has_column("transaction_hash")); - source.fetcher.geth_debug_trace_block_diffs(block_number, include_txs).await + source.geth_debug_trace_block_diffs(block_number, include_txs).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -79,7 +82,6 @@ impl CollectByTransaction for GethStateDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let include_block_number = query.schemas.values().any(|x| x.has_column("transaction_hash")); source - .fetcher .geth_debug_trace_transaction_diffs(request.transaction_hash()?, include_block_number) .await } @@ -147,34 +149,34 @@ pub(crate) fn process_geth_diffs( } fn add_balances( - address: &H160, + address: &Address, pre: Option, post: Option, columns: &mut GethBalanceDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let (from_value, to_value) = parse_pre_post(pre, post, U256::zero); + let (from_value, to_value) = parse_pre_post(pre, post, U256::ZERO); let (block_number, transaction_index, transaction_hash) = index; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); + store!(schema, columns, address, address.to_vec()); store!(schema, columns, from_value, from_value); store!(schema, columns, to_value, to_value); Ok(()) } fn add_codes( - address: &H160, - pre: &Option, - post: &Option, + address: &Address, + pre: &Option, + post: &Option, columns: &mut GethCodeDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let blank = String::new(); + let blank = Bytes::new(); let (from_value, to_value) = match (pre, post) { (Some(pre), Some(post)) => (pre, post), (Some(pre), None) => (pre, &blank), @@ -186,57 +188,40 @@ fn add_codes( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); - let from_value = if !from_value.is_empty() { - prefix_hex::decode(from_value).map_err(|_| err("could not decode from code contents"))? - } else { - vec![] - }; - let to_value = if !to_value.is_empty() { - prefix_hex::decode(to_value).map_err(|_| err("could not decode to code contents"))? - } else { - vec![] - }; - store!(schema, columns, from_value, from_value); - store!(schema, columns, to_value, to_value); + store!(schema, columns, address, address.to_vec()); + store!(schema, columns, from_value, from_value.to_vec()); + store!(schema, columns, to_value, to_value.to_vec()); Ok(()) } fn add_nonces( - address: &H160, - pre: Option, - post: Option, + address: &Address, + pre: Option, + post: Option, columns: &mut GethNonceDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let (from_value, to_value) = parse_pre_post(pre, post, U256::zero); + let (from_value, to_value) = parse_pre_post(pre, post, 0_u64); let (block_number, transaction_index, transaction_hash) = index; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); + store!(schema, columns, address, address.to_vec()); store!(schema, columns, from_value, from_value); store!(schema, columns, to_value, to_value); Ok(()) } fn add_storages( - address: &H160, - pre: &Option>, - post: &Option>, + address: &Address, + pre: &BTreeMap, + post: &BTreeMap, columns: &mut GethStorageDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let blank = BTreeMap::new(); - let (pre, post) = match (pre, post) { - (Some(pre), Some(post)) => (pre, post), - (Some(pre), None) => (pre, &blank), - (None, Some(post)) => (&blank, post), - (None, None) => (&blank, &blank), - }; let (block_number, transaction_index, transaction_hash) = index; let slots: Vec<_> = pre .clone() @@ -245,7 +230,7 @@ fn add_storages( .collect::>() .into_iter() .collect(); - let blank = H256::zero(); + let blank = B256::ZERO; for slot in slots.into_iter() { let (from, to) = match (pre.get(&slot), post.get(&slot)) { (Some(pre), Some(post)) => (pre, post), @@ -257,19 +242,22 @@ fn add_storages( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); - store!(schema, columns, slot, slot.as_bytes().to_vec()); - store!(schema, columns, from_value, from.as_bytes().to_vec()); - store!(schema, columns, to_value, to.as_bytes().to_vec()); + store!(schema, columns, address, address.to_vec()); + store!(schema, columns, slot, slot.to_vec()); + store!(schema, columns, from_value, from.to_vec()); + store!(schema, columns, to_value, to.to_vec()); } Ok(()) } -fn parse_pre_post(pre: Option, post: Option, new: fn() -> T) -> (T, T) { +fn parse_pre_post(pre: Option, post: Option, new: T) -> (T, T) +where + T: Copy + Clone, +{ match (pre, post) { (Some(pre), Some(post)) => (pre, post), - (Some(pre), None) => (pre, new()), - (None, Some(post)) => (new(), post), - (None, None) => (new(), new()), + (Some(pre), None) => (pre, new), + (None, Some(post)) => (new, post), + (None, None) => (new, new), } } diff --git a/crates/freeze/src/multi_datasets/state_diffs.rs b/crates/freeze/src/multi_datasets/state_diffs.rs index 858fee4..2806fee 100644 --- a/crates/freeze/src/multi_datasets/state_diffs.rs +++ b/crates/freeze/src/multi_datasets/state_diffs.rs @@ -1,4 +1,5 @@ use crate::*; +use alloy::rpc::types::trace::parity::TraceResults; use polars::prelude::*; use std::collections::HashMap; @@ -11,7 +12,7 @@ pub struct StateDiffs( storage_diffs::StorageDiffs, ); -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); impl ToDataFrames for StateDiffs { fn create_dfs( @@ -35,7 +36,10 @@ impl CollectByBlock for StateDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let include_txs = query.schemas.values().any(|x| x.has_column("transaction_hash")); - source.fetcher.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -48,7 +52,7 @@ impl CollectByTransaction for StateDiffs { type Response = BlockTxsTraces; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.fetcher.trace_transaction_state_diffs(request.transaction_hash()?).await + source.trace_transaction_state_diffs(request.transaction_hash()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/multi_datasets/state_reads.rs b/crates/freeze/src/multi_datasets/state_reads.rs index 339bb49..0fa8ae4 100644 --- a/crates/freeze/src/multi_datasets/state_reads.rs +++ b/crates/freeze/src/multi_datasets/state_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::{BTreeMap, HashMap}; @@ -12,7 +12,7 @@ pub struct StateReads( storage_reads::StorageReads, ); -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); impl ToDataFrames for StateReads { fn create_dfs( @@ -22,10 +22,18 @@ impl ToDataFrames for StateReads { ) -> R> { let StateReads(balances, codes, nonces, storages) = self; let mut output = HashMap::new(); - output.extend(balances.create_dfs(schemas, chain_id)?); - output.extend(codes.create_dfs(schemas, chain_id)?); - output.extend(nonces.create_dfs(schemas, chain_id)?); - output.extend(storages.create_dfs(schemas, chain_id)?); + if schemas.get(&Datatype::BalanceReads).is_some() { + output.extend(balances.create_dfs(schemas, chain_id)?); + } + if schemas.get(&Datatype::CodeReads).is_some() { + output.extend(codes.create_dfs(schemas, chain_id)?); + } + if schemas.get(&Datatype::NonceReads).is_some() { + output.extend(nonces.create_dfs(schemas, chain_id)?); + } + if schemas.get(&Datatype::StorageReads).is_some() { + output.extend(storages.create_dfs(schemas, chain_id)?); + } Ok(output) } } @@ -35,13 +43,19 @@ impl CollectByBlock for StateReads { type Response = BlockTxsTraces; async fn extract(request: Params, source: Arc, query: Arc) -> R { - let schema = - query.schemas.get(&Datatype::StorageReads).ok_or(err("schema not provided"))?; - let include_txs = schema.has_column("transaction_hash"); - source - .fetcher - .geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs) - .await + let include_txs = match ( + query.schemas.get(&Datatype::BalanceReads), + query.schemas.get(&Datatype::CodeReads), + query.schemas.get(&Datatype::NonceReads), + query.schemas.get(&Datatype::StorageReads), + ) { + (Some(schema), _, _, _) | + (_, Some(schema), _, _) | + (_, _, Some(schema), _) | + (_, _, _, Some(schema)) => schema.has_column("transaction_hash"), + _ => false, + }; + source.geth_debug_trace_block_prestate(request.block_number()? as u32, include_txs).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -54,11 +68,20 @@ impl CollectByTransaction for StateReads { type Response = BlockTxsTraces; async fn extract(request: Params, source: Arc, query: Arc) -> R { - let schema = - query.schemas.get(&Datatype::StorageReads).ok_or(err("schema not provided"))?; - let include_block_number = schema.has_column("block_number"); + let include_block_number = match ( + query.schemas.get(&Datatype::BalanceReads), + query.schemas.get(&Datatype::CodeReads), + query.schemas.get(&Datatype::NonceReads), + query.schemas.get(&Datatype::StorageReads), + ) { + (Some(schema), _, _, _) | + (_, Some(schema), _, _) | + (_, _, Some(schema), _) | + (_, _, _, Some(schema)) => schema.has_column("block_number"), + _ => false, + }; let tx = request.transaction_hash()?; - source.fetcher.geth_debug_trace_transaction_prestate(tx, include_block_number).await + source.geth_debug_trace_transaction_prestate(tx, include_block_number).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -72,9 +95,17 @@ fn process_state_reads( schemas: &HashMap, ) -> R<()> { let StateReads(balances, codes, nonces, storages) = columns; - balance_reads::process_balance_reads(&response, balances, schemas)?; - code_reads::process_code_reads(&response, codes, schemas)?; - nonce_reads::process_nonce_reads(&response, nonces, schemas)?; - storage_reads::process_storage_reads(&response, storages, schemas)?; + if schemas.get(&Datatype::BalanceReads).is_some() { + balance_reads::process_balance_reads(&response, balances, schemas)?; + } + if schemas.get(&Datatype::CodeReads).is_some() { + code_reads::process_code_reads(&response, codes, schemas)?; + } + if schemas.get(&Datatype::NonceReads).is_some() { + nonce_reads::process_nonce_reads(&response, nonces, schemas)?; + } + if schemas.get(&Datatype::StorageReads).is_some() { + storage_reads::process_storage_reads(&response, storages, schemas)?; + } Ok(()) } diff --git a/crates/freeze/src/types/chunks/number_chunk.rs b/crates/freeze/src/types/chunks/number_chunk.rs index b557e4c..bb68d1f 100644 --- a/crates/freeze/src/types/chunks/number_chunk.rs +++ b/crates/freeze/src/types/chunks/number_chunk.rs @@ -1,6 +1,6 @@ use super::chunk_ops::ChunkData; use crate::ChunkError; -use ethers::types::FilterBlockOption; +use alloy::rpc::types::FilterBlockOption; /// Chunk of blocks #[derive(Debug, Clone)] @@ -77,7 +77,7 @@ impl NumberChunk { match self { NumberChunk::Numbers(numbers) => Some(NumberChunk::Numbers(numbers)), NumberChunk::Range(start, end) => { - let start = ((start + chunk_size - 1) / chunk_size) * chunk_size; + let start = start.div_ceil(chunk_size) * chunk_size; let end = (end / chunk_size) * chunk_size; if end > start { Some(NumberChunk::Range(start, end)) diff --git a/crates/freeze/src/types/chunks/subchunks.rs b/crates/freeze/src/types/chunks/subchunks.rs index d6e739e..6404c87 100644 --- a/crates/freeze/src/types/chunks/subchunks.rs +++ b/crates/freeze/src/types/chunks/subchunks.rs @@ -27,7 +27,7 @@ impl Subchunk for BlockChunk { fn subchunk_by_count(&self, n_chunks: &u64) -> Vec { let total_blocks = self.size(); - let chunk_size = (total_blocks + n_chunks - 1) / n_chunks; + let chunk_size = total_blocks.div_ceil(*n_chunks); self.subchunk_by_size(&chunk_size) } } @@ -42,7 +42,7 @@ impl Subchunk for Vec { } } -fn to_single_chunk(chunks: &Vec) -> BlockChunk { +fn to_single_chunk(chunks: &[BlockChunk]) -> BlockChunk { match (chunks.len(), chunks.first()) { (1, Some(chunk)) => chunk.clone(), _ => { diff --git a/crates/freeze/src/types/columns.rs b/crates/freeze/src/types/columns.rs index 5270616..8d8baa6 100644 --- a/crates/freeze/src/types/columns.rs +++ b/crates/freeze/src/types/columns.rs @@ -52,10 +52,7 @@ pub trait ColumnData: Default + crate::Dataset { /// input arg aliases fn base_arg_aliases() -> HashMap { - match Self::arg_aliases() { - Some(x) => x, - None => HashMap::new(), - } + Self::arg_aliases().unwrap_or_default() } } diff --git a/crates/freeze/src/types/conversions.rs b/crates/freeze/src/types/conversions.rs index ce8d39f..536ee3a 100644 --- a/crates/freeze/src/types/conversions.rs +++ b/crates/freeze/src/types/conversions.rs @@ -1,6 +1,6 @@ use crate::CollectError; /// conversion operations -use ethers::prelude::*; +use alloy::primitives::{Bytes, I256, U256}; use prefix_hex; /// convert Bytes to u32 @@ -21,11 +21,7 @@ pub trait ToVecU8 { impl ToVecU8 for U256 { fn to_vec_u8(&self) -> Vec { - let mut vec = Vec::new(); - for &number in self.0.iter().rev() { - vec.extend_from_slice(&number.to_be_bytes()); - } - vec + self.to_be_bytes_vec() } } @@ -45,9 +41,7 @@ impl ToVecU8 for Vec { fn to_vec_u8(&self) -> Vec { let mut vec = Vec::new(); for value in self { - for &number in value.0.iter().rev() { - vec.extend_from_slice(&number.to_be_bytes()); - } + vec.extend_from_slice(&value.to_be_bytes_vec()) } vec } diff --git a/crates/freeze/src/types/dataframes/creation.rs b/crates/freeze/src/types/dataframes/creation.rs index b4dd01d..860d5b4 100644 --- a/crates/freeze/src/types/dataframes/creation.rs +++ b/crates/freeze/src/types/dataframes/creation.rs @@ -74,7 +74,7 @@ macro_rules! with_series_u256 { let name = $name.to_string() + U256Type::U32.suffix().as_str(); let name = name.as_str(); - let converted: Vec = $value.iter().map(|v| v.as_u32()).collect(); + let converted: Vec = $value.iter().map(|v| v.wrapping_to::()).collect(); $all_series.push(Series::new(name, converted)); } @@ -83,7 +83,7 @@ macro_rules! with_series_u256 { let name = $name.to_string() + U256Type::U64.suffix().as_str(); let name = name.as_str(); - let converted: Vec = $value.iter().map(|v| v.as_u64()).collect(); + let converted: Vec = $value.iter().map(|v| v.wrapping_to::()).collect(); $all_series.push(Series::new(name, converted)); } @@ -154,7 +154,7 @@ macro_rules! with_series_option_u256 { let name = name.as_str(); let converted: Vec> = - $value.iter().map(|v| v.map(|x| x.as_u32())).collect(); + $value.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); $all_series.push(Series::new(name, converted)); } @@ -164,7 +164,7 @@ macro_rules! with_series_option_u256 { let name = name.as_str(); let converted: Vec> = - $value.iter().map(|v| v.map(|x| x.as_u64())).collect(); + $value.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); $all_series.push(Series::new(name, converted)); } diff --git a/crates/freeze/src/types/dataframes/u256s.rs b/crates/freeze/src/types/dataframes/u256s.rs index ea3a353..9e47689 100644 --- a/crates/freeze/src/types/dataframes/u256s.rs +++ b/crates/freeze/src/types/dataframes/u256s.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::{I256, U256}; use polars::prelude::*; /// Converts a Vec of U256-like data into a polars Series @@ -46,11 +46,11 @@ impl ToU256Series for Vec { Ok(Series::new(name, converted)) } U256Type::U32 => { - let converted: Vec = self.iter().map(|v| v.as_u32()).collect(); + let converted: Vec = self.iter().map(|v| v.wrapping_to::()).collect(); Ok(Series::new(name, converted)) } U256Type::U64 => { - let converted: Vec = self.iter().map(|v| v.as_u64()).collect(); + let converted: Vec = self.iter().map(|v| v.wrapping_to::()).collect(); Ok(Series::new(name, converted)) } U256Type::Decimal128 => { @@ -100,12 +100,12 @@ impl ToU256Series for Vec> { } U256Type::U32 => { let converted: Vec> = - self.iter().map(|v| v.map(|x| x.as_u32())).collect(); + self.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); Ok(Series::new(name, converted)) } U256Type::U64 => { let converted: Vec> = - self.iter().map(|v| v.map(|x| x.as_u64())).collect(); + self.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); Ok(Series::new(name, converted)) } U256Type::Decimal128 => { diff --git a/crates/freeze/src/types/datatypes/scalar.rs b/crates/freeze/src/types/datatypes/scalar.rs index c4078c0..6f86bd8 100644 --- a/crates/freeze/src/types/datatypes/scalar.rs +++ b/crates/freeze/src/types/datatypes/scalar.rs @@ -16,6 +16,7 @@ define_datatypes!( Erc20Metadata, Erc20Supplies, Erc20Transfers, + Erc20Approvals, Erc721Metadata, Erc721Transfers, EthCalls, diff --git a/crates/freeze/src/types/decoders/log_decoder.rs b/crates/freeze/src/types/decoders/log_decoder.rs index 5f7c87a..b107b60 100644 --- a/crates/freeze/src/types/decoders/log_decoder.rs +++ b/crates/freeze/src/types/decoders/log_decoder.rs @@ -1,8 +1,12 @@ use crate::{err, CollectError, ColumnEncoding, ToU256Series, U256Type}; -use ethers::prelude::*; -use ethers_core::abi::{AbiEncode, EventParam, HumanReadableParser, ParamType, RawLog, Token}; +use alloy::{ + dyn_abi::{DynSolValue, EventExt}, + hex::ToHexExt, + json_abi::Event, + primitives::{I256, U256}, + rpc::types::Log, +}; use polars::prelude::*; -use std::collections::HashSet; /// container for log decoding context #[derive(Clone, Debug, PartialEq)] @@ -11,7 +15,7 @@ pub struct LogDecoder { /// uint256 amount) pub raw: String, /// decoded abi type of event signature string - pub event: abi::Event, + pub event: Event, } impl LogDecoder { @@ -19,7 +23,7 @@ impl LogDecoder { /// ex: LogDecoder::new("event Transfer(address indexed from, address indexed to, uint256 /// amount)".to_string()) pub fn new(event_signature: String) -> Result { - match HumanReadableParser::parse_event(event_signature.as_str()) { + match Event::parse(&event_signature) { Ok(event) => Ok(Self { event, raw: event_signature.clone() }), Err(e) => { let err = format!("incorrectly formatted event {} (expect something like event Transfer(address indexed from, address indexed to, uint256 amount) err: {}", event_signature, e); @@ -37,19 +41,35 @@ impl LogDecoder { /// converts from a log type to an abi token type /// this function assumes all logs are of the same type and skips fields if they don't match the /// passed event definition - pub fn parse_log_from_event(&self, logs: Vec) -> indexmap::IndexMap> { - let mut map: indexmap::IndexMap> = indexmap::IndexMap::new(); - let known_keys = - self.event.inputs.clone().into_iter().map(|i| i.name).collect::>(); + pub fn parse_log_from_event( + &self, + logs: Vec, + ) -> indexmap::IndexMap> { + let mut map: indexmap::IndexMap> = indexmap::IndexMap::new(); + let indexed_keys: Vec = self + .event + .inputs + .clone() + .into_iter() + .filter_map(|x| if x.indexed { Some(x.name) } else { None }) + .collect(); + let body_keys: Vec = self + .event + .inputs + .clone() + .into_iter() + .filter_map(|x| if x.indexed { None } else { Some(x.name) }) + .collect(); for log in logs { - match self.event.parse_log(RawLog::from(log)) { - Ok(log) => { - for param in log.params { - if known_keys.contains(param.name.as_str()) { - let tokens = map.entry(param.name).or_default(); - tokens.push(param.value); - } + match self.event.decode_log_parts(log.topics().to_vec(), log.data().data.as_ref(), true) + { + Ok(decoded) => { + for (idx, param) in decoded.indexed.into_iter().enumerate() { + map.entry(indexed_keys[idx].clone()).or_default().push(param); + } + for (idx, param) in decoded.body.into_iter().enumerate() { + map.entry(body_keys[idx].clone()).or_default().push(param); } } Err(e) => eprintln!("error parsing log: {:?}", e), @@ -62,7 +82,7 @@ impl LogDecoder { pub fn make_series( &self, name: String, - data: Vec, + data: Vec, chunk_len: usize, u256_types: &[U256Type], column_encoding: &ColumnEncoding, @@ -70,7 +90,6 @@ impl LogDecoder { // This is a smooth brain way of doing this, but I can't think of a better way right now let mut ints: Vec = vec![]; let mut uints: Vec = vec![]; - let mut str_ints: Vec = vec![]; let mut u256s: Vec = vec![]; let mut i256s: Vec = vec![]; let mut bytes: Vec> = vec![]; @@ -79,68 +98,39 @@ impl LogDecoder { let mut strings: Vec = vec![]; // TODO: support array & tuple types - let param = self - .event - .inputs - .clone() - .into_iter() - .filter(|i| i.name == name) - .collect::>(); - let param = param.first(); - for token in data { match token { - Token::Address(a) => match column_encoding { - ColumnEncoding::Binary => bytes.push(a.to_fixed_bytes().into()), + DynSolValue::Address(a) => match column_encoding { + ColumnEncoding::Binary => bytes.push(a.to_vec()), ColumnEncoding::Hex => hexes.push(format!("{:?}", a)), }, - Token::FixedBytes(b) => match column_encoding { + DynSolValue::FixedBytes(b, _) => match column_encoding { + ColumnEncoding::Binary => bytes.push(b.to_vec()), + ColumnEncoding::Hex => hexes.push(b.encode_hex()), + }, + DynSolValue::Bytes(b) => match column_encoding { ColumnEncoding::Binary => bytes.push(b), ColumnEncoding::Hex => hexes.push(b.encode_hex()), }, - Token::Bytes(b) => match column_encoding { - ColumnEncoding::Binary => bytes.push(b), - ColumnEncoding::Hex => hexes.push(b.encode_hex()), - }, - Token::Uint(i) => match param { - Some(param) => match param.kind.clone() { - ParamType::Uint(size) => { - if size <= 64 { - uints.push(i.as_u64()) - } else { - u256s.push(i) - } - } - _ => str_ints.push(i.to_string()), - }, - None => match i.try_into() { - Ok(i) => ints.push(i), - Err(_) => str_ints.push(i.to_string()), - }, - }, - Token::Int(i) => { - let i = I256::from_raw(i); - match param { - Some(param) => match param.kind.clone() { - ParamType::Int(size) => { - if size <= 64 { - ints.push(i.as_i64()) - } else { - i256s.push(i) - } - } - _ => str_ints.push(i.to_string()), - }, - None => match i.try_into() { - Ok(i) => ints.push(i), - Err(_) => str_ints.push(i.to_string()), - }, + DynSolValue::Uint(i, size) => { + if size <= 64 { + uints.push(i.wrapping_to::()) + } else { + u256s.push(i) } } - Token::Bool(b) => bools.push(b), - Token::String(s) => strings.push(s), - Token::Array(_) | Token::FixedArray(_) => {} - Token::Tuple(_) => {} + DynSolValue::Int(i, size) => { + if size <= 64 { + ints.push(i.unchecked_into()); + } else { + i256s.push(i); + } + } + DynSolValue::Bool(b) => bools.push(b), + DynSolValue::String(s) => strings.push(s), + DynSolValue::Array(_) | DynSolValue::FixedArray(_) => {} + DynSolValue::Tuple(_) => {} + DynSolValue::Function(_) => {} } } let mixed_length_err = format!("could not parse column {}, mixed type", name); @@ -173,8 +163,6 @@ impl LogDecoder { Ok(series_vec) } else if !uints.is_empty() { Ok(vec![Series::new(name.as_str(), uints)]) - } else if !str_ints.is_empty() { - Ok(vec![Series::new(name.as_str(), str_ints)]) } else if !bytes.is_empty() { if bytes.len() != chunk_len { return Err(err(mixed_length_err)) diff --git a/crates/freeze/src/types/errors.rs b/crates/freeze/src/types/errors.rs index f48495c..fe3bae2 100644 --- a/crates/freeze/src/types/errors.rs +++ b/crates/freeze/src/types/errors.rs @@ -1,5 +1,5 @@ +use alloy::transports::{RpcError, TransportErrorKind}; /// error specifications -use ethers::prelude::*; use polars::prelude::*; use thiserror::Error; @@ -60,7 +60,7 @@ pub enum CollectError { /// Error related to provider operations #[error("Failed to get block: {0}")] - ProviderError(#[source] ProviderError), + ProviderError(#[source] RpcError), /// Error related to tokio task #[error("Task failed: {0}")] @@ -96,11 +96,25 @@ pub enum ParseError { /// Error related to provider operations #[error("Failed to get block: {0}")] - ProviderError(#[source] ProviderError), + ProviderError(#[source] RpcError), /// Parse int error #[error("Parsing error")] ParseIntError(#[from] std::num::ParseIntError), + + /// MESC error + #[error("MESC error: {:?}", .0)] + MescError(mesc::MescError), + + /// Parse url error + #[error("Parsing url error: {0}")] + ParseUrlError(url::ParseError), +} + +impl From for ParseError { + fn from(err: mesc::MescError) -> Self { + ParseError::MescError(err) + } } /// Error performing a chunk operation diff --git a/crates/freeze/src/types/execution.rs b/crates/freeze/src/types/execution.rs index a8285d2..0bbe4a7 100644 --- a/crates/freeze/src/types/execution.rs +++ b/crates/freeze/src/types/execution.rs @@ -89,7 +89,7 @@ impl Default for ExecutionEnvBuilder { impl ExecutionEnvBuilder { /// initialize ExecutionEnvBuilder pub fn new() -> Self { - ExecutionEnvBuilder { ..Default::default() } + Self::default() } /// dry run diff --git a/crates/freeze/src/types/files.rs b/crates/freeze/src/types/files.rs index 4dccac0..bfbca16 100644 --- a/crates/freeze/src/types/files.rs +++ b/crates/freeze/src/types/files.rs @@ -14,7 +14,7 @@ pub struct FileOutput { pub subdirs: Vec, /// Whether to overwrite existing files or skip them pub overwrite: bool, - /// File format to used for output files + /// File format to use for output files pub format: FileFormat, /// Number of rows per parquet row group pub row_group_size: Option, @@ -51,7 +51,9 @@ impl FileOutput { }; for meta_datatype in meta_datatypes.iter() { for datatype in meta_datatype.datatypes().into_iter() { - paths.insert(datatype, self.get_path(query, partition, datatype)?); + if query.schemas.contains_key(&datatype) { + paths.insert(datatype, self.get_path(query, partition, datatype)?); + } } } Ok(paths) diff --git a/crates/freeze/src/types/mod.rs b/crates/freeze/src/types/mod.rs index d4eb84c..b0e163d 100644 --- a/crates/freeze/src/types/mod.rs +++ b/crates/freeze/src/types/mod.rs @@ -1,5 +1,4 @@ /// type specifications for cryo_freeze crate - /// type specifications for chunk types pub mod chunks; /// conversion operations @@ -36,6 +35,7 @@ pub use reports::CRYO_VERSION; pub mod dataframes; /// function and event signatures +#[allow(missing_docs)] pub mod signatures; /// error specifications diff --git a/crates/freeze/src/types/rpc_params.rs b/crates/freeze/src/types/rpc_params.rs index 2832b4c..fc58f5b 100644 --- a/crates/freeze/src/types/rpc_params.rs +++ b/crates/freeze/src/types/rpc_params.rs @@ -1,5 +1,8 @@ use crate::{err, CollectError}; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, BlockNumber, B256}, + rpc::types::{Filter, FilterBlockOption}, +}; /// represents parameters for a single rpc call #[derive(Default, Clone, Debug)] @@ -74,22 +77,22 @@ impl Params { /// ethers block number pub fn ethers_block_number(&self) -> Result { - Ok(self.block_number()?.into()) + self.block_number() } /// ethers transaction - pub fn ethers_transaction_hash(&self) -> Result { - Ok(H256::from_slice(&self.transaction_hash()?)) + pub fn ethers_transaction_hash(&self) -> Result { + Ok(B256::from_slice(&self.transaction_hash()?)) } /// ethers address - pub fn ethers_address(&self) -> Result { - Ok(H160::from_slice(&self.address()?)) + pub fn ethers_address(&self) -> Result { + Ok(Address::from_slice(&self.address()?)) } /// ethers contract - pub fn ethers_contract(&self) -> Result { - Ok(H160::from_slice(&self.contract()?)) + pub fn ethers_contract(&self) -> Result { + Ok(Address::from_slice(&self.contract()?)) } /// log filter @@ -97,16 +100,33 @@ impl Params { let (start, end) = self.block_range()?; let block_option = FilterBlockOption::Range { from_block: Some(start.into()), to_block: Some(end.into()) }; - let filter = Filter { - block_option, - address: self.address.clone().map(|x| ValueOrArray::Value(H160::from_slice(&x))), - topics: [ - self.topic0.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - self.topic1.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - self.topic2.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - self.topic3.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - ], - }; + // let filter = Filter { + // block_option, + // address: self.address.clone().map(|x| ValueOrArray::Value(Address::from_slice(&x))), + // topics: [ + // self.topic0.clone().map(|x| ValueOrArray::Value(Some(B256::from_slice(&x)))), + // self.topic1.clone().map(|x| ValueOrArray::Value(Some(B256::from_slice(&x)))), + // self.topic2.clone().map(|x| ValueOrArray::Value(Some(B256::from_slice(&x)))), + // self.topic3.clone().map(|x| ValueOrArray::Value(Some(B2::from_slice(&x)))), + // ], + // }; + let mut filter = Filter::new(); + filter.block_option = block_option; + if self.address.is_some() { + filter = filter.address(Address::from_slice(&self.address.clone().unwrap())); + } + if self.topic0.is_some() { + filter = filter.event_signature(B256::from_slice(&self.topic0.clone().unwrap())); + } + if self.topic1.is_some() { + filter = filter.topic1(B256::from_slice(&self.topic1.clone().unwrap())); + } + if self.topic2.is_some() { + filter = filter.topic2(B256::from_slice(&self.topic2.clone().unwrap())); + } + if self.topic3.is_some() { + filter = filter.topic3(B256::from_slice(&self.topic3.clone().unwrap())); + } Ok(filter) } } diff --git a/crates/freeze/src/types/schemas.rs b/crates/freeze/src/types/schemas.rs index 6584c4e..54201ee 100644 --- a/crates/freeze/src/types/schemas.rs +++ b/crates/freeze/src/types/schemas.rs @@ -8,7 +8,7 @@ use thiserror::Error; /// collection of schemas pub type Schemas = HashMap; -/// funcitons for Schemas +/// functions for Schemas pub trait SchemaFunctions { /// get schema fn get_schema(&self, datatype: &Datatype) -> Result<&Table, CollectError>; @@ -257,7 +257,7 @@ mod tests { let table = Datatype::Blocks .table_schema(&get_u256_types(), &ColumnEncoding::Hex, &None, &None, &cols, None, None) .unwrap(); - assert_eq!(15, table.columns().len()); + assert_eq!(21, table.columns().len()); assert!(table.columns().contains(&"block_hash")); assert!(table.columns().contains(&"transactions_root")); } @@ -308,7 +308,7 @@ mod tests { None, ) .unwrap(); - assert_eq!(15, table.columns().len()); + assert_eq!(21, table.columns().len()); assert!(table.columns().contains(&"block_hash")); assert!(table.columns().contains(&"transactions_root")); } diff --git a/crates/freeze/src/types/signatures.rs b/crates/freeze/src/types/signatures.rs index d5f9dfb..fb74358 100644 --- a/crates/freeze/src/types/signatures.rs +++ b/crates/freeze/src/types/signatures.rs @@ -1,31 +1,26 @@ -use ethers::prelude::*; +use alloy::sol; -lazy_static::lazy_static! { +sol! { + contract ERC20 { + function name() external pure returns (string memory); + function symbol() external pure returns (string memory); + function decimals() external pure returns (uint8); + function totalSupply() external view returns (uint); + function balanceOf(address owner) external view returns (uint); + function allowance(address owner, address spender) external view returns (uint); - /// function signature of FUNCTION_ERC20_NAME - pub static ref FUNCTION_ERC20_NAME: Vec = prefix_hex::decode("0x06fdde03").expect("Decoding failed"); - - /// function signature of FUNCTION_ERC20_SYMBOL - pub static ref FUNCTION_ERC20_SYMBOL: Vec = prefix_hex::decode("0x95d89b41").expect("Decoding failed"); - - /// function signature of FUNCTION_ERC20_DECIMALS - pub static ref FUNCTION_ERC20_DECIMALS: Vec = prefix_hex::decode("0x313ce567").expect("Decoding failed"); - - /// function signature of FUNCTION_ERC20_BALANCE_OF - pub static ref FUNCTION_ERC20_BALANCE_OF: Vec = prefix_hex::decode("0x70a08231").expect("Decoding failed"); - - /// function signature of FUNCTION_ERC20_TOTAL_SUPPLY - pub static ref FUNCTION_ERC20_TOTAL_SUPPLY: Vec = prefix_hex::decode("0x18160ddd").expect("Decoding failed"); - - /// event hash of EVENT_ERC20_TRANSFER - pub static ref EVENT_ERC20_TRANSFER: H256 = H256( - prefix_hex::decode("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") - .expect("Decoding failed"), - ); - - /// event hash of EVENT_ERC721_TRANSFER - pub static ref EVENT_ERC721_TRANSFER: H256 = H256( - prefix_hex::decode("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") - .expect("Decoding failed"), - ); + event Approval(address indexed owner, address indexed spender, uint value); + event Transfer(address indexed from, address indexed to, uint value); + } +} + +sol! { + contract ERC721 { + event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); + event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); + event ApprovalForAll(address indexed owner, address indexed operator, bool approved); + function name() external view returns (string memory); + function symbol() external view returns (string memory); + function tokenURI(uint256 tokenId) external view returns (string memory); + } } diff --git a/crates/freeze/src/types/sources.rs b/crates/freeze/src/types/sources.rs index 7e58f15..04b5c69 100644 --- a/crates/freeze/src/types/sources.rs +++ b/crates/freeze/src/types/sources.rs @@ -1,6 +1,29 @@ use std::sync::Arc; -use ethers::prelude::*; +use alloy::{ + eips::BlockNumberOrTag, + primitives::{Address, BlockNumber, Bytes, TxHash, B256, U256}, + providers::{ + ext::{DebugApi, TraceApi}, + Provider, ProviderBuilder, RootProvider, + }, + rpc::types::{ + trace::{ + common::TraceResult, + geth::{ + AccountState, CallConfig, CallFrame, DefaultFrame, DiffMode, + GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingOptions, + GethTrace, PreStateConfig, PreStateFrame, + }, + parity::{ + LocalizedTransactionTrace, TraceResults, TraceResultsWithTransactionHash, TraceType, + }, + }, + Block, BlockTransactions, BlockTransactionsKind, Filter, Log, Transaction, + TransactionInput, TransactionReceipt, TransactionRequest, + }, + transports::{http::reqwest::Url, BoxTransport, RpcError, TransportErrorKind}, +}; use governor::{ clock::DefaultClock, middleware::NoOpMiddleware, @@ -19,8 +42,8 @@ pub type RateLimiter = governor::RateLimiter>>, + /// provider + pub provider: RootProvider, /// chain_id of network pub chain_id: u64, /// number of blocks per log request @@ -29,6 +52,10 @@ pub struct Source { pub max_concurrent_chunks: Option, /// Rpc Url pub rpc_url: String, + /// semaphore for controlling concurrency + pub semaphore: Arc>, + /// rate limiter for controlling request rate + pub rate_limiter: Arc>, /// Labels (these are non-functional) pub labels: SourceLabels, } @@ -40,32 +67,32 @@ impl Source { &self, block: &Block, ) -> Result> { - let block_number = - block.number.ok_or(CollectError::CollectError("no block number".to_string()))?.as_u64(); - if let Ok(receipts) = self.fetcher.get_block_receipts(block_number).await { + let block_number = block.header.number; + if let Ok(Some(receipts)) = self.get_block_receipts(block_number).await { return Ok(receipts); } - self.get_tx_receipts(&block.transactions).await + self.get_tx_receipts(block.transactions.clone()).await } /// Returns all receipts for vector of transactions using `eth_getTransactionReceipt` pub async fn get_tx_receipts( &self, - transactions: &Vec, + transactions: BlockTransactions, ) -> Result> { let mut tasks = Vec::new(); - for tx in transactions { - let tx_hash = tx.hash; - let fetcher = self.fetcher.clone(); - let task = task::spawn(async move { - match fetcher.get_transaction_receipt(tx_hash).await? { - Some(receipt) => Ok(receipt), - None => { - Err(CollectError::CollectError("could not find tx receipt".to_string())) + for tx in transactions.as_transactions().unwrap() { + let tx_hash = *tx.inner.tx_hash(); + let source = self.clone(); + let task: task::JoinHandle> = + task::spawn(async move { + match source.get_transaction_receipt(tx_hash).await? { + Some(receipt) => Ok(receipt), + None => { + Err(CollectError::CollectError("could not find tx receipt".to_string())) + } } - } - }); + }); tasks.push(task); } let mut receipts = Vec::new(); @@ -90,25 +117,21 @@ const DEFAULT_MAX_CONCURRENT_REQUESTS: u64 = 100; impl Source { /// initialize source pub async fn init(rpc_url: Option) -> Result { - let rpc_url = parse_rpc_url(rpc_url); - let provider = Provider::>::new_client( - &rpc_url, - DEFAULT_MAX_RETRIES, - DEFAULT_INTIAL_BACKOFF, - ) - .map_err(|_| CollectError::RPCError("could not connect to provider".to_string()))?; + let rpc_url: String = parse_rpc_url(rpc_url); + let parsed_rpc_url: Url = rpc_url.parse().expect("rpc url is not valid"); + let provider = ProviderBuilder::new().on_http(parsed_rpc_url.clone()); let chain_id = provider - .get_chainid() + .get_chain_id() .await - .map_err(|_| CollectError::RPCError("could not get chain_id".to_string()))? - .as_u64(); + .map_err(|_| CollectError::RPCError("could not get chain_id".to_string()))?; let rate_limiter = None; let semaphore = None; - let fetcher = Fetcher { provider, semaphore, rate_limiter }; + + let provider = ProviderBuilder::new().on_http(parsed_rpc_url); let source = Source { - fetcher: Arc::new(fetcher), + provider: provider.boxed(), chain_id, inner_request_size: DEFAULT_INNER_REQUEST_SIZE, max_concurrent_chunks: Some(DEFAULT_MAX_CONCURRENT_CHUNKS), @@ -119,6 +142,8 @@ impl Source { max_retries: Some(DEFAULT_MAX_RETRIES), initial_backoff: Some(DEFAULT_INTIAL_BACKOFF), }, + rate_limiter: rate_limiter.into(), + semaphore: semaphore.into(), }; Ok(source) @@ -173,7 +198,7 @@ fn parse_rpc_url(rpc_url: Option) -> String { // } /// source labels (non-functional) -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct SourceLabels { /// Maximum requests collected concurrently pub max_concurrent_requests: Option, @@ -189,7 +214,7 @@ pub struct SourceLabels { #[derive(Debug)] pub struct Fetcher

{ /// provider data source - pub provider: Provider

, + pub provider: RootProvider

, /// semaphore for controlling concurrency pub semaphore: Option, /// rate limiter for controlling request rate @@ -198,7 +223,8 @@ pub struct Fetcher

{ type Result = ::core::result::Result; -impl Fetcher

{ +// impl Fetcher

{ +impl Source { /// Returns an array (possibly empty) of logs that match the filter pub async fn get_logs(&self, filter: &Filter) -> Result> { let _permit = self.permit_request().await; @@ -208,11 +234,13 @@ impl Fetcher

{ /// Replays all transactions in a block returning the requested traces for each transaction pub async fn trace_replay_block_transactions( &self, - block: BlockNumber, + block: BlockNumberOrTag, trace_types: Vec, - ) -> Result> { + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(self.provider.trace_replay_block_transactions(block, trace_types).await) + Self::map_err( + self.provider.trace_replay_block_transactions(block.into(), &trace_types).await, + ) } /// Get state diff traces of block @@ -220,24 +248,28 @@ impl Fetcher

{ &self, block: u32, include_transaction_hashes: bool, - ) -> Result<(Option, Vec>>, Vec)> { + ) -> Result<(Option, Vec>>, Vec)> { // get traces let result = self .trace_replay_block_transactions( - block.into(), - vec![ethers::types::TraceType::StateDiff], + BlockNumberOrTag::Number(block as u64), + vec![TraceType::StateDiff], ) .await?; // get transactions let txs = if include_transaction_hashes { - self.get_block(block as u64) + let transactions = self + .get_block(block as u64, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("could not find block".to_string()))? - .transactions - .iter() - .map(|tx| Some(tx.0.to_vec())) - .collect() + .transactions; + match transactions { + BlockTransactions::Hashes(hashes) => { + hashes.into_iter().map(|tx| Some(tx.to_vec())).collect() + } + _ => return Err(CollectError::CollectError("wrong transaction format".to_string())), + } } else { vec![None; result.len()] }; @@ -249,9 +281,12 @@ impl Fetcher

{ pub async fn trace_block_vm_traces( &self, block: u32, - ) -> Result<(Option, Option>, Vec)> { + ) -> Result<(Option, Option>, Vec)> { let result = self - .trace_replay_block_transactions(block.into(), vec![ethers::types::TraceType::VmTrace]) + .trace_replay_block_transactions( + BlockNumberOrTag::Number(block as u64), + vec![TraceType::VmTrace], + ) .await; Ok((Some(block), None, result?)) } @@ -261,20 +296,20 @@ impl Fetcher

{ &self, tx_hash: TxHash, trace_types: Vec, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - Self::map_err(self.provider.trace_replay_transaction(tx_hash, trace_types).await) + Self::map_err(self.provider.trace_replay_transaction(tx_hash, &trace_types).await) } /// Get state diff traces of transaction pub async fn trace_transaction_state_diffs( &self, transaction_hash: Vec, - ) -> Result<(Option, Vec>>, Vec)> { + ) -> Result<(Option, Vec>>, Vec)> { let result = self .trace_replay_transaction( - H256::from_slice(&transaction_hash), - vec![ethers::types::TraceType::StateDiff], + B256::from_slice(&transaction_hash), + vec![TraceType::StateDiff], ) .await; Ok((None, vec![Some(transaction_hash)], vec![result?])) @@ -284,20 +319,17 @@ impl Fetcher

{ pub async fn trace_transaction_vm_traces( &self, transaction_hash: Vec, - ) -> Result<(Option, Option>, Vec)> { + ) -> Result<(Option, Option>, Vec)> { let result = self - .trace_replay_transaction( - H256::from_slice(&transaction_hash), - vec![ethers::types::TraceType::VmTrace], - ) + .trace_replay_transaction(B256::from_slice(&transaction_hash), vec![TraceType::VmTrace]) .await; Ok((None, Some(transaction_hash), vec![result?])) } /// Gets the transaction with transaction_hash - pub async fn get_transaction(&self, tx_hash: TxHash) -> Result> { + pub async fn get_transaction_by_hash(&self, tx_hash: TxHash) -> Result> { let _permit = self.permit_request().await; - Self::map_err(self.provider.get_transaction(tx_hash).await) + Self::map_err(self.provider.get_transaction_by_hash(tx_hash).await) } /// Gets the transaction receipt with transaction_hash @@ -310,42 +342,53 @@ impl Fetcher

{ } /// Gets the block at `block_num` (transaction hashes only) - pub async fn get_block(&self, block_num: u64) -> Result>> { + pub async fn get_block( + &self, + block_num: u64, + kind: BlockTransactionsKind, + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(self.provider.get_block(block_num).await) + Self::map_err(self.provider.get_block(block_num.into(), kind).await) } - /// Gets the block at `block_num` (transaction hashes only) - pub async fn get_block_by_hash(&self, block_hash: H256) -> Result>> { + /// Gets the block with `block_hash` (transaction hashes only) + pub async fn get_block_by_hash( + &self, + block_hash: B256, + kind: BlockTransactionsKind, + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(self.provider.get_block(BlockId::Hash(block_hash)).await) - } - - /// Gets the block at `block_num` (full transactions included) - pub async fn get_block_with_txs(&self, block_num: u64) -> Result>> { - let _permit = self.permit_request().await; - Self::map_err(self.provider.get_block_with_txs(block_num).await) + Self::map_err(self.provider.get_block(block_hash.into(), kind).await) } /// Returns all receipts for a block. /// Note that this uses the `eth_getBlockReceipts` method which is not supported by all nodes. /// Consider using `FetcherExt::get_tx_receipts_in_block` which takes a block, and falls back to /// `eth_getTransactionReceipt` if `eth_getBlockReceipts` is not supported. - pub async fn get_block_receipts(&self, block_num: u64) -> Result> { + pub async fn get_block_receipts( + &self, + block_num: u64, + ) -> Result>> { let _permit = self.permit_request().await; - Self::map_err(self.provider.get_block_receipts(block_num).await) + Self::map_err(self.provider.get_block_receipts(block_num.into()).await) } /// Returns traces created at given block - pub async fn trace_block(&self, block_num: BlockNumber) -> Result> { + pub async fn trace_block( + &self, + block_num: BlockNumber, + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(self.provider.trace_block(block_num).await) + Self::map_err(self.provider.trace_block(block_num.into()).await) } /// Returns all traces of a given transaction - pub async fn trace_transaction(&self, tx_hash: TxHash) -> Result> { + pub async fn trace_transaction( + &self, + tx_hash: TxHash, + ) -> Result> { let _permit = self.permit_request().await; - self.provider.trace_transaction(tx_hash).await.map_err(CollectError::ProviderError) + Self::map_err(self.provider.trace_transaction(tx_hash).await) } /// Deprecated @@ -355,10 +398,7 @@ impl Fetcher

{ block_number: BlockNumber, ) -> Result { let _permit = self.permit_request().await; - self.provider - .call(&transaction.into(), Some(block_number.into())) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.call(&transaction).block(block_number.into()).await) } /// Returns traces for given call data @@ -367,61 +407,55 @@ impl Fetcher

{ transaction: TransactionRequest, trace_type: Vec, block_number: Option, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - self.provider - .trace_call(transaction, trace_type, block_number) - .await - .map_err(CollectError::ProviderError) + if let Some(bn) = block_number { + return Self::map_err( + self.provider.trace_call(&transaction, &trace_type).block_id(bn.into()).await, + ); + } + Self::map_err(self.provider.trace_call(&transaction, &trace_type).await) } /// Get nonce of address pub async fn get_transaction_count( &self, - address: H160, + address: Address, block_number: BlockNumber, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - self.provider - .get_transaction_count(address, Some(block_number.into())) - .await - .map_err(CollectError::ProviderError) + Self::map_err( + self.provider.get_transaction_count(address).block_id(block_number.into()).await, + ) } /// Get code at address - pub async fn get_balance(&self, address: H160, block_number: BlockNumber) -> Result { + pub async fn get_balance(&self, address: Address, block_number: BlockNumber) -> Result { let _permit = self.permit_request().await; - self.provider - .get_balance(address, Some(block_number.into())) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.get_balance(address).block_id(block_number.into()).await) } /// Get code at address - pub async fn get_code(&self, address: H160, block_number: BlockNumber) -> Result { + pub async fn get_code(&self, address: Address, block_number: BlockNumber) -> Result { let _permit = self.permit_request().await; - self.provider - .get_code(address, Some(block_number.into())) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.get_code_at(address).block_id(block_number.into()).await) } /// Get stored data at given location pub async fn get_storage_at( &self, - address: H160, - slot: H256, + address: Address, + slot: U256, block_number: BlockNumber, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - self.provider - .get_storage_at(address, slot, Some(block_number.into())) - .await - .map_err(CollectError::ProviderError) + Self::map_err( + self.provider.get_storage_at(address, slot).block_id(block_number.into()).await, + ) } /// Get the block number - pub async fn get_block_number(&self) -> Result { + pub async fn get_block_number(&self) -> Result { Self::map_err(self.provider.get_block_number().await) } @@ -429,60 +463,65 @@ impl Fetcher

{ /// block number of transaction pub async fn get_transaction_block_number(&self, transaction_hash: Vec) -> Result { - let block = self.get_transaction(H256::from_slice(&transaction_hash)).await?; + let block = self.get_transaction_by_hash(B256::from_slice(&transaction_hash)).await?; let block = block.ok_or(CollectError::CollectError("could not get block".to_string()))?; Ok(block .block_number .ok_or(CollectError::CollectError("could not get block number".to_string()))? - .as_u32()) + as u32) } /// block number of transaction pub async fn get_transaction_logs(&self, transaction_hash: Vec) -> Result> { Ok(self - .get_transaction_receipt(H256::from_slice(&transaction_hash)) + .get_transaction_receipt(B256::from_slice(&transaction_hash)) .await? .ok_or(CollectError::CollectError("transaction receipt not found".to_string()))? - .logs) + .inner + .logs() + .to_vec()) } /// Return output data of a contract call pub async fn call2( &self, - address: H160, + address: Address, call_data: Vec, block_number: BlockNumber, ) -> Result { let transaction = TransactionRequest { to: Some(address.into()), - data: Some(call_data.into()), + input: TransactionInput::new(call_data.into()), ..Default::default() }; let _permit = self.permit_request().await; - self.provider - .call(&transaction.into(), Some(block_number.into())) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.call(&transaction).block(block_number.into()).await) } /// Return output data of a contract call pub async fn trace_call2( &self, - address: H160, + address: Address, call_data: Vec, trace_type: Vec, block_number: Option, - ) -> Result { + ) -> Result { let transaction = TransactionRequest { to: Some(address.into()), - data: Some(call_data.into()), + input: TransactionInput::new(call_data.into()), ..Default::default() }; let _permit = self.permit_request().await; - self.provider - .trace_call(transaction, trace_type, block_number) - .await - .map_err(CollectError::ProviderError) + if block_number.is_some() { + Self::map_err( + self.provider + .trace_call(&transaction, &trace_type) + .block_id(block_number.unwrap().into()) + .await, + ) + } else { + Self::map_err(self.provider.trace_call(&transaction, &trace_type).await) + } } /// get geth debug block traces @@ -491,20 +530,28 @@ impl Fetcher

{ block_number: u32, options: GethDebugTracingOptions, include_transaction_hashes: bool, - ) -> Result<(Option, Vec>>, Vec)> { + ) -> Result<(Option, Vec>>, Vec>)> { let traces = { let _permit = self.permit_request().await; - self.provider - .debug_trace_block_by_number(Some(block_number.into()), options) - .await - .map_err(CollectError::ProviderError)? + Self::map_err( + self.provider + .debug_trace_block_by_number( + BlockNumberOrTag::Number(block_number.into()), + options, + ) + .await, + )? }; let txs = if include_transaction_hashes { - match self.get_block(block_number as u64).await? { - Some(block) => { - block.transactions.iter().map(|x| Some(x.as_bytes().to_vec())).collect() - } + match self.get_block(block_number as u64, BlockTransactionsKind::Hashes).await? { + Some(block) => block + .transactions + .as_hashes() + .unwrap() + .iter() + .map(|x| Some(x.to_vec())) + .collect(), None => { return Err(CollectError::CollectError( "could not get block for txs".to_string(), @@ -533,8 +580,21 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Unknown(value) => calls.push(value), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::JS(value) => calls.push(value), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))) + } } } Ok((block, txs, calls)) @@ -553,8 +613,21 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::Default(frame)) => calls.push(frame), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::Default(frame) => calls.push(frame), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "inalid trace result in tx {:?}: {}", + tx_hash, error + ))); + } } } Ok((block, txs, calls)) @@ -574,11 +647,27 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::FourByteTracer(FourByteFrame(frame))) => { - calls.push(frame) + // GethTrace::Known(GethTraceFrame::FourByteTracer(FourByteFrame(frame))) => { + // calls.push(frame) + // } + // GethTrace::Known(GethTraceFrame::NoopTracer(_)) => {} + // _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::FourByteTracer(frame) => calls.push(frame.0), + GethTrace::NoopTracer(_) => {} + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); } - GethTrace::Known(GethTraceFrame::NoopTracer(_)) => {} - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } Ok((block, txs, calls)) @@ -589,7 +678,7 @@ impl Fetcher

{ &self, block_number: u32, include_transaction_hashes: bool, - ) -> Result<(Option, Vec>>, Vec>)> { + ) -> Result<(Option, Vec>>, Vec>)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); let options = GethDebugTracingOptions { tracer: Some(tracer), ..Default::default() }; let (block, txs, traces) = @@ -598,10 +687,25 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Default( - PreStateMode(frame), - ))) => calls.push(frame), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + // GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Default( + // PreStateMode(frame), + // ))) => calls.push(frame), + // _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::PreStateTracer(PreStateFrame::Default(frame)) => calls.push(frame.0), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); + } } } Ok((block, txs, calls)) @@ -614,22 +718,37 @@ impl Fetcher

{ include_transaction_hashes: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::CallTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), + // ); + let options = GethDebugTracingOptions::default() + .with_tracer(tracer) + .with_call_config(CallConfig::default()); let (block, txs, traces) = self.geth_debug_trace_block(block_number, options, include_transaction_hashes).await?; let mut calls = Vec::new(); for trace in traces.into_iter() { + // match trace { + // GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => + // calls.push(call_frame), _ => return + // Err(CollectError::CollectError("invalid trace result".to_string())), } match trace { - GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => calls.push(call_frame), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::CallTracer(frame) => calls.push(frame), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); + } } } Ok((block, txs, calls)) @@ -642,30 +761,41 @@ impl Fetcher

{ include_transaction_hashes: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) + // }), + let options = GethDebugTracingOptions::default() + .with_prestate_config(PreStateConfig { + diff_mode: Some(true), + disable_code: None, + disable_storage: None, + }) + .with_tracer(tracer); let (block, txs, traces) = self.geth_debug_trace_block(block_number, options, include_transaction_hashes).await?; let mut diffs = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Diff(diff))) => { - diffs.push(diff) - } - GethTrace::Unknown(ethers::utils::__serde_json::Value::Object(map)) => { - let diff = parse_geth_diff_object(map)?; - diffs.push(diff) - } - _ => { - println!("{:?}", trace); - return Err(CollectError::CollectError("invalid trace result".to_string())); + TraceResult::Success { result, tx_hash } => match result { + GethTrace::PreStateTracer(PreStateFrame::Diff(diff)) => diffs.push(diff), + GethTrace::JS(serde_json::Value::Object(map)) => { + let diff = parse_geth_diff_object(map)?; + diffs.push(diff); + } + _ => { + println!("{:?}", result); + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))); + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); } } } @@ -679,7 +809,7 @@ impl Fetcher

{ options: GethDebugTracingOptions, include_block_number: bool, ) -> Result<(Option, Vec>>, Vec)> { - let ethers_tx = H256::from_slice(&transaction_hash); + let ethers_tx = B256::from_slice(&transaction_hash); let trace = { let _permit = self.permit_request().await; @@ -691,8 +821,8 @@ impl Fetcher

{ let traces = vec![trace]; let block_number = if include_block_number { - match self.get_transaction(ethers_tx).await? { - Some(tx) => tx.block_number.map(|x| x.as_u32()), + match self.get_transaction_by_hash(ethers_tx).await? { + Some(tx) => tx.block_number.map(|x| x as u32), None => { return Err(CollectError::CollectError( "could not get block for txs".to_string(), @@ -722,7 +852,7 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Unknown(value) => calls.push(value), + GethTrace::JS(value) => calls.push(value), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -743,7 +873,7 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::Default(frame)) => calls.push(frame), + GethTrace::Default(frame) => calls.push(frame), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -765,9 +895,7 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::FourByteTracer(FourByteFrame(frame))) => { - calls.push(frame) - } + GethTrace::FourByteTracer(frame) => calls.push(frame.0), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -779,7 +907,7 @@ impl Fetcher

{ &self, transaction_hash: Vec, include_block_number: bool, - ) -> Result<(Option, Vec>>, Vec>)> { + ) -> Result<(Option, Vec>>, Vec>)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); let options = GethDebugTracingOptions { tracer: Some(tracer), ..Default::default() }; let (block, txs, traces) = self @@ -789,9 +917,7 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Default( - PreStateMode(frame), - ))) => calls.push(frame), + GethTrace::PreStateTracer(PreStateFrame::Default(frame)) => calls.push(frame.0), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -805,14 +931,12 @@ impl Fetcher

{ include_block_number: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::CallTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), + // ); + let options = GethDebugTracingOptions::default() + .with_tracer(tracer) + .with_call_config(CallConfig::default()); let (block, txs, traces) = self .geth_debug_trace_transaction(transaction_hash, options, include_block_number) .await?; @@ -820,7 +944,9 @@ impl Fetcher

{ let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => calls.push(call_frame), + // GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => + // calls.push(call_frame), + GethTrace::CallTracer(frame) => calls.push(frame), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -834,14 +960,12 @@ impl Fetcher

{ include_transaction_hashes: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) }), + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) + // }), ); + let options = GethDebugTracingOptions::default().with_tracer(tracer).with_prestate_config( + PreStateConfig { diff_mode: Some(true), disable_code: None, disable_storage: None }, ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; let (block, txs, traces) = self .geth_debug_trace_transaction(transaction_hash, options, include_transaction_hashes) .await?; @@ -849,9 +973,10 @@ impl Fetcher

{ let mut diffs = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Diff(diff))) => { - diffs.push(diff) - } + // GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Diff(diff))) => { + // diffs.push(diff) + // } + GethTrace::PreStateTracer(PreStateFrame::Diff(diff)) => diffs.push(diff), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -861,17 +986,17 @@ impl Fetcher

{ async fn permit_request( &self, ) -> Option<::core::result::Result, AcquireError>> { - let permit = match &self.semaphore { + let permit = match &*self.semaphore { Some(semaphore) => Some(semaphore.acquire().await), _ => None, }; - if let Some(limiter) = &self.rate_limiter { + if let Some(limiter) = &*self.rate_limiter { limiter.until_ready().await; } permit } - fn map_err(res: ::core::result::Result) -> Result { + fn map_err(res: ::core::result::Result>) -> Result { res.map_err(CollectError::ProviderError) } } @@ -879,13 +1004,10 @@ impl Fetcher

{ use crate::err; use std::collections::BTreeMap; -fn parse_geth_diff_object( - map: ethers::utils::__serde_json::Map, -) -> Result { - println!("HERE {:?}", map); - let pre: BTreeMap = serde_json::from_value(map["pre"].clone()) +fn parse_geth_diff_object(map: serde_json::Map) -> Result { + let pre: BTreeMap = serde_json::from_value(map["pre"].clone()) .map_err(|_| err("cannot deserialize pre diff"))?; - let post: BTreeMap = serde_json::from_value(map["post"].clone()) + let post: BTreeMap = serde_json::from_value(map["post"].clone()) .map_err(|_| err("cannot deserialize pre diff"))?; Ok(DiffMode { pre, post }) diff --git a/crates/freeze/src/types/summaries.rs b/crates/freeze/src/types/summaries.rs index bdd5061..f760c1d 100644 --- a/crates/freeze/src/types/summaries.rs +++ b/crates/freeze/src/types/summaries.rs @@ -5,9 +5,8 @@ use colored::Colorize; use thousands::Separable; use crate::{ - chunks::chunk_ops::ValueToString, err, ChunkData, ChunkStats, CollectError, ColumnType, - Datatype, Dim, ExecutionEnv, FileOutput, MetaDatatype, MultiDatatype, Partition, Query, Source, - Table, + chunks::chunk_ops::ValueToString, ChunkData, ChunkStats, CollectError, ColumnType, Datatype, + Dim, ExecutionEnv, FileOutput, MetaDatatype, MultiDatatype, Partition, Query, Source, Table, }; use std::path::PathBuf; @@ -27,6 +26,8 @@ pub struct FreezeSummary { pub skipped: Vec, /// partitions errored pub errored: Vec<(Option, CollectError)>, + /// rows written + pub n_rows: u64, } /// print all datasets @@ -361,8 +362,6 @@ fn print_schemas( println!(); println!(); print_schema(datatype, &schema.clone()) - } else { - return Err(err("missing schema for datatype")) } } } @@ -498,6 +497,7 @@ pub(crate) fn print_cryo_conclusion( total_time, query.datatypes.len() as u64, ); + print_bullet_indent("rows written", freeze_summary.n_rows.separate_with_commas(), 0); } macro_rules! print_dim_speed { diff --git a/crates/python/Cargo.toml b/crates/python/Cargo.toml index f276af7..580f49e 100644 --- a/crates/python/Cargo.toml +++ b/crates/python/Cargo.toml @@ -5,7 +5,6 @@ description = "cryo python is a python library built on top of the rust cryo lib version.workspace = true edition.workspace = true license.workspace = true -homepage.workspace = true repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,9 +14,8 @@ path = "rust/lib.rs" crate-type = ["cdylib"] [dependencies] -cryo_cli = { version = "0.3.0", path = "../cli" } -cryo_freeze = { version = "0.3.0", path = "../freeze" } - +cryo_cli = { workspace = true } +cryo_freeze = { workspace = true } polars = { workspace = true } pyo3 = { workspace = true } pyo3-asyncio = { workspace = true } diff --git a/crates/python/README.md b/crates/python/README.md new file mode 100644 index 0000000..7807a57 --- /dev/null +++ b/crates/python/README.md @@ -0,0 +1,5 @@ + +# ❄️🧊 cryo 🧊❄️ for python + +see full [README](https://github.com/paradigmxyz/cryo?tab=readme-ov-file#installing-cryo_python-from-pypi) for details + diff --git a/crates/python/pyproject.toml b/crates/python/pyproject.toml index f7bbb40..2d2ce6c 100644 --- a/crates/python/pyproject.toml +++ b/crates/python/pyproject.toml @@ -3,13 +3,15 @@ requires = ["maturin>=1.1,<2.0"] build-backend = "maturin" [project] -name = "cryo_python" +name = "cryo" +description = "cryo is the easiest way to extract blockchain data to parquet, csv, json, or a python dataframe." requires-python = ">=3.7" classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] +readme = "README.md" [tool.maturin] diff --git a/crates/python/python/cryo/__init__.py b/crates/python/python/cryo/__init__.py index f762ca4..ef43519 100644 --- a/crates/python/python/cryo/__init__.py +++ b/crates/python/python/cryo/__init__.py @@ -2,8 +2,15 @@ # ruff: noqa: F401 +from ._cryo_rust import __version__ # type: ignore from ._freeze import async_freeze from ._freeze import freeze from ._collect import async_collect from ._collect import collect +__all__ = [ + 'async_collect', + 'async_freeze', + 'collect', + 'freeze', +] diff --git a/crates/python/python/cryo/_args.py b/crates/python/python/cryo/_args.py index 01ef0e8..67f359f 100644 --- a/crates/python/python/cryo/_args.py +++ b/crates/python/python/cryo/_args.py @@ -12,7 +12,6 @@ def parse_cli_args( start_block: _spec.BlockReference | None = None, end_block: _spec.BlockReference | None = None, file_format: _spec.FileFormat = 'parquet', - verbose: bool = True, **kwargs: Unpack[_spec.CryoCliArgs], ) -> _spec.CryoCliArgs: """ @@ -37,7 +36,7 @@ def parse_cli_args( else: raise Exception('unknown file_format') - kwargs['no_verbose'] = not verbose + kwargs['no_verbose'] = not kwargs.get('verbose', True) return kwargs diff --git a/crates/python/python/cryo/_collect.py b/crates/python/python/cryo/_collect.py index 55d7488..78c3300 100644 --- a/crates/python/python/cryo/_collect.py +++ b/crates/python/python/cryo/_collect.py @@ -3,7 +3,7 @@ import typing if typing.TYPE_CHECKING: from typing_extensions import Unpack - from typing import Any + from typing import Any, Literal, TypeVar import pandas as pd import polars as pl @@ -11,6 +11,43 @@ if typing.TYPE_CHECKING: ListOfDicts = list[dict[str, Any]] DictOfLists = dict[str, list[Any]] + T = TypeVar('T', pl.DataFrame, pd.DataFrame, ListOfDicts, DictOfLists) + + +@typing.overload +async def async_collect( + datatype: _spec.Datatype, + output_format: Literal['polars'] = 'polars', + **kwargs: Unpack[_spec.CryoCliArgs], +) -> pl.DataFrame: + ... + + +@typing.overload +async def async_collect( + datatype: _spec.Datatype, + output_format: Literal['pandas'], + **kwargs: Unpack[_spec.CryoCliArgs], +) -> pd.DataFrame: + ... + + +@typing.overload +async def async_collect( + datatype: _spec.Datatype, + output_format: Literal['list'], + **kwargs: Unpack[_spec.CryoCliArgs], +) -> ListOfDicts: + ... + + +@typing.overload +async def async_collect( + datatype: _spec.Datatype, + output_format: Literal['dict'], + **kwargs: Unpack[_spec.CryoCliArgs], +) -> DictOfLists: + ... async def async_collect( @@ -45,6 +82,42 @@ async def async_collect( raise Exception('unknown output format') +@typing.overload +def collect( + datatype: _spec.Datatype, + output_format: Literal['polars'] = 'polars', + **kwargs: Unpack[_spec.CryoCliArgs], +) -> pl.DataFrame: + ... + + +@typing.overload +def collect( + datatype: _spec.Datatype, + output_format: Literal['pandas'], + **kwargs: Unpack[_spec.CryoCliArgs], +) -> pd.DataFrame: + ... + + +@typing.overload +def collect( + datatype: _spec.Datatype, + output_format: Literal['list'], + **kwargs: Unpack[_spec.CryoCliArgs], +) -> ListOfDicts: + ... + + +@typing.overload +def collect( + datatype: _spec.Datatype, + output_format: Literal['dict'], + **kwargs: Unpack[_spec.CryoCliArgs], +) -> DictOfLists: + ... + + def collect( datatype: _spec.Datatype, output_format: _spec.PythonOutput = 'polars', @@ -58,11 +131,14 @@ def collect( try: import concurrent.futures + loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) with concurrent.futures.ThreadPoolExecutor() as executor: future = executor.submit(loop.run_until_complete, coroutine) # type: ignore - return future.result() # type: ignore + result: T = future.result() # type: ignore except RuntimeError: - return asyncio.run(coroutine) + result = asyncio.run(coroutine) + + return result diff --git a/crates/python/python/cryo/_spec.py b/crates/python/python/cryo/_spec.py index 11af8ae..97c98d8 100644 --- a/crates/python/python/cryo/_spec.py +++ b/crates/python/python/cryo/_spec.py @@ -47,11 +47,33 @@ if typing.TYPE_CHECKING: n_row_groups: int | None no_stats: bool compression: str | None - contract: str | bytes | None - topic0: str | bytes | None - topic1: str | bytes | None - topic2: str | bytes | None - topic3: str | bytes | None + contract: typing.Sequence[str | bytes | None] + topic0: typing.Sequence[str | bytes | None] + topic1: typing.Sequence[str | bytes | None] + topic2: typing.Sequence[str | bytes | None] + topic3: typing.Sequence[str | bytes | None] inner_request_size: int | None no_verbose: bool + timestamps: typing.Sequence[str] | None + txs: typing.Sequence[str] | None + u256_types: typing.Sequence[str] | None + exclude_failed: bool + chunk_order: str | None + max_retries: int + initial_backoff: int + partition_by: typing.Sequence[str] | None + subdirs: typing.Sequence[str] + label: str | None + report_dir: str | None + no_report: bool + address: typing.Sequence[str] | None + to_address: typing.Sequence[str] | None + from_address: typing.Sequence[str] | None + call_data: typing.Sequence[str] | None + function: typing.Sequence[str] | None + inputs: typing.Sequence[str] | None + slot: typing.Sequence[str] | None + js_tracer: str | None + verbose: bool + event_signature: str | None diff --git a/crates/python/python/cryo/py.typed b/crates/python/python/cryo/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/crates/python/python/cryo_test/README.md b/crates/python/python/cryo_test/README.md new file mode 100644 index 0000000..1fce65c --- /dev/null +++ b/crates/python/python/cryo_test/README.md @@ -0,0 +1,35 @@ + +# cryo test + +utility for performing comparisons between cryo environments + +```bash +cryo_test is a cli tool for comparing cryo outputs across different conditions + +Usage: cryo_test QUERY [OPTIONS] + +This will 1. setup comparison dir, 2. collect data, and 3. compare outputs + +Examples: + cryo_test --rpc source1=https://h1.com source2=https://h2.com (compare rpc's) + cryo_test --executable old=/path/to/cryo1 new=/path/to/cryo2 (compare executables) + cryo_test --python ... (use python) + cryo_test --cli-vs-python ... (compare cli vs python) + +Options: + -h, --help show this help message and exit + -e, --executable, --executables EXECUTABLE [...] + executable(s) to use + --rpc RPC [...] rpc endpoint(s) to use + -d, --datatype, --datatypes DATATYPE [...] + datatype(s) to collect + -p, --python use python for all batches + --cli-vs-python compare cli to python + -r, --rerun rerun previous comparison + --label LABEL name of comparison + -s, --steps {setup,collect,compare} [...] steps to perform {setup, collect, compare} + --dir DIR directory for storing comparison data + -i, --interactive load data in interactive python session + --scan-interactive scan data in interactive python session + --debug, --pdb enter debug mode upon error +``` diff --git a/crates/python/python/cryo_test/cryo_test/__init__.py b/crates/python/python/cryo_test/cryo_test/__init__.py new file mode 100644 index 0000000..d68cdf3 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/__init__.py @@ -0,0 +1,6 @@ +"""library for performing comparisons between cryo jobs""" + +from .comparison import perform_comparison + + +__version__ = '0.1.0' diff --git a/crates/python/python/cryo_test/cryo_test/__main__.py b/crates/python/python/cryo_test/cryo_test/__main__.py new file mode 100644 index 0000000..6c49d97 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/__main__.py @@ -0,0 +1,7 @@ +from __future__ import annotations + +from . import cli + + +if __name__ == '__main__': + cli.run_cli() diff --git a/crates/python/python/cryo_test/cryo_test/cli/__init__.py b/crates/python/python/cryo_test/cryo_test/cli/__init__.py new file mode 100644 index 0000000..b4ffdd2 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/cli/__init__.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from .cli_classes import * +from .cli_run import * +from .cli_summary import * +from .cli_utils import * + + +if __name__ == '__main__': + run_cli() diff --git a/crates/python/python/cryo_test/cryo_test/cli/cli_classes.py b/crates/python/python/cryo_test/cryo_test/cli/cli_classes.py new file mode 100644 index 0000000..2d9e436 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/cli/cli_classes.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +import argparse +import typing + +import rich_argparse + +if typing.TYPE_CHECKING: + import typing_extensions + + +usage_template = """%(prog)s [{prog}]QUERY [OPTIONS][/{prog}]\n\n + +[{help} not bold]This will 1. setup comparison dir, 2. collect data, and 3. compare outputs[/{help} not bold] + +[{groups}]Examples:[/{groups}] + [{prog}]cryo_test --rpc source1=https://h1.com source2=https://h2.com[/{prog}] (compare rpc's) + [{prog}]cryo_test --executable old=/path/to/cryo1 new=/path/to/cryo2[/{prog}] (compare executables) + [{prog}]cryo_test --python ...[/{prog}] (use python) + [{prog}]cryo_test --cli-vs-python ...[/{prog}] (compare cli vs python)""" + + +class CryoTestHelpFormatter(rich_argparse.RichHelpFormatter): + usage_markup = True + + styles = { + 'argparse.prog': 'bold white', + 'argparse.groups': 'bold rgb(0,255,0)', + 'argparse.args': 'bold white', + 'argparse.metavar': 'grey62', + 'argparse.help': 'grey62', + 'argparse.text': 'blue', + 'argparse.syntax': 'blue', + 'argparse.default': 'blue', + } + + def __init__(self, prog: str) -> None: + super().__init__('cryo_test', max_help_position=45) + + def _format_args(self, action, default_metavar): # type: ignore + get_metavar = self._metavar_formatter(action, default_metavar) + if action.nargs == argparse.ZERO_OR_MORE: + return '[%s [%s ...]]' % get_metavar(2) + elif action.nargs == argparse.ONE_OR_MORE: + return '%s [...]' % get_metavar(1) + return super()._format_args(action, default_metavar) + + def format_help(self) -> str: + import rich + + line = '[{prog}]cryo_test[/{prog}] [{help}]is a cli tool for comparing [{prog}]cryo[/{prog}] outputs across different conditions\n' + rich.print(self.format_styles(line)) + + # indent certain arguments for full alignment + raw = super().format_help() + lines = raw.split('\n') + for i, line in enumerate(lines): + if line.startswith(' \x1b[38;2;197;149;242m--'): + lines[i] = ' ' + lines[i].replace(' ', '', 1) + + # indices = [i for i, line in enumerate(lines) if line.startswith(' \x1b[1;37m--')] + # if lines[indices[0]] == '': + # lines = lines[:indices[0]] + ['FUCK'] + lines[indices[0]:] + + # lines = [ + # line + # for line in lines + # if 'Options:' not in line and '--help' not in line + # ] + return '\n'.join(lines).replace('\n\n\n', '\n\n') + + @classmethod + def format_styles(cls, s: str) -> str: + styles = {k.split('.')[1]: v for k, v in cls.styles.items()} + return s.format(**styles) + + +class CryoTestArgParser(argparse.ArgumentParser): + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + return super().__init__( + *args, + formatter_class=CryoTestHelpFormatter, # type: ignore + usage=CryoTestHelpFormatter.format_styles(usage_template), + **kwargs, + ) + + def error(self, message: str) -> typing_extensions.NoReturn: + import sys + import rich + + sys.stderr.write(f'Error: {message}\n') + print() + self.print_usage() + print() + line = '[{help}]show all options with[/{help}] [bold white]cryo_test -h[/bold white]' + rich.print(CryoTestHelpFormatter.format_styles(line)) + sys.exit(0) diff --git a/crates/python/python/cryo_test/cryo_test/cli/cli_run.py b/crates/python/python/cryo_test/cryo_test/cli/cli_run.py new file mode 100644 index 0000000..6e26d4b --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/cli/cli_run.py @@ -0,0 +1,212 @@ +from __future__ import annotations + +import typing + +from .. import commands +from .. import comparison +from .. import files +from . import cli_classes +from . import cli_summary +from . import cli_utils + +if typing.TYPE_CHECKING: + import argparse + + +def run_cli() -> None: + try: + # parse inputs + args = parse_args() + + if set(args.steps) in [ + {'compare'}, + {'collect'}, + {'collect', 'compare'}, + ]: + rerun = True + else: + rerun = args.rerun + + # load commands + if rerun: + if args.dir is not None: + comparison_dir = args.dir + else: + comparison_dir = files.get_most_recent_comparison_dir() + batches = files.load_commands(comparison_dir) + else: + comparison_dir, batches = create_command_batches(args) + files.save_commands(comparison_dir=comparison_dir, batches=batches) + + # summarize + cli_summary.summarize_args(args, comparison_dir, batches) + + # perform comparison + comparison.perform_comparison( + batches=batches, + comparison_dir=comparison_dir, + steps=args.steps, + ) + + # enter interactive session + if args.interactive or args.scan_interactive: + print('entering interactive session') + if args.scan_interactive: + all_data: typing.Any = files.scan_all_data(comparison_dir) + else: + all_data = files.load_all_data(comparison_dir) + cli_utils.open_interactive_session({'data': all_data}) + except Exception as e: + if args.debug: + cli_utils._enter_debugger() + else: + raise e + + +def parse_args() -> argparse.Namespace: + parser = cli_classes.CryoTestArgParser() + # + # specifying batch args + parser.add_argument( + '-e', + '--executable', + '--executables', + nargs='+', + help='executable(s) to use', + ) + parser.add_argument('--rpc', nargs='+', help='rpc endpoint(s) to use') + parser.add_argument( + '-d', + '--datatype', + '--datatypes', + nargs='+', + help='datatype(s) to collect', + ) + parser.add_argument( + '-p', '--python', action='store_true', help='use python for all batches' + ) + parser.add_argument( + '--cli-vs-python', action='store_true', help='compare cli to python' + ) + # + # specifying how to run + parser.add_argument( + '-r', '--rerun', action='store_true', help='rerun previous comparison' + ) + parser.add_argument('--label', help='name of comparison') + parser.add_argument( + '-s', + '--steps', + help='steps to perform {setup, collect, compare}', + nargs='+', + choices=['setup', 'collect', 'compare'], + default=['setup', 'collect', 'compare'], + ) + parser.add_argument('--dir', help='directory for storing comparison data') + parser.add_argument( + '-i', + '--interactive', + action='store_true', + help='load data in interactive python session', + ) + parser.add_argument( + '--scan-interactive', + action='store_true', + help='scan data in interactive python session', + ) + parser.add_argument( + '--debug', + '--pdb', + action='store_true', + help='enter debug mode upon error', + ) + return parser.parse_args() + + +def create_command_batches( + args: argparse.Namespace, +) -> tuple[str, dict[str, dict[str, str]]]: + command_arg_combos: dict[str, list[str]] = {} + common_command_args: commands.PartialCommandArgs = {} + batch_specific_args: dict[str, commands.PartialCommandArgs] = {} + + # determine batch mode (the variables that change across batches) + if args.executable is not None and len(args.executable) > 1: + batch_mode = 'executable' + elif args.rpc is not None and len(args.rpc) > 1: + batch_mode = 'rpc' + else: + batch_mode = 'default' + + # determine comparison dir + comparison_dir = files.create_comparison_dir(args.dir, args.label) + + # determine interface + if args.python: + common_command_args['interface'] = 'python' + + # + if batch_mode == 'default': + batch_specific_args = {'default': {}} + + # arg: executable + if batch_mode == 'executable': + for raw_executable in args.executable: + batch_name, executable = raw_executable.split('=', maxsplit=1) + batch_specific_args[batch_name] = {'executable': executable} + else: + if args.executable is None: + common_command_args['executable'] = 'cryo' + elif len(args.executable) == 1: + common_command_args['executable'] = args.executable[0] + else: + raise Exception() + + # arg: rpc + if batch_mode == 'rpc': + for raw_rpc in args.rpcs: + batch_name, rpc = raw_rpc.split('=', maxsplits=1) + batch_specific_args[batch_name] = {'rpc': rpc} + else: + if args.rpc is None: + pass + elif len(args.rpc) == 1: + common_command_args['rpc'] = args.rpc[0] + else: + raise Exception() + + # arg: datatypes + if args.datatype is not None: + command_arg_combos['datatype'] = args.datatype + + # if cli-vs-python, create cli and python version of each batch + if args.cli_vs_python: + new_batch_specific_args = {} + for batch_name, batch_kwargs in batch_specific_args.items(): + new_batch_specific_args[batch_name + '_cli'] = dict( + batch_kwargs, interface='cli' + ) + new_batch_specific_args[batch_name + '_python'] = dict( + batch_kwargs, interface='python' + ) + + # arg: output_dir + for batch_name in batch_specific_args.keys(): + batch_specific_args[batch_name]['data_root'] = files.get_batch_data_dir( + comparison_dir=comparison_dir, + batch_name=batch_name, + ) + + # generate commands + batches = {} + for batch_name in batch_specific_args.keys(): + kwargs: commands.PartialCommandArgs = dict( + **common_command_args, **batch_specific_args[batch_name] + ) + batches[batch_name] = commands.generate_commands( + common_command_args=kwargs, + command_arg_combos=command_arg_combos, + ) + + return comparison_dir, batches + diff --git a/crates/python/python/cryo_test/cryo_test/cli/cli_summary.py b/crates/python/python/cryo_test/cryo_test/cli/cli_summary.py new file mode 100644 index 0000000..b24a71a --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/cli/cli_summary.py @@ -0,0 +1,92 @@ +from __future__ import annotations + +import typing + +if typing.TYPE_CHECKING: + import argparse + + +def summarize_args( + args: argparse.Namespace, + comparison_dir: str, + batches: dict[str, dict[str, str]], +) -> None: + print_text_box('cryo test') + print() + print_header('parameters') + print_bullet(key='re-running previous job:', value=args.rerun) + print_bullet(key='directory', value=comparison_dir) + print_bullet(key='steps', value=', '.join(args.steps)) + + # argument: rpc + if args.rpc is not None: + if len(args.rpc) == 1: + print_bullet(key='rpc', value=args.rpc[0]) + else: + print_bullet(key='rpc', value=None) # type: ignore + for rpc in args.rpc: + print_bullet(key=rpc, value=None, indent=4) # type: ignore + else: + print_bullet(key='rpc', value='\[default]') # noqa: W605 + + # argument: executable + if args.executable is not None: + if len(args.executable) == 1: + print_bullet(key='executable', value=args.executable[0]) + else: + print_bullet(key='executable', value=None) # type: ignore + for executable in args.executable: + print_bullet(key=None, value=executable, indent=4) # type: ignore + else: + print_bullet(key='executable', value='\[default]') # noqa: W605 + + # argument: python + if args.cli_vs_python or args.python: + if args.cli_vs_python: + print_bullet(key='interface', value='cli, python') + else: + print_bullet(key='interface', value='python') + else: + print_bullet(key='interactive', value='cli') + + # argument: interactive + if args.interactive or args.scan_interactive: + if args.scan_interactive: + print_bullet(key='interactive', value="yes, scanning LazyFrame's") + else: + print_bullet(key='interactive', value="yes, loading DataFrame's") + else: + print_bullet(key='interactive', value='no') + + print() + print_header('comparing ' + str(len(batches)) + ' cryo contexts') + for batch_name in batches.keys(): + print_bullet(key=None, value=batch_name) # type: ignore + if len(batches) == 0: + print('[none]') + print() + print() + + +def print_text_box(text: str) -> None: + import toolstr + + header_kwargs = {'style': 'rgb(0,255,0)', 'text_style': 'white bold'} + toolstr.print_text_box(text, **header_kwargs) # type: ignore + + +def print_header(text: str) -> None: + import toolstr + + header_kwargs = {'style': 'rgb(0,255,0)', 'text_style': 'white bold'} + toolstr.print_header(text, **header_kwargs) # type: ignore + + +def print_bullet(key: str, value: str, indent: int | None = None) -> None: + import toolstr + + bullet_kwargs = { + 'colon_style': 'rgb(0,255,0)', + 'key_style': 'white bold', + } + toolstr.print_bullet(key=key, value=value, indent=indent, **bullet_kwargs) diff --git a/crates/python/python/cryo_test/cryo_test/cli/cli_utils.py b/crates/python/python/cryo_test/cryo_test/cli/cli_utils.py new file mode 100644 index 0000000..f863f73 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/cli/cli_utils.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +import typing + + +def open_interactive_session(variables: dict[str, typing.Any]) -> None: + header = 'data sorted in these variables:' + for key, value in variables.items(): + header += ( + '\n- \033[1m\033[97m' + key + '\033[0m: ' + type(value).__name__ + ) + try: + from IPython.terminal.embed import InteractiveShellEmbed + + ipshell = InteractiveShellEmbed(colors='Linux') # type: ignore + ipshell(header=header, local_ns=variables) + except ImportError: + import code + import sys + + class ExitInteract: + def __call__(self) -> None: + raise SystemExit + + def __repr__(self) -> str: + raise SystemExit + + try: + sys.ps1 = '>>> ' + code.interact( + banner='\n' + header + '\n', + local=dict(variables, exit=ExitInteract()), + ) + except SystemExit: + pass + + +def _enter_debugger() -> None: + """open debugger to most recent exception + + - adapted from https://stackoverflow.com/a/242514 + """ + import sys + import traceback + + # print stacktrace + extype, value, tb = sys.exc_info() + print('[ENTERING DEBUGGER]') + traceback.print_exc() + print() + + try: + import ipdb # type: ignore + import types + + tb = typing.cast(types.TracebackType, tb) + ipdb.post_mortem(tb) + + except ImportError: + import pdb + + pdb.post_mortem(tb) diff --git a/crates/python/python/cryo_test/cryo_test/commands/__init__.py b/crates/python/python/cryo_test/cryo_test/commands/__init__.py new file mode 100644 index 0000000..b21d09e --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/commands/__init__.py @@ -0,0 +1,3 @@ +from .command_generation import * +from .command_parsing import * +from .command_types import * diff --git a/crates/python/python/cryo_test/cryo_test/commands/command_generation.py b/crates/python/python/cryo_test/cryo_test/commands/command_generation.py new file mode 100644 index 0000000..b7468c8 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/commands/command_generation.py @@ -0,0 +1,201 @@ +from __future__ import annotations + +import typing + +from .. import defaults +from .. import files +from . import command_types + +if typing.TYPE_CHECKING: + from typing_extensions import Unpack + + +python_command_template = """cryo.freeze( + {datatype}, + {time_dimension}, + output_dir={output_dir}, + rpc={rpc}, + subdirs='datatype', + include_columns=['all'], + **{extra_args} +)""" + + +def generate_commands( + command_arg_list: list[command_types.PartialCommandArgs] | None = None, + command_arg_combos: dict[str, list[typing.Any]] | None = None, + common_command_args: command_types.PartialCommandArgs | None = None, +) -> dict[str, str]: + """generate cryo commands""" + import itertools + + # parse default inputs + if command_arg_list is None: + command_arg_list = [{}] + if common_command_args is None: + common_command_args = {} + + missing_keys = { + key + for key in defaults.default_combos.keys() + if key not in common_command_args + and not all(key in item for item in command_arg_list) + and (command_arg_combos is not None and key not in command_arg_combos) + } + if len(missing_keys) > 0: + if command_arg_combos is None: + command_arg_combos = {} + else: + command_arg_combos = dict(command_arg_combos) + for key in missing_keys: + command_arg_combos[key] = defaults.default_combos[key] + + # render all_command_args + if command_arg_combos is not None: + all_command_args: list[command_types.PartialCommandArgs] = [] + for command_arg_set in command_arg_list: + keys = list(command_arg_combos.keys()) + for values in itertools.product(*command_arg_combos.values()): + command_args: command_types.PartialCommandArgs = dict( # type: ignore + command_arg_set, **dict(zip(keys, values)) + ) + all_command_args.append(command_args) + else: + all_command_args = command_arg_list + + # add common kwargs + for args in all_command_args: + for key, value in common_command_args.items(): + if key not in args: + args[key] = value # type: ignore + + # eliminate invalid combinations + all_command_args = [ + command_args + for command_args in all_command_args + if are_command_args_valid(**command_args) + ] + + # generate commands + commands = {} + for command_args in all_command_args: + name = create_command_name(**command_args) + if name in commands: + raise Exception('name collision: ' + str(name)) + commands[name] = generate_command(**command_args) + + return commands + + +def generate_command(**kwargs: Unpack[command_types.CommandArgs]) -> str: + if isinstance(kwargs.get('datatype'), list): + kwargs['datatype'] = tuple(kwargs['datatype']) + interface = kwargs.get('interface', 'cli') + if interface == 'cli': + return generate_cli_command(**kwargs) + elif interface == 'python': + return generate_python_command(**kwargs) + else: + raise Exception('invalid interface') + + +def generate_cli_command( + datatype: str | tuple[str, ...], + time_dimension: str, + data_root: str, + executable: str, + extra_args: list[str] | None = None, + name: str | None = None, + interface: typing.Literal['cli', 'python'] = 'cli', + rpc: str | None = None, +) -> str: + datatype = _datatype_to_tuple(datatype) + if interface != 'cli': + raise Exception('interface must be cli') + if name is None: + name = create_command_name(datatype, time_dimension) + if extra_args is None: + extra_args = [] + pieces = [ + executable, + *datatype, + defaults.time_dimensions[time_dimension], + '--subdirs datatype', + '--include-columns all', + '--output-dir ' + + files.get_command_data_dir( + batch_data_dir=data_root, command_name=name + ), + ' '.join(extra_args), + defaults.datatype_parameters.get(datatype, ''), + ] + if rpc is not None: + pieces.extend(['--rpc', rpc]) + return ' '.join(pieces).strip(' ').replace(' ', ' ') + + +def generate_python_command( + datatype: str | tuple[str, ...], + time_dimension: str, + data_root: str, + executable: str, + extra_args: list[str], + name: str | None = None, + interface: typing.Literal['cli', 'python'] = 'python', + rpc: str | None = None, +) -> str: + datatype = _datatype_to_tuple(datatype) + if interface != 'python': + raise Exception('interface must be python') + if name is None: + name = create_command_name(datatype, time_dimension) + if time_dimension == 'blocks': + value = defaults.time_dimensions['blocks'].split(' ', maxsplit=1)[1:] + time_dimension = 'blocks=' + ' '.join(value) + elif time_dimension == 'transactions': + value = defaults.time_dimensions['transactions'].split(' ', maxsplit=1)[ + 1: + ] + time_dimension = 'transactions=' + ' '.join(value) + else: + raise Exception('invalid time dimension') + return python_command_template.format( + datatype=datatype, + time_dimension=time_dimension, + rpc=rpc, + output_dir=files.get_command_data_dir( + batch_data_dir=data_root, command_name=name + ), + extra_args=extra_args, + ) + + +def create_command_name( + datatype: str | tuple[str, ...], + time_dimension: str, + name: str | None = None, + **kwargs: typing.Any, +) -> str: + datatype = _datatype_to_tuple(datatype) + if name is not None: + return name + else: + return '_and_'.join(datatype) + '_by_' + time_dimension + + +def are_command_args_valid( + datatype: str | tuple[str, ...], time_dimension: str, **kwargs: typing.Any +) -> bool: + datatype = _datatype_to_tuple(datatype) + + if time_dimension == 'transactions' and any( + dt in defaults.not_by_transaction for dt in datatype + ): + return False + return True + + +def _datatype_to_tuple(datatype: str | tuple[str, ...]) -> tuple[str, ...]: + if isinstance(datatype, str): + datatype = (datatype,) + return tuple([d for dt in datatype for d in dt.split(' ')]) diff --git a/crates/python/python/cryo_test/cryo_test/commands/command_parsing.py b/crates/python/python/cryo_test/cryo_test/commands/command_parsing.py new file mode 100644 index 0000000..8404bb5 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/commands/command_parsing.py @@ -0,0 +1,57 @@ +from __future__ import annotations + +import typing + +from .. import defaults + + +def get_commands_interface(commands: dict[str, str]) -> str: + interfaces = set( + get_command_interface(command) for command in commands.values() + ) + if len(interfaces) == 1: + return list(interfaces)[0] + else: + raise Exception() + + +def get_command_interface(command: str) -> typing.Literal['cli', 'python']: + if command.startswith('cryo.'): + return 'python' + else: + return 'cli' + + +def get_command_output_dir(command: str) -> str: + interface = get_command_interface(command) + if interface == 'cli': + pre_index = command.index('--output-dir ') + start_index = pre_index + len('--output-dir') + end_index = command.index(' \\', pre_index) + return command[start_index:end_index] + elif interface == 'python': + pre_index = command.index('output_dir=') + start_index = pre_index + len('output_dir=') + end_index = command.index(',', pre_index) + return command[start_index:end_index] + else: + raise Exception('invalid interface') + + +def parse_command_datatypes(command: str) -> list[str]: + interface = get_command_interface(command) + if interface == 'cli': + datatypes = [] + pieces = command.split(' ') + for piece in pieces[1:]: + if piece.startswith('-'): + break + else: + datatypes.append(piece) + return [ + dt + for datatype in datatypes + for dt in defaults.multi_aliases.get(datatype, [datatype]) + ] + else: + raise Exception() diff --git a/crates/python/python/cryo_test/cryo_test/commands/command_types.py b/crates/python/python/cryo_test/cryo_test/commands/command_types.py new file mode 100644 index 0000000..66526b8 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/commands/command_types.py @@ -0,0 +1,25 @@ +from __future__ import annotations + +import typing + + +class PartialCommandArgs(typing.TypedDict, total=False): + datatype: str | tuple[str, ...] + time_dimension: str + data_root: str + executable: str + extra_args: list[str] + name: str | None + interface: typing.Literal['cli', 'python'] + rpc: str + + +class CommandArgs(typing.TypedDict): + datatype: str | tuple[str, ...] + time_dimension: str + data_root: str + executable: str + extra_args: list[str] + name: str | None + interface: typing.Literal['cli', 'python'] + rpc: str diff --git a/crates/python/python/cryo_test/cryo_test/comparison.py b/crates/python/python/cryo_test/cryo_test/comparison.py new file mode 100644 index 0000000..5c10b1e --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/comparison.py @@ -0,0 +1,257 @@ +from __future__ import annotations + +import typing + +from . import cli +from . import commands +from . import files +from . import scripts +from . import polars_utils + +if typing.TYPE_CHECKING: + from typing import Literal, Sequence + + CompareStep = Literal['setup', 'collect', 'compare'] + + +def perform_comparison( + batches: dict[str, dict[str, str]], + comparison_dir: str | None, + steps: Sequence[CompareStep] = ['setup', 'collect', 'compare'], +) -> dict[str, typing.Any]: + import json + import subprocess + import time + + # initialize variables + timing: dict[str, float | None] = { + 't_' + side + '_' + step: None + for side in ['start', 'end'] + for step in ['setup', 'collect', 'compare'] + } + if comparison_dir is None and batches is None: + raise Exception('must specify batches or existing comparison dir') + if comparison_dir is None: + comparison_dir = files.create_comparison_dir() + elif batches is None: + batches_path = files.get_batches_json_path(comparison_dir) + with open(batches_path) as f: + batches = json.load(f) + script_paths = {} + for batch_name, batch_commands in batches.items(): + script_paths[batch_name] = files.get_scripts_path( + comparison_dir=comparison_dir, + batch_name=batch_name, + batch_commands=batch_commands, + ) + + # step: setup collection scripts + if steps is None or 'setup' in steps: + timing['t_start_setup'] = time.time() + cli.print_text_box('\[step: setup]') # noqa: W605 + print('building scripts in ' + files.get_scripts_dir(comparison_dir)) + for batch_name, batch_commands in batches.items(): + scripts.generate_collect_script( + commands=batch_commands, script_path=script_paths[batch_name] + ) + timing['t_end_setup'] = time.time() + + # step: collect output data + if steps is None or 'collect' in steps: + timing['t_start_collect'] = time.time() + print('\n\n') + for batch_name, batch_commands in batches.items(): + cli.print_text_box( + '\[step: collect] collecting data in batch [rgb(50,220,50) bold]' + + batch_name + + '[/rgb(50,220,50) bold]' + ) # noqa: W605 + subprocess.call(script_paths[batch_name]) + timing['t_end_collect'] = time.time() + + # step: compare outputs + if steps is None or 'compare' in steps: + timing['t_start_compare'] = time.time() + cli.print_text_box('\[step: compare] comparing data') # noqa: W605 + _compare_outputs(comparison_dir=comparison_dir, batches=batches) + timing['t_end_compare'] = time.time() + + # save output + output = { + 'comparison_dir': comparison_dir, + 'script_paths': script_paths, + 'timing': timing, + 'steps': steps, + } + _save_comparison_output(output) + + print() + print('...complete') + print() + print('(see data in ' + comparison_dir + ')') + + return output + + +def _compare_outputs( + comparison_dir: str, batches: dict[str, dict[str, str]] +) -> dict[str, dict[str, list[str]]]: + import rich + + # gather command names + command_names = [] # use list not set to preserve order + for batch in batches.values(): + for command_name in batch.keys(): + if command_name not in command_names: + command_names.append(command_name) + if len(batches) == 1: + context_str = 'context' + else: + context_str = 'contexts' + print(len(command_names), 'commands across', len(batches), context_str) + print() + cli.print_header('Data summary') + + # for each command, compare outputs + all_differences: dict[str, dict[str, list[str]]] = {} + for command_name in command_names: + # get datatypes + datatypes = set() + for batch_name, batch in batches.items(): + if command_name in batch: + command = batches[batch_name][command_name] + datatypes.update(commands.parse_command_datatypes(command)) + + # compare results + all_differences[command_name] = {} + for datatype in datatypes: + s = ( + '[rgb(0,255,0)]-[/rgb(0,255,0)] verifying [rgb(0,255,0) bold]' + + command_name + + '[/rgb(0,255,0) bold]' + ) + if len(datatypes) > 1: + s = s + ' (datatype = ' + datatype + ')' + rich.print(s) + + all_differences[command_name][datatype] = _compare_specific( + comparison_dir=comparison_dir, + command_name=command_name, + datatype=datatype, + batches=batches, + ) + + total_differences = sum( + len(datatype_diffs) + for command_diffs in all_differences.values() + for datatype_diffs in command_diffs.values() + ) + print('') + cli.print_header('Total differences: ' + str(total_differences)) + if total_differences == 0: + print('[none]') + else: + i = 1 + for command_name in all_differences.keys(): + for datatype in all_differences[command_name].keys(): + for diff in all_differences[command_name][datatype]: + if diff.startswith('(omitting'): + continue + rich.print( + str(i) + '.', + '\[[rgb(0,255,0) bold]' + + command_name + + '[/rgb(0,255,0) bold]]', + '\[[white bold]' + datatype + '[/white bold]]', + diff, + ) + i += 1 + + return all_differences + + +def _compare_specific( + comparison_dir: str, + command_name: str, + datatype: str, + batches: dict[str, dict[str, str]], +) -> list[str]: + import glob + import rich + + diffs = [] + all_paths = {} + for batch_name, batch in batches.items(): + # get paths + if command_name not in batch: + continue + batch_glob = files.get_command_data_glob( + comparison_dir=comparison_dir, + batch_name=batch_name, + command_name=command_name, + datatype=datatype, + ) + paths = glob.glob(batch_glob) + _print_batch_data_summary(batch_name=batch_name, paths=paths) + if len(paths) == 0: + diffs.append('data missing for ' + batch_name) + else: + all_paths[batch_name] = paths + + # compute differences + diffs += polars_utils.find_df_differences(all_paths) + diffs = [diff[:300] for diff in diffs if not diff.startswith('(omitting')] + if len(diffs) > 0: + for diff in diffs: + rich.print(' [red bold]diff[/red bold]: ' + diff) + else: + rich.print(' [green bold]equal[/green bold]') + + return diffs + + +def _print_batch_data_summary(batch_name: str, paths: list[str]) -> None: + import os + import toolstr + import polars as pl + import rich + + if len(paths) == 1: + file_str = 'file' + else: + file_str = 'files' + + if len(paths) == 0: + summary = '[red bold]DATA MISSING[/red bold])' + else: + n_bytes = sum(os.path.getsize(path) for path in paths) + n_rows = pl.scan_parquet(paths).select(pl.len()).collect()['len'][0] + summary = ( + toolstr.format(n_bytes, 'nbytes') + + ', ' + + toolstr.format(n_rows) + + ' rows)[/white]' + ) + + rich.print( + ' batch [rgb(0,255,0)]=[/rgb(0,255,0)] [white bold]' + + batch_name + + '[/white bold] ' + + '[white](' + + str(len(paths)) + + ' ' + + file_str + + ', ' + + summary + ) + + +def _save_comparison_output(output: dict[str, typing.Any]) -> None: + import json + import os + + comparison_dir = output['comparison_dir'] + run_path = files.get_summary_path(comparison_dir=comparison_dir) + os.makedirs(os.path.dirname(run_path), exist_ok=True) + with open(run_path, 'w') as f: + json.dump(output, f) diff --git a/crates/python/python/cryo_test/cryo_test/defaults.py b/crates/python/python/cryo_test/cryo_test/defaults.py new file mode 100644 index 0000000..c7fb794 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/defaults.py @@ -0,0 +1,94 @@ +from __future__ import annotations + + +datatypes = [ + 'address_appearances', + 'balance_diffs', + 'balances', + 'blocks', + 'code_diffs', + 'codes', + 'contracts', + 'erc20_balances', + 'erc20_metadata', + 'erc20_supplies', + 'erc20_transfers', + 'erc721_metadata', + 'erc721_transfers', + 'eth_calls', + 'logs', + 'native_transfers', + 'nonce_diffs', + 'nonces', + 'storage_diffs', + 'slots', + 'trace_calls', + 'traces', + 'transactions', + # 'vm_traces', +] + +multi_datatypes = [ + 'blocks transactions', + 'state_diffs', +] + +multi_aliases = { + 'state_diffs': [ + 'balance_diffs', + 'code_diffs', + 'nonce_diffs', + 'storage_diffs', + ], +} + +datatype_parameters: dict[str | tuple[str, ...], str] = { + ('balances',): '--address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ('codes',): '--address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ('nonces',): '--address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ( + 'erc20_balances', + ): '--contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ('erc20_metadata',): '--address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ( + 'erc20_supplies', + ): '--contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ( + 'erc721_metadata', + ): '--contract 0xed5af388653567af2f388e6224dc7c4b3241c544', + ( + 'erc721_transfers', + ): '--contract 0xed5af388653567af2f388e6224dc7c4b3241c544', + ( + 'eth_calls', + ): '--call-data 0x18160ddd --contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ( + 'slots', + ): '--address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --slot 0x0000000000000000000000000000000000000000000000000000000000000000', + ( + 'trace_calls', + ): '--call-data 0x18160ddd --contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', +} + +not_by_transaction = [ + 'balances', + 'codes', + 'erc20_balances', + 'erc20_metadata', + 'erc20_supplies', + 'erc721_metadata', + 'eth_calls', + 'nonces', + 'slots', + 'trace_calls', +] + +time_dimensions = { + 'blocks': '-b 18.000M:18.0001M', + 'transactions': '--txs 0xa1935e783e5e7cd320c6e9005a8a7770853d2e46837ac31de1afcfe8b4b7079d', +} + +default_combos: dict[str, list[str]] = { + 'datatype': datatypes + multi_datatypes, + 'time_dimension': ['blocks', 'transactions'], +} diff --git a/crates/python/python/cryo_test/cryo_test/files/__init__.py b/crates/python/python/cryo_test/cryo_test/files/__init__.py new file mode 100644 index 0000000..56aadaf --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/files/__init__.py @@ -0,0 +1,2 @@ +from .file_io import * +from .file_paths import * diff --git a/crates/python/python/cryo_test/cryo_test/files/file_io.py b/crates/python/python/cryo_test/cryo_test/files/file_io.py new file mode 100644 index 0000000..87bca0f --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/files/file_io.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +import typing + +from . import file_paths + +if typing.TYPE_CHECKING: + import polars as pl + + T = typing.TypeVar('T') + + +def save_commands( + comparison_dir: str, batches: dict[str, dict[str, str]] +) -> None: + import json + import os + + os.makedirs(comparison_dir, exist_ok=True) + with open(file_paths.get_commands_path(comparison_dir), 'w') as f: + json.dump(batches, f) + + +def load_commands(comparison_dir: str) -> dict[str, dict[str, str]]: + import json + + with open(file_paths.get_commands_path(comparison_dir)) as f: + result: dict[str, dict[str, str]] = json.load(f) + return result + + +def load_all_data(comparison_dir: str) -> dict[str, dict[str, pl.DataFrame]]: + import polars as pl + + return _io_data(comparison_dir, pl.read_parquet) + + +def scan_all_data(comparison_dir: str) -> dict[str, dict[str, pl.LazyFrame]]: + import polars as pl + + return _io_data(comparison_dir, pl.scan_parquet) + + +def _io_data( + comparison_dir: str, f: typing.Callable[[str], T] +) -> dict[str, dict[str, T]]: + batches = load_commands(comparison_dir) + data: dict[str, dict[str, T]] = {} + for batch_name in batches.keys(): + data[batch_name] = {} + for command in batches[batch_name].keys(): + data[batch_name][command] = f(comparison_dir) + return data diff --git a/crates/python/python/cryo_test/cryo_test/files/file_paths.py b/crates/python/python/cryo_test/cryo_test/files/file_paths.py new file mode 100644 index 0000000..6e4c70d --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/files/file_paths.py @@ -0,0 +1,146 @@ +from __future__ import annotations + +from .. import commands as commands_module + + +def create_comparison_dir( + comparison_dir: str | None = None, label: str | None = None +) -> str: + import datetime + import os + + if comparison_dir is not None: + if label is not None: + pieces = comparison_dir.split('__', maxsplit=1) + if len(pieces) != 2 or pieces[-1] != '__' + label: + raise Exception('comparison_dir does not match label') + return comparison_dir + else: + dir_name = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + if label is not None: + dir_name = dir_name + '__' + label + return os.path.join(get_cryo_test_root(), dir_name) + + +def get_most_recent_comparison_dir() -> str: + import os + + test_root = get_cryo_test_root() + jobs = sorted(os.listdir(test_root)) + if len(jobs) == 0: + raise Exception('no previous jobs') + else: + return os.path.join(test_root, jobs[-1]) + + +def get_cryo_test_root() -> str: + import os + import tempfile + + tmp_root = '/tmp' if os.path.exists('/tmp') else tempfile.gettempdir() + return os.path.join(tmp_root, 'cryo_test') + + +def get_commands_path(comparison_dir: str) -> str: + import os + + return os.path.join(comparison_dir, 'commands.json') + + +def get_summary_path(comparison_dir: str) -> str: + import datetime + import os + + timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + return os.path.join(comparison_dir, 'runs', timestamp + '.json') + + +def get_batch_data_dir(comparison_dir: str, batch_name: str) -> str: + import os + + return os.path.join(comparison_dir, 'data', batch_name) + + +def get_command_data_dir( + *, + batch_data_dir: str | None = None, + comparison_dir: str | None = None, + batch_name: str | None = None, + command_name: str, +) -> str: + import os + + if batch_data_dir is None: + if comparison_dir is None or batch_name is None: + raise Exception('specify more arguments') + batch_data_dir = get_batch_data_dir( + comparison_dir=comparison_dir, batch_name=batch_name + ) + + return os.path.join(batch_data_dir, command_name) + + +def get_command_collected_datatypes( + *, + batch_data_dir: str | None = None, + comparison_dir: str | None = None, + batch_name: str | None = None, + command_name: str, +) -> list[str]: + import os + + data_dir = get_command_data_dir( + batch_data_dir=batch_data_dir, + comparison_dir=comparison_dir, + batch_name=batch_name, + command_name=command_name, + ) + return [ + item + for item in os.listdir(data_dir) + if item != '.cryo' + and (len(os.listdir(os.path.join(data_dir, item))) > 0) + ] + + +def get_command_data_glob( + *, + batch_data_dir: str | None = None, + comparison_dir: str | None = None, + batch_name: str | None = None, + command_name: str, + datatype: str, +) -> str: + import os + + command_dir = get_command_data_dir( + batch_data_dir=batch_data_dir, + comparison_dir=comparison_dir, + batch_name=batch_name, + command_name=command_name, + ) + return os.path.join(command_dir, datatype, '*.parquet') + + +def get_scripts_dir(comparison_dir: str) -> str: + import os + + return os.path.join(comparison_dir, 'scripts') + + +def get_scripts_path( + comparison_dir: str, batch_name: str, batch_commands: dict[str, str] +) -> str: + import os + + interface = commands_module.get_commands_interface(batch_commands) + if interface == 'cli': + extension = '.sh' + elif interface == 'python': + extension = '.py' + else: + raise Exception() + + filename = 'collect_' + batch_name + extension + + return os.path.join(get_scripts_dir(comparison_dir), filename) diff --git a/crates/python/python/cryo_test/cryo_test/polars_utils.py b/crates/python/python/cryo_test/cryo_test/polars_utils.py new file mode 100644 index 0000000..862a805 --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/polars_utils.py @@ -0,0 +1,171 @@ +from __future__ import annotations + +import typing + +if typing.TYPE_CHECKING: + from typing import Mapping, Sequence + import polars as pl + + DataRef = typing.Union[str, list[str], pl.DataFrame, pl.LazyFrame] + + +def find_df_differences( + dfs: Sequence[DataRef] | Mapping[str, DataRef], +) -> list[str]: + """input is list or dict of 1. glob, 2. DataFrame, or 3. LazyFrame""" + differences = find_schema_differences(dfs) + if len(differences) > 0: + differences.append('(omitting row check because schemas not equal)') + else: + differences += find_row_differences(dfs) + return differences + + +def _dfs_to_map( + dfs: Sequence[DataRef] | Mapping[str, DataRef], +) -> Mapping[str, pl.DataFrame]: + if isinstance(dfs, dict): + return {key: _resolve(value) for key, value in dfs.items()} + elif isinstance(dfs, list): + if len(dfs) == 2: + return {'lhs': _resolve(dfs[0]), 'rhs': _resolve(dfs[1])} + elif len(dfs) > 2: + return {'input_' + str(i): _resolve(df) for i, df in enumerate(dfs)} + else: + return {'only': _resolve(df) for df in dfs} + else: + raise Exception() + + +def _resolve(ref: DataRef) -> pl.DataFrame: + import polars as pl + + if isinstance(ref, str): + return pl.read_parquet(ref) + elif isinstance(ref, list) and all(isinstance(item, str) for item in ref): + return pl.read_parquet(ref) + elif isinstance(ref, pl.DataFrame): + return ref + elif isinstance(ref, pl.LazyFrame): + return ref.collect() + else: + raise Exception('cannot resolve DataFrame from type') + + +def find_schema_differences( + dfs: Sequence[DataRef] | Mapping[str, DataRef], +) -> list[str]: + # package inputs + data = _dfs_to_map(dfs) + if len(data) <= 1: + return [] + data_list = list(data.items()) + + # compare all pairs + differences = [] + name, df = data_list[0] + for other_name, other_df in data_list[1:]: + # check missing columns + missing_columns = [] + for column in other_df.schema: + if column not in df.schema: + missing_columns.append(column) + if len(missing_columns) > 0: + difference = ( + other_name + + ' has extra columns compared to ' + + name + + ': ' + + ', '.join(missing_columns) + ) + differences.append(difference) + continue + + # check extra columns + extra_columns = [] + for column in df.schema: + if column not in other_df.schema: + extra_columns.append(column) + if len(extra_columns) > 0: + difference = ( + name + + ' has extra columns compared to ' + + other_name + + ': ' + + ', '.join(extra_columns) + ) + differences.append(difference) + continue + + # check column types + different_types = {} + for column in df.schema.keys(): + if df.schema[column] != other_df.schema[column]: + different_types[column] = { + name: df.schema[column], + other_name: other_df.schema[column], + } + if len(different_types) > 0: + difference = ( + name + + ' and ' + + other_name + + ' have different column types: ' + + str(different_types) + ) + differences.append(difference) + continue + + # check column order + if list(df.schema.keys()) != list(other_df.schema.keys()): + difference = ( + 'columns of ' + + name + + ' and ' + + other_name + + ' are in different order' + ) + differences.append(difference) + continue + + return differences + + +def find_row_differences( + dfs: Sequence[DataRef] | Mapping[str, DataRef], +) -> list[str]: + import polars.testing + + # package inputs + data = _dfs_to_map(dfs) + if len(data) <= 1: + return [] + data_list = list(data.items()) + + # compare all pairs + differences = [] + name, df = data_list[0] + for other_name, other_df in data_list[1:]: + # row count + if len(df) != len(other_df): + difference = ( + name + ' and ' + other_name + ' have different number of rows' + ) + continue + + # row values + try: + polars.testing.assert_frame_equal(df, other_df) + except AssertionError as e: + difference = ( + 'rows of ' + + name + + ' and ' + + other_name + + ' do not match because ' + + e.args[0] + ) + differences.append(difference) + continue + + return differences diff --git a/crates/python/python/cryo_test/cryo_test/scripts.py b/crates/python/python/cryo_test/cryo_test/scripts.py new file mode 100644 index 0000000..ba2aacd --- /dev/null +++ b/crates/python/python/cryo_test/cryo_test/scripts.py @@ -0,0 +1,43 @@ +from __future__ import annotations + +from . import commands as commands_module + + +def generate_collect_script( + commands: dict[str, str], script_path: str | None = None +) -> str: + interface = commands_module.get_commands_interface(commands) + if interface == 'cli': + script = '#!/usr/bin/env bash\n\n' + for name, command in commands.items(): + script += '\n\n# ' + name + '\n' + script += 'echo "collecting ' + name + '"\n' + script += 'echo ""\n' + script += command.replace(' -', ' \\\n -') + '\n' + script += 'echo ""\n' + script += 'echo ""\n' + elif interface == 'python': + script = '#!/usr/bin/env python3\n' + for name, command in commands.items(): + script += '\n\n# ' + name + '\n' + script += "print('collecting ' + name)" + script += command + else: + raise Exception('invalid interface') + + # write to file + if script_path is not None: + _write_script(script, script_path) + + return script + + +def _write_script(script: str, path: str) -> None: + import os + import stat + + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, 'w') as f: + f.write(script) + st = os.stat(path) + os.chmod(path, st.st_mode | stat.S_IXUSR) diff --git a/crates/python/python/cryo_test/examples/ethers_vs_alloy/build_cryo b/crates/python/python/cryo_test/examples/ethers_vs_alloy/build_cryo new file mode 100755 index 0000000..db115c2 --- /dev/null +++ b/crates/python/python/cryo_test/examples/ethers_vs_alloy/build_cryo @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +set -e + +# get directory of script +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# make directories +mkdir -p "$ROOT_DIR/bin" +mkdir -p "$ROOT_DIR/build/alloy" +mkdir -p "$ROOT_DIR/build/ethers" + +# parse inputs +BUILD_ALLOY=false +BUILD_ETHERS=false +ANY_FLAG_SET=false +while getopts "ae-:" opt; do + case $opt in + a) BUILD_ALLOY=true; ANY_FLAG_SET=true ;; + e) BUILD_ETHERS=true; ANY_FLAG_SET=true ;; + -) + case "${OPTARG}" in + alloy) BUILD_ALLOY=true; ANY_FLAG_SET=true ;; + ethers) BUILD_ETHERS=true; ANY_FLAG_SET=true ;; + *) echo "Invalid option: --${OPTARG}" >&2 + echo "Usage: $0 [-a|--alloy] [-e|--ethers]" >&2 + exit 1 ;; + esac ;; + *) echo "Usage: $0 [-a|--alloy] [-e|--ethers]" >&2 + exit 1 ;; + esac +done +if [ "$ANY_FLAG_SET" = false ]; then + BUILD_ALLOY=true + BUILD_ETHERS=true +fi +echo "BUILD_ALLOY: $BUILD_ALLOY" +echo "BUILD_ETHERS: $BUILD_ETHERS" + +# build alloy +if [ "$BUILD_ALLOY" = true ]; then + echo "building cryo alloy" + + # go to repo + cd ~/repos/cryo + + # check out build + git checkout main + + # build cryo + cargo install \ + --path crates/cli \ + --root "$ROOT_DIR/build/alloy" + + # link to built binary + rm -f "$ROOT_DIR/bin/cryo_alloy" + ln -s "$ROOT_DIR/build/alloy/bin/cryo" "$ROOT_DIR/bin/cryo_alloy" + echo "" + echo "built cryo alloy at: $ROOT_DIR/bin/cryo_alloy" +fi + +if [ "$BUILD_ETHERS" = true ]; then + echo "building cryo ethers" + + # go to repo + cd ~/repos/cryo + + # check out build + git checkout eba6192298e40add4d35d1587511d875f6d770e4 + + # build cryo + cargo install \ + --path crates/cli \ + --root "$ROOT_DIR/build/ethers" + + # link to built binary + rm -f "$ROOT_DIR/bin/cryo_ethers" + ln -s "$ROOT_DIR/build/ethers/bin/cryo" "$ROOT_DIR/bin/cryo_ethers" + echo "" + echo "built cryo ethers at: $ROOT_DIR/bin/cryo_ethers" +fi diff --git a/crates/python/python/cryo_test/examples/ethers_vs_alloy/compare_alloy_to_ethers b/crates/python/python/cryo_test/examples/ethers_vs_alloy/compare_alloy_to_ethers new file mode 100755 index 0000000..1fafd53 --- /dev/null +++ b/crates/python/python/cryo_test/examples/ethers_vs_alloy/compare_alloy_to_ethers @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +python3 -m cryo_test \ + --debug \ + --executable \ + cryo_alloy="$ROOT_DIR/bin/cryo_alloy" \ + cryo_ethers="$ROOT_DIR/bin/cryo_ethers" \ + "$@" diff --git a/crates/python/python/cryo_test/pyproject.toml b/crates/python/python/cryo_test/pyproject.toml new file mode 100644 index 0000000..c4d2e48 --- /dev/null +++ b/crates/python/python/cryo_test/pyproject.toml @@ -0,0 +1,70 @@ +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "cryo_test" +readme = "README.md" +requires-python = ">=3.7" +dynamic = ["version", "description"] +license = {text = "MIT OR Apache-2.0"} +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Financial and Insurance Industry", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Typing :: Typed", +] +dependencies = [ + "polars >= 1.0", + "rich >= 13.3.3", + "rich-argparse >= 1.5.2", +] + +[project.urls] +Documentation = "https://github.com/paradigmxyz/cryo_test" +Source = "https://github.com/paradigmxyz/cryo_test" + +[tool.flit.module] +name = "cryo_test" + +[project.optional-dependencies] +test = [ + "typing-extensions >=4.9.0", +] + +[project.dev-dependencies] +pytest = "^7.0.0" +pytest-asyncio = "^0.18.3" # Add this line for pytest-asyncio + +[tool.mypy] +python_version = "3.9" +strict = true +implicit_reexport = true +files = ["cryo_test"] + +[tool.pytest.ini_options] +testpaths = [ + "tests", +] + +[project.scripts] +cryo_test = "cryo_test.cli:run_cli" + +[tool.ruff] +line-length = 80 + +[tool.ruff.format] +quote-style = "single" diff --git a/crates/python/rust/collect_adapter.rs b/crates/python/rust/collect_adapter.rs index 0f8e467..d17fa26 100644 --- a/crates/python/rust/collect_adapter.rs +++ b/crates/python/rust/collect_adapter.rs @@ -31,6 +31,7 @@ use cryo_freeze::collect; chunk_order = None, max_retries = 10, initial_backoff = 500, + compute_units_per_second = 50, dry = false, chunk_size = 1000, n_chunks = None, @@ -92,6 +93,7 @@ pub fn _collect( chunk_order: Option, max_retries: u32, initial_backoff: u64, + compute_units_per_second: u64, dry: bool, chunk_size: u64, n_chunks: Option, @@ -157,6 +159,7 @@ pub fn _collect( chunk_order, max_retries, initial_backoff, + compute_units_per_second, dry, chunk_size, n_chunks, diff --git a/crates/python/rust/freeze_adapter.rs b/crates/python/rust/freeze_adapter.rs index 5b7616e..f40317a 100644 --- a/crates/python/rust/freeze_adapter.rs +++ b/crates/python/rust/freeze_adapter.rs @@ -28,6 +28,7 @@ use cryo_cli::{run, Args}; chunk_order = None, max_retries = 10, initial_backoff = 500, + compute_units_per_second = 50, dry = false, chunk_size = 1000, n_chunks = None, @@ -89,6 +90,7 @@ pub fn _freeze( chunk_order: Option, max_retries: u32, initial_backoff: u64, + compute_units_per_second: u64, dry: bool, chunk_size: u64, n_chunks: Option, @@ -149,6 +151,7 @@ pub fn _freeze( chunk_order, max_retries, initial_backoff, + compute_units_per_second, dry, chunk_size, n_chunks, diff --git a/crates/python/rust/lib.rs b/crates/python/rust/lib.rs index 1fe06a2..6eea1dc 100644 --- a/crates/python/rust/lib.rs +++ b/crates/python/rust/lib.rs @@ -17,5 +17,6 @@ fn cryo_rust(_py: Python, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; m.add_function(wrap_pyfunction!(freeze_adapter::_freeze, m)?)?; m.add_function(wrap_pyfunction!(collect_adapter::_collect, m)?)?; + m.add("__version__", env!("CARGO_PKG_VERSION"))?; Ok(()) } diff --git a/crates/to_df/Cargo.toml b/crates/to_df/Cargo.toml index 19058dc..b28efdc 100644 --- a/crates/to_df/Cargo.toml +++ b/crates/to_df/Cargo.toml @@ -4,7 +4,6 @@ description = "cryo_to_df is a procedural macro used for defining datasets" version.workspace = true edition.workspace = true license.workspace = true -homepage.workspace = true repository.workspace = true [lib] diff --git a/crates/to_df/src/lib.rs b/crates/to_df/src/lib.rs index 97f10c2..6ab9332 100644 --- a/crates/to_df/src/lib.rs +++ b/crates/to_df/src/lib.rs @@ -98,47 +98,47 @@ pub fn to_df(attrs: TokenStream, input: TokenStream) -> TokenStream { } } - use ethers_core::abi::ParamType; - // Write columns even if there are no values decoded - indicates empty dataframe let chunk_len = self.n_rows; if self.event_cols.is_empty() { for param in decoder.event.inputs.iter() { let name = "event__".to_string() + param.name.as_str(); let name = name.as_str(); - match param.kind { - ParamType::Address => { + let ty = DynSolType::parse(¶m.ty).unwrap(); + match ty { + DynSolType::Address => { match schema.binary_type { ColumnEncoding::Binary => cols.push(Series::new(name, Vec::>::new())), ColumnEncoding::Hex => cols.push(Series::new(name, Vec::::new())), } }, - ParamType::Bytes => { + DynSolType::Bytes => { match schema.binary_type { ColumnEncoding::Binary => cols.push(Series::new(name, Vec::>::new())), ColumnEncoding::Hex => cols.push(Series::new(name, Vec::::new())), } }, - ParamType::Int(bits) => { + DynSolType::Int(bits) => { if bits <= 64 { cols.push(Series::new(name, Vec::::new())) } else { create_empty_u256_columns(&mut cols, name, &u256_types, &schema.binary_type) } }, - ParamType::Uint(bits) => { + DynSolType::Uint(bits) => { if bits <= 64 { cols.push(Series::new(name, Vec::::new())) } else { create_empty_u256_columns(&mut cols, name, &u256_types, &schema.binary_type) } }, - ParamType::Bool => cols.push(Series::new(name, Vec::::new())), - ParamType::String => cols.push(Series::new(name, Vec::::new())), - ParamType::Array(_) => return Err(err("could not generate Array column")), - ParamType::FixedBytes(_) => return Err(err("could not generate FixedBytes column")), - ParamType::FixedArray(_, _) => return Err(err("could not generate FixedArray column")), - ParamType::Tuple(_) => return Err(err("could not generate Tuple column")), + DynSolType::Bool => cols.push(Series::new(name, Vec::::new())), + DynSolType::String => cols.push(Series::new(name, Vec::::new())), + DynSolType::Array(_) => return Err(err("could not generate Array column")), + DynSolType::FixedBytes(_) => return Err(err("could not generate FixedBytes column")), + DynSolType::FixedArray(_, _) => return Err(err("could not generate FixedArray column")), + DynSolType::Tuple(_) => return Err(err("could not generate Tuple column")), + DynSolType::Function => return Err(err("could not generate Function column")), _ => (), } } diff --git a/examples/all.sh b/examples/all.sh new file mode 100755 index 0000000..cee7b7e --- /dev/null +++ b/examples/all.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# This is an example of collecting most of the cryo datasets + +# +# # parameters +# + +# use installed cryo installation +EXECUTABLE=cryo + +# use local cargo repo +# EXECUTABLE="cargo run --" + +# use some other cargo repo +# EXECUTABLE="cargo run --manifest-path MANIFEST_PATH --" + +BLOCKS="18M:+100" # collect blocks 18,000,000 to 18,000,100 +OUTPUT_DIR="data" # output directory + + +# +# # datasets +# + +$EXECUTABLE address_appearances -b $BLOCKS -o $OUTPUT_DIR/address_appearances + +$EXECUTABLE balance_diffs -b $BLOCKS -o $OUTPUT_DIR/balance_diffs + +$EXECUTABLE balances -b $BLOCKS -o $OUTPUT_DIR/balances --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE blocks -b $BLOCKS -o $OUTPUT_DIR/blocks + +$EXECUTABLE code_diffs -b $BLOCKS -o $OUTPUT_DIR/code_diffs + +$EXECUTABLE codes -b $BLOCKS -o $OUTPUT_DIR/codes --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE contracts -b $BLOCKS -o $OUTPUT_DIR/contracts + +$EXECUTABLE erc20_balances -b $BLOCKS -o $OUTPUT_DIR/erc20_balances --contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE erc20_metadata -b $BLOCKS -o $OUTPUT_DIR/erc20_metadata --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE erc20_supplies -b $BLOCKS -o $OUTPUT_DIR/erc20_supplies --contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE erc20_transfers -b $BLOCKS -o $OUTPUT_DIR/erc20_transfers + +$EXECUTABLE erc721_metadata -b $BLOCKS -o $OUTPUT_DIR/erc721_metadata --contract 0xed5af388653567af2f388e6224dc7c4b3241c544 & + +$EXECUTABLE erc721_transfers -b $BLOCKS -o $OUTPUT_DIR/erc721_transfers --contract 0xed5af388653567af2f388e6224dc7c4b3241c544 & + +$EXECUTABLE eth_calls -b $BLOCKS -o $OUTPUT_DIR/eth_calls --call-data 0x18160ddd --contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE logs -b $BLOCKS -o $OUTPUT_DIR/logs + +$EXECUTABLE native_transfers -b $BLOCKS -o $OUTPUT_DIR/native_transfers + +$EXECUTABLE nonce_diffs -b $BLOCKS -o $OUTPUT_DIR/nonce_diffs + +$EXECUTABLE nonces -b $BLOCKS -o $OUTPUT_DIR/nonces --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE state_diffs -b $BLOCKS -o $OUTPUT_DIR/state_diffs + +$EXECUTABLE storage_diffs -b $BLOCKS -o $OUTPUT_DIR/storage_diffs + +$EXECUTABLE storages -b $BLOCKS -o $OUTPUT_DIR/storages --address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --slot 0x0000000000000000000000000000000000000000000000000000000000000000 & + +$EXECUTABLE trace_calls -b $BLOCKS -o $OUTPUT_DIR/trace_calls --call-data 0x18160ddd --contract 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 & + +$EXECUTABLE traces -b $BLOCKS -o $OUTPUT_DIR/traces + +$EXECUTABLE transactions -b $BLOCKS -o $OUTPUT_DIR/transactions + +$EXECUTABLE blocks transactions -b $BLOCKS -o $OUTPUT_DIR/blocks_transactions + +$EXECUTABLE state_diffs -b $BLOCKS -o $OUTPUT_DIR/state_diffs diff --git a/examples/erc20_balances.sh b/examples/erc20_balances.sh new file mode 100755 index 0000000..70c426e --- /dev/null +++ b/examples/erc20_balances.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# get ERC20 balances of addresses over some block range + +# ERC20 = USDC, USDT +export ERC20="0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 0xdac17f958d2ee523a2206206994597c13d831ec7" + +# WALLET = Maker PSM, Arbitrum Bridge +export WALLETS="0x0a59649758aa4d66e25f08dd01271e891fe52199 0xcee284f754e854890e311e3280b767f80797180d" + +# block range = 10 blocks between 16,000,000 and 17,000,000 +export BLOCKS="16M:17M/10" + +# collect data +cryo erc20_balances --blocks $BLOCKS --contract $ERC20 --address $WALLETS \ No newline at end of file diff --git a/examples/uniswap.sh b/examples/uniswap.sh old mode 100644 new mode 100755 index 76af15c..275f4d5 --- a/examples/uniswap.sh +++ b/examples/uniswap.sh @@ -1,9 +1,12 @@ +#!/usr/bin/env bash + # This script extracts all pools and swaps for Uniswap v2 / v3 # This script is # - idempotent: run the script as many times as you want, the data will be fine -# - interuptable: you can interrupt the script whenever you want, the data will be fine -# - incremental: only missing data is collected. re-runing the script does not re-collect data +# - interruptible: you can interrupt the script whenever you want, the data will be fine +# - incremental: only missing data is collected. re-running the script does not re-collect data + # uniswap v2 pools cryo logs \