From ea2478c11bba1c6e3fd701cd6372f53111c0c608 Mon Sep 17 00:00:00 2001 From: Yurii Koba Date: Fri, 15 Mar 2024 14:55:46 +0200 Subject: [PATCH] chore: release v0.2.0 (#195) * Support nearcore 1.37 (#194) * Support nearcore 1.37 * fmt * runtime config * protocol config * delete unused deps * requests methods * rpc methods 1.37 * add near rpc client with supports nearcore 1.37 * rebase from main * rebase from main * rebase from main * Enhance state-indexer compatibility with NEAR Lake and NEAR Indexer Framework (#196) * add near-state-indexer * solve compilation problem * improvements * add readme * Implement support for optimistic block finality (#197) * add optimistic handler * handle optimistic block * update nearcore * optimistiv block handle * add redis client clone * reffactoring * run with optimistic improvement * naming improvement * update changelog * Create GitHub Action to build a binary for `near-state-indexer` (#201) * Improvements for near-state-indexer and rpc-server (#202) * 1. Improvement builds for near-state-indexer and rpc-server 2. Umprovement metrics for near-state-indexer * update nearcore to 1.38.0-rc.2 (#203) * chore: release v0.2.0-rc.1 * set feature near_state_indexer_disabled as a default (#204) --- .cargo/config.toml | 2 + .github/workflows/release.yml | 50 + CHANGELOG.md | 10 +- Cargo.lock | 4058 +++++++++++++---- Cargo.toml | 32 +- README.md | 4 + config.toml | 5 + configuration/Cargo.toml | 8 +- configuration/README.md | 1 + configuration/example.config.toml | 16 + configuration/src/configs/general.rs | 70 +- configuration/src/configs/lake.rs | 43 +- configuration/src/configs/mod.rs | 41 +- configuration/src/lib.rs | 3 +- database/Cargo.toml | 27 +- database/src/base/rpc_server.rs | 6 - database/src/base/state_indexer.rs | 134 +- .../down.sql | 10 + .../up.sql | 1 + database/src/postgres/models.rs | 55 +- database/src/postgres/rpc_server.rs | 51 +- database/src/postgres/schema.rs | 11 - database/src/postgres/state_indexer.rs | 33 +- database/src/postgres/tx_indexer.rs | 49 +- database/src/scylladb/mod.rs | 7 +- database/src/scylladb/rpc_server.rs | 37 +- database/src/scylladb/state_indexer.rs | 64 +- database/src/scylladb/tx_indexer.rs | 35 +- docs/RPC_METHODS.md | 61 +- epoch-indexer/Cargo.toml | 19 +- epoch-indexer/src/config.rs | 8 - epoch-indexer/src/lib.rs | 77 +- near-state-indexer/Cargo.toml | 49 + near-state-indexer/README.md | 54 + near-state-indexer/build.rs | 20 + near-state-indexer/src/configs.rs | 80 + near-state-indexer/src/main.rs | 324 ++ near-state-indexer/src/metrics.rs | 89 + near-state-indexer/src/utils.rs | 107 + perf-testing/Cargo.toml | 10 +- perf-testing/src/main.rs | 2 +- perf-testing/src/transactions.rs | 4 +- readnode-primitives/Cargo.toml | 7 +- readnode-primitives/src/lib.rs | 18 +- rpc-server/Cargo.toml | 51 +- rpc-server/Dockerfile | 6 +- rpc-server/build.rs | 20 + rpc-server/src/config.rs | 26 +- rpc-server/src/errors.rs | 8 +- rpc-server/src/health.rs | 5 +- rpc-server/src/main.rs | 83 +- rpc-server/src/modules/blocks/methods.rs | 173 +- rpc-server/src/modules/blocks/mod.rs | 290 +- rpc-server/src/modules/blocks/utils.rs | 40 +- rpc-server/src/modules/network/methods.rs | 116 +- rpc-server/src/modules/network/mod.rs | 40 - rpc-server/src/modules/queries/methods.rs | 473 +- rpc-server/src/modules/queries/mod.rs | 204 +- rpc-server/src/modules/queries/utils.rs | 135 +- .../src/modules/transactions/methods.rs | 50 +- rpc-server/src/modules/transactions/mod.rs | 18 +- rpc-server/src/utils.rs | 177 +- rust-toolchain | 2 +- state-indexer/Cargo.toml | 23 +- state-indexer/Dockerfile | 4 +- state-indexer/src/configs.rs | 8 - state-indexer/src/main.rs | 132 +- tx-indexer/Cargo.toml | 20 +- tx-indexer/Dockerfile | 4 +- tx-indexer/src/config.rs | 8 - 70 files changed, 5906 insertions(+), 2002 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 .github/workflows/release.yml create mode 100644 database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/down.sql create mode 100644 database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/up.sql create mode 100644 near-state-indexer/Cargo.toml create mode 100644 near-state-indexer/README.md create mode 100644 near-state-indexer/build.rs create mode 100644 near-state-indexer/src/configs.rs create mode 100644 near-state-indexer/src/main.rs create mode 100644 near-state-indexer/src/metrics.rs create mode 100644 near-state-indexer/src/utils.rs create mode 100644 rpc-server/build.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..794c4046 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +NEARCORE_VERSION = "1.38.0-rc.2" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..1bb9e5fe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release NearStateIndexer Workflow + +on: + release: + types: [created, published] + +jobs: + build-and-release: + permissions: + contents: write + runs-on: ubuntu-22.04 + if: > + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || + (github.event_name == 'release' && github.event.action == 'created') + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Rust toolchain + run: | + rustup update stable + rustup default stable + + - name: Build release binary + run: | + cargo build --release --package near-state-indexer --verbose + strip target/release/near-state-indexer + cp target/release/near-state-indexer near-state-indexer + + - name: Determine UPLOAD_URL + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + TAG_NAME=${GITHUB_REF#refs/tags/} + RELEASE_RESPONSE=$(curl -s -X GET -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME") + UPLOAD_URL=$(echo "$RELEASE_RESPONSE" | jq -r .upload_url) + echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV + else + echo "UPLOAD_URL=${{ github.event.release.upload_url }}" >> $GITHUB_ENV + fi + + - name: Upload release asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.UPLOAD_URL }} + asset_path: ./near-state-indexer/near-state-indexer + asset_name: near-state-indexer + asset_content_type: application/octet-stream + diff --git a/CHANGELOG.md b/CHANGELOG.md index 640b8b17..34dcf0fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/near/read-rpc/compare/v0.1.0...HEAD) +## [Unreleased](https://github.com/near/read-rpc/compare/0.2.0-rc.1...HEAD) + +## [0.2.0-rc.1](https://github.com/near/read-rpc/releases/tag/0.2.0-rc.1) + +### Supported Nearcore Version +- nearcore v.38.0-rc.2 +- rust v1.76.0 ### Added - Added support for `SyncCheckpoint` in the `block` method for better block handling and synchronization. +- Added support for `OptimisticBlock` in the `block` method for better block handling and synchronization. - Added `ARCHIVAL_PROXY_QUERY_VIEW_STATE_WITH_INCLUDE_PROOFS` metric to track the number of archival proxy requests for view state with include proofs. - Added `TOTAL_REQUESTS_COUNTER` metric to counting total rpc requests. - Added `GET /health` for the healthcheck of rpc-server. - Implemented the `status` method to accommodate `near_primitives::views::StatusResponse`. - Implemented the `health` method. Health includes the info about the syncing state of the node of `rpc-server`. +- Implemented near-state-indexer to index the state of the nearcore node. ### Changed - Enhanced the tx method to show in-progress transaction status, avoiding `UNKNOWN_TRANSACTION` responses and providing more accurate feedback. diff --git a/Cargo.lock b/Cargo.lock index a29ab5d1..c0578bea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,6 +12,31 @@ dependencies = [ "regex", ] +[[package]] +name = "actix" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb72882332b6d6282f428b77ba0358cb2687e61a6f6df6a6d3871e8a177c2d4f" +dependencies = [ + "actix-macros", + "actix-rt", + "actix_derive", + "bitflags 2.4.2", + "bytes", + "crossbeam-channel", + "futures-core", + "futures-sink", + "futures-task", + "futures-util", + "log", + "once_cell", + "parking_lot 0.12.1", + "pin-project-lite", + "smallvec", + "tokio", + "tokio-util 0.7.10", +] + [[package]] name = "actix-codec" version = "0.5.2" @@ -25,7 +50,7 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", - "tokio-util", + "tokio-util 0.7.10", "tracing", ] @@ -44,6 +69,21 @@ dependencies = [ "smallvec", ] +[[package]] +name = "actix-cors" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9e772b3bcafe335042b5db010ab7c09013dad6eac4915c91d8d50902769f331" +dependencies = [ + "actix-utils", + "actix-web", + "derive_more", + "futures-util", + "log", + "once_cell", + "smallvec", +] + [[package]] name = "actix-http" version = "3.6.0" @@ -54,8 +94,8 @@ dependencies = [ "actix-rt", "actix-service", "actix-utils", - "ahash 0.8.7", - "base64", + "ahash 0.8.11", + "base64 0.21.7", "bitflags 2.4.2", "brotli", "bytes", @@ -65,7 +105,7 @@ dependencies = [ "flate2", "futures-core", "h2", - "http 0.2.11", + "http 0.2.12", "httparse", "httpdate", "itoa", @@ -78,7 +118,7 @@ dependencies = [ "sha1", "smallvec", "tokio", - "tokio-util", + "tokio-util 0.7.10", "tracing", "zstd", ] @@ -90,7 +130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -100,7 +140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", - "http 0.2.11", + "http 0.2.12", "regex", "serde", "tracing", @@ -112,6 +152,7 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ + "actix-macros", "futures-core", "tokio", ] @@ -128,7 +169,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tracing", ] @@ -144,6 +185,27 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "actix-tls" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cce60a2f2b477bc72e5cde0af1812a6e82d8fd85b5570a5dcf2a5bf2c5be5f" +dependencies = [ + "actix-rt", + "actix-service", + "actix-utils", + "futures-core", + "http 0.2.12", + "http 1.1.0", + "impl-more", + "openssl", + "pin-project-lite", + "tokio", + "tokio-openssl", + "tokio-util 0.7.10", + "tracing", +] + [[package]] name = "actix-utils" version = "3.0.1" @@ -169,7 +231,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash 0.8.7", + "ahash 0.8.11", "bytes", "bytestring", "cfg-if 1.0.0", @@ -189,7 +251,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.5", + "socket2 0.5.6", "time", "url", ] @@ -203,16 +265,18 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] -name = "addr2line" -version = "0.19.0" +name = "actix_derive" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" dependencies = [ - "gimli 0.27.3", + "proc-macro2", + "quote", + "syn 2.0.52", ] [[package]] @@ -221,7 +285,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli 0.28.1", + "gimli", ] [[package]] @@ -232,9 +296,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom 0.2.12", "once_cell", @@ -243,9 +307,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if 1.0.0", "getrandom 0.2.12", @@ -301,9 +365,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -315,9 +379,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -349,9 +413,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "arbitrary" @@ -364,9 +428,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +checksum = "7b3d0060af21e8d11a926981cc00c6c1541aa91dd64b9f881985c3da1094425f" [[package]] name = "arrayref" @@ -390,6 +454,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + [[package]] name = "async-channel" version = "1.9.0" @@ -401,6 +471,17 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -420,7 +501,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -431,18 +512,23 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] -name = "atty" -version = "0.2.14" +name = "attohttpc" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "262c3f7f5d61249d8c00e5546e2685cd15ebeeb1bc0f3cc5449350a1cb07319e" dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", + "http 0.2.12", + "log", + "native-tls", + "openssl", + "serde", + "serde_json", + "url", + "wildmatch", ] [[package]] @@ -451,11 +537,45 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "awc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68c09cc97310b926f01621faee652f3d1b0962545a3cec6c9ac07def9ea36c2c" +dependencies = [ + "actix-codec", + "actix-http", + "actix-rt", + "actix-service", + "actix-tls", + "actix-utils", + "base64 0.21.7", + "bytes", + "cfg-if 1.0.0", + "cookie", + "derive_more", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "itoa", + "log", + "mime", + "openssl", + "percent-encoding", + "pin-project-lite", + "rand 0.8.5", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", +] + [[package]] name = "aws-config" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b30c39ebe61f75d1b3785362b1586b41991873c9ab3e317a9181c246fb71d82" +checksum = "4f4084d18094aec9f79d509f4cb6ccf6b613c5037e32f32e74312e52b836e366" dependencies = [ "aws-credential-types", "aws-runtime", @@ -472,9 +592,9 @@ dependencies = [ "bytes", "fastrand 2.0.1", "hex", - "http 0.2.11", + "http 0.2.12", "hyper", - "ring", + "ring 0.17.8", "time", "tokio", "tracing", @@ -483,9 +603,9 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33cc49dcdd31c8b6e79850a179af4c367669150c7ac0135f176c61bec81a70f7" +checksum = "fa8587ae17c8e967e4b05a62d495be2fb7701bec52a97f7acfe8a29f938384c8" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -494,19 +614,35 @@ dependencies = [ ] [[package]] -name = "aws-http" -version = "0.60.5" +name = "aws-creds" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13ccfc04c9add2ee02a300cdc240d7c3e4477f100fb2380dc15fd75ca86d31da" +checksum = "5aeeee1a5defa63cba39097a510dfe63ef53658fc8995202a610f6a8a4d03639" dependencies = [ - "aws-runtime", + "attohttpc", + "dirs", + "rust-ini", + "serde", + "serde-xml-rs", + "thiserror", + "time", + "url", +] + +[[package]] +name = "aws-region" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42fed2b9fca70f2908268d057a607f2a906f47edbf856ea8587de9038d264e22" +dependencies = [ + "thiserror", ] [[package]] name = "aws-runtime" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb031bff99877c26c28895766f7bb8484a05e24547e370768d6cc9db514662aa" +checksum = "b13dc54b4b49f8288532334bba8f87386a40571c47c37b1304979b556dc613c8" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -518,7 +654,7 @@ dependencies = [ "aws-types", "bytes", "fastrand 2.0.1", - "http 0.2.11", + "http 0.2.12", "http-body", "percent-encoding", "pin-project-lite", @@ -528,12 +664,12 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "0.39.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29223b1074621f1d011bac836d995c002936663052b1e7ad02927551b17d6625" +checksum = "be7167516f69aff3acca64e47c993336105e62f008067d2695324dfa5cbfdba6" dependencies = [ + "ahash 0.8.11", "aws-credential-types", - "aws-http", "aws-runtime", "aws-sigv4", "aws-smithy-async", @@ -547,20 +683,25 @@ dependencies = [ "aws-smithy-xml", "aws-types", "bytes", - "http 0.2.11", + "fastrand 2.0.1", + "hex", + "hmac", + "http 0.2.12", "http-body", + "lru 0.12.3", "once_cell", "percent-encoding", - "regex", + "regex-lite", + "sha2", "tracing", "url", ] [[package]] name = "aws-sdk-sso" -version = "1.12.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f486420a66caad72635bc2ce0ff6581646e0d32df02aa39dc983bfe794955a5b" +checksum = "6729c96a2bc5acdbc0d6f406415678c24de30a9999f33084a34e64fc415cc365" dependencies = [ "aws-credential-types", "aws-runtime", @@ -572,7 +713,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "http 0.2.11", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -580,9 +721,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.12.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ddccf01d82fce9b4a15c8ae8608211ee7db8ed13a70b514bbfe41df3d24841" +checksum = "9ccdd38f35f089c16fe0641cda34f2d06e3ab7b99a884407bce350a9fa70b1a9" dependencies = [ "aws-credential-types", "aws-runtime", @@ -594,7 +735,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "http 0.2.11", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -602,9 +743,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.12.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a591f8c7e6a621a501b2b5d2e88e1697fcb6274264523a6ad4d5959889a41ce" +checksum = "396e8064892a3c08b25b60fe3abda7ff5afa74efee500572cae65122ba5afd0d" dependencies = [ "aws-credential-types", "aws-runtime", @@ -617,7 +758,7 @@ dependencies = [ "aws-smithy-types", "aws-smithy-xml", "aws-types", - "http 0.2.11", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -625,9 +766,9 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.1.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c371c6b0ac54d4605eb6f016624fb5c7c2925d315fdf600ac1bf21b19d5f1742" +checksum = "11d6f29688a4be9895c0ba8bef861ad0c0dac5c15e9618b9b7a6c233990fc263" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", @@ -639,13 +780,13 @@ dependencies = [ "form_urlencoded", "hex", "hmac", - "http 0.2.11", - "http 1.0.0", + "http 0.2.12", + "http 1.1.0", "once_cell", "p256", "percent-encoding", - "ring", - "sha2 0.10.8", + "ring 0.17.8", + "sha2", "subtle", "time", "tracing", @@ -654,9 +795,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ee2d09cce0ef3ae526679b522835d63e75fb427aca5413cd371e490d52dcc6" +checksum = "d26ea8fa03025b2face2b3038a63525a10891e3d8829901d502e5384a0d8cd46" dependencies = [ "futures-util", "pin-project-lite", @@ -665,9 +806,9 @@ dependencies = [ [[package]] name = "aws-smithy-checksums" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2acd1b9c6ae5859999250ed5a62423aedc5cf69045b844432de15fa2f31f2b" +checksum = "83fa43bc04a6b2441968faeab56e68da3812f978a670a5db32accbdcafddd12f" dependencies = [ "aws-smithy-http", "aws-smithy-types", @@ -675,12 +816,12 @@ dependencies = [ "crc32c", "crc32fast", "hex", - "http 0.2.11", + "http 0.2.12", "http-body", "md-5", "pin-project-lite", "sha1", - "sha2 0.10.8", + "sha2", "tracing", ] @@ -697,9 +838,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dab56aea3cd9e1101a0a999447fb346afb680ab1406cebc44b32346e25b4117d" +checksum = "3f10fa66956f01540051b0aa7ad54574640f748f9839e843442d99b970d3aff9" dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", @@ -707,7 +848,7 @@ dependencies = [ "bytes", "bytes-utils", "futures-core", - "http 0.2.11", + "http 0.2.12", "http-body", "once_cell", "percent-encoding", @@ -718,18 +859,18 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3898ca6518f9215f62678870064398f00031912390efd03f1f6ef56d83aa8e" +checksum = "4683df9469ef09468dad3473d129960119a0d3593617542b7d52086c8486f2d6" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-query" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda4b1dfc9810e35fba8a620e900522cd1bd4f9578c446e82f49d1ce41d2e9f9" +checksum = "f2fbd61ceb3fe8a1cb7352e42689cec5335833cd9f94103a61e98f9bb61c64bb" dependencies = [ "aws-smithy-types", "urlencoding", @@ -737,9 +878,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fafdab38f40ad7816e7da5dec279400dd505160780083759f01441af1bbb10ea" +checksum = "ec81002d883e5a7fd2bb063d6fb51c4999eb55d404f4fff3dd878bf4733b9f01" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -748,7 +889,7 @@ dependencies = [ "bytes", "fastrand 2.0.1", "h2", - "http 0.2.11", + "http 0.2.12", "http-body", "hyper", "hyper-rustls", @@ -762,14 +903,15 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.1.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c18276dd28852f34b3bf501f4f3719781f4999a51c7bff1a5c6dc8c4529adc29" +checksum = "9acb931e0adaf5132de878f1398d83f8677f90ba70f01f65ff87f6d7244be1c5" dependencies = [ "aws-smithy-async", "aws-smithy-types", "bytes", - "http 0.2.11", + "http 0.2.12", + "http 1.1.0", "pin-project-lite", "tokio", "tracing", @@ -778,15 +920,15 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3e134004170d3303718baa2a4eb4ca64ee0a1c0a7041dca31b38be0fb414f3" +checksum = "abe14dceea1e70101d38fbf2a99e6a34159477c0fb95e68e05c66bd7ae4c3729" dependencies = [ "base64-simd", "bytes", "bytes-utils", "futures-core", - "http 0.2.11", + "http 0.2.12", "http-body", "itoa", "num-integer", @@ -796,29 +938,29 @@ dependencies = [ "serde", "time", "tokio", - "tokio-util", + "tokio-util 0.7.10", ] [[package]] name = "aws-smithy-xml" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8604a11b25e9ecaf32f9aa56b9fe253c5e2f606a3477f0071e96d3155a5ed218" +checksum = "872c68cf019c0e4afc5de7753c4f7288ce4b71663212771bf5e4542eb9346ca9" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "789bbe008e65636fe1b6dbbb374c40c8960d1232b96af5ff4aec349f9c4accf4" +checksum = "0dbf2f3da841a8930f159163175cf6a3d16ddde517c1b0fba7aa776822800f40" dependencies = [ "aws-credential-types", "aws-smithy-async", "aws-smithy-runtime-api", "aws-smithy-types", - "http 0.2.11", + "http 0.2.12", "rustc_version 0.4.0", "tracing", ] @@ -829,12 +971,12 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line 0.21.0", + "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.32.2", + "object", "rustc-demangle", ] @@ -844,6 +986,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -868,20 +1022,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bigdecimal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1e50562e37200edf7c6c43e54a08e64a5553bfb59d9c297d5572512aa517256" -dependencies = [ - "num-bigint 0.3.3", - "num-integer", - "num-traits", -] - -[[package]] -name = "bigdecimal" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06619be423ea5bb86c95f087d5707942791a08a85530df0db2209a3ecfb8bc9" +checksum = "9324c8014cd04590682b34f1e9448d38f0674d0f7b2dc553331016ef0e4e9ebc" dependencies = [ "autocfg", "libm", @@ -899,6 +1042,27 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.65.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.52", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -911,6 +1075,15 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -951,20 +1124,21 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.9.0" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array 0.14.7", ] [[package]] -name = "block-buffer" -version = "0.10.4" +name = "block_on_proc" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "b872f3528eeeb4370ee73b51194dc1cd93680c2d0eb6c7a223889038d2c1a167" dependencies = [ - "generic-array 0.14.7", + "quote", + "syn 1.0.109", ] [[package]] @@ -979,12 +1153,12 @@ dependencies = [ [[package]] name = "borsh" -version = "0.10.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ - "borsh-derive 0.10.3", - "hashbrown 0.13.2", + "borsh-derive 1.3.1", + "cfg_aliases", ] [[package]] @@ -993,8 +1167,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" dependencies = [ - "borsh-derive-internal 0.9.3", - "borsh-schema-derive-internal 0.9.3", + "borsh-derive-internal", + "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -1002,15 +1176,16 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "0.10.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ - "borsh-derive-internal 0.10.3", - "borsh-schema-derive-internal 0.10.3", - "proc-macro-crate 0.1.5", + "once_cell", + "proc-macro-crate 3.1.0", "proc-macro2", - "syn 1.0.109", + "quote", + "syn 2.0.52", + "syn_derive", ] [[package]] @@ -1024,17 +1199,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "borsh-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "borsh-schema-derive-internal" version = "0.9.3" @@ -1046,17 +1210,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "borsh-schema-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "brotli" version = "3.4.0" @@ -1086,9 +1239,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "bytecheck" @@ -1152,6 +1305,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "c2-chacha" version = "0.3.3" @@ -1170,14 +1334,23 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" dependencies = [ "jobserver", "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -1190,11 +1363,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1202,7 +1381,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -1215,89 +1394,84 @@ dependencies = [ ] [[package]] -name = "clap" -version = "3.2.25" +name = "clang-sys" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_derive 3.2.25", - "clap_lex 0.2.4", - "indexmap 1.9.3", - "once_cell", - "strsim", - "termcolor", - "textwrap", + "glob", + "libc", + "libloading", ] [[package]] name = "clap" -version = "4.4.18" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" dependencies = [ "clap_builder", - "clap_derive 4.4.7", + "clap_derive", ] [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", - "clap_lex 0.6.0", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" -dependencies = [ - "heck 0.4.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", + "clap_lex", + "strsim 0.11.0", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.48", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", + "syn 2.0.52", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] -name = "cloudabi" -version = "0.0.3" +name = "cloud-storage" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "7602ac4363f68ac757d6b87dd5d850549a14d37489902ae639c06ecec06ad275" +dependencies = [ + "async-trait", + "base64 0.13.1", + "bytes", + "chrono", + "dotenv", + "futures-util", + "hex", + "jsonwebtoken", + "lazy_static", + "openssl", + "percent-encoding", + "reqwest", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ "bitflags 1.3.2", ] @@ -1308,6 +1482,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util 0.7.10", +] + [[package]] name = "concurrent-queue" version = "2.4.0" @@ -1328,19 +1516,32 @@ dependencies = [ "dotenv", "lazy_static", "near-lake-framework", - "opentelemetry", + "opentelemetry 0.19.0", "opentelemetry-jaeger", "regex", "serde", "serde_derive", "serde_json", - "toml 0.8.9", + "toml 0.8.11", "tracing", - "tracing-opentelemetry", + "tracing-opentelemetry 0.19.0", "tracing-stackdriver", "tracing-subscriber", ] +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode 0.3.6", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -1406,18 +1607,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "182b82f78049f54d3aee5a19870d356ef754226665a695ce2fcdd5d55379718e" +checksum = "2b5bb9245ec7dcc04d03110e538d31f0969d301c9d673145f4b4d5c3478539a3" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c027bf04ecae5b048d3554deb888061bc26f426afff47bf06d6ac933dce0a6" +checksum = "ebb18d10e5ddac43ba4ca8fd4e310938569c3e484cc01b6372b27dc5bb4dfd28" dependencies = [ "bumpalo", "cranelift-bforest", @@ -1426,81 +1627,82 @@ dependencies = [ "cranelift-control", "cranelift-entity", "cranelift-isle", - "gimli 0.27.3", - "hashbrown 0.13.2", + "gimli", + "hashbrown 0.14.3", "log", "regalloc2", "smallvec", - "target-lexicon 0.12.13", + "target-lexicon 0.12.14", ] [[package]] name = "cranelift-codegen-meta" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649f70038235e4c81dba5680d7e5ae83e1081f567232425ab98b55b03afd9904" +checksum = "7a3ce6d22982c1b9b6b012654258bab1a13947bb12703518bef06b1a4867c3d6" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a1d1c5ee2611c6a0bdc8d42d5d3dc5ce8bf53a8040561e26e88b9b21f966417" +checksum = "47220fd4f9a0ce23541652b6f16f83868d282602c600d14934b2a4c166b4bd80" [[package]] name = "cranelift-control" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da66a68b1f48da863d1d53209b8ddb1a6236411d2d72a280ffa8c2f734f7219e" +checksum = "ed5a4c42672aea9b6e820046b52e47a1c05d3394a6cdf4cb3c3c4b702f954bd2" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd897422dbb66621fa558f4d9209875530c53e3c8f4b13b2849fbb667c431a6" +checksum = "0b4e9a3296fc827f9d35135dc2c0c8dd8d8359eb1ef904bae2d55d5bcb0c9f94" dependencies = [ "serde", + "serde_derive", ] [[package]] name = "cranelift-frontend" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05db883114c98cfcd6959f72278d2fec42e01ea6a6982cfe4f20e88eebe86653" +checksum = "33ec537d0f0b8e084517f3e7bfa1d89af343d7c7df455573fca9f272d4e01267" dependencies = [ "cranelift-codegen", "log", "smallvec", - "target-lexicon 0.12.13", + "target-lexicon 0.12.14", ] [[package]] name = "cranelift-isle" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84559de86e2564152c87e299c8b2559f9107e9c6d274b24ebeb04fb0a5f4abf8" +checksum = "45bab6d69919d210a50331d35cc6ce111567bc040aebac63a8ae130d0400a075" [[package]] name = "cranelift-native" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f40b57f187f0fe1ffaf281df4adba2b4bc623a0f6651954da9f3c184be72761" +checksum = "f32e81605f352cf37af5463f11cd7deec7b6572741931a8d372f7fdd4a744f5d" dependencies = [ "cranelift-codegen", "libc", - "target-lexicon 0.12.13", + "target-lexicon 0.12.14", ] [[package]] name = "cranelift-wasm" -version = "0.96.4" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3eab6084cc789b9dd0b1316241efeb2968199fee709f4bb4fe0fb0923bb468b" +checksum = "0edaa4cbec1bc787395c074233df2652dd62f3e29d3ee60329514a0a51e6b045" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1508,33 +1710,61 @@ dependencies = [ "itertools 0.10.5", "log", "smallvec", - "wasmparser 0.103.0", + "wasmparser 0.115.0", "wasmtime-types", ] +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32c" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74" +checksum = "89254598aa9b9fa608de44b3ae54c810f0f06d755e24c50177f1f8f31ff50ce2" dependencies = [ "rustc_version 0.4.0", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -1558,6 +1788,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.19" @@ -1635,24 +1874,24 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.44" +version = "0.4.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22" +checksum = "1e2161dd6eba090ff1594084e95fd67aeccf04382ffea77999ea94ed42ec67b6" dependencies = [ "curl-sys", "libc", "openssl-probe", "openssl-sys", "schannel", - "socket2 0.4.10", - "winapi", + "socket2 0.5.6", + "windows-sys 0.52.0", ] [[package]] name = "curl-sys" -version = "0.4.71+curl-8.6.0" +version = "0.4.72+curl-8.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7b12a7ab780395666cb576203dc3ed6e01513754939a600b85196ccf5356bc5" +checksum = "29cbdc8314c447d11e8fd156dcdd031d9e02a7a976163e396b548c03153bc9ea" dependencies = [ "cc", "libc", @@ -1660,22 +1899,38 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if 1.0.0", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rand_core 0.6.4", + "rustc_version 0.4.0", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "darling" version = "0.14.4" @@ -1688,12 +1943,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.5" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ - "darling_core 0.20.5", - "darling_macro 0.20.5", + "darling_core 0.20.8", + "darling_macro 0.20.8", ] [[package]] @@ -1706,22 +1961,22 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 1.0.109", ] [[package]] name = "darling_core" -version = "0.20.5" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.48", + "strsim 0.10.0", + "syn 2.0.52", ] [[package]] @@ -1737,13 +1992,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.5" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ - "darling_core 0.20.5", + "darling_core 0.20.8", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -1765,8 +2020,8 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "bigdecimal 0.4.2", - "borsh 0.10.3", + "bigdecimal", + "borsh 1.3.1", "bytes", "configuration", "diesel", @@ -1774,15 +2029,16 @@ dependencies = [ "diesel_migrations", "futures", "hex", - "near-chain-configs", - "near-crypto", + "near-chain-configs 0.0.0", + "near-crypto 0.0.0", "near-indexer-primitives", - "near-primitives", - "num-bigint 0.3.3", + "near-primitives 0.0.0", + "num-bigint 0.4.4", "num-traits", "prettytable-rs", "readnode-primitives", "scylla", + "scylla-cql", "serde", "serde_json", "tokio", @@ -1846,23 +2102,23 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] name = "derive_builder" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "660047478bc508c0fde22c868991eec0c40a63e48d610befef466d48e2bee574" +checksum = "8f59169f400d8087f238c5c0c7db6a28af18681717f3b623227d92f397e938c7" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b217e6dd1011a54d12f3b920a411b5abd44b1716ecfe94f5f2f2f7b52e08ab7" +checksum = "a4ec317cc3e7ef0928b0ca6e4a634a4d6c001672ae210438cf114a83e56b018d" dependencies = [ "darling 0.14.4", "proc-macro2", @@ -1872,9 +2128,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5f77d7e20ac9153428f7ca14a88aba652adfc7a0ef0a06d654386310ef663b" +checksum = "870368c3fb35b8031abb378861d4460f573b92238ec2152c927a21f77e3e0127" dependencies = [ "derive_builder_core", "syn 1.0.109", @@ -1899,7 +2155,7 @@ version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62c6fcf842f17f8c78ecf7c81d75c5ce84436b41ee07e03f490fbb5f5a8731d8" dependencies = [ - "bigdecimal 0.4.2", + "bigdecimal", "bitflags 2.4.2", "byteorder", "diesel_derives", @@ -1935,7 +2191,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -1955,7 +2211,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -1982,11 +2238,20 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", "subtle", ] +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -1997,6 +2262,17 @@ dependencies = [ "dirs-sys-next", ] +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -2014,6 +2290,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" +[[package]] +name = "dlv-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + [[package]] name = "dotenv" version = "0.15.0" @@ -2088,37 +2370,45 @@ dependencies = [ "der", "elliptic-curve", "rfc6979", - "signature", + "signature 1.6.4", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ - "signature", + "signature 2.2.0", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", + "rand_core 0.6.4", + "sha2", + "subtle", ] [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "elastic-array" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "0d63720ea2bc2e1b79f7aa044d9dc0b825f9ccb6930b32120f8fb9e873aa84bc" +dependencies = [ + "heapsize", +] [[package]] name = "elliptic-curve" @@ -2140,6 +2430,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "encode_unicode" version = "1.0.0" @@ -2172,7 +2468,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -2190,10 +2486,10 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling 0.20.5", + "darling 0.20.8", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -2201,13 +2497,12 @@ name = "epoch-indexer" version = "0.1.0" dependencies = [ "anyhow", - "clap 3.2.25", + "clap", "configuration", "database", - "futures", - "near-chain-configs", + "near-chain-configs 0.0.0", "near-indexer-primitives", - "near-jsonrpc-client", + "near-jsonrpc-client 0.8.0 (git+https://github.com/kobayurii/near-jsonrpc-client-rs.git?branch=0.8.2)", "near-lake-framework", "readnode-primitives", "tokio", @@ -2222,9 +2517,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.31" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" +checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" dependencies = [ "serde", ] @@ -2281,6 +2576,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "1.9.0" @@ -2306,6 +2607,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" + [[package]] name = "finite-wasm" version = "0.5.0" @@ -2317,7 +2624,7 @@ dependencies = [ "num-traits", "prefix-sum-vec", "thiserror", - "wasm-encoder", + "wasm-encoder 0.27.0", "wasmparser 0.105.0", "wasmprinter", ] @@ -2337,6 +2644,12 @@ 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" @@ -2475,7 +2788,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -2573,20 +2886,20 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", + "fallible-iterator 0.3.0", + "indexmap 2.2.5", "stable_deref_trait", ] [[package]] -name = "gimli" -version = "0.28.1" +name = "glob" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "group" @@ -2610,11 +2923,11 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.2.2", + "http 0.2.12", + "indexmap 2.2.5", "slab", "tokio", - "tokio-util", + "tokio-util 0.7.10", "tracing", ] @@ -2624,7 +2937,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -2633,7 +2946,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -2642,7 +2955,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.11", ] [[package]] @@ -2651,10 +2964,19 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.11", "allocator-api2", ] +[[package]] +name = "heapsize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" +dependencies = [ + "winapi", +] + [[package]] name = "heck" version = "0.3.3" @@ -2672,18 +2994,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -2709,11 +3022,20 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -2722,9 +3044,9 @@ dependencies = [ [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -2738,7 +3060,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.11", + "http 0.2.12", "pin-project-lite", ] @@ -2771,13 +3093,13 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 0.2.11", + "http 0.2.12", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tower-service", "tracing", @@ -2791,7 +3113,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.11", + "http 0.2.12", "hyper", "log", "rustls", @@ -2800,6 +3122,18 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -2852,6 +3186,26 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] +name = "impl-more" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" + [[package]] name = "indexmap" version = "1.9.3" @@ -2865,15 +3219,28 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", "serde", ] +[[package]] +name = "indicatif" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4" +dependencies = [ + "console", + "lazy_static", + "number_prefix", + "rayon", + "regex", +] + [[package]] name = "instant" version = "0.1.12" @@ -2889,17 +3256,6 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.4", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -2908,12 +3264,12 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.4", - "rustix 0.38.31", + "hermit-abi", + "libc", "windows-sys 0.52.0", ] @@ -2930,7 +3286,7 @@ dependencies = [ "curl-sys", "event-listener", "futures-lite", - "http 0.2.11", + "http 0.2.12", "log", "once_cell", "polling", @@ -2968,18 +3324,18 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -2993,7 +3349,7 @@ checksum = "9dbbfed4e59ba9750e15ba154fdfd9329cee16ff3df539c2666b70f58cc32105" [[package]] name = "jsonrpc-v2" version = "0.11.0" -source = "git+https://github.com/kobayurii/jsonrpc-v2?rev=95e7b1d2567ae841163af212a3f25abb6862becb#95e7b1d2567ae841163af212a3f25abb6862becb" +source = "git+https://github.com/kobayurii/jsonrpc-v2?branch=master#ee01c71bcd2e131d787988728b7288734c2371df" dependencies = [ "actix-service", "actix-web", @@ -3006,6 +3362,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "jsonwebtoken" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afabcc15e437a6484fc4f12d0fd63068fe457bf93f1c148d3d9649c60b103f32" +dependencies = [ + "base64 0.12.3", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "keccak" version = "0.1.5" @@ -3030,6 +3400,12 @@ dependencies = [ "spin 0.5.2", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "leb128" version = "0.2.5" @@ -3042,6 +3418,16 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if 1.0.0", + "windows-targets 0.52.4", +] + [[package]] name = "libm" version = "0.2.8" @@ -3059,6 +3445,23 @@ dependencies = [ "redox_syscall 0.4.1", ] +[[package]] +name = "librocksdb-sys" +version = "0.11.0+8.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +dependencies = [ + "bindgen", + "bzip2-sys", + "cc", + "glob", + "libc", + "libz-sys", + "lz4-sys", + "tikv-jemalloc-sys", + "zstd-sys", +] + [[package]] name = "libz-sys" version = "1.1.15" @@ -3071,12 +3474,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -3121,29 +3518,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "loupe" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6a72dfa44fe15b5e76b94307eeb2ff995a8c5b283b55008940c02e0c5b634d" -dependencies = [ - "loupe-derive", - "rustversion", -] - -[[package]] -name = "loupe-derive" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952" -dependencies = [ - "quote", - "syn 1.0.109", -] +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru" @@ -3156,13 +3533,23 @@ dependencies = [ [[package]] name = "lru" -version = "0.11.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ "hashbrown 0.14.3", ] +[[package]] +name = "lz4-sys" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "lz4_flex" version = "0.11.2" @@ -3172,6 +3559,17 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "lzma-sys" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "mach" version = "0.3.2" @@ -3190,6 +3588,17 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "maybe-async" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "md-5" version = "0.10.6" @@ -3200,6 +3609,12 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + [[package]] name = "memchr" version = "2.7.1" @@ -3212,7 +3627,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.31", + "rustix", ] [[package]] @@ -3252,6 +3667,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "migrations_internals" version = "2.1.0" @@ -3279,6 +3703,31 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minidom" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f45614075738ce1b77a1768912a60c0227525971b03e09122a05b8a34a2a6278" +dependencies = [ + "rxml", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.2" @@ -3290,9 +3739,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", @@ -3306,6 +3755,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "mutually_exclusive_features" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d02c0b00610773bb7fc61d85e13d86c7858cbdf00e1a120bfc41bc055dbaa0e" + [[package]] name = "native-tls" version = "0.2.11" @@ -3326,197 +3787,886 @@ dependencies = [ [[package]] name = "near-account-id" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35cbb989542587b47205e608324ddd391f0cee1c22b4b64ae49f458334b95907" +dependencies = [ + "borsh 1.3.1", + "serde", +] + +[[package]] +name = "near-async" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "borsh 0.10.3", + "actix", + "derive_more", + "futures", + "near-async-derive", + "near-o11y 0.0.0", + "near-performance-metrics", + "once_cell", "serde", + "serde_json", + "time", + "tokio", +] + +[[package]] +name = "near-async-derive" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", ] [[package]] name = "near-cache" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "lru 0.7.8", ] +[[package]] +name = "near-chain" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "assert_matches", + "borsh 1.3.1", + "bytesize", + "chrono", + "crossbeam-channel", + "easy-ext", + "enum-map", + "itertools 0.10.5", + "itoa", + "lru 0.7.8", + "near-async", + "near-cache", + "near-chain-configs 0.0.0", + "near-chain-primitives", + "near-client-primitives", + "near-crypto 0.0.0", + "near-epoch-manager", + "near-mainnet-res", + "near-network", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-performance-metrics", + "near-performance-metrics-macros", + "near-pool", + "near-primitives 0.0.0", + "near-store", + "near-vm-runner 0.0.0", + "node-runtime", + "num-rational", + "once_cell", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rayon", + "strum 0.24.1", + "tempfile", + "thiserror", + "tracing", + "yansi", +] + [[package]] name = "near-chain-configs" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "anyhow", + "bytesize", "chrono", "derive_more", - "near-config-utils", - "near-crypto", - "near-primitives", + "near-async", + "near-config-utils 0.0.0", + "near-crypto 0.0.0", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-primitives 0.0.0", "num-rational", "once_cell", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "smart-default", + "time", "tracing", ] [[package]] -name = "near-config-utils" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +name = "near-chain-configs" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e5a8ace81c09d7eb165dffc1742358a021b2fa761f2160943305f83216003" dependencies = [ "anyhow", - "json_comments", + "bytesize", + "chrono", + "derive_more", + "near-config-utils 0.20.1", + "near-crypto 0.20.1", + "near-parameters 0.20.1", + "near-primitives 0.20.1", + "num-rational", + "once_cell", + "serde", + "serde_json", + "sha2", + "smart-default", + "tracing", +] + +[[package]] +name = "near-chain-primitives" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "near-async", + "near-crypto 0.0.0", + "near-primitives 0.0.0", "thiserror", + "time", "tracing", ] [[package]] -name = "near-crypto" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +name = "near-chunks" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "blake2", - "borsh 0.10.3", - "bs58", - "c2-chacha", - "curve25519-dalek", + "actix", + "borsh 1.3.1", + "chrono", "derive_more", - "ed25519-dalek", - "hex", - "near-account-id", - "near-config-utils", - "near-stdx", + "futures", + "itertools 0.10.5", + "lru 0.7.8", + "near-async", + "near-chain", + "near-chain-configs 0.0.0", + "near-chunks-primitives", + "near-crypto 0.0.0", + "near-epoch-manager", + "near-network", + "near-o11y 0.0.0", + "near-performance-metrics", + "near-performance-metrics-macros", + "near-pool", + "near-primitives 0.0.0", + "near-store", "once_cell", - "primitive-types", - "rand 0.7.3", - "secp256k1", - "serde", - "serde_json", - "subtle", - "thiserror", + "rand 0.8.5", + "reed-solomon-erasure", + "strum 0.24.1", + "time", + "tracing", ] [[package]] -name = "near-fmt" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +name = "near-chunks-primitives" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "near-primitives-core", + "near-chain-primitives", + "near-primitives 0.0.0", ] [[package]] -name = "near-indexer-primitives" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +name = "near-client" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "near-primitives", + "actix", + "actix-rt", + "anyhow", + "async-trait", + "borsh 1.3.1", + "bytesize", + "chrono", + "cloud-storage", + "derive_more", + "futures", + "itertools 0.10.5", + "lru 0.7.8", + "near-async", + "near-cache", + "near-chain", + "near-chain-configs 0.0.0", + "near-chain-primitives", + "near-chunks", + "near-client-primitives", + "near-crypto 0.0.0", + "near-dyn-configs", + "near-epoch-manager", + "near-network", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-performance-metrics", + "near-performance-metrics-macros", + "near-pool", + "near-primitives 0.0.0", + "near-store", + "near-telemetry", + "num-rational", + "once_cell", + "percent-encoding", + "rand 0.8.5", + "rayon", + "reed-solomon-erasure", + "regex", + "reqwest", + "rust-s3", "serde", "serde_json", + "strum 0.24.1", + "sysinfo 0.24.7", + "tempfile", + "thiserror", + "tokio", + "tracing", + "yansi", ] [[package]] -name = "near-jsonrpc-client" -version = "0.7.0" -source = "git+https://github.com/kobayurii/near-jsonrpc-client-rs.git?branch=0.7.0#55396b286cfb1f5d7c8e6d7caa9db73d087c821c" +name = "near-client-primitives" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "borsh 0.10.3", - "lazy_static", - "log", - "near-chain-configs", - "near-crypto", - "near-jsonrpc-primitives", - "near-primitives", - "reqwest", + "actix", + "chrono", + "near-async", + "near-chain-configs 0.0.0", + "near-chain-primitives", + "near-chunks-primitives", + "near-crypto 0.0.0", + "near-primitives 0.0.0", "serde", "serde_json", + "strum 0.24.1", "thiserror", + "time", + "tracing", + "yansi", ] [[package]] -name = "near-jsonrpc-primitives" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +name = "near-config-utils" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "arbitrary", - "near-chain-configs", - "near-crypto", - "near-primitives", - "near-rpc-error-macro", - "serde", - "serde_json", + "anyhow", + "json_comments", "thiserror", + "tracing", ] [[package]] -name = "near-lake-framework" -version = "0.7.9" -source = "git+https://github.com/kobayurii/near-lake-framework-rs.git?branch=0.7.9#8b76ca8c1e335e3c888fa3efe523e16daf9ff2db" +name = "near-config-utils" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae1eaab1d545a9be7a55b6ef09f365c2017f93a03063547591d12c0c6d27e58" dependencies = [ "anyhow", - "async-stream", - "async-trait", - "aws-config", - "aws-credential-types", - "aws-sdk-s3", - "aws-smithy-types", - "aws-types", - "derive_builder", - "futures", - "near-indexer-primitives", - "serde", - "serde_json", + "json_comments", "thiserror", - "tokio", - "tokio-stream", "tracing", ] [[package]] -name = "near-primitives" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +name = "near-crypto" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ - "arbitrary", - "borsh 0.10.3", - "bytesize", - "cfg-if 1.0.0", - "chrono", + "blake2", + "borsh 1.3.1", + "bs58", + "curve25519-dalek", "derive_more", - "easy-ext", - "enum-map", + "ed25519-dalek", "hex", - "near-crypto", - "near-fmt", - "near-primitives-core", - "near-rpc-error-macro", - "near-stdx", - "near-vm-runner", - "num-rational", + "near-account-id", + "near-config-utils 0.0.0", + "near-stdx 0.0.0", "once_cell", "primitive-types", - "rand 0.8.5", - "reed-solomon-erasure", + "secp256k1", "serde", "serde_json", - "serde_with", - "serde_yaml", - "smart-default", - "strum 0.24.1", + "subtle", "thiserror", - "time", - "tracing", ] [[package]] -name = "near-primitives-core" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" -dependencies = [ +name = "near-crypto" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2991d2912218a80ec0733ac87f84fa803accea105611eea209d4419271957667" +dependencies = [ + "blake2", + "borsh 1.3.1", + "bs58", + "c2-chacha", + "curve25519-dalek", + "derive_more", + "ed25519-dalek", + "hex", + "near-account-id", + "near-config-utils 0.20.1", + "near-stdx 0.20.1", + "once_cell", + "primitive-types", + "rand 0.7.3", + "secp256k1", + "serde", + "serde_json", + "subtle", + "thiserror", +] + +[[package]] +name = "near-dyn-configs" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "anyhow", + "near-async", + "near-chain-configs 0.0.0", + "near-o11y 0.0.0", + "near-primitives 0.0.0", + "once_cell", + "prometheus", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "near-epoch-manager" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "borsh 1.3.1", + "itertools 0.10.5", + "near-cache", + "near-chain-configs 0.0.0", + "near-chain-primitives", + "near-crypto 0.0.0", + "near-o11y 0.0.0", + "near-primitives 0.0.0", + "near-store", + "num-rational", + "primitive-types", + "rand 0.8.5", + "rand_hc 0.3.2", + "serde_json", + "smart-default", + "tracing", +] + +[[package]] +name = "near-fmt" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "near-primitives-core 0.0.0", +] + +[[package]] +name = "near-fmt" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7d998dfc1e04001608899b2498ad5a782c7d036b73769d510de21964db99286" +dependencies = [ + "near-primitives-core 0.20.1", +] + +[[package]] +name = "near-indexer" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "anyhow", + "async-recursion", + "futures", + "near-chain-configs 0.0.0", + "near-client", + "near-crypto 0.0.0", + "near-dyn-configs", + "near-indexer-primitives", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-primitives 0.0.0", + "near-store", + "nearcore", + "node-runtime", + "once_cell", + "rocksdb", + "serde", + "serde_json", + "tokio", + "tracing", +] + +[[package]] +name = "near-indexer-primitives" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "near-primitives 0.0.0", + "serde", + "serde_json", +] + +[[package]] +name = "near-jsonrpc" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "actix-cors 0.6.5", + "actix-web", + "bs58", + "derive_more", + "easy-ext", + "futures", + "hex", + "near-async", + "near-chain-configs 0.0.0", + "near-client", + "near-client-primitives", + "near-jsonrpc-client 0.0.0", + "near-jsonrpc-primitives 0.0.0", + "near-network", + "near-o11y 0.0.0", + "near-primitives 0.0.0", + "near-rpc-error-macro 0.0.0", + "once_cell", + "serde", + "serde_json", + "serde_with", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "near-jsonrpc-client" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix-http", + "awc", + "futures", + "near-jsonrpc-primitives 0.0.0", + "near-primitives 0.0.0", + "serde", + "serde_json", +] + +[[package]] +name = "near-jsonrpc-client" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18ad81e015f7aced8925d5b9ba3f369b36da9575c15812cfd0786bc1213284ca" +dependencies = [ + "borsh 1.3.1", + "lazy_static", + "log", + "near-chain-configs 0.20.1", + "near-crypto 0.20.1", + "near-jsonrpc-primitives 0.20.1", + "near-primitives 0.20.1", + "reqwest", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "near-jsonrpc-client" +version = "0.8.0" +source = "git+https://github.com/kobayurii/near-jsonrpc-client-rs.git?branch=0.8.2#a73423f1e348210466da7c82bd610b02f8aad80e" +dependencies = [ + "borsh 1.3.1", + "lazy_static", + "log", + "near-chain-configs 0.0.0", + "near-crypto 0.0.0", + "near-jsonrpc-primitives 0.0.0", + "near-primitives 0.0.0", + "reqwest", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "near-jsonrpc-primitives" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "arbitrary", + "near-chain-configs 0.0.0", + "near-client-primitives", + "near-crypto 0.0.0", + "near-primitives 0.0.0", + "near-rpc-error-macro 0.0.0", + "serde", + "serde_json", + "thiserror", + "time", +] + +[[package]] +name = "near-jsonrpc-primitives" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0ce745e954ae776eef05957602e638ee9581106a3675946fb43c2fe7e38ef03" +dependencies = [ + "arbitrary", + "near-chain-configs 0.20.1", + "near-crypto 0.20.1", + "near-primitives 0.20.1", + "near-rpc-error-macro 0.20.1", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "near-lake-framework" +version = "0.0.0" +source = "git+https://github.com/kobayurii/near-lake-framework-rs.git?branch=0.7.8#84cf76a39669914bd46a01d8463761efd576c230" +dependencies = [ + "anyhow", + "async-stream", + "async-trait", + "aws-config", + "aws-credential-types", + "aws-sdk-s3", + "aws-smithy-types", + "aws-types", + "derive_builder", + "futures", + "near-indexer-primitives", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "near-mainnet-res" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "near-account-id", + "near-chain-configs 0.0.0", + "near-primitives 0.0.0", + "serde_json", +] + +[[package]] +name = "near-network" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "anyhow", + "arc-swap", + "async-trait", + "borsh 1.3.1", + "bytes", + "bytesize", + "chrono", + "crossbeam-channel", + "derive_more", + "futures", + "futures-util", + "im", + "itertools 0.10.5", + "lru 0.7.8", + "near-async", + "near-crypto 0.0.0", + "near-fmt 0.0.0", + "near-o11y 0.0.0", + "near-performance-metrics", + "near-performance-metrics-macros", + "near-primitives 0.0.0", + "near-store", + "once_cell", + "opentelemetry 0.17.0", + "parking_lot 0.12.1", + "pin-project", + "protobuf 3.4.0", + "protobuf-codegen", + "rand 0.8.5", + "rayon", + "serde", + "sha2", + "smart-default", + "strum 0.24.1", + "stun", + "thiserror", + "time", + "tokio", + "tokio-stream", + "tokio-util 0.7.10", + "tracing", +] + +[[package]] +name = "near-o11y" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "base64 0.21.7", + "clap", + "near-crypto 0.0.0", + "near-primitives-core 0.0.0", + "once_cell", + "opentelemetry 0.17.0", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions 0.9.0", + "prometheus", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-appender", + "tracing-opentelemetry 0.17.4", + "tracing-subscriber", +] + +[[package]] +name = "near-o11y" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d20762631bc8253030013bbae9b5f0542691edc1aa6722f1e8141cc9b928ae5b" +dependencies = [ + "actix", + "base64 0.21.7", + "clap", + "near-crypto 0.20.1", + "near-fmt 0.20.1", + "near-primitives-core 0.20.1", + "once_cell", + "opentelemetry 0.17.0", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions 0.9.0", + "prometheus", + "serde", + "serde_json", + "strum 0.24.1", + "thiserror", + "tokio", + "tracing", + "tracing-appender", + "tracing-opentelemetry 0.17.4", + "tracing-subscriber", +] + +[[package]] +name = "near-parameters" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "borsh 1.3.1", + "enum-map", + "near-account-id", + "near-primitives-core 0.0.0", + "num-rational", + "serde", + "serde_repr", + "serde_yaml", + "strum 0.24.1", + "thiserror", +] + +[[package]] +name = "near-parameters" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f16a59b6c3e69b0585be951af6fe42a0ba86c0e207cb8c63badd19efd16680" +dependencies = [ + "assert_matches", + "borsh 1.3.1", + "enum-map", + "near-account-id", + "near-primitives-core 0.20.1", + "num-rational", + "serde", + "serde_repr", + "serde_yaml", + "strum 0.24.1", + "thiserror", +] + +[[package]] +name = "near-performance-metrics" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "bitflags 1.3.2", + "bytes", + "futures", + "libc", + "once_cell", + "tokio", + "tokio-util 0.7.10", + "tracing", +] + +[[package]] +name = "near-performance-metrics-macros" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "quote", + "syn 2.0.52", +] + +[[package]] +name = "near-pool" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "borsh 1.3.1", + "near-crypto 0.0.0", + "near-o11y 0.0.0", + "near-primitives 0.0.0", + "once_cell", + "rand 0.8.5", +] + +[[package]] +name = "near-primitives" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "arbitrary", + "base64 0.21.7", + "borsh 1.3.1", + "bytesize", + "cfg-if 1.0.0", + "chrono", + "derive_more", + "easy-ext", + "enum-map", + "hex", + "itertools 0.10.5", + "near-async", + "near-crypto 0.0.0", + "near-fmt 0.0.0", + "near-parameters 0.0.0", + "near-primitives-core 0.0.0", + "near-rpc-error-macro 0.0.0", + "near-stdx 0.0.0", + "near-vm-runner 0.0.0", + "num-rational", + "once_cell", + "primitive-types", + "rand 0.8.5", + "rand_chacha 0.3.1", + "reed-solomon-erasure", + "serde", + "serde_json", + "serde_with", + "serde_yaml", + "sha3", + "smart-default", + "strum 0.24.1", + "thiserror", + "tracing", +] + +[[package]] +name = "near-primitives" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0462b067732132babcc89d5577db3bfcb0a1bcfbaaed3f2db4c11cd033666314" +dependencies = [ + "arbitrary", + "base64 0.21.7", + "borsh 1.3.1", + "bytesize", + "cfg-if 1.0.0", + "chrono", + "derive_more", + "easy-ext", + "enum-map", + "hex", + "near-crypto 0.20.1", + "near-fmt 0.20.1", + "near-o11y 0.20.1", + "near-parameters 0.20.1", + "near-primitives-core 0.20.1", + "near-rpc-error-macro 0.20.1", + "near-stdx 0.20.1", + "near-vm-runner 0.20.1", + "num-rational", + "once_cell", + "primitive-types", + "rand 0.8.5", + "rand_chacha 0.3.1", + "reed-solomon-erasure", + "serde", + "serde_json", + "serde_with", + "serde_yaml", + "sha3", + "smart-default", + "strum 0.24.1", + "thiserror", + "time", + "tracing", +] + +[[package]] +name = "near-primitives-core" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "arbitrary", + "base64 0.21.7", + "borsh 1.3.1", + "bs58", + "derive_more", + "enum-map", + "near-account-id", + "num-rational", + "serde", + "serde_repr", + "sha2", + "thiserror", +] + +[[package]] +name = "near-primitives-core" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8443eb718606f572c438be6321a097a8ebd69f8e48d953885b4f16601af88225" +dependencies = [ "arbitrary", - "base64", - "borsh 0.10.3", + "base64 0.21.7", + "borsh 1.3.1", "bs58", "derive_more", "enum-map", @@ -3525,49 +4675,195 @@ dependencies = [ "serde", "serde_repr", "serde_with", - "sha2 0.10.8", + "sha2", + "strum 0.24.1", + "thiserror", +] + +[[package]] +name = "near-rosetta-rpc" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "actix-cors 0.6.5", + "actix-http", + "actix-web", + "awc", + "derive_more", + "futures", + "hex", + "near-account-id", + "near-chain-configs 0.0.0", + "near-client", + "near-client-primitives", + "near-crypto 0.0.0", + "near-network", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-primitives 0.0.0", + "node-runtime", + "paperclip", + "serde", + "serde_json", "strum 0.24.1", "thiserror", + "tokio", ] [[package]] name = "near-rpc-error-core" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "quote", + "serde", + "syn 2.0.52", +] + +[[package]] +name = "near-rpc-error-core" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80fca203c51edd9595ec14db1d13359fb9ede32314990bf296b6c5c4502f6ab7" dependencies = [ "quote", "serde", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] name = "near-rpc-error-macro" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "near-rpc-error-core 0.0.0", + "serde", + "syn 2.0.52", +] + +[[package]] +name = "near-rpc-error-macro" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897a445de2102f6732c8a185d922f5e3bf7fd0a41243ce40854df2197237f799" dependencies = [ "fs2", - "near-rpc-error-core", + "near-rpc-error-core 0.20.1", "serde", - "syn 2.0.48", + "syn 2.0.52", +] + +[[package]] +name = "near-state-indexer" +version = "0.1.0" +dependencies = [ + "actix", + "actix-web", + "anyhow", + "borsh 1.3.1", + "clap", + "configuration", + "database", + "futures", + "hex", + "humantime", + "near-client", + "near-indexer", + "near-o11y 0.0.0", + "once_cell", + "openssl-probe", + "redis", + "rustc_version 0.4.0", + "serde_json", + "tokio", + "tokio-stream", + "tracing", ] [[package]] name = "near-stdx" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" + +[[package]] +name = "near-stdx" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "855fd5540e3b4ff6fedf12aba2db1ee4b371b36f465da1363a6d022b27cb43b8" + +[[package]] +name = "near-store" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "actix-rt", + "anyhow", + "borsh 1.3.1", + "bytesize", + "crossbeam", + "derive_more", + "elastic-array", + "enum-map", + "hex", + "itertools 0.10.5", + "itoa", + "lru 0.7.8", + "near-async", + "near-chain-configs 0.0.0", + "near-crypto 0.0.0", + "near-fmt 0.0.0", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-primitives 0.0.0", + "near-stdx 0.0.0", + "near-vm-runner 0.0.0", + "num_cpus", + "once_cell", + "rand 0.8.5", + "rayon", + "rlimit", + "rocksdb", + "serde", + "serde_json", + "strum 0.24.1", + "tempfile", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "near-telemetry" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "awc", + "futures", + "near-async", + "near-o11y 0.0.0", + "near-performance-metrics", + "near-performance-metrics-macros", + "once_cell", + "openssl", + "serde", + "serde_json", + "tracing", +] [[package]] name = "near-vm-compiler" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "enumset", "finite-wasm", "near-vm-types", "near-vm-vm", "rkyv", - "smallvec", - "target-lexicon 0.12.13", + "target-lexicon 0.12.14", "thiserror", "tracing", "wasmparser 0.99.0", @@ -3575,8 +4871,8 @@ dependencies = [ [[package]] name = "near-vm-compiler-singlepass" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "dynasm 2.0.0", "dynasmrt 2.0.0", @@ -3596,15 +4892,14 @@ dependencies = [ [[package]] name = "near-vm-engine" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "backtrace", "cfg-if 1.0.0", "enumset", "finite-wasm", "lazy_static", - "memmap2", "more-asserts", "near-vm-compiler", "near-vm-types", @@ -3612,32 +4907,34 @@ dependencies = [ "region", "rkyv", "rustc-demangle", - "target-lexicon 0.12.13", + "rustix", + "target-lexicon 0.12.14", "thiserror", "tracing", ] [[package]] name = "near-vm-runner" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "anyhow", - "base64", - "borsh 0.10.3", + "base64 0.21.7", + "borsh 1.3.1", "ed25519-dalek", + "enum-map", "finite-wasm", - "loupe", "memoffset 0.8.0", - "near-cache", - "near-crypto", - "near-primitives-core", - "near-stdx", + "near-crypto 0.0.0", + "near-parameters 0.0.0", + "near-primitives-core 0.0.0", + "near-stdx 0.0.0", "near-vm-compiler", "near-vm-compiler-singlepass", "near-vm-engine", "near-vm-types", "near-vm-vm", + "num-rational", "once_cell", "parity-wasm 0.41.0", "parity-wasm 0.42.2", @@ -3645,13 +4942,13 @@ dependencies = [ "pwasm-utils", "ripemd", "serde", - "serde_with", - "sha2 0.10.8", + "serde_repr", + "sha2", "sha3", "strum 0.24.1", "thiserror", "tracing", - "wasm-encoder", + "wasm-encoder 0.27.0", "wasmer-compiler-near", "wasmer-compiler-singlepass-near", "wasmer-engine-near", @@ -3665,10 +4962,40 @@ dependencies = [ "zeropool-bn", ] +[[package]] +name = "near-vm-runner" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56c80bdb1954808f59bd36a9112377197b38d424991383bf05f52d0fe2e0da5" +dependencies = [ + "base64 0.21.7", + "borsh 1.3.1", + "ed25519-dalek", + "enum-map", + "memoffset 0.8.0", + "near-crypto 0.20.1", + "near-parameters 0.20.1", + "near-primitives-core 0.20.1", + "near-stdx 0.20.1", + "num-rational", + "once_cell", + "prefix-sum-vec", + "ripemd", + "serde", + "serde_repr", + "serde_with", + "sha2", + "sha3", + "strum 0.24.1", + "thiserror", + "tracing", + "zeropool-bn", +] + [[package]] name = "near-vm-types" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "indexmap 1.9.3", "num-traits", @@ -3678,8 +5005,8 @@ dependencies = [ [[package]] name = "near-vm-vm" -version = "1.36.0" -source = "git+https://github.com/near/nearcore.git?branch=1.36.0#b0c5d14557b0e24ee8f4ffcc293963b8ccf633a6" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" dependencies = [ "backtrace", "cc", @@ -3694,10 +5021,82 @@ dependencies = [ "rkyv", "thiserror", "tracing", - "wasmparser 0.99.0", "winapi", ] +[[package]] +name = "near-wallet-contract" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "anyhow", + "near-vm-runner 0.0.0", +] + +[[package]] +name = "nearcore" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "actix", + "actix-rt", + "actix-web", + "anyhow", + "awc", + "borsh 1.3.1", + "chrono", + "cloud-storage", + "dirs", + "easy-ext", + "futures", + "hex", + "hyper", + "hyper-tls", + "indicatif", + "near-async", + "near-chain", + "near-chain-configs 0.0.0", + "near-chunks", + "near-client", + "near-client-primitives", + "near-config-utils 0.0.0", + "near-crypto 0.0.0", + "near-dyn-configs", + "near-epoch-manager", + "near-jsonrpc", + "near-jsonrpc-primitives 0.0.0", + "near-mainnet-res", + "near-network", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-performance-metrics", + "near-pool", + "near-primitives 0.0.0", + "near-rosetta-rpc", + "near-store", + "near-telemetry", + "near-vm-runner 0.0.0", + "node-runtime", + "num-rational", + "once_cell", + "rand 0.8.5", + "rayon", + "regex", + "reqwest", + "rlimit", + "rust-s3", + "serde", + "serde_ignored", + "serde_json", + "smart-default", + "strum 0.24.1", + "tempfile", + "thiserror", + "tokio", + "tracing", + "xz2", +] + [[package]] name = "nix" version = "0.15.0" @@ -3711,6 +5110,66 @@ dependencies = [ "void", ] +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags 1.3.2", + "cfg-if 1.0.0", + "libc", + "memoffset 0.6.5", +] + +[[package]] +name = "node-runtime" +version = "0.0.0" +source = "git+https://github.com/near/nearcore.git?rev=836dbb7971a8d183e02f95d81d8a9ae18e731b37#836dbb7971a8d183e02f95d81d8a9ae18e731b37" +dependencies = [ + "borsh 1.3.1", + "hex", + "near-chain-configs 0.0.0", + "near-crypto 0.0.0", + "near-o11y 0.0.0", + "near-parameters 0.0.0", + "near-primitives 0.0.0", + "near-primitives-core 0.0.0", + "near-store", + "near-vm-runner 0.0.0", + "near-wallet-contract", + "num-bigint 0.3.3", + "num-rational", + "num-traits", + "once_cell", + "rand 0.8.5", + "rayon", + "serde", + "serde_json", + "sha2", + "thiserror", + "tracing", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + [[package]] name = "ntapi" version = "0.4.1" @@ -3730,6 +5189,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.3.3" @@ -3760,11 +5230,10 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[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", ] @@ -3783,9 +5252,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -3796,7 +5265,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.4", + "hermit-abi", "libc", ] @@ -3818,20 +5287,14 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] -name = "object" -version = "0.30.4" +name = "number_prefix" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" -dependencies = [ - "crc32fast", - "hashbrown 0.13.2", - "indexmap 1.9.3", - "memchr", -] +checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" [[package]] name = "object" @@ -3839,6 +5302,9 @@ version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ + "crc32fast", + "hashbrown 0.14.3", + "indexmap 2.2.5", "memchr", ] @@ -3850,15 +5316,15 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ "bitflags 2.4.2", "cfg-if 1.0.0", @@ -3877,7 +5343,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -3886,18 +5352,49 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "300.2.3+3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror", + "tokio", + "tokio-stream", +] + [[package]] name = "opentelemetry" version = "0.19.0" @@ -3916,7 +5413,7 @@ checksum = "a819b71d6530c4297b49b3cae2939ab3a8cc1b9f382826a1bc29dd0ca3864906" dependencies = [ "async-trait", "bytes", - "http 0.2.11", + "http 0.2.12", "isahc", "opentelemetry_api", ] @@ -3930,24 +5427,51 @@ dependencies = [ "async-trait", "futures", "futures-executor", - "http 0.2.11", + "http 0.2.12", "isahc", "once_cell", - "opentelemetry", + "opentelemetry 0.19.0", "opentelemetry-http", - "opentelemetry-semantic-conventions", + "opentelemetry-semantic-conventions 0.11.0", "thiserror", "thrift", "tokio", ] +[[package]] +name = "opentelemetry-otlp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a" +dependencies = [ + "async-trait", + "futures", + "futures-util", + "http 0.2.12", + "opentelemetry 0.17.0", + "prost", + "thiserror", + "tokio", + "tonic", + "tonic-build", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985cc35d832d412224b2cffe2f9194b1b89b6aa5d0bef76d080dce09d90e62bd" +dependencies = [ + "opentelemetry 0.17.0", +] + [[package]] name = "opentelemetry-semantic-conventions" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24e33428e6bf08c6f7fcea4ddb8e358fab0fe48ab877a87c70c6ebe20f673ce5" dependencies = [ - "opentelemetry", + "opentelemetry 0.19.0", ] [[package]] @@ -3998,10 +5522,14 @@ dependencies = [ ] [[package]] -name = "os_str_bytes" -version = "6.6.1" +name = "ordered-multimap" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] [[package]] name = "outref" @@ -4023,7 +5551,7 @@ checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ "ecdsa", "elliptic-curve", - "sha2 0.10.8", + "sha2", ] [[package]] @@ -4036,6 +5564,79 @@ dependencies = [ "winapi", ] +[[package]] +name = "paperclip" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2509afd8f138efe07cd367832289f5cc61d1eb1ec7f1eb75172abca6f7b9b66d" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "once_cell", + "paperclip-actix", + "paperclip-core", + "paperclip-macros", + "semver 1.0.22", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "thiserror", + "url", +] + +[[package]] +name = "paperclip-actix" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4adf797da91baee514bc03b020fdd6673d2f8c1af8a859e50d6d803a4b3dddd2" +dependencies = [ + "actix-service", + "actix-web", + "futures", + "mime_guess", + "once_cell", + "paperclip-core", + "paperclip-macros", + "serde_json", +] + +[[package]] +name = "paperclip-core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8db363c823fa71c00da73ff8cee3d6902e1ad66b770cc224a74dc7cf54de3aad" +dependencies = [ + "actix-web", + "mime", + "once_cell", + "paperclip-macros", + "pin-project-lite", + "regex", + "serde", + "serde_json", + "serde_yaml", + "thiserror", +] + +[[package]] +name = "paperclip-macros" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e25ce2c5362c8d48dc89e0f9ca076d507f7c1eabd04f0d593cdf5addff90c" +dependencies = [ + "heck 0.4.1", + "http 0.2.12", + "lazy_static", + "mime", + "proc-macro-error", + "proc-macro2", + "quote", + "strum 0.24.1", + "strum_macros 0.24.3", + "syn 1.0.109", +] + [[package]] name = "parity-wasm" version = "0.41.0" @@ -4107,6 +5708,23 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "pem" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +dependencies = [ + "base64 0.13.1", + "once_cell", + "regex", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -4119,19 +5737,29 @@ version = "0.1.0" dependencies = [ "anyhow", "chrono", - "clap 4.4.18", + "clap", "dotenv", "futures", - "http 0.2.11", - "near-jsonrpc-client", - "near-jsonrpc-primitives", - "near-primitives", + "http 1.1.0", + "near-jsonrpc-client 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-jsonrpc-primitives 0.20.1", + "near-primitives 0.20.1", "rand 0.8.5", "serde_json", "tokio", "tracing", ] +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.2.5", +] + [[package]] name = "phf" version = "0.11.2" @@ -4152,22 +5780,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -4194,9 +5822,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "platforms" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "polling" @@ -4220,15 +5854,15 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b6c5ef183cd3ab4ba005f1ca64c21e8bd97ce4699cfea9e8d9a2c4958ca520" dependencies = [ - "base64", + "base64 0.21.7", "byteorder", "bytes", - "fallible-iterator", + "fallible-iterator 0.2.0", "hmac", "md-5", "memchr", "rand 0.8.5", - "sha2 0.10.8", + "sha2", "stringprep", ] @@ -4239,7 +5873,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d2234cdee9408b523530a9b6d2d6b373d1db34f6a8e51dc03ded1828d7fb67c" dependencies = [ "bytes", - "fallible-iterator", + "fallible-iterator 0.2.0", "postgres-protocol", ] @@ -4270,6 +5904,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa06bd51638b6e76ac9ba9b6afb4164fa647bd2916d722f2623fbb6d1ed8bdba" +[[package]] +name = "prettyplease" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +dependencies = [ + "proc-macro2", + "syn 2.0.52", +] + [[package]] name = "prettytable-rs" version = "0.10.0" @@ -4277,7 +5921,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eea25e07510aa6ab6547308ebe3c036016d162b8da920dbb079e3ba8acf3d95a" dependencies = [ "csv", - "encode_unicode", + "encode_unicode 1.0.0", "is-terminal", "lazy_static", "term", @@ -4313,6 +5957,15 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -4339,9 +5992,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -4357,16 +6010,120 @@ dependencies = [ "lazy_static", "memchr", "parking_lot 0.12.1", - "protobuf", + "protobuf 2.28.0", "thiserror", ] +[[package]] +name = "prost" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +dependencies = [ + "bytes", + "heck 0.3.3", + "itertools 0.10.5", + "lazy_static", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "regex", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +dependencies = [ + "bytes", + "prost", +] + [[package]] name = "protobuf" version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" +[[package]] +name = "protobuf" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58678a64de2fced2bdec6bca052a6716a0efe692d6e3f53d1bda6a1def64cfc0" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-codegen" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32777b0b3f6538d9d2e012b3fad85c7e4b9244b5958d04a6415f4333782b7a77" +dependencies = [ + "anyhow", + "once_cell", + "protobuf 3.4.0", + "protobuf-parse", + "regex", + "tempfile", + "thiserror", +] + +[[package]] +name = "protobuf-parse" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96cb37955261126624a25b5e6bda40ae34cf3989d52a783087ca6091b29b5642" +dependencies = [ + "anyhow", + "indexmap 1.9.3", + "log", + "protobuf 3.4.0", + "protobuf-support", + "tempfile", + "thiserror", + "which", +] + +[[package]] +name = "protobuf-support" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ed294a835b0f30810e13616b1cd34943c6d1e84a8f3b0dcfe466d256c3e7e7" +dependencies = [ + "thiserror", +] + [[package]] name = "psm" version = "0.1.21" @@ -4432,7 +6189,7 @@ dependencies = [ "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc", + "rand_hc 0.2.0", ] [[package]] @@ -4493,6 +6250,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rand_pcg" version = "0.3.1" @@ -4502,11 +6268,20 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rayon" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" dependencies = [ "either", "rayon-core", @@ -4526,11 +6301,12 @@ dependencies = [ name = "read-rpc-server" version = "0.1.0" dependencies = [ - "actix-cors", + "actix-cors 0.7.0", "actix-web", "anyhow", "assert-json-diff", - "borsh 0.10.3", + "borsh 1.3.1", + "chrono", "configuration", "database", "erased-serde", @@ -4539,22 +6315,26 @@ dependencies = [ "hex", "jsonrpc-v2", "lazy_static", - "lru 0.11.1", - "near-chain-configs", - "near-crypto", + "lru 0.12.3", + "near-chain-configs 0.0.0", + "near-crypto 0.0.0", "near-indexer-primitives", - "near-jsonrpc-client", - "near-jsonrpc-primitives", + "near-jsonrpc-client 0.8.0 (git+https://github.com/kobayurii/near-jsonrpc-client-rs.git?branch=0.8.2)", + "near-jsonrpc-primitives 0.0.0", "near-lake-framework", - "near-primitives", - "near-vm-runner", + "near-parameters 0.0.0", + "near-primitives 0.0.0", + "near-vm-runner 0.0.0", "paste", "prometheus", "readnode-primitives", + "redis", + "rustc_version 0.4.0", "serde", "serde_json", - "sysinfo", + "sysinfo 0.30.7", "thiserror", + "time", "tokio", "tokio-stream", "tracing", @@ -4566,15 +6346,38 @@ name = "readnode-primitives" version = "0.1.0" dependencies = [ "anyhow", - "borsh 0.10.3", - "near-chain-configs", + "borsh 1.3.1", + "near-chain-configs 0.0.0", "near-indexer-primitives", - "num-bigint 0.3.3", "num-traits", "serde", "serde_json", ] +[[package]] +name = "redis" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c580d9cbbe1d1b479e8d67cf9daf6a62c957e6846048408b80b43ac3f6af84cd" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "combine", + "futures", + "futures-util", + "itoa", + "percent-encoding", + "pin-project-lite", + "ryu", + "sha1_smol", + "socket2 0.4.10", + "tokio", + "tokio-retry", + "tokio-util 0.7.10", + "url", +] + [[package]] name = "redox_syscall" version = "0.1.57" @@ -4612,9 +6415,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.8.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a52e724646c6c0800fc456ec43b4165d2f91fba88ceaca06d9e0b400023478" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" dependencies = [ "hashbrown 0.13.2", "log", @@ -4631,7 +6434,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -4646,9 +6449,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -4696,17 +6499,17 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", - "http 0.2.11", + "http 0.2.12", "http-body", "hyper", "hyper-tls", @@ -4726,10 +6529,12 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tokio-util 0.7.10", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", "winreg", ] @@ -4753,16 +6558,32 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.16.20" +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.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if 1.0.0", "getrandom 0.2.12", "libc", "spin 0.9.8", - "untrusted", - "windows-sys 0.48.0", + "untrusted 0.9.0", + "windows-sys 0.52.0", ] [[package]] @@ -4803,6 +6624,67 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rlimit" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "347703a5ae47adf1e693144157be231dde38c72bd485925cae7407ad3e52480b" +dependencies = [ + "libc", +] + +[[package]] +name = "rocksdb" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +dependencies = [ + "libc", + "librocksdb-sys", +] + +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if 1.0.0", + "ordered-multimap", +] + +[[package]] +name = "rust-s3" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6009d9d4cf910505534d62d380a0aa305805a2af0b5c3ad59a3024a0715b847" +dependencies = [ + "async-trait", + "aws-creds", + "aws-region", + "base64 0.13.1", + "block_on_proc", + "cfg-if 1.0.0", + "hex", + "hmac", + "http 0.2.12", + "log", + "maybe-async", + "md5", + "minidom", + "percent-encoding", + "reqwest", + "serde", + "serde-xml-rs", + "serde_derive", + "sha2", + "thiserror", + "time", + "tokio", + "tokio-stream", + "url", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -4836,21 +6718,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.21", -] - -[[package]] -name = "rustix" -version = "0.37.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" -dependencies = [ - "bitflags 1.3.2", - "errno 0.3.8", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", + "semver 1.0.22", ] [[package]] @@ -4862,7 +6730,7 @@ dependencies = [ "bitflags 2.4.2", "errno 0.3.8", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys", "windows-sys 0.52.0", ] @@ -4873,7 +6741,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -4896,7 +6764,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", + "base64 0.21.7", ] [[package]] @@ -4905,8 +6773,8 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -4915,11 +6783,28 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +[[package]] +name = "rxml" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98f186c7a2f3abbffb802984b7f1dfd65dac8be1aafdaabbca4137f53f0dff7" +dependencies = [ + "bytes", + "rxml_validation", + "smartstring", +] + +[[package]] +name = "rxml_validation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530" + [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schannel" @@ -4952,19 +6837,18 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "scylla" -version = "0.9.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8338911f1c2a7bf8ba4036997196e49e9eda8d4414af10548e9420e23a5dbd6f" +checksum = "03d2db76aa23f55d2ece5354e1a3778633098a3d1ea76153f494d71e92cd02d8" dependencies = [ "arc-swap", "async-trait", - "bigdecimal 0.2.2", "byteorder", "bytes", "chrono", @@ -4973,7 +6857,6 @@ dependencies = [ "histogram", "itertools 0.11.0", "lz4_flex", - "num-bigint 0.3.3", "num_enum", "rand 0.8.5", "rand_pcg", @@ -4981,7 +6864,7 @@ dependencies = [ "scylla-macros", "smallvec", "snap", - "socket2 0.5.5", + "socket2 0.5.6", "strum 0.23.0", "strum_macros 0.23.1", "thiserror", @@ -4992,34 +6875,38 @@ dependencies = [ [[package]] name = "scylla-cql" -version = "0.0.8" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048bdf0be96308ec0f5aeed2847bb2270f53355425b3afd67e64efc99d70b3e3" +checksum = "345626c0dd5d9624c413daaba854685bba6a65cff4eb5ea0fb0366df16901f67" dependencies = [ "async-trait", - "bigdecimal 0.2.2", + "bigdecimal", "byteorder", "bytes", "chrono", "lz4_flex", "num-bigint 0.3.3", + "num-bigint 0.4.4", "num_enum", "scylla-macros", + "secrecy", "snap", "thiserror", + "time", "tokio", "uuid", ] [[package]] name = "scylla-macros" -version = "0.2.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66bbac3874ee838894b5a82c5833c2b0b29d39ca5ad486d982ee434177b2cc57" +checksum = "eb6085ff9c3fd7e5163826901d39164ab86f11bdca16b2f766a00c528ff9cef9" dependencies = [ + "darling 0.20.8", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -5061,6 +6948,15 @@ dependencies = [ "cc", ] +[[package]] +name = "secrecy" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" +dependencies = [ + "zeroize", +] + [[package]] name = "security-framework" version = "2.9.2" @@ -5095,9 +6991,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "semver-parser" @@ -5107,9 +7003,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -5124,6 +7020,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-xml-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65162e9059be2f6a3421ebbb4fef3e74b7d9e7c60c50a0e292c6239f19f1edfa" +dependencies = [ + "log", + "serde", + "thiserror", + "xml-rs", +] + [[package]] name = "serde_bytes" version = "0.11.14" @@ -5135,20 +7043,29 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", +] + +[[package]] +name = "serde_ignored" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8e319a36d1b52126a0d608f24e93b2d81297091818cd70625fcf50a15d84ddf" +dependencies = [ + "serde", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -5163,7 +7080,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -5189,16 +7106,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" +checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ - "base64", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.2", + "indexmap 2.2.5", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -5206,23 +7124,23 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15" +checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ - "darling 0.20.5", + "darling 0.20.8", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] name = "serde_yaml" -version = "0.9.31" +version = "0.9.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" +checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.5", "itoa", "ryu", "serde", @@ -5241,17 +7159,10 @@ dependencies = [ ] [[package]] -name = "sha2" -version = "0.9.9" +name = "sha1_smol" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" [[package]] name = "sha2" @@ -5283,6 +7194,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -5302,18 +7219,45 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" + [[package]] name = "simdutf8" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "simple_asn1" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" +dependencies = [ + "chrono", + "num-bigint 0.2.6", + "num-traits", +] + [[package]] name = "siphasher" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -5357,6 +7301,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "autocfg", + "static_assertions", + "version_check", +] + [[package]] name = "snap" version = "1.1.1" @@ -5375,12 +7330,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -5405,6 +7360,12 @@ dependencies = [ "der", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -5417,8 +7378,8 @@ version = "0.1.0" dependencies = [ "actix-web", "anyhow", - "borsh 0.10.3", - "clap 3.2.25", + "borsh 1.3.1", + "clap", "configuration", "database", "epoch-indexer", @@ -5427,9 +7388,9 @@ dependencies = [ "humantime", "lazy_static", "near-indexer-primitives", - "near-jsonrpc-client", + "near-jsonrpc-client 0.8.0 (git+https://github.com/kobayurii/near-jsonrpc-client-rs.git?branch=0.8.2)", "near-lake-framework", - "near-primitives", + "near-primitives 0.0.0", "openssl-probe", "prometheus", "tokio", @@ -5460,6 +7421,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "strum" version = "0.23.0" @@ -5501,6 +7468,25 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "stun" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" +dependencies = [ + "base64 0.13.1", + "crc", + "lazy_static", + "md-5", + "rand 0.8.5", + "ring 0.16.20", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", +] + [[package]] name = "subtle" version = "2.5.0" @@ -5520,15 +7506,27 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "sync_wrapper" version = "0.1.2" @@ -5537,19 +7535,34 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sysinfo" -version = "0.29.11" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" +checksum = "54cb4ebf3d49308b99e6e9dc95e989e2fdbdc210e4f67c39db0bb89ba927001c" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys", "libc", - "ntapi", + "ntapi 0.3.7", "once_cell", "rayon", "winapi", ] +[[package]] +name = "sysinfo" +version = "0.30.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c385888ef380a852a16209afc8cfad22795dd8873d69c9a14d2e2088f118d18" +dependencies = [ + "cfg-if 1.0.0", + "core-foundation-sys", + "libc", + "ntapi 0.4.1", + "once_cell", + "rayon", + "windows", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -5585,20 +7598,19 @@ checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if 1.0.0", "fastrand 2.0.1", - "redox_syscall 0.4.1", - "rustix 0.38.31", + "rustix", "windows-sys 0.52.0", ] @@ -5613,46 +7625,31 @@ dependencies = [ "winapi", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if 1.0.0", "once_cell", @@ -5680,6 +7677,16 @@ dependencies = [ "threadpool", ] +[[package]] +name = "tikv-jemalloc-sys" +version = "0.5.4+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "time" version = "0.3.34" @@ -5740,12 +7747,22 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2 0.5.6", "tokio-macros", "tracing", "windows-sys 0.48.0", ] +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-macros" version = "2.2.0" @@ -5754,16 +7771,28 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-openssl" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "6ffab79df67727f6acf57f1ff743091873c24c579b1e2ce4d8f53e47ded4d63d" dependencies = [ - "native-tls", + "futures-util", + "openssl", + "openssl-sys", "tokio", ] @@ -5776,7 +7805,7 @@ dependencies = [ "async-trait", "byteorder", "bytes", - "fallible-iterator", + "fallible-iterator 0.2.0", "futures-channel", "futures-util", "log", @@ -5787,12 +7816,23 @@ dependencies = [ "postgres-protocol", "postgres-types", "rand 0.8.5", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", - "tokio-util", + "tokio-util 0.7.10", "whoami", ] +[[package]] +name = "tokio-retry" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" +dependencies = [ + "pin-project", + "rand 0.8.5", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.24.1" @@ -5814,6 +7854,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -5851,14 +7905,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325" +checksum = "af06656561d28735e9c1cd63dfd57132c8155426aa6af24f36a00a351f88c48e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.1", + "toml_edit 0.22.7", ] [[package]] @@ -5876,11 +7930,11 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] @@ -5889,13 +7943,93 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.5", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18769cd1cec395d70860ceb4d932812a0b4d06b1a4bb336745a4d21b9496e992" +dependencies = [ + "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.5", +] + +[[package]] +name = "tonic" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +dependencies = [ + "async-stream", + "async-trait", + "base64 0.13.1", + "bytes", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + +[[package]] +name = "tonic-build" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757" +dependencies = [ + "proc-macro2", + "prost-build", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand 0.8.5", + "slab", + "tokio", + "tokio-util 0.7.10", + "tower-layer", + "tower-service", + "tracing", ] +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -5916,16 +8050,29 @@ dependencies = [ [[package]] name = "tracing-actix-web" -version = "0.6.2" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d725b8fa6ef307b3f4856913523337de45c47cc79271bafd7acfb39559e3a2da" +checksum = "fa069bd1503dd526ee793bb3fce408895136c95fc86d2edb2acf1c646d7f0684" dependencies = [ "actix-web", + "mutually_exclusive_features", "pin-project", "tracing", "uuid", ] +[[package]] +name = "tracing-appender" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +dependencies = [ + "crossbeam-channel", + "thiserror", + "time", + "tracing-subscriber", +] + [[package]] name = "tracing-attributes" version = "0.1.27" @@ -5934,7 +8081,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -5979,6 +8126,20 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-opentelemetry" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +dependencies = [ + "once_cell", + "opentelemetry 0.17.0", + "tracing", + "tracing-core", + "tracing-log 0.1.4", + "tracing-subscriber", +] + [[package]] name = "tracing-opentelemetry" version = "0.19.0" @@ -5986,7 +8147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00a39dcf9bfc1742fa4d6215253b33a6e474be78275884c216fc2a06267b3600" dependencies = [ "once_cell", - "opentelemetry", + "opentelemetry 0.19.0", "tracing", "tracing-core", "tracing-log 0.1.4", @@ -6061,7 +8222,7 @@ version = "0.1.0" dependencies = [ "actix-web", "anyhow", - "clap 3.2.25", + "clap", "configuration", "database", "futures", @@ -6069,7 +8230,7 @@ dependencies = [ "humantime", "lazy_static", "near-indexer-primitives", - "near-jsonrpc-client", + "near-jsonrpc-client 0.8.0 (git+https://github.com/kobayurii/near-jsonrpc-client-rs.git?branch=0.8.2)", "near-lake-framework", "prometheus", "readnode-primitives", @@ -6096,6 +8257,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -6110,18 +8280,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -6135,6 +8305,12 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +[[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" @@ -6230,11 +8406,17 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -6242,24 +8424,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -6269,9 +8451,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6279,22 +8461,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-encoder" @@ -6305,6 +8487,28 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca90ba1b5b0a70d3d49473c5579951f3bddc78d47b59256d2f9d4922b150aca" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-streams" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wasmer-compiler-near" version = "2.4.1" @@ -6314,7 +8518,7 @@ dependencies = [ "enumset", "rkyv", "smallvec", - "target-lexicon 0.12.13", + "target-lexicon 0.12.14", "thiserror", "wasmer-types-near", "wasmer-vm-near", @@ -6352,7 +8556,7 @@ dependencies = [ "memmap2", "more-asserts", "rustc-demangle", - "target-lexicon 0.12.13", + "target-lexicon 0.12.14", "thiserror", "wasmer-compiler-near", "wasmer-types-near", @@ -6394,7 +8598,7 @@ dependencies = [ "indexmap 1.9.3", "lazy_static", "libc", - "nix", + "nix 0.15.0", "page_size", "parking_lot 0.10.2", "rustc_version 0.2.3", @@ -6435,7 +8639,7 @@ dependencies = [ "dynasmrt 1.2.3", "lazy_static", "libc", - "nix", + "nix 0.15.0", "serde", "serde_derive", "smallvec", @@ -6497,9 +8701,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.103.0" +version = "0.105.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c437373cac5ea84f1113d648d51f71751ffbe3d90c00ae67618cf20d0b5ee7b" +checksum = "83be9e0b3f9570dc1979a33ae7b89d032c73211564232b99976553e5c155ec32" dependencies = [ "indexmap 1.9.3", "url", @@ -6507,12 +8711,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.105.0" +version = "0.115.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83be9e0b3f9570dc1979a33ae7b89d032c73211564232b99976553e5c155ec32" +checksum = "e06c0641a4add879ba71ccb3a1e4278fd546f76f1eafb21d8f7b07733b547cd5" dependencies = [ - "indexmap 1.9.3", - "url", + "indexmap 2.2.5", + "semver 1.0.22", ] [[package]] @@ -6527,26 +8731,28 @@ dependencies = [ [[package]] name = "wasmtime" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634357e8668774b24c80b210552f3f194e2342a065d6d83845ba22c5817d0770" +checksum = "ca54f6090ce46973f33a79f265924b204f248f91aec09229bce53d19d567c1a6" dependencies = [ "anyhow", "bincode", "bumpalo", "cfg-if 1.0.0", "fxprof-processed-profile", - "indexmap 1.9.3", + "indexmap 2.2.5", "libc", "log", - "object 0.30.4", + "object", "once_cell", "paste", "psm", "serde", + "serde_derive", "serde_json", - "target-lexicon 0.12.13", - "wasmparser 0.103.0", + "target-lexicon 0.12.14", + "wasm-encoder 0.35.0", + "wasmparser 0.115.0", "wasmtime-cranelift", "wasmtime-environ", "wasmtime-jit", @@ -6556,88 +8762,93 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d33c73c24ce79b0483a3b091a9acf88871f4490b88998e8974b22236264d304c" +checksum = "54984bc0b5689da87a43d7c181d23092b4d5cfcbb7ae3eb6b917dd55865d95e6" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "wasmtime-cranelift" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5800616a28ed6bd5e8b99ea45646c956d798ae030494ac0689bc3e45d3b689c1" +checksum = "1cf3cee8be02f5006d21b773ffd6802f96a0b7d661ff2ad8a01fb93df458b1aa" dependencies = [ "anyhow", + "cfg-if 1.0.0", "cranelift-codegen", "cranelift-control", "cranelift-entity", "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.27.3", + "gimli", "log", - "object 0.30.4", - "target-lexicon 0.12.13", + "object", + "target-lexicon 0.12.14", "thiserror", - "wasmparser 0.103.0", + "wasmparser 0.115.0", "wasmtime-cranelift-shared", "wasmtime-environ", + "wasmtime-versioned-export-macros", ] [[package]] name = "wasmtime-cranelift-shared" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e4030b959ac5c5d6ee500078977e813f8768fa2b92fc12be01856cd0c76c55" +checksum = "420fd2a69bc162957f4c94f21c7fa08ecf60d916f4e87b56332507c555da381d" dependencies = [ "anyhow", "cranelift-codegen", "cranelift-control", "cranelift-native", - "gimli 0.27.3", - "object 0.30.4", - "target-lexicon 0.12.13", + "gimli", + "object", + "target-lexicon 0.12.14", "wasmtime-environ", ] [[package]] name = "wasmtime-environ" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec815d01a8d38aceb7ed4678f9ba551ae6b8a568a63810ac3ad9293b0fd01c8" +checksum = "fb6a445ce2b2810127caee6c1b79b8da4ae57712b05556a674592c18b7500a14" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.27.3", - "indexmap 1.9.3", + "gimli", + "indexmap 2.2.5", "log", - "object 0.30.4", + "object", "serde", - "target-lexicon 0.12.13", + "serde_derive", + "target-lexicon 0.12.14", "thiserror", - "wasmparser 0.103.0", + "wasmparser 0.115.0", "wasmtime-types", ] [[package]] name = "wasmtime-jit" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2712eafe829778b426cad0e1769fef944898923dd29f0039e34e0d53ba72b234" +checksum = "1f0f6586c61125fbfc13c3108c3dd565d21f314dd5bac823b9a5b7ab576d21f1" dependencies = [ - "addr2line 0.19.0", + "addr2line", "anyhow", "bincode", "cfg-if 1.0.0", "cpp_demangle", - "gimli 0.27.3", + "gimli", "log", - "object 0.30.4", + "object", "rustc-demangle", + "rustix", "serde", - "target-lexicon 0.12.13", + "serde_derive", + "target-lexicon 0.12.14", "wasmtime-environ", "wasmtime-jit-icache-coherence", "wasmtime-runtime", @@ -6646,18 +8857,19 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fb78eacf4a6e47260d8ef8cc81ea8ddb91397b2e848b3fb01567adebfe89b5" +checksum = "109a9e46afe33580b952b14a4207354355f19bcdf0b47485b397b68409eaf553" dependencies = [ "once_cell", + "wasmtime-versioned-export-macros", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1364900b05f7d6008516121e8e62767ddb3e176bdf4c84dfa85da1734aeab79" +checksum = "f67e6be36375c39cff57ed3b137ab691afbf2d9ba8ee1c01f77888413f218749" dependencies = [ "cfg-if 1.0.0", "libc", @@ -6666,60 +8878,122 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a16ffe4de9ac9669175c0ea5c6c51ffc596dfb49320aaa6f6c57eff58cef069" +checksum = "1d07986b2327b5e7f535ed638fbde25990fc8f85400194fda0d26db71c7b685e" dependencies = [ "anyhow", "cc", "cfg-if 1.0.0", - "indexmap 1.9.3", + "indexmap 2.2.5", "libc", "log", "mach", "memfd", - "memoffset 0.8.0", + "memoffset 0.9.0", "paste", "rand 0.8.5", - "rustix 0.37.27", + "rustix", + "sptr", + "wasm-encoder 0.35.0", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", + "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", "windows-sys 0.48.0", ] [[package]] name = "wasmtime-types" -version = "9.0.4" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19961c9a3b04d5e766875a5c467f6f5d693f508b3e81f8dc4a1444aa94f041c9" +checksum = "e810a0d2e869abd1cb42bd232990f6bd211672b3d202d2ae7e70ffb97ed70ea3" dependencies = [ "cranelift-entity", "serde", + "serde_derive", "thiserror", - "wasmparser 0.103.0", + "wasmparser 0.115.0", ] +[[package]] +name = "wasmtime-versioned-export-macros" +version = "14.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b5575a75e711ca6c36bb9ad647c93541cdc8e34218031acba5da3f35919dd3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "wasmtime-wmemcheck" +version = "14.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dafab2db172a53e23940e0fa3078c202f567ee5f13f4b42f66b694fab43c658" + [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webrtc-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" +dependencies = [ + "async-trait", + "bitflags 1.3.2", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix 0.24.3", + "rand 0.8.5", + "thiserror", + "tokio", + "winapi", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "whoami" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "wasm-bindgen", + "redox_syscall 0.4.1", + "wasite", "web-sys", ] +[[package]] +name = "wildmatch" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9d63b4687b0737f3b9e0f3a299ffd65824623859303a8e148443c3611c5c445" + [[package]] name = "winapi" version = "0.3.9" @@ -6736,28 +9010,29 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.4", +] + [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -6775,7 +9050,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -6795,17 +9070,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -6816,9 +9091,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -6828,9 +9103,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -6840,9 +9115,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -6852,9 +9127,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -6864,9 +9139,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -6876,9 +9151,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -6888,15 +9163,24 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winnow" -version = "0.5.37" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -6920,12 +9204,33 @@ dependencies = [ "tap", ] +[[package]] +name = "xml-rs" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + [[package]] name = "xmlparser" version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" +[[package]] +name = "xz2" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" +dependencies = [ + "lzma-sys", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "zerocopy" version = "0.7.32" @@ -6943,7 +9248,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -6951,20 +9256,6 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] [[package]] name = "zeropool-bn" @@ -6972,7 +9263,6 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" dependencies = [ - "borsh 0.9.3", "byteorder", "crunchy", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index ca4be70a..f9af9f04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ "configuration", "database", "epoch-indexer", + "near-state-indexer", "perf-testing", "readnode-primitives", "rpc-server", @@ -19,15 +20,24 @@ members = [ "tx-indexer", ] -[patch.crates-io] -near-chain-configs = { git = 'https://github.com/near/nearcore.git', branch = '1.36.0' } -near-crypto = { git = 'https://github.com/near/nearcore.git', branch = '1.36.0' } -near-jsonrpc-primitives = { git = 'https://github.com/near/nearcore.git', branch = '1.36.0' } -near-indexer-primitives = { git = 'https://github.com/near/nearcore.git', branch = '1.36.0' } -near-primitives = { git = 'https://github.com/near/nearcore.git', branch = '1.36.0' } -near-vm-runner = { git = 'https://github.com/near/nearcore.git', branch = '1.36.0' } +[workspace.dependencies] -# TODO: We use forks to resolve nearcore dependency conflicts. -# After updating the dependencies, we should use the published versions of the crates. -near-jsonrpc-client = { git = 'https://github.com/kobayurii/near-jsonrpc-client-rs.git', branch = '0.7.0' } -near-lake-framework = { git = 'https://github.com/kobayurii/near-lake-framework-rs.git', branch = '0.7.9' } +configuration = { path = "configuration" } +database = { path = "database" } +readnode-primitives = { path = "readnode-primitives" } +epoch-indexer = { path = "epoch-indexer" } + +# Please, update the supported nearcore version in .cargo/config.toml file +near-indexer = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-client = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-o11y = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-indexer-primitives = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-primitives = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-chain-configs = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-crypto = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-jsonrpc-primitives = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-parameters = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } +near-vm-runner = { git = 'https://github.com/near/nearcore.git', rev = '836dbb7971a8d183e02f95d81d8a9ae18e731b37' } + +near-lake-framework = { git = 'https://github.com/kobayurii/near-lake-framework-rs.git', branch = '0.7.8' } +near-jsonrpc-client = { git = 'https://github.com/kobayurii/near-jsonrpc-client-rs.git', branch = '0.8.2'} diff --git a/README.md b/README.md index 10e52b17..1183224c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ The JSON RPC server implementation that repeats all the APIs current real NEAR J The indexer built on top of Lake Framework that watches the network and stores the `StateChanges` into the Storage (ScyllaDB) using the designed data schemas. +### [near-state-indexer](near-state-indexer/README.md) + +The indexer built on [NEAR Indexer Framework](https://github.com/nearprotocol/nearcore/tree/master/chain/indexer) + ### [tx-indexer](tx-indexer/README.md) The indexer built on top of Lake Framework that watches the network and stores the `Transactions` along with all the related entities (`Receipts`, `ExecutionOutcomes`) into the Storage (ScyllaDB) using the specifically defined `TransactionDetails` structure in a dumped way (using the simplest key-value schema) diff --git a/config.toml b/config.toml index d9414bf4..d0d4dfb7 100644 --- a/config.toml +++ b/config.toml @@ -5,6 +5,7 @@ chain_id = "${CHAIN_ID}" near_rpc_url = "${NEAR_RPC_URL}" near_archival_rpc_url = "${ARCHIVAL_NEAR_RPC_URL}" +redis_url = "${REDIS_URL}" [general.rpc_server] referer_header_value = "${REFERER_HEADER_VALUE}" @@ -25,6 +26,10 @@ indexer_id = "${STATE_INDEXER_ID}" metrics_server_port = "${STATE_SERVER_PORT}" concurrency = "${CONCURRENCY}" +[general.near_state_indexer] +metrics_server_port = "${NEAR_STATE_SERVER_PORT}" +concurrency = "${NEAR_STATE_CONCURRENCY}" + [general.epoch_indexer] indexer_id = "${EPOCH_INDEXER_ID}" diff --git a/configuration/Cargo.toml b/configuration/Cargo.toml index a88ce207..7d8ff12e 100644 --- a/configuration/Cargo.toml +++ b/configuration/Cargo.toml @@ -9,9 +9,9 @@ license.workspace = true [dependencies] anyhow = "1.0.70" -aws-credential-types = "1.0.0" -aws-sdk-s3 = { version = "0.39.1", features = ["behavior-version-latest"] } -aws-types = "1.0.0" +aws-credential-types = "1.1.4" +aws-sdk-s3 = { version = "1.14.0", features = ["behavior-version-latest"] } +aws-types = "1.1.4" dotenv = "0.15.0" lazy_static = "1.4.0" regex = "1.10.2" @@ -35,7 +35,7 @@ tracing-subscriber = { version = "0.3.15", features = [ tracing-opentelemetry = { version = "0.19", optional = true } tracing-stackdriver = "0.7.2" # GCP logs -near-lake-framework = "0.7.9" +near-lake-framework.workspace = true [features] tracing-instrumentation = ["dep:opentelemetry-jaeger", "dep:tracing-opentelemetry"] diff --git a/configuration/README.md b/configuration/README.md index bda68b95..583f92bd 100644 --- a/configuration/README.md +++ b/configuration/README.md @@ -26,6 +26,7 @@ The configuration settings are stored in a TOML file. The settings include: - RPC server settings like the server port and max gas burnt for contract function call. - Transaction indexer settings like the indexer ID and port for the metrics server. - State indexer settings like the indexer ID and port for the metrics server. +- Near State indexer settings like the port for the metrics server. - Epoch indexer settings like the indexer ID. - Rightsizing settings like the accounts and state changes to track. - Lake framework settings like the AWS access key ID and secret access key. diff --git a/configuration/example.config.toml b/configuration/example.config.toml index e708681c..f15f9958 100644 --- a/configuration/example.config.toml +++ b/configuration/example.config.toml @@ -15,6 +15,11 @@ near_rpc_url = "https://beta.rpc.mainnet.near.org" ## default value is None #near_archival_rpc_url = "https://beta.rpc.mainnet.near.org" +## redis url using for pub/sub optimistic_block and finale_block +## from near_state_indexer to rpc_server +## Default value is redis://127.0.0.1/ +#redis_url = "redis://127.0.0.1/" + ### Rpc server general configuration [general.rpc_server] @@ -88,6 +93,17 @@ near_rpc_url = "https://beta.rpc.mainnet.near.org" ## Default value is 1 #concurrency = 1 +### Near state indexer general configuration +[general.near_state_indexer] + +## Port for metrics server +## By default it 8082 +#metrics_server_port = 8082 + +## Concurrency for state-indexer +## Default value is 1 +#concurrency = 1 + ## Epoch indexer general configuration [general.epoch_indexer] diff --git a/configuration/src/configs/general.rs b/configuration/src/configs/general.rs index 47fb5d7b..73875eb8 100644 --- a/configuration/src/configs/general.rs +++ b/configuration/src/configs/general.rs @@ -2,13 +2,16 @@ use std::str::FromStr; use serde_derive::Deserialize; -use crate::configs::{deserialize_data_or_env, deserialize_optional_data_or_env}; +use crate::configs::{ + deserialize_data_or_env, deserialize_optional_data_or_env, required_value_or_panic, +}; #[derive(Debug, Clone)] pub struct GeneralRpcServerConfig { pub chain_id: ChainId, pub near_rpc_url: String, pub near_archival_rpc_url: Option, + pub redis_url: String, pub referer_header_value: String, pub server_port: u16, pub max_gas_burnt: u64, @@ -38,6 +41,13 @@ pub struct GeneralStateIndexerConfig { pub concurrency: usize, } +#[derive(Debug, Clone)] +pub struct GeneralNearStateIndexerConfig { + pub chain_id: ChainId, + pub redis_url: String, + pub concurrency: usize, +} + #[derive(Debug, Clone)] pub struct GeneralEpochIndexerConfig { pub chain_id: ChainId, @@ -50,10 +60,12 @@ pub struct GeneralEpochIndexerConfig { pub struct CommonGeneralConfig { #[serde(deserialize_with = "deserialize_data_or_env")] pub chain_id: ChainId, - #[serde(deserialize_with = "deserialize_data_or_env")] - pub near_rpc_url: String, + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub near_rpc_url: Option, #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] pub near_archival_rpc_url: Option, + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub redis_url: Option, #[serde(default)] pub rpc_server: CommonGeneralRpcServerConfig, #[serde(default)] @@ -61,6 +73,8 @@ pub struct CommonGeneralConfig { #[serde(default)] pub state_indexer: CommonGeneralStateIndexerConfig, #[serde(default)] + pub near_state_indexer: CommonGeneralNearStateIndexerConfig, + #[serde(default)] pub epoch_indexer: CommonGeneralEpochIndexerConfig, } @@ -70,6 +84,8 @@ pub enum ChainId { #[default] Mainnet, Testnet, + Betanet, + Localnet, } impl FromStr for ChainId { @@ -79,6 +95,8 @@ impl FromStr for ChainId { match s { "mainnet" => Ok(ChainId::Mainnet), "testnet" => Ok(ChainId::Testnet), + "localnet" => Ok(ChainId::Localnet), + "betanet" => Ok(ChainId::Betanet), _ => Err(anyhow::anyhow!("Invalid chain id")), } } @@ -210,6 +228,26 @@ impl Default for CommonGeneralStateIndexerConfig { } } +#[derive(Deserialize, Debug, Clone)] +pub struct CommonGeneralNearStateIndexerConfig { + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub concurrency: Option, +} + +impl CommonGeneralNearStateIndexerConfig { + pub fn default_concurrency() -> usize { + 1 + } +} + +impl Default for CommonGeneralNearStateIndexerConfig { + fn default() -> Self { + Self { + concurrency: Some(Self::default_concurrency()), + } + } +} + #[derive(Deserialize, Debug, Clone)] pub struct CommonGeneralEpochIndexerConfig { #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] @@ -234,8 +272,11 @@ impl From for GeneralRpcServerConfig { fn from(common_config: CommonGeneralConfig) -> Self { Self { chain_id: common_config.chain_id, - near_rpc_url: common_config.near_rpc_url, + near_rpc_url: required_value_or_panic("near_rpc_url", common_config.near_rpc_url), near_archival_rpc_url: common_config.near_archival_rpc_url, + redis_url: common_config + .redis_url + .unwrap_or("redis://127.0.0.1/".to_string()), referer_header_value: common_config .rpc_server .referer_header_value @@ -269,7 +310,7 @@ impl From for GeneralTxIndexerConfig { fn from(common_config: CommonGeneralConfig) -> Self { Self { chain_id: common_config.chain_id, - near_rpc_url: common_config.near_rpc_url, + near_rpc_url: required_value_or_panic("near_rpc_url", common_config.near_rpc_url), near_archival_rpc_url: common_config.near_archival_rpc_url, indexer_id: common_config .tx_indexer @@ -291,7 +332,7 @@ impl From for GeneralStateIndexerConfig { fn from(common_config: CommonGeneralConfig) -> Self { Self { chain_id: common_config.chain_id, - near_rpc_url: common_config.near_rpc_url, + near_rpc_url: required_value_or_panic("near_rpc_url", common_config.near_rpc_url), near_archival_rpc_url: common_config.near_archival_rpc_url, indexer_id: common_config .state_indexer @@ -309,11 +350,26 @@ impl From for GeneralStateIndexerConfig { } } +impl From for GeneralNearStateIndexerConfig { + fn from(common_config: CommonGeneralConfig) -> Self { + Self { + chain_id: common_config.chain_id, + redis_url: common_config + .redis_url + .unwrap_or("redis://127.0.0.1/".to_string()), + concurrency: common_config + .near_state_indexer + .concurrency + .unwrap_or_else(CommonGeneralNearStateIndexerConfig::default_concurrency), + } + } +} + impl From for GeneralEpochIndexerConfig { fn from(common_config: CommonGeneralConfig) -> Self { Self { chain_id: common_config.chain_id, - near_rpc_url: common_config.near_rpc_url, + near_rpc_url: required_value_or_panic("near_rpc_url", common_config.near_rpc_url), near_archival_rpc_url: common_config.near_archival_rpc_url, indexer_id: common_config .epoch_indexer diff --git a/configuration/src/configs/lake.rs b/configuration/src/configs/lake.rs index 15b1d351..1f781c63 100644 --- a/configuration/src/configs/lake.rs +++ b/configuration/src/configs/lake.rs @@ -1,17 +1,13 @@ use near_lake_framework::near_indexer_primitives::near_primitives; use serde_derive::Deserialize; -use crate::configs::deserialize_data_or_env; +use crate::configs::{deserialize_optional_data_or_env, required_value_or_panic}; -#[derive(Deserialize, Debug, Clone, Default)] +#[derive(Debug, Clone)] pub struct LakeConfig { - #[serde(deserialize_with = "deserialize_data_or_env")] pub aws_access_key_id: String, - #[serde(deserialize_with = "deserialize_data_or_env")] pub aws_secret_access_key: String, - #[serde(deserialize_with = "deserialize_data_or_env")] pub aws_default_region: String, - #[serde(deserialize_with = "deserialize_data_or_env")] pub aws_bucket_name: String, } @@ -53,3 +49,38 @@ impl LakeConfig { )) } } + +#[derive(Deserialize, Debug, Clone, Default)] +pub struct CommonLakeConfig { + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub aws_access_key_id: Option, + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub aws_secret_access_key: Option, + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub aws_default_region: Option, + #[serde(deserialize_with = "deserialize_optional_data_or_env", default)] + pub aws_bucket_name: Option, +} + +impl From for LakeConfig { + fn from(common_config: CommonLakeConfig) -> Self { + Self { + aws_access_key_id: required_value_or_panic( + "aws_access_key_id", + common_config.aws_access_key_id, + ), + aws_secret_access_key: required_value_or_panic( + "aws_secret_access_key", + common_config.aws_secret_access_key, + ), + aws_default_region: required_value_or_panic( + "aws_default_region", + common_config.aws_default_region, + ), + aws_bucket_name: required_value_or_panic( + "aws_bucket_name", + common_config.aws_bucket_name, + ), + } + } +} diff --git a/configuration/src/configs/mod.rs b/configuration/src/configs/mod.rs index 841cb735..1c54dc5b 100644 --- a/configuration/src/configs/mod.rs +++ b/configuration/src/configs/mod.rs @@ -14,6 +14,14 @@ lazy_static::lazy_static! { static ref RE_NAME_ENV: regex::Regex = regex::Regex::new(r"\$\{(?\w+)}").unwrap(); } +fn required_value_or_panic(config_name: &str, value: Option) -> T { + if let Some(value) = value { + value + } else { + panic!("Config `{}` is required!", config_name) + } +} + fn get_env_var(env_var_name: &str) -> anyhow::Result where T: FromStr, @@ -70,7 +78,7 @@ pub struct CommonConfig { pub general: general::CommonGeneralConfig, #[serde(default)] pub rightsizing: rightsizing::CommonRightsizingConfig, - pub lake_config: lake::LakeConfig, + pub lake_config: lake::CommonLakeConfig, pub database: database::CommonDatabaseConfig, } @@ -89,7 +97,7 @@ impl Config for RpcServerConfig { fn from_common_config(common_config: CommonConfig) -> Self { Self { general: common_config.general.into(), - lake_config: common_config.lake_config, + lake_config: common_config.lake_config.into(), database: database::DatabaseRpcServerConfig::from(common_config.database).into(), } } @@ -117,7 +125,7 @@ impl Config for TxIndexerConfig { Self { general: common_config.general.into(), rightsizing: common_config.rightsizing.into(), - lake_config: common_config.lake_config, + lake_config: common_config.lake_config.into(), database: database::DatabaseTxIndexerConfig::from(common_config.database).into(), } } @@ -142,7 +150,30 @@ impl Config for StateIndexerConfig { Self { general: common_config.general.into(), rightsizing: common_config.rightsizing.into(), - lake_config: common_config.lake_config, + lake_config: common_config.lake_config.into(), + database: database::DatabaseStateIndexerConfig::from(common_config.database).into(), + } + } +} + +#[derive(Debug, Clone)] +pub struct NearStateIndexerConfig { + pub general: general::GeneralNearStateIndexerConfig, + pub rightsizing: rightsizing::RightsizingConfig, + pub database: database::DatabaseConfig, +} + +impl NearStateIndexerConfig { + pub fn state_should_be_indexed(&self, state_change_value: &StateChangeValueView) -> bool { + self.rightsizing.state_should_be_indexed(state_change_value) + } +} + +impl Config for NearStateIndexerConfig { + fn from_common_config(common_config: CommonConfig) -> Self { + Self { + general: common_config.general.into(), + rightsizing: common_config.rightsizing.into(), database: database::DatabaseStateIndexerConfig::from(common_config.database).into(), } } @@ -159,7 +190,7 @@ impl Config for EpochIndexerConfig { fn from_common_config(common_config: CommonConfig) -> Self { Self { general: common_config.general.into(), - lake_config: common_config.lake_config, + lake_config: common_config.lake_config.into(), database: database::DatabaseStateIndexerConfig::from(common_config.database).into(), } } diff --git a/configuration/src/lib.rs b/configuration/src/lib.rs index 6081c859..c368b764 100644 --- a/configuration/src/lib.rs +++ b/configuration/src/lib.rs @@ -7,7 +7,8 @@ mod configs; pub use crate::configs::database::DatabaseConfig; pub use crate::configs::general::ChainId; pub use crate::configs::{ - EpochIndexerConfig, RpcServerConfig, StateIndexerConfig, TxIndexerConfig, + EpochIndexerConfig, NearStateIndexerConfig, RpcServerConfig, StateIndexerConfig, + TxIndexerConfig, }; pub async fn read_configuration() -> anyhow::Result diff --git a/database/Cargo.toml b/database/Cargo.toml index 9013ea6f..4a7fa50e 100644 --- a/database/Cargo.toml +++ b/database/Cargo.toml @@ -11,39 +11,40 @@ license.workspace = true anyhow = "1.0.70" async-trait = "0.1.66" bigdecimal = { version = "0.4.2", optional = true } -borsh = "0.10.2" -bytes = "1.0.1" +borsh = "1.3.1" +bytes = "1.5.0" diesel = { version = "2.1.3", features = ["postgres", "numeric", "serde_json"], optional = true } diesel-async = { version = "0.4.1", features = ["postgres", "deadpool"], optional = true } diesel_migrations = { version = "2.1.0", optional = true } futures = "0.3.5" hex = "0.4.3" prettytable-rs = { version = "0.10", optional = true } -num-bigint = { version = "0.3", optional = true } +num-bigint = { version = "0.4.4", optional = true } num-traits = { version = "0.2.15", optional = true } -scylla = { version = "0.9.0", optional = true } +scylla = { version = "0.12.0", features = ["full-serialization"], optional = true } +scylla-cql = { version = "0.1.0", optional = true } serde = { version = "1.0.145", features = ["derive"]} serde_json = "1.0.85" -tokio = { version = "1.19.2", features = [ +tokio = { version = "1.36.0", features = [ "sync", "time", "macros", "rt-multi-thread", ] } tracing = "0.1.34" -uuid = { version = "1.3.0", optional = true } +uuid = { version = "1.7.0", optional = true } -configuration = { path = "../configuration" } -readnode-primitives = { path = "../readnode-primitives" } +configuration.workspace = true +readnode-primitives.workspace = true -near-chain-configs = "1.36.0" -near-primitives = "1.36.0" -near-crypto = "1.36.0" -near-indexer-primitives = "1.36.0" +near-chain-configs.workspace = true +near-primitives.workspace = true +near-crypto.workspace = true +near-indexer-primitives.workspace = true [features] default = ["scylla_db"] postgres_db = ["dep:diesel", "dep:diesel-async", "dep:diesel_migrations", "dep:bigdecimal"] -scylla_db = ["dep:scylla", "dep:num-bigint", "dep:num-traits"] +scylla_db = ["dep:scylla", "dep:scylla-cql", "dep:num-bigint", "dep:num-traits"] scylla_db_tracing = ["dep:prettytable-rs", "dep:uuid", "scylla_db"] account_access_keys = [] diff --git a/database/src/base/rpc_server.rs b/database/src/base/rpc_server.rs index 5bda1a67..a4f40997 100644 --- a/database/src/base/rpc_server.rs +++ b/database/src/base/rpc_server.rs @@ -112,10 +112,4 @@ pub trait ReaderDbManager { &self, block_height: near_primitives::types::BlockHeight, ) -> anyhow::Result; - - /// Return protocol config by the given epoch id - async fn get_protocol_config_by_epoch_id( - &self, - epoch_id: near_primitives::hash::CryptoHash, - ) -> anyhow::Result; } diff --git a/database/src/base/state_indexer.rs b/database/src/base/state_indexer.rs index 844d38a5..b355040b 100644 --- a/database/src/base/state_indexer.rs +++ b/database/src/base/state_indexer.rs @@ -119,17 +119,135 @@ pub trait StateIndexerDbManager { validators_info: &near_primitives::views::EpochValidatorInfo, ) -> anyhow::Result<()>; - async fn add_protocol_config( - &self, - epoch_id: near_indexer_primitives::CryptoHash, - epoch_height: u64, - epoch_start_height: u64, - protocol_config: &near_chain_configs::ProtocolConfigView, - ) -> anyhow::Result<()>; - async fn update_epoch_end_height( &self, epoch_id: near_indexer_primitives::CryptoHash, epoch_end_block_hash: near_indexer_primitives::CryptoHash, ) -> anyhow::Result<()>; + + async fn save_block( + &self, + block_height: u64, + block_hash: near_indexer_primitives::CryptoHash, + chunks: Vec<( + crate::primitives::ChunkHash, + crate::primitives::ShardId, + crate::primitives::HeightIncluded, + )>, + ) -> anyhow::Result<()> { + let add_block_future = self.add_block(block_height, block_hash); + let add_chunks_future = self.add_chunks(block_height, chunks); + + futures::try_join!(add_block_future, add_chunks_future)?; + Ok(()) + } + + async fn save_state_change( + &self, + state_change: &near_primitives::views::StateChangeWithCauseView, + block_height: u64, + block_hash: near_indexer_primitives::CryptoHash, + ) -> anyhow::Result<()> { + match &state_change.value { + near_primitives::views::StateChangeValueView::DataUpdate { + account_id, + key, + value, + } => { + self.add_state_changes( + account_id.clone(), + block_height, + block_hash, + key.as_ref(), + value.as_ref(), + ) + .await? + } + near_primitives::views::StateChangeValueView::DataDeletion { account_id, key } => { + self.delete_state_changes( + account_id.clone(), + block_height, + block_hash, + key.as_ref(), + ) + .await? + } + near_primitives::views::StateChangeValueView::AccessKeyUpdate { + account_id, + public_key, + access_key, + } => { + let data_key = borsh::to_vec(&public_key)?; + let data_value = borsh::to_vec(&access_key)?; + let add_access_key_future = self.add_access_key( + account_id.clone(), + block_height, + block_hash, + &data_key, + &data_value, + ); + + #[cfg(feature = "account_access_keys")] + { + let add_account_access_keys_future = self.add_account_access_keys( + account_id.clone(), + block_height, + &data_key, + Some(&data_value), + ); + futures::try_join!(add_access_key_future, add_account_access_keys_future)?; + } + #[cfg(not(feature = "account_access_keys"))] + add_access_key_future.await?; + } + near_primitives::views::StateChangeValueView::AccessKeyDeletion { + account_id, + public_key, + } => { + let data_key = borsh::to_vec(&public_key)?; + let delete_access_key_future = + self.delete_access_key(account_id.clone(), block_height, block_hash, &data_key); + + #[cfg(feature = "account_access_keys")] + { + let delete_account_access_keys_future = self.add_account_access_keys( + account_id.clone(), + block_height, + &data_key, + None, + ); + futures::try_join!( + delete_access_key_future, + delete_account_access_keys_future + )?; + } + #[cfg(not(feature = "account_access_keys"))] + delete_access_key_future.await?; + } + near_primitives::views::StateChangeValueView::ContractCodeUpdate { + account_id, + code, + } => { + self.add_contract_code(account_id.clone(), block_height, block_hash, code.as_ref()) + .await? + } + near_primitives::views::StateChangeValueView::ContractCodeDeletion { account_id } => { + self.delete_contract_code(account_id.clone(), block_height, block_hash) + .await? + } + near_primitives::views::StateChangeValueView::AccountUpdate { + account_id, + account, + } => { + let value = borsh::to_vec(&near_primitives::account::Account::from(account))?; + self.add_account(account_id.clone(), block_height, block_hash, value) + .await? + } + near_primitives::views::StateChangeValueView::AccountDeletion { account_id } => { + self.delete_account(account_id.clone(), block_height, block_hash) + .await? + } + } + Ok(()) + } } diff --git a/database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/down.sql b/database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/down.sql new file mode 100644 index 00000000..ba404b22 --- /dev/null +++ b/database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/down.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS protocol_configs ( + epoch_id text NOT NULL, + epoch_height numeric(20,0) NOT NULL, + epoch_start_height numeric(20,0) NOT NULL, + epoch_end_height numeric(20,0) NULL, + protocol_config jsonb NOT NULL +); + +ALTER TABLE ONLY protocol_configs + ADD CONSTRAINT protocol_config_pk PRIMARY KEY (epoch_id); diff --git a/database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/up.sql b/database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/up.sql new file mode 100644 index 00000000..f3bfe3a2 --- /dev/null +++ b/database/src/postgres/migrations/2024-02-14-125531_delete_protocol_configs/up.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS protocol_configs; diff --git a/database/src/postgres/models.rs b/database/src/postgres/models.rs index cb6219ea..4f15ee26 100644 --- a/database/src/postgres/models.rs +++ b/database/src/postgres/models.rs @@ -1,5 +1,4 @@ use crate::schema::*; -use borsh::{BorshDeserialize, BorshSerialize}; use diesel::prelude::*; use diesel_async::RunQueryDsl; @@ -362,7 +361,7 @@ impl AccountState { page_token: crate::PageToken, ) -> anyhow::Result<(Vec, crate::PageToken)> { let page_state = if let Some(page_state_token) = page_token { - PageState::try_from_slice(&hex::decode(page_state_token)?)? + borsh::from_slice::(&hex::decode(page_state_token)?)? } else { PageState::new(1000) }; @@ -384,7 +383,7 @@ impl AccountState { } else { Ok(( state_keys, - Some(hex::encode(page_state.next_page().try_to_vec()?)), + Some(hex::encode(borsh::to_vec(&page_state.next_page())?)), )) } } @@ -735,53 +734,3 @@ impl Validators { Ok(response) } } - -#[derive(Insertable, Queryable, Selectable)] -#[diesel(table_name = protocol_configs)] -pub struct ProtocolConfig { - pub epoch_id: String, - pub epoch_height: bigdecimal::BigDecimal, - pub epoch_start_height: bigdecimal::BigDecimal, - pub epoch_end_height: Option, - pub protocol_config: serde_json::Value, -} - -impl ProtocolConfig { - pub async fn insert_or_ignore( - &self, - mut conn: crate::postgres::PgAsyncConn, - ) -> anyhow::Result<()> { - diesel::insert_into(protocol_configs::table) - .values(self) - .on_conflict_do_nothing() - .execute(&mut conn) - .await?; - Ok(()) - } - - pub async fn update_epoch_end_height( - mut conn: crate::postgres::PgAsyncConn, - epoch_id: near_indexer_primitives::CryptoHash, - epoch_end_height: bigdecimal::BigDecimal, - ) -> anyhow::Result<()> { - diesel::update(protocol_configs::table) - .filter(protocol_configs::epoch_id.eq(epoch_id.to_string())) - .set(protocol_configs::epoch_end_height.eq(epoch_end_height)) - .execute(&mut conn) - .await?; - Ok(()) - } - - pub async fn get_protocol_config( - mut conn: crate::postgres::PgAsyncConn, - epoch_id: near_indexer_primitives::CryptoHash, - ) -> anyhow::Result { - let response = protocol_configs::table - .filter(protocol_configs::epoch_id.eq(epoch_id.to_string())) - .select(Self::as_select()) - .first(&mut conn) - .await?; - - Ok(response) - } -} diff --git a/database/src/postgres/rpc_server.rs b/database/src/postgres/rpc_server.rs index 652d0acc..fc294ea6 100644 --- a/database/src/postgres/rpc_server.rs +++ b/database/src/postgres/rpc_server.rs @@ -2,7 +2,6 @@ use std::str::FromStr; use crate::postgres::PostgresStorageManager; use bigdecimal::ToPrimitive; -use borsh::{BorshDeserialize, BorshSerialize}; pub struct PostgresDBManager { pg_pool: crate::postgres::PgAsyncPool, @@ -67,7 +66,7 @@ impl crate::ReaderDbManager for PostgresDBManager { ) -> anyhow::Result> { let result = crate::models::AccountState::get_state_keys_all( Self::get_connection(&self.pg_pool).await?, - account_id, + account_id.as_str(), ) .await? .into_iter() @@ -83,7 +82,7 @@ impl crate::ReaderDbManager for PostgresDBManager { let hex_str_prefix = hex::encode(prefix); let result = crate::models::AccountState::get_state_keys_by_prefix( Self::get_connection(&self.pg_pool).await?, - account_id, + account_id.as_str(), hex_str_prefix, ) .await? @@ -99,7 +98,7 @@ impl crate::ReaderDbManager for PostgresDBManager { ) -> anyhow::Result<(Vec, crate::PageToken)> { let (state_keys, next_page_token) = crate::models::AccountState::get_state_keys_by_page( Self::get_connection(&self.pg_pool).await?, - account_id, + account_id.as_str(), page_token, ) .await?; @@ -126,7 +125,7 @@ impl crate::ReaderDbManager for PostgresDBManager { }; let result = if let Ok(result) = crate::models::StateChangesData::get_state_key_value( connection, - account_id, + account_id.as_str(), block_height, hex::encode(key_data.clone()), ) @@ -146,7 +145,7 @@ impl crate::ReaderDbManager for PostgresDBManager { ) -> anyhow::Result> { let account_data = crate::models::StateChangesAccount::get_account( Self::get_connection(&self.pg_pool).await?, - account_id, + account_id.as_str(), request_block_height, ) .await?; @@ -176,7 +175,7 @@ impl crate::ReaderDbManager for PostgresDBManager { ) -> anyhow::Result>> { let contract_data = crate::models::StateChangesContract::get_contract( Self::get_connection(&self.pg_pool).await?, - account_id, + account_id.as_str(), request_block_height, ) .await?; @@ -205,10 +204,10 @@ impl crate::ReaderDbManager for PostgresDBManager { request_block_height: near_primitives::types::BlockHeight, public_key: near_crypto::PublicKey, ) -> anyhow::Result> { - let key_data = public_key.try_to_vec()?; + let key_data = borsh::to_vec(&public_key)?; let access_key_data = crate::models::StateChangesAccessKey::get_access_key( Self::get_connection(&self.pg_pool).await?, - account_id, + account_id.as_str(), request_block_height, hex::encode(key_data), ) @@ -241,7 +240,7 @@ impl crate::ReaderDbManager for PostgresDBManager { ) -> anyhow::Result>> { let active_access_keys = crate::models::StateChangesAccessKeys::get_active_access_keys( Self::get_connection(&self.pg_pool).await?, - &account_id, + account_id.as_str(), block_height, ) .await?; @@ -293,9 +292,7 @@ impl crate::ReaderDbManager for PostgresDBManager { transaction_hash, ) .await?; - Ok(readnode_primitives::TransactionDetails::try_from_slice( - &transaction_data, - )?) + Ok(borsh::from_slice::(&transaction_data)?) } async fn get_indexing_transaction_by_hash( @@ -308,7 +305,7 @@ impl crate::ReaderDbManager for PostgresDBManager { ) .await?; let mut transaction_details = - readnode_primitives::CollectingTransactionDetails::try_from_slice(&data_value)?; + borsh::from_slice::(&data_value)?; let result = crate::models::ReceiptOutcome::get_receipt_outcome( Self::get_connection(&self.pg_pool).await?, @@ -318,13 +315,10 @@ impl crate::ReaderDbManager for PostgresDBManager { .await?; for receipt_outcome in result { let receipt = - near_primitives::views::ReceiptView::try_from_slice(&receipt_outcome.receipt) - .expect("Failed to deserialize receipt"); - let execution_outcome = - near_primitives::views::ExecutionOutcomeWithIdView::try_from_slice( - &receipt_outcome.outcome, - ) - .expect("Failed to deserialize execution outcome"); + borsh::from_slice::(&receipt_outcome.receipt)?; + let execution_outcome = borsh::from_slice::< + near_primitives::views::ExecutionOutcomeWithIdView, + >(&receipt_outcome.outcome)?; transaction_details.receipts.push(receipt); transaction_details .execution_outcomes @@ -414,19 +408,4 @@ impl crate::ReaderDbManager for PostgresDBManager { validators_info, }) } - - async fn get_protocol_config_by_epoch_id( - &self, - epoch_id: near_indexer_primitives::CryptoHash, - ) -> anyhow::Result { - let protocol_config = crate::models::ProtocolConfig::get_protocol_config( - Self::get_connection(&self.pg_pool).await?, - epoch_id, - ) - .await?; - let (protocol_config,) = serde_json::from_value::<(near_chain_configs::ProtocolConfigView,)>( - protocol_config.protocol_config, - )?; - Ok(protocol_config) - } } diff --git a/database/src/postgres/schema.rs b/database/src/postgres/schema.rs index 2d7f1f2b..9ad3ba40 100644 --- a/database/src/postgres/schema.rs +++ b/database/src/postgres/schema.rs @@ -30,16 +30,6 @@ diesel::table! { } } -diesel::table! { - protocol_configs (epoch_id) { - epoch_id -> Text, - epoch_height -> Numeric, - epoch_start_height -> Numeric, - epoch_end_height -> Nullable, - protocol_config -> Jsonb, - } -} - diesel::table! { receipt_map (receipt_id) { receipt_id -> Text, @@ -138,7 +128,6 @@ diesel::allow_tables_to_appear_in_same_query!( block, chunk, meta, - protocol_configs, receipt_map, receipt_outcome, state_changes_access_key, diff --git a/database/src/postgres/state_indexer.rs b/database/src/postgres/state_indexer.rs index 3c122c77..a8fc14f4 100644 --- a/database/src/postgres/state_indexer.rs +++ b/database/src/postgres/state_indexer.rs @@ -112,7 +112,7 @@ impl crate::StateIndexerDbManager for PostgresDBManager { ) -> anyhow::Result>> { let active_access_keys = crate::models::StateChangesAccessKeys::get_active_access_keys( Self::get_connection(&self.pg_pool).await?, - &account_id, + account_id.as_str(), block_height, ) .await?; @@ -325,43 +325,18 @@ impl crate::StateIndexerDbManager for PostgresDBManager { Ok(()) } - async fn add_protocol_config( - &self, - epoch_id: near_indexer_primitives::CryptoHash, - epoch_height: u64, - epoch_start_height: u64, - protocol_config: &near_chain_configs::ProtocolConfigView, - ) -> anyhow::Result<()> { - crate::models::ProtocolConfig { - epoch_id: epoch_id.to_string(), - epoch_height: bigdecimal::BigDecimal::from(epoch_height), - epoch_start_height: bigdecimal::BigDecimal::from(epoch_start_height), - epoch_end_height: None, - protocol_config: serde_json::to_value(protocol_config)?, - } - .insert_or_ignore(Self::get_connection(&self.pg_pool).await?) - .await?; - Ok(()) - } - async fn update_epoch_end_height( &self, epoch_id: near_indexer_primitives::CryptoHash, epoch_end_block_hash: near_indexer_primitives::CryptoHash, ) -> anyhow::Result<()> { let epoch_end_height = self.get_block_by_hash(epoch_end_block_hash).await?; - - let validators_future = crate::models::Validators::update_epoch_end_height( + crate::models::Validators::update_epoch_end_height( Self::get_connection(&self.pg_pool).await?, epoch_id, bigdecimal::BigDecimal::from(epoch_end_height), - ); - let protocol_config_future = crate::models::ProtocolConfig::update_epoch_end_height( - Self::get_connection(&self.pg_pool).await?, - epoch_id, - bigdecimal::BigDecimal::from(epoch_end_height), - ); - futures::future::try_join(validators_future, protocol_config_future).await?; + ) + .await?; Ok(()) } } diff --git a/database/src/postgres/tx_indexer.rs b/database/src/postgres/tx_indexer.rs index f1fdea29..10b81620 100644 --- a/database/src/postgres/tx_indexer.rs +++ b/database/src/postgres/tx_indexer.rs @@ -1,6 +1,5 @@ use crate::postgres::PostgresStorageManager; use bigdecimal::ToPrimitive; -use borsh::{BorshDeserialize, BorshSerialize}; pub struct PostgresDBManager { pg_pool: crate::postgres::PgAsyncPool, @@ -30,14 +29,11 @@ impl crate::TxIndexerDbManager for PostgresDBManager { transaction: readnode_primitives::TransactionDetails, block_height: u64, ) -> anyhow::Result<()> { - let transaction_details = transaction - .try_to_vec() - .expect("Failed to borsh-serialize the Transaction"); crate::models::TransactionDetail { transaction_hash: transaction.transaction.hash.to_string(), block_height: bigdecimal::BigDecimal::from(block_height), account_id: transaction.transaction.signer_id.to_string(), - transaction_details, + transaction_details: borsh::to_vec(&transaction)?, } .insert_or_ignore(Self::get_connection(&self.pg_pool).await?) .await @@ -75,7 +71,7 @@ impl crate::TxIndexerDbManager for PostgresDBManager { ) -> anyhow::Result<()> { let transaction_hash = transaction_details.transaction.hash.clone().to_string(); let block_height = transaction_details.block_height; - let transaction_details = transaction_details.try_to_vec().map_err(|err| { + let transaction_details = borsh::to_vec(&transaction_details).map_err(|err| { tracing::error!(target: "tx_indexer", "Failed to serialize transaction details: {:?}", err); err})?; crate::models::TransactionCache { @@ -100,12 +96,8 @@ impl crate::TxIndexerDbManager for PostgresDBManager { .receipt .receipt_id .to_string(), - receipt: indexer_execution_outcome_with_receipt - .receipt - .try_to_vec()?, - outcome: indexer_execution_outcome_with_receipt - .execution_outcome - .try_to_vec()?, + receipt: borsh::to_vec(&indexer_execution_outcome_with_receipt.receipt)?, + outcome: borsh::to_vec(&indexer_execution_outcome_with_receipt.execution_outcome)?, } .insert_or_ignore(Self::get_connection(&self.pg_pool).await?) .await @@ -131,11 +123,10 @@ impl crate::TxIndexerDbManager for PostgresDBManager { Ok(transactions .into_iter() .map(|tx| { - let transaction_details = - readnode_primitives::CollectingTransactionDetails::try_from_slice( - &tx.transaction_details, - ) - .expect("Failed to deserialize transaction details"); + let transaction_details = borsh::from_slice::< + readnode_primitives::CollectingTransactionDetails, + >(&tx.transaction_details) + .expect("Failed to deserialize transaction details"); (transaction_details.transaction_key(), transaction_details) }) .collect()) @@ -156,11 +147,9 @@ impl crate::TxIndexerDbManager for PostgresDBManager { &transaction_hash, ) .await?; - Ok( - readnode_primitives::CollectingTransactionDetails::try_from_slice( - &transaction_details, - )?, - ) + Ok(borsh::from_slice::< + readnode_primitives::CollectingTransactionDetails, + >(&transaction_details)?) } async fn get_receipts_in_cache( @@ -176,14 +165,14 @@ impl crate::TxIndexerDbManager for PostgresDBManager { Ok(result .into_iter() .map(|receipt_outcome| { - let receipt = - near_primitives::views::ReceiptView::try_from_slice(&receipt_outcome.receipt) - .expect("Failed to deserialize receipt"); - let execution_outcome = - near_primitives::views::ExecutionOutcomeWithIdView::try_from_slice( - &receipt_outcome.outcome, - ) - .expect("Failed to deserialize execution outcome"); + let receipt = borsh::from_slice::( + &receipt_outcome.receipt, + ) + .expect("Failed to deserialize receipt"); + let execution_outcome = borsh::from_slice::< + near_primitives::views::ExecutionOutcomeWithIdView, + >(&receipt_outcome.outcome) + .expect("Failed to deserialize execution outcome"); near_indexer_primitives::IndexerExecutionOutcomeWithReceipt { receipt, execution_outcome, diff --git a/database/src/scylladb/mod.rs b/database/src/scylladb/mod.rs index c9e76912..a555c2bc 100644 --- a/database/src/scylladb/mod.rs +++ b/database/src/scylladb/mod.rs @@ -5,6 +5,7 @@ pub mod tx_indexer; use scylla::prepared_statement::PreparedStatement; use scylla::retry_policy::{QueryInfo, RetryDecision}; use scylla::transport::errors::QueryError; +use scylla_cql::types::serialize::row::SerializeRow; #[derive(Debug)] pub struct CustomDBRetryPolicy { @@ -81,7 +82,7 @@ impl Default for CustomRetrySession { impl scylla::retry_policy::RetrySession for CustomRetrySession { /// Called after the query failed - decide what to do next fn decide_should_retry(&mut self, query_info: QueryInfo) -> RetryDecision { - if let scylla::frame::types::LegacyConsistency::Serial(_) = query_info.consistency { + if query_info.consistency.is_serial() { return RetryDecision::DontRetry; }; tracing::warn!("ScyllaDB QueryError: {:?}", query_info.error); @@ -338,7 +339,7 @@ pub trait ScyllaStorageManager { async fn execute_prepared_query( scylla_session: &scylla::Session, query: &PreparedStatement, - values: impl scylla::frame::value::ValueList + std::marker::Send, + values: impl SerializeRow + Send, ) -> anyhow::Result { let result = scylla_session.execute(query, values).await?; @@ -391,7 +392,7 @@ pub trait ScyllaStorageManager { } if let Some(start_at) = tracing_info.started_at { - tracing_info_table.add_row(prettytable::row!["Started at", start_at]); + tracing_info_table.add_row(prettytable::row!["Started at", start_at.0]); } let mut events_table = diff --git a/database/src/scylladb/rpc_server.rs b/database/src/scylladb/rpc_server.rs index a81d82d4..5babc969 100644 --- a/database/src/scylladb/rpc_server.rs +++ b/database/src/scylladb/rpc_server.rs @@ -1,7 +1,6 @@ use std::convert::TryFrom; use std::str::FromStr; -use borsh::{BorshDeserialize, BorshSerialize}; use futures::StreamExt; use num_traits::ToPrimitive; use scylla::{prepared_statement::PreparedStatement, IntoTypedRows}; @@ -27,7 +26,6 @@ pub struct ScyllaDBManager { get_stored_at_block_height_and_shard_id_by_block_height: PreparedStatement, get_validators_by_epoch_id: PreparedStatement, get_validators_by_end_block_height: PreparedStatement, - get_protocol_config_by_epoch_id: PreparedStatement, } #[async_trait::async_trait] @@ -147,10 +145,6 @@ impl ScyllaStorageManager for ScyllaDBManager { &scylla_db_session, "SELECT epoch_id, epoch_height, validators_info FROM state_indexer.validators WHERE epoch_end_height = ?", ).await?, - get_protocol_config_by_epoch_id: Self::prepare_read_query( - &scylla_db_session, - "SELECT protocol_config FROM state_indexer.protocol_configs WHERE epoch_id = ?", - ).await?, })) } } @@ -377,7 +371,7 @@ impl crate::ReaderDbManager for ScyllaDBManager { request_block_height: near_primitives::types::BlockHeight, public_key: near_crypto::PublicKey, ) -> anyhow::Result> { - let key_data = public_key.try_to_vec()?; + let key_data = borsh::to_vec(&public_key)?; let (block_height, block_hash, data_blob) = Self::execute_prepared_query( &self.scylla_session, &self.get_access_key, @@ -465,9 +459,7 @@ impl crate::ReaderDbManager for ScyllaDBManager { .single_row()? .into_typed::<(Vec,)>()?; - Ok(readnode_primitives::TransactionDetails::try_from_slice( - &data_value, - )?) + Ok(borsh::from_slice::(&data_value)?) } /// Returns the readnode_primitives::TransactionDetails @@ -485,7 +477,7 @@ impl crate::ReaderDbManager for ScyllaDBManager { .single_row()? .into_typed::<(Vec,)>()?; let mut transaction_details = - readnode_primitives::CollectingTransactionDetails::try_from_slice(&data_value)?; + borsh::from_slice::(&data_value)?; let mut rows_stream = self .scylla_session @@ -500,9 +492,9 @@ impl crate::ReaderDbManager for ScyllaDBManager { .into_typed::<(Vec, Vec)>(); while let Some(next_row_res) = rows_stream.next().await { let (receipt, outcome) = next_row_res?; - let receipt = near_primitives::views::ReceiptView::try_from_slice(&receipt)?; + let receipt = borsh::from_slice::(&receipt)?; let execution_outcome = - near_primitives::views::ExecutionOutcomeWithIdView::try_from_slice(&outcome)?; + borsh::from_slice::(&outcome)?; transaction_details.receipts.push(receipt); transaction_details .execution_outcomes @@ -596,23 +588,4 @@ impl crate::ReaderDbManager for ScyllaDBManager { validators_info, }) } - - async fn get_protocol_config_by_epoch_id( - &self, - epoch_id: near_primitives::hash::CryptoHash, - ) -> anyhow::Result { - let (protocol_config,) = Self::execute_prepared_query( - &self.scylla_session, - &self.get_protocol_config_by_epoch_id, - (epoch_id.to_string(),), - ) - .await? - .single_row()? - .into_typed::<(String,)>()?; - - let protocol_config: near_chain_configs::ProtocolConfigView = - serde_json::from_str(&protocol_config)?; - - Ok(protocol_config) - } } diff --git a/database/src/scylladb/state_indexer.rs b/database/src/scylladb/state_indexer.rs index 272aac5f..0a2d7271 100644 --- a/database/src/scylladb/state_indexer.rs +++ b/database/src/scylladb/state_indexer.rs @@ -27,9 +27,7 @@ pub struct ScyllaDBManager { add_chunk: PreparedStatement, add_validators: PreparedStatement, - add_protocol_config: PreparedStatement, update_validators_epoch_end_height: PreparedStatement, - update_protocol_config_epoch_end_height: PreparedStatement, add_account_state: PreparedStatement, @@ -178,19 +176,7 @@ impl ScyllaStorageManager for ScyllaDBManager { .await?; scylla_db_session - .query( - " - CREATE TABLE IF NOT EXISTS protocol_configs ( - epoch_id varchar, - epoch_height varint, - epoch_start_height varint, - epoch_end_height varint, - protocol_config text, - PRIMARY KEY (epoch_id) - ) - ", - &[], - ) + .query("DROP TABLE IF EXISTS protocol_configs", &[]) .await?; scylla_db_session @@ -375,23 +361,11 @@ impl ScyllaStorageManager for ScyllaDBManager { VALUES (?, ?, ?, NULL, ?)", ) .await?, - add_protocol_config: Self::prepare_write_query( - &scylla_db_session, - "INSERT INTO state_indexer.protocol_configs - (epoch_id, epoch_height, epoch_start_height, epoch_end_height, protocol_config) - VALUES (?, ?, ?, NULL, ?)", - ) - .await?, update_validators_epoch_end_height: Self::prepare_write_query( &scylla_db_session, "UPDATE state_indexer.validators SET epoch_end_height = ? WHERE epoch_id = ?", ) .await?, - update_protocol_config_epoch_end_height: Self::prepare_write_query( - &scylla_db_session, - "UPDATE state_indexer.protocol_configs SET epoch_end_height = ? WHERE epoch_id = ?", - ) - .await?, add_account_state: Self::prepare_write_query( &scylla_db_session, "INSERT INTO state_indexer.account_state @@ -766,51 +740,21 @@ impl crate::StateIndexerDbManager for ScyllaDBManager { Ok(()) } - async fn add_protocol_config( - &self, - epoch_id: near_indexer_primitives::CryptoHash, - epoch_height: u64, - epoch_start_height: u64, - protocol_config: &near_chain_configs::ProtocolConfigView, - ) -> anyhow::Result<()> { - Self::execute_prepared_query( - &self.scylla_session, - &self.add_protocol_config, - ( - epoch_id.to_string(), - num_bigint::BigInt::from(epoch_height), - num_bigint::BigInt::from(epoch_start_height), - serde_json::to_string(protocol_config)?, - ), - ) - .await?; - Ok(()) - } - async fn update_epoch_end_height( &self, epoch_id: near_indexer_primitives::CryptoHash, epoch_end_block_hash: near_indexer_primitives::CryptoHash, ) -> anyhow::Result<()> { let epoch_end_height = self.get_block_by_hash(epoch_end_block_hash).await?; - - let validators_future = Self::execute_prepared_query( + Self::execute_prepared_query( &self.scylla_session, &self.update_validators_epoch_end_height, ( num_bigint::BigInt::from(epoch_end_height), epoch_id.to_string(), ), - ); - let protocol_config_future = Self::execute_prepared_query( - &self.scylla_session, - &self.update_protocol_config_epoch_end_height, - ( - num_bigint::BigInt::from(epoch_end_height), - epoch_id.to_string(), - ), - ); - futures::future::try_join(validators_future, protocol_config_future).await?; + ) + .await?; Ok(()) } } diff --git a/database/src/scylladb/tx_indexer.rs b/database/src/scylladb/tx_indexer.rs index 08a37bd2..91cc7f87 100644 --- a/database/src/scylladb/tx_indexer.rs +++ b/database/src/scylladb/tx_indexer.rs @@ -1,5 +1,4 @@ use crate::scylladb::ScyllaStorageManager; -use borsh::{BorshDeserialize, BorshSerialize}; use futures::StreamExt; use num_traits::ToPrimitive; use scylla::prepared_statement::PreparedStatement; @@ -54,10 +53,9 @@ impl ScyllaDBManager { .into_typed::<(Vec,)>(); while let Some(next_row_res) = rows_stream.next().await { let (transaction_details,) = next_row_res?; - let transaction_details = - readnode_primitives::CollectingTransactionDetails::try_from_slice( - &transaction_details, - )?; + let transaction_details = borsh::from_slice::< + readnode_primitives::CollectingTransactionDetails, + >(&transaction_details)?; result.push(transaction_details); } Ok(result) @@ -248,9 +246,6 @@ impl crate::TxIndexerDbManager for ScyllaDBManager { transaction: readnode_primitives::TransactionDetails, block_height: u64, ) -> anyhow::Result<()> { - let transaction_details = transaction - .try_to_vec() - .expect("Failed to borsh-serialize the Transaction"); Self::execute_prepared_query( &self.scylla_session, &self.add_transaction, @@ -258,7 +253,7 @@ impl crate::TxIndexerDbManager for ScyllaDBManager { transaction.transaction.hash.to_string(), num_bigint::BigInt::from(block_height), transaction.transaction.signer_id.to_string(), - &transaction_details, + &borsh::to_vec(&transaction)?, ), ) .await?; @@ -302,7 +297,7 @@ impl crate::TxIndexerDbManager for ScyllaDBManager { ) -> anyhow::Result<()> { let transaction_hash = transaction_details.transaction.hash.clone().to_string(); let block_height = transaction_details.block_height; - let transaction_details = transaction_details.try_to_vec().map_err(|err| { + let transaction_details = borsh::to_vec(&transaction_details).map_err(|err| { tracing::error!(target: "tx_indexer", "Failed to serialize transaction details: {:?}", err); err})?; Self::execute_prepared_query( @@ -337,12 +332,8 @@ impl crate::TxIndexerDbManager for ScyllaDBManager { .receipt .receipt_id .to_string(), - indexer_execution_outcome_with_receipt - .receipt - .try_to_vec()?, - indexer_execution_outcome_with_receipt - .execution_outcome - .try_to_vec()?, + borsh::to_vec(&indexer_execution_outcome_with_receipt.receipt)?, + borsh::to_vec(&indexer_execution_outcome_with_receipt.execution_outcome)?, ), ) .await?; @@ -433,11 +424,9 @@ impl crate::TxIndexerDbManager for ScyllaDBManager { .single_row()? .into_typed::<(Vec,)>()?; - Ok( - readnode_primitives::CollectingTransactionDetails::try_from_slice( - &transaction_details, - )?, - ) + Ok(borsh::from_slice::< + readnode_primitives::CollectingTransactionDetails, + >(&transaction_details)?) } async fn get_receipts_in_cache( @@ -458,9 +447,9 @@ impl crate::TxIndexerDbManager for ScyllaDBManager { .into_typed::<(Vec, Vec)>(); while let Some(next_row_res) = rows_stream.next().await { let (receipt, outcome) = next_row_res?; - let receipt = near_primitives::views::ReceiptView::try_from_slice(&receipt)?; + let receipt = borsh::from_slice::(&receipt)?; let execution_outcome = - near_primitives::views::ExecutionOutcomeWithIdView::try_from_slice(&outcome)?; + borsh::from_slice::(&outcome)?; result.push( near_indexer_primitives::IndexerExecutionOutcomeWithReceipt { receipt, diff --git a/docs/RPC_METHODS.md b/docs/RPC_METHODS.md index 48f2bfe4..7d45dae3 100644 --- a/docs/RPC_METHODS.md +++ b/docs/RPC_METHODS.md @@ -1,28 +1,33 @@ -| **Method** | **status** | **Note** | -|---------------------------------|------------|-----------------------------------------------------------------------------| -| block | Included | | -| chunk | Included | | -| query.view_account | Included | | -| query.view_state | Included | | -| view_state_paginated | Included | Custom method. See details [here](../docs/CUSTOM_RPC_METHODS.md) | -| query.view_code | Included | | -| query.view_access_key | Included | | -| query.call_function | Included | | -| query.view_access_key_list | Proxy | Planned. It will be implemented in the future. | -| gas_price | Included | | -| tx | Included | | -| EXPERIMENTAL_tx_status | Included | | -| broadcast_tx_commit | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | -| broadcast_tx_async | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | -| EXPETIMENTAL_receipt | Included | | -| EXPERIMENTAL_changes | Included | | -| EXPERIMENTAL_changes_in_block | Included | | -| network_info | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | -| status | Included | | -| health | Included | Health includes the info about the syncing state of the node of rpc-server. | -| light_client_proof | Proxy | | -| next_light_client_block | Proxy | | -| validators | Included | | -| EXPERIMENTAL_validators_ordered | Proxy | | -| EXPERIMENTAL_genesis_config | Included | Cache it on the start. | -| EXPERIMENTAL_protocol_config | Included | | \ No newline at end of file +| **Method** | **status** | **Note** | +|----------------------------------|---------------|-----------------------------------------------------------------------------| +| view_state_paginated | Included | Custom method. See details [here](../docs/CUSTOM_RPC_METHODS.md) | +| query.view_account | Included | | +| query.view_code | Included | | +| query.view_state | Included | | +| query.call_function | Included | | +| query.view_access_key | Included | | +| query.view_access_key_list | Proxy | Planned. It will be implemented in the future. | +| block | Included | | +| broadcast_tx_async | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | +| broadcast_tx_commit | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | +| chunk | Included | | +| gas_price | Included | | +| health | Included | Health includes the info about the syncing state of the node of rpc-server. | +| light_client_proof | Proxy | | +| next_light_client_block | Proxy | | +| network_info | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | +| status | Included | | +| send_tx | Proxy | PROXY_ONLY. Immediately proxy to a real RPC. | +| tx | Included | | +| validators | Included | | +| client_config | Unimplemented | | +| EXPERIMENTAL_changes | Included | | +| EXPERIMENTAL_changes_in_block | Included | | +| EXPERIMENTAL_genesis_config | Included | Cache it on the start. | +| EXPERIMENTAL_light_client_proof | Proxy | | +| EXPERIMENTAL_protocol_config | Included | | +| EXPETIMENTAL_receipt | Included | | +| EXPERIMENTAL_tx_status | Included | | +| EXPERIMENTAL_validators_ordered | Proxy | | +| EXPERIMENTAL_maintenance_windows | Unimplemented | | +| EXPERIMENTAL_split_storage_info | Unimplemented | | diff --git a/epoch-indexer/Cargo.toml b/epoch-indexer/Cargo.toml index 41a9f7a9..25eee3bc 100644 --- a/epoch-indexer/Cargo.toml +++ b/epoch-indexer/Cargo.toml @@ -9,9 +9,8 @@ license.workspace = true [dependencies] anyhow = "1.0.70" -clap = { version = "3.1.6", features = ["color", "derive", "env"] } -futures = "0.3.5" -tokio = { version = "1.28.2", features = [ +clap = "4.4.18" +tokio = { version = "1.36.0", features = [ "sync", "time", "macros", @@ -19,14 +18,14 @@ tokio = { version = "1.28.2", features = [ ] } tracing = "0.1.34" -configuration = { path = "../configuration" } -database = { path = "../database" } -readnode-primitives = { path = "../readnode-primitives" } +configuration.workspace = true +database.workspace = true +readnode-primitives.workspace = true -near-jsonrpc-client = "0.7.0" -near-chain-configs = "1.36.0" -near-indexer-primitives = "1.36.0" -near-lake-framework = "0.7.9" +near-jsonrpc-client.workspace = true +near-chain-configs.workspace = true +near-indexer-primitives.workspace = true +near-lake-framework.workspace = true [features] default = ["scylla_db"] diff --git a/epoch-indexer/src/config.rs b/epoch-indexer/src/config.rs index b6d1e569..d05baf83 100644 --- a/epoch-indexer/src/config.rs +++ b/epoch-indexer/src/config.rs @@ -1,14 +1,6 @@ use clap::{Parser, Subcommand}; #[derive(Parser, Debug)] -#[clap( - version, - author, - about, - setting(clap::AppSettings::DisableHelpSubcommand), - setting(clap::AppSettings::PropagateVersion), - setting(clap::AppSettings::NextLineHelp) -)] pub struct Opts { #[clap(subcommand)] pub start_options: StartOptions, diff --git a/epoch-indexer/src/lib.rs b/epoch-indexer/src/lib.rs index b1c570f8..041b2715 100644 --- a/epoch-indexer/src/lib.rs +++ b/epoch-indexer/src/lib.rs @@ -29,72 +29,18 @@ pub async fn get_epoch_validators( } } -/// util to fetch protocol config by epoch_start_height -/// try_another_blocks - special flag to try another blocks if we have error -/// in case of error we try to fetch protocol config for next block -pub async fn get_protocol_config( - epoch_start_height: u64, - client: &near_jsonrpc_client::JsonRpcClient, - try_another_blocks: bool, -) -> anyhow::Result { - let mut attempt_counter = 0; - let mut block_height = epoch_start_height; - loop { - let params = - near_jsonrpc_client::methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest { - block_reference: near_primitives::types::BlockReference::BlockId( - near_indexer_primitives::types::BlockId::Height(block_height), - ), - }; - match client.call(params).await { - Ok(response) => return Ok(response), - Err(e) => { - attempt_counter += 1; - if try_another_blocks { - block_height += 1; - } - tracing::debug!( - "Attempt: {}. Epoch_start_height {}. Error fetching protocol config: {:?}", - attempt_counter, - block_height, - e - ); - if attempt_counter > 20 { - anyhow::bail!( - "Failed to fetch epoch protocol config for epoch_start_height: {}", - epoch_start_height - ) - } - } - } - } -} - pub async fn get_epoch_info_by_id( epoch_id: CryptoHash, rpc_client: &near_jsonrpc_client::JsonRpcClient, ) -> anyhow::Result { let validators_info = get_epoch_validators(epoch_id, rpc_client).await?; - let protocol_config = - match get_protocol_config(validators_info.epoch_start_height, rpc_client, false).await { - Ok(protocol_config) => protocol_config, - Err(e) => { - tracing::warn!( - "Error fetching protocol config: {:?}. Try with another blocks", - e - ); - get_protocol_config(validators_info.epoch_start_height, rpc_client, true).await? - } - }; - Ok(readnode_primitives::IndexedEpochInfo { epoch_id, epoch_height: validators_info.epoch_height, epoch_start_height: validators_info.epoch_start_height, epoch_end_height: None, validators_info, - protocol_config, }) } @@ -219,21 +165,14 @@ pub async fn save_epoch_info( epoch.epoch_height }; - let save_validators_feature = db_manager.add_validators( - epoch.epoch_id, - epoch_height, - epoch.epoch_start_height, - &epoch.validators_info, - ); - - let save_protocol_config_feature = db_manager.add_protocol_config( - epoch.epoch_id, - epoch_height, - epoch.epoch_start_height, - &epoch.protocol_config, - ); - - futures::try_join!(save_validators_feature, save_protocol_config_feature)?; + db_manager + .add_validators( + epoch.epoch_id, + epoch_height, + epoch.epoch_start_height, + &epoch.validators_info, + ) + .await?; tracing::info!( "Save epoch info: epoch_id: {:?}, epoch_height: {:?}, epoch_start_height: {}", epoch.epoch_id, diff --git a/near-state-indexer/Cargo.toml b/near-state-indexer/Cargo.toml new file mode 100644 index 00000000..a308cef2 --- /dev/null +++ b/near-state-indexer/Cargo.toml @@ -0,0 +1,49 @@ +[package] +name = "near-state-indexer" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +license.workspace = true + +[build-dependencies] +anyhow = "1.0.51" +rustc_version = "0.4" + +[dependencies] +actix = "0.13.3" +actix-web = "4.2.1" +anyhow = "1.0.70" +borsh = "1.3.1" +clap = "4.4.18" +futures = "0.3.5" +hex = "0.4.3" +humantime = "2.1.0" +openssl-probe = "0.1.5" +once_cell = "1.19.0" +redis = { version = "0.24.0", features = ["tokio-comp", "connection-manager"] } +serde_json = "1.0.64" +tokio = { version = "1.36.0", features = [ + "sync", + "time", + "macros", + "rt-multi-thread", +] } +tokio-stream = "0.1" +tracing = "0.1.34" + +configuration.workspace = true +database.workspace = true + +near-o11y.workspace = true +near-client.workspace = true +near-indexer.workspace = true + +[features] +default = ["scylla_db"] +tracing-instrumentation = ["configuration/tracing-instrumentation"] +postgres_db = ["database/postgres_db"] +scylla_db = ["database/scylla_db"] +scylla_db_tracing = ["database/scylla_db_tracing", "scylla_db"] +account_access_keys = ["database/account_access_keys"] diff --git a/near-state-indexer/README.md b/near-state-indexer/README.md new file mode 100644 index 00000000..1b7e963b --- /dev/null +++ b/near-state-indexer/README.md @@ -0,0 +1,54 @@ +NEAR State Indexer +================== + +Near State Indexer based on [NEAR Indexer Framework](https://github.com/nearprotocol/nearcore/tree/master/chain/indexer) +Near State Indexer is only designed to track the end of the network. +It is not designed to index historical data. +It is assumed that in a bet with near_state_indexer the [state-indexer](../state-indexer/README.md) will always be running. + +## How to set up and test NEAR State Indexer + +### localnet + +To run the NEAR Indexer connected to a network we need to have configs and keys prepopulated. To generate configs for localnet do the following + +```bash +$ cargo run --release -- --home ~/.near/localnet init +``` +The above commands should initialize necessary configs and keys to run localnet in `~/.near/localnet`. + +```bash +$ cargo run --release -- --home ~/.near/localnet/ run +``` +After the node is started, you should see logs of every block produced in your localnet. + +### testnet / betanet + +To run the NEAR Indexer connected to testnet or betanet we need to have configs and keys prepopulated, you can get them with the NEAR Indexer Example like above with a little change. Follow the instructions below to run non-validating node (leaving account ID empty). + +```bash +$ cargo run --release -- --home-dir ~/.near/testnet init --chain-id testnet --download +``` + +The above code will download the official genesis config and generate necessary configs. You can replace `testnet` in the command above to different network ID `betanet`. + +**NB!** According to changes in `nearcore` config generation we don't fill all the necessary fields in the config file. While this issue is open you need to download config you want and replace the generated one manually. +- [testnet config.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/config.json) +- [betanet config.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/betanet/config.json) +- [mainnet config.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json) + +Replace `config.json` in your `--home` (e.g. `~/.near/testnet/config.json`) with downloaded one. + +Configs for the specified network are in the `--home` provided folder. We need to ensure that NEAR Indexer follows all the necessary shards, so `"tracked_shards"` parameters in `~/.near/testnet/config.json` needs to be configured properly. For example, with a single shared network, you just add the shard #0 to the list: + +```text +... +"tracked_shards": [0], +... +``` + +After that we can run NEAR Indexer. + +```bash +$ cargo run --release -- --home-dir ~/.near/testnet run +``` diff --git a/near-state-indexer/build.rs b/near-state-indexer/build.rs new file mode 100644 index 00000000..777e594b --- /dev/null +++ b/near-state-indexer/build.rs @@ -0,0 +1,20 @@ +/// This build.rs script is used to generate build-time information and set environment variables for the build process. +/// It retrieves the Rust compiler version and sets it as the `RUSTC_VERSION` environment variable. +/// It also sets the `BUILD_VERSION` environment variable to the value of `NEARCORE_VERSION` defined in the project. +/// Additionally, it prints messages to indicate which files should trigger a rebuild when changed. +fn get_rustc_version() -> anyhow::Result { + let version = rustc_version::version()?; + Ok(version.to_string()) +} + +fn main() -> anyhow::Result<()> { + println!("cargo:rerun-if-changed=.git/HEAD"); + println!("cargo:rerun-if-changed=.git/index"); + + println!("cargo:rustc-env=BUILD_VERSION={}", env!("NEARCORE_VERSION")); + + let rustc_version = get_rustc_version()?; + println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version); + + Ok(()) +} diff --git a/near-state-indexer/src/configs.rs b/near-state-indexer/src/configs.rs new file mode 100644 index 00000000..8d2de11c --- /dev/null +++ b/near-state-indexer/src/configs.rs @@ -0,0 +1,80 @@ +/// Watches for stream of blocks from the chain +#[derive(clap::Parser, Debug)] +pub(crate) struct Opts { + /// Sets a custom config dir. Defaults to ~/.near/ + #[clap(short, long)] + pub home: Option, + #[clap(subcommand)] + pub subcmd: SubCommand, +} + +#[derive(clap::Parser, Debug)] +#[allow(clippy::large_enum_variant)] +pub(crate) enum SubCommand { + /// Run NEAR Indexer Example. Start observe the network + Run, + /// Initialize necessary configs + Init(InitConfigArgs), +} + +#[derive(clap::Parser, Debug)] +pub(crate) struct InitConfigArgs { + /// chain/network id (localnet, testnet, devnet, betanet) + #[clap(short, long)] + pub chain_id: Option, + /// Account ID for the validator key + #[clap(long)] + pub account_id: Option, + /// Specify private key generated from seed (TESTING ONLY) + #[clap(long)] + pub test_seed: Option, + /// Number of shards to initialize the chain with + #[clap(short, long, default_value = "1")] + pub num_shards: u64, + /// Makes block production fast (TESTING ONLY) + #[clap(short, long)] + pub fast: bool, + /// Genesis file to use when initialize testnet (including downloading) + #[clap(short, long)] + pub genesis: Option, + #[clap(long)] + /// Download the verified NEAR genesis file automatically. + pub download_genesis: bool, + /// Specify a custom download URL for the genesis-file. + #[clap(long)] + pub download_genesis_url: Option, + /// Specify a custom download URL for the records-file. + #[clap(long)] + pub download_records_url: Option, + #[clap(long)] + /// Download the verified NEAR config file automatically. + pub download_config: bool, + /// Specify a custom download URL for the config file. + #[clap(long)] + pub download_config_url: Option, + /// Specify the boot nodes to bootstrap the network + pub boot_nodes: Option, + /// Specify a custom max_gas_burnt_view limit. + #[clap(long)] + pub max_gas_burnt_view: Option, +} + +impl From for near_indexer::InitConfigArgs { + fn from(config_args: InitConfigArgs) -> Self { + Self { + chain_id: config_args.chain_id, + account_id: config_args.account_id, + test_seed: config_args.test_seed, + num_shards: config_args.num_shards, + fast: config_args.fast, + genesis: config_args.genesis, + download_genesis: config_args.download_genesis, + download_genesis_url: config_args.download_genesis_url, + download_records_url: config_args.download_records_url, + download_config: config_args.download_config, + download_config_url: config_args.download_config_url, + boot_nodes: config_args.boot_nodes, + max_gas_burnt_view: config_args.max_gas_burnt_view, + } + } +} diff --git a/near-state-indexer/src/main.rs b/near-state-indexer/src/main.rs new file mode 100644 index 00000000..a1a8d64a --- /dev/null +++ b/near-state-indexer/src/main.rs @@ -0,0 +1,324 @@ +use clap::Parser; +use futures::StreamExt; + +use crate::configs::Opts; +use near_indexer::near_primitives::hash::CryptoHash; +use near_indexer::near_primitives::views::{StateChangeValueView, StateChangeWithCauseView}; + +mod configs; +mod metrics; +mod utils; + +// Categories for logging +pub(crate) const INDEXER: &str = "near_state_indexer"; + +#[cfg_attr( + feature = "tracing-instrumentation", + tracing::instrument(skip(streamer_message, db_manager, redis_client)) +)] +async fn handle_streamer_message( + streamer_message: near_indexer::StreamerMessage, + db_manager: &(impl database::StateIndexerDbManager + Sync + Send + 'static), + redis_client: redis::aio::ConnectionManager, + client: &actix::Addr, + indexer_config: configuration::NearStateIndexerConfig, + stats: std::sync::Arc>, +) -> anyhow::Result<()> { + let block_height = streamer_message.block.header.height; + let block_hash = streamer_message.block.header.hash; + + let current_epoch_id = streamer_message.block.header.epoch_id; + let next_epoch_id = streamer_message.block.header.next_epoch_id; + + tracing::debug!(target: INDEXER, "Block height {}", block_height,); + + stats + .write() + .await + .block_heights_processing + .insert(block_height); + + let handle_epoch_future = handle_epoch( + stats.read().await.current_epoch_id, + stats.read().await.current_epoch_height, + current_epoch_id, + next_epoch_id, + db_manager, + client, + ); + let handle_block_future = db_manager.save_block( + block_height, + block_hash, + streamer_message + .block + .chunks + .iter() + .map(|chunk| { + ( + chunk.chunk_hash.to_string(), + chunk.shard_id, + chunk.height_included, + ) + }) + .collect(), + ); + let handle_state_change_future = handle_state_changes( + &streamer_message, + db_manager, + block_height, + block_hash, + &indexer_config, + ); + + let published_streamer_message_feature = + utils::publish_streamer_message("final_block", &streamer_message, redis_client); + + futures::try_join!( + handle_epoch_future, + handle_block_future, + handle_state_change_future, + published_streamer_message_feature, + )?; + + let mut stats_lock = stats.write().await; + stats_lock.block_heights_processing.remove(&block_height); + stats_lock.blocks_processed_count += 1; + metrics::BLOCKS_DONE.inc(); + stats_lock.last_processed_block_height = block_height; + if let Some(stats_epoch_id) = stats_lock.current_epoch_id { + if current_epoch_id != stats_epoch_id { + stats_lock.current_epoch_id = Some(current_epoch_id); + if stats_epoch_id == CryptoHash::default() { + stats_lock.current_epoch_height = 1; + } else { + stats_lock.current_epoch_height += 1; + } + } + } else { + // handle first indexing epoch + let epoch_info = utils::fetch_epoch_validators_info(current_epoch_id, client).await?; + stats_lock.current_epoch_id = Some(current_epoch_id); + stats_lock.current_epoch_height = epoch_info.epoch_height; + } + Ok(()) +} + +#[cfg_attr( + feature = "tracing-instrumentation", + tracing::instrument(skip(db_manager)) +)] +async fn handle_epoch( + stats_current_epoch_id: Option, + stats_current_epoch_height: u64, + current_epoch_id: CryptoHash, + next_epoch_id: CryptoHash, + db_manager: &(impl database::StateIndexerDbManager + Sync + Send + 'static), + client: &actix::Addr, +) -> anyhow::Result<()> { + if let Some(stats_epoch_id) = stats_current_epoch_id { + if stats_epoch_id == current_epoch_id { + // If epoch didn't change, we don't need handle it + Ok(()) + } else { + // If epoch changed, we need to save epoch info and update epoch_end_height + let validators_info = + utils::fetch_epoch_validators_info(stats_epoch_id, client).await?; + + db_manager + .add_validators( + stats_epoch_id, + stats_current_epoch_height, + validators_info.epoch_start_height, + &validators_info, + ) + .await?; + + db_manager + .update_epoch_end_height(stats_epoch_id, next_epoch_id) + .await?; + Ok(()) + } + } else { + // If stats_current_epoch_id is None, we don't need handle it + Ok(()) + } +} + +/// This function will iterate over all StateChangesWithCauseViews in order to collect +/// a single StateChangesWithCauseView for a unique account and unique change kind, and unique key. +/// The reasoning behind this is that in a single Block (StreamerMessage) there might be a bunch of +/// changes to the same change kind to the same account to the same key (state key or public key) and +/// we want to ensure we store the very last of them. +/// It's impossible to achieve it with handling all of them one by one asynchronously (they might be handled +/// in any order) so it's easier for us to skip all the changes except the latest one. +#[cfg_attr( + feature = "tracing-instrumentation", + tracing::instrument(skip(streamer_message, db_manager)) +)] +async fn handle_state_changes( + streamer_message: &near_indexer::StreamerMessage, + db_manager: &(impl database::StateIndexerDbManager + Sync + Send + 'static), + block_height: u64, + block_hash: CryptoHash, + indexer_config: &configuration::NearStateIndexerConfig, +) -> anyhow::Result> { + let mut state_changes_to_store = + std::collections::HashMap::::new(); + + let initial_state_changes = streamer_message + .shards + .iter() + .flat_map(|shard| shard.state_changes.iter()); + + // Collecting a unique list of StateChangeWithCauseView for account_id + change kind + suffix + // by overwriting the records in the HashMap + for state_change in initial_state_changes { + if !indexer_config.state_should_be_indexed(&state_change.value) { + continue; + }; + let key = match &state_change.value { + StateChangeValueView::DataUpdate { + account_id, key, .. + } + | StateChangeValueView::DataDeletion { account_id, key } => { + // returning a hex-encoded key to ensure we store data changes to the key + // (if there is more than one change to the same key) + let key: &[u8] = key.as_ref(); + format!("{}_data_{}", account_id.as_str(), hex::encode(key)) + } + StateChangeValueView::AccessKeyUpdate { + account_id, + public_key, + .. + } + | StateChangeValueView::AccessKeyDeletion { + account_id, + public_key, + } => { + // returning a hex-encoded key to ensure we store data changes to the key + // (if there is more than one change to the same key) + let data_key = borsh::to_vec(&public_key)?; + format!( + "{}_access_key_{}", + account_id.as_str(), + hex::encode(data_key) + ) + } + // ContractCode and Account changes is not separate-able by any key, we can omit the suffix + StateChangeValueView::ContractCodeUpdate { account_id, .. } + | StateChangeValueView::ContractCodeDeletion { account_id } => { + format!("{}_contract", account_id.as_str()) + } + StateChangeValueView::AccountUpdate { account_id, .. } + | StateChangeValueView::AccountDeletion { account_id } => { + format!("{}_account", account_id.as_str()) + } + }; + // This will override the previous record for this account_id + state change kind + suffix + state_changes_to_store.insert(key, state_change); + } + + // Asynchronous storing of StateChangeWithCauseView into the storage. + let futures = state_changes_to_store + .into_values() + .map(|state_change_with_cause| { + db_manager.save_state_change(state_change_with_cause, block_height, block_hash) + }); + + futures::future::try_join_all(futures).await +} + +#[actix_web::main] +async fn main() -> anyhow::Result<()> { + configuration::init_tracing(INDEXER).await?; + // We use it to automatically search the for root certificates to perform HTTPS calls + // (sending telemetry and downloading genesis) + openssl_probe::init_ssl_cert_env_vars(); + let opts: Opts = Opts::parse(); + let home_dir = opts.home.unwrap_or_else(near_indexer::get_default_home); + + match opts.subcmd { + configs::SubCommand::Run => { + // This will set the near_lake_build_info metric + // e.g. near_lake_build_info{build="1.37.1",release="0.1.29",rustc_version="1.76.0"} + metrics::NODE_BUILD_INFO.reset(); + metrics::NODE_BUILD_INFO + .with_label_values(&[ + env!("CARGO_PKG_VERSION"), + env!("BUILD_VERSION"), + env!("RUSTC_VERSION"), + ]) + .inc(); + run(home_dir).await? + } + configs::SubCommand::Init(init_config) => { + near_indexer::indexer_init_configs(&home_dir, init_config.into())? + } + }; + Ok(()) +} + +async fn run(home_dir: std::path::PathBuf) -> anyhow::Result<()> { + let state_indexer_config = + configuration::read_configuration::().await?; + + #[cfg(feature = "scylla_db")] + let db_manager = database::prepare_db_manager::< + database::scylladb::state_indexer::ScyllaDBManager, + >(&state_indexer_config.database) + .await?; + + #[cfg(all(feature = "postgres_db", not(feature = "scylla_db")))] + let db_manager = database::prepare_db_manager::< + database::postgres::state_indexer::PostgresDBManager, + >(&state_indexer_config.database) + .await?; + + let redis_client = redis::Client::open(state_indexer_config.general.redis_url.clone())? + .get_connection_manager() + .await?; + + let indexer_config = near_indexer::IndexerConfig { + home_dir, + sync_mode: near_indexer::SyncModeEnum::LatestSynced, + await_for_node_synced: near_indexer::AwaitForNodeSyncedEnum::StreamWhileSyncing, + validate_genesis: true, + }; + let indexer = near_indexer::Indexer::new(indexer_config)?; + + // Regular indexer process starts here + let stream = indexer.streamer(); + let (view_client, _) = indexer.client_actors(); + + let stats = std::sync::Arc::new(tokio::sync::RwLock::new(metrics::Stats::new())); + tokio::spawn(metrics::state_logger( + std::sync::Arc::clone(&stats), + view_client.clone(), + )); + tokio::spawn(utils::optimistic_stream( + view_client.clone(), + redis_client.clone(), + )); + + let mut handlers = tokio_stream::wrappers::ReceiverStream::new(stream) + .map(|streamer_message| { + handle_streamer_message( + streamer_message, + &db_manager, + redis_client.clone(), + &view_client, + state_indexer_config.clone(), + std::sync::Arc::clone(&stats), + ) + }) + .buffer_unordered(state_indexer_config.general.concurrency); + + while let Some(_handle_message) = handlers.next().await { + if let Err(err) = _handle_message { + tracing::warn!(target: INDEXER, "{:?}", err); + } + } + drop(handlers); // close the channel so the sender will stop + + Ok(()) +} diff --git a/near-state-indexer/src/metrics.rs b/near-state-indexer/src/metrics.rs new file mode 100644 index 00000000..6b198109 --- /dev/null +++ b/near-state-indexer/src/metrics.rs @@ -0,0 +1,89 @@ +use near_o11y::metrics::*; +use once_cell::sync::Lazy; + +pub static BLOCKS_DONE: Lazy = Lazy::new(|| { + try_create_int_counter( + "near_lake_block_done_total", + "Total number of indexed blocks", + ) + .unwrap() +}); + +// This metric is present in the near_o11y crate but it's not public +// so we can't use it directly. We have to redefine it here. +pub static NODE_BUILD_INFO: Lazy = Lazy::new(|| { + try_create_int_counter_vec( + "near_lake_build_info", + "Metric whose labels indicate node’s version; see \ + .", + &["release", "build", "rustc_version"], + ) + .unwrap() +}); + +#[derive(Debug, Clone)] +pub struct Stats { + pub block_heights_processing: std::collections::BTreeSet, + pub blocks_processed_count: u64, + pub last_processed_block_height: u64, + pub current_epoch_id: Option, + pub current_epoch_height: u64, +} + +impl Stats { + pub fn new() -> Self { + Self { + block_heights_processing: std::collections::BTreeSet::new(), + blocks_processed_count: 0, + last_processed_block_height: 0, + current_epoch_id: None, + current_epoch_height: 0, + } + } +} + +pub async fn state_logger( + stats: std::sync::Arc>, + view_client: actix::Addr, +) { + let interval_secs = 10; + let mut prev_blocks_processed_count: u64 = 0; + + loop { + tokio::time::sleep(std::time::Duration::from_secs(interval_secs)).await; + let stats_lock = stats.read().await; + + let block_processing_speed: f64 = ((stats_lock.blocks_processed_count + - prev_blocks_processed_count) as f64) + / (interval_secs as f64); + + let time_to_catch_the_tip_duration = if block_processing_speed > 0.0 { + if let Ok(block_height) = crate::utils::fetch_latest_block(&view_client).await { + Some(std::time::Duration::from_millis( + (((block_height - stats_lock.last_processed_block_height) as f64 + / block_processing_speed) + * 1000f64) as u64, + )) + } else { + None + } + } else { + None + }; + + tracing::info!( + target: crate::INDEXER, + "# {} | Blocks processing: {}| Blocks done: {}. Bps {:.2} b/s {}", + stats_lock.last_processed_block_height, + stats_lock.block_heights_processing.len(), + stats_lock.blocks_processed_count, + block_processing_speed, + if let Some(duration) = time_to_catch_the_tip_duration { + format!(" | {} to catch up the tip", humantime::format_duration(duration)) + } else { + "".to_string() + } + ); + prev_blocks_processed_count = stats_lock.blocks_processed_count; + } +} diff --git a/near-state-indexer/src/utils.rs b/near-state-indexer/src/utils.rs new file mode 100644 index 00000000..047d35fc --- /dev/null +++ b/near-state-indexer/src/utils.rs @@ -0,0 +1,107 @@ +use near_o11y::WithSpanContextExt; + +pub(crate) async fn fetch_epoch_validators_info( + epoch_id: near_indexer::near_primitives::hash::CryptoHash, + client: &actix::Addr, +) -> anyhow::Result { + Ok(client + .send( + near_client::GetValidatorInfo { + epoch_reference: near_indexer::near_primitives::types::EpochReference::EpochId( + near_indexer::near_primitives::types::EpochId(epoch_id), + ), + } + .with_span_context(), + ) + .await??) +} + +const INTERVAL: std::time::Duration = std::time::Duration::from_millis(500); + +/// Fetches the status to retrieve `latest_block_height` to determine if we need to fetch +/// entire block or we already fetched this block. +pub(crate) async fn fetch_latest_block( + client: &actix::Addr, +) -> anyhow::Result { + let block = client + .send( + near_client::GetBlock( + near_indexer::near_primitives::types::BlockReference::Finality( + near_indexer::near_primitives::types::Finality::Final, + ), + ) + .with_span_context(), + ) + .await??; + Ok(block.header.height) +} + +pub(crate) async fn fetch_optimistic_block( + client: &actix::Addr, +) -> anyhow::Result { + Ok(client + .send(near_client::GetBlock::latest().with_span_context()) + .await??) +} + +pub(crate) async fn publish_streamer_message( + topic: &str, + streamer_message: &near_indexer::StreamerMessage, + redis_client: redis::aio::ConnectionManager, +) -> anyhow::Result<()> { + let json_streamer_message = serde_json::to_string(streamer_message)?; + redis::cmd("publish") + .arg(topic) + .arg(json_streamer_message) + .query_async::(&mut redis_client.clone()) + .await?; + Ok(()) +} + +pub async fn optimistic_stream( + view_client: actix::Addr, + redis_client: redis::aio::ConnectionManager, +) { + tracing::info!(target: crate::INDEXER, "Starting Optimistic Streamer..."); + let mut optimistic_block_height: Option = None; + loop { + tokio::time::sleep(INTERVAL).await; + if let Ok(block) = fetch_optimistic_block(&view_client).await { + let height = block.header.height; + if let Some(block_height) = optimistic_block_height { + if height <= block_height { + continue; + } else { + optimistic_block_height = Some(height); + } + } else { + optimistic_block_height = Some(height); + }; + let response = near_indexer::build_streamer_message(&view_client, block).await; + match response { + Ok(streamer_message) => { + tracing::info!(target: crate::INDEXER, "Optimistic block {:?}", &optimistic_block_height); + if let Err(err) = publish_streamer_message( + "optimistic_block", + &streamer_message, + redis_client.clone(), + ) + .await + { + tracing::error!( + target: crate::INDEXER, + "Failed to publish optimistic block streamer message: {:#?}", err + ); + }; + } + Err(err) => { + tracing::error!( + target: crate::INDEXER, + "Missing data, skipping block #{}...", height + ); + tracing::error!(target: crate::INDEXER, "{:#?}", err); + } + } + }; + } +} diff --git a/perf-testing/Cargo.toml b/perf-testing/Cargo.toml index a941abdc..f4f9e5b6 100644 --- a/perf-testing/Cargo.toml +++ b/perf-testing/Cargo.toml @@ -10,15 +10,15 @@ license.workspace = true [dependencies] anyhow = "1.0.70" chrono = "0.4.26" -clap = { version = "4.3.21", features = ["color", "derive", "env"] } +clap = { version = "4.4.18", features = ["color", "derive", "env"] } dotenv = "0.15" futures = "0.3.28" -http = "0.2.8" +http = "1.0.0" rand = "0.8" serde_json = "1.0" tokio = { version = "1.28.2", features = ["full", "tracing"] } tracing = "0.1.34" -near-jsonrpc-client = "0.7.0" -near-jsonrpc-primitives = "1.36.0" -near-primitives = "1.36.0" +near-jsonrpc-client = "0.8.0" +near-jsonrpc-primitives = "0.20.0" +near-primitives = "0.20.0" diff --git a/perf-testing/src/main.rs b/perf-testing/src/main.rs index c45a88c5..2440dce3 100644 --- a/perf-testing/src/main.rs +++ b/perf-testing/src/main.rs @@ -71,7 +71,7 @@ async fn test(rpc_url: &http::Uri, name: &str, queries_count: usize) -> Vec anyhow:: let _ = client .call(methods::tx::RpcTransactionStatusRequest { transaction_info: TransactionInfo::TransactionId { - hash: tx.hash, - account_id: tx.sender_id.clone(), + tx_hash: tx.hash, + sender_account_id: tx.sender_id.clone(), }, }) .await?; diff --git a/readnode-primitives/Cargo.toml b/readnode-primitives/Cargo.toml index 0c278267..a9f90ac7 100644 --- a/readnode-primitives/Cargo.toml +++ b/readnode-primitives/Cargo.toml @@ -9,11 +9,10 @@ license.workspace = true [dependencies] anyhow = "1.0.70" -borsh = "0.10.2" -num-bigint = "0.3" +borsh = "1.3.1" num-traits = "0.2.15" serde = { version = "1.0.145", features = ["derive"] } serde_json = "1.0.85" -near-chain-configs = "1.36.0" -near-indexer-primitives = "1.36.0" +near-chain-configs.workspace = true +near-indexer-primitives.workspace = true diff --git a/readnode-primitives/src/lib.rs b/readnode-primitives/src/lib.rs index 96f1e999..c1602c90 100644 --- a/readnode-primitives/src/lib.rs +++ b/readnode-primitives/src/lib.rs @@ -1,7 +1,6 @@ use std::convert::TryFrom; use std::str::FromStr; -use borsh::{BorshDeserialize, BorshSerialize}; use near_indexer_primitives::{views, CryptoHash, IndexerTransactionWithOutcome}; use num_traits::ToPrimitive; use serde::{Deserialize, Serialize}; @@ -21,7 +20,7 @@ impl TransactionKey { } } -#[derive(BorshSerialize, BorshDeserialize, Serialize, Deserialize, Debug, Clone)] +#[derive(borsh::BorshSerialize, borsh::BorshDeserialize, Serialize, Deserialize, Debug, Clone)] pub struct CollectingTransactionDetails { pub transaction: views::SignedTransactionView, pub receipts: Vec, @@ -117,7 +116,7 @@ impl From for TransactionDetails { } } -#[derive(BorshSerialize, BorshDeserialize, Serialize, Deserialize, Debug, Clone)] +#[derive(borsh::BorshSerialize, borsh::BorshDeserialize, Serialize, Deserialize, Debug, Clone)] pub struct TransactionDetails { pub receipts: Vec, pub receipts_outcome: Vec, @@ -169,7 +168,7 @@ impl TransactionDetails { pub type StateKey = Vec; pub type StateValue = Vec; pub struct BlockHeightShardId(pub u64, pub u64); -pub struct QueryData { +pub struct QueryData { pub data: T, // block_height and block_hash we return here represents the moment // when the data was last updated in the database @@ -198,14 +197,6 @@ pub struct EpochValidatorsInfo { pub validators_info: views::EpochValidatorInfo, } -#[derive(Debug)] -pub struct ProtocolConfig { - pub epoch_id: CryptoHash, - pub epoch_height: u64, - pub epoch_start_height: u64, - pub protocol_config: near_chain_configs::ProtocolConfigView, -} - #[derive(Debug)] pub struct IndexedEpochInfo { pub epoch_id: CryptoHash, @@ -213,7 +204,6 @@ pub struct IndexedEpochInfo { pub epoch_start_height: u64, pub epoch_end_height: Option, pub validators_info: views::EpochValidatorInfo, - pub protocol_config: near_chain_configs::ProtocolConfigView, } #[derive(Debug)] @@ -253,7 +243,7 @@ impl CryptoHash, )> for QueryData where - T: BorshDeserialize, + T: borsh::BorshDeserialize, { type Error = anyhow::Error; diff --git a/rpc-server/Cargo.toml b/rpc-server/Cargo.toml index 4133ea2b..daa35435 100644 --- a/rpc-server/Cargo.toml +++ b/rpc-server/Cargo.toml @@ -7,47 +7,56 @@ rust-version.workspace = true repository.workspace = true license.workspace = true +[build-dependencies] +anyhow = "1.0.51" +rustc_version = "0.4" + [dependencies] -actix-web = "4.2.1" -actix-cors = "0.6.5" +actix-web = "4.5.1" +actix-cors = "0.7.0" anyhow = "1.0.70" assert-json-diff = { version = "2.0.2", optional = true } -borsh = "0.10.2" -erased-serde = "0.3.23" +borsh = "1.3.1" +chrono = "0.4.19" +erased-serde = "0.4.2" futures = "0.3.24" futures-locks = "0.7.1" hex = "0.4.3" -jsonrpc-v2 = { git = "https://github.com/kobayurii/jsonrpc-v2", rev = "95e7b1d2567ae841163af212a3f25abb6862becb" } +jsonrpc-v2 = { git = "https://github.com/kobayurii/jsonrpc-v2", branch = "master" } lazy_static = "1.4.0" -lru = "0.11.1" +lru = "0.12.2" paste = "1.0.14" prometheus = "0.13.1" +redis = { version = "0.24.0", features = ["tokio-comp", "connection-manager"] } serde = { version = "1.0.145", features = ["derive"] } serde_json = "1.0.85" thiserror = "1.0.40" -tokio = { version = "1.28.2", features = ["full", "tracing"] } +time = "0.3.34" +tokio = { version = "1.36.0", features = ["full", "tracing"] } tokio-stream = { version = "0.1.12" } tracing = { version = "0.1.36", features = ["std"] } -tracing-actix-web = "0.6.1" -sysinfo = "0.29.10" +tracing-actix-web = "0.7.9" +sysinfo = "0.30.5" -configuration = { path = "../configuration" } -database = { path = "../database" } -readnode-primitives = { path = "../readnode-primitives" } +configuration.workspace = true +database.workspace = true +readnode-primitives.workspace = true -near-chain-configs = "1.36.0" -near-crypto = "1.36.0" -near-jsonrpc-client = "0.7.0" -near-jsonrpc-primitives = "1.36.0" -near-indexer-primitives = "1.36.0" -near-lake-framework = "0.7.9" -near-primitives = "1.36.0" -near-vm-runner = "1.36.0" +near-chain-configs.workspace = true +near-crypto.workspace = true +near-jsonrpc-client.workspace = true +near-jsonrpc-primitives.workspace = true +near-indexer-primitives.workspace = true +near-lake-framework.workspace = true +near-primitives.workspace = true +near-parameters.workspace = true +near-vm-runner.workspace = true [features] -default = ["send_tx_methods", "scylla_db"] +default = ["send_tx_methods", "scylla_db", "near_state_indexer_disabled"] send_tx_methods = [] +near_state_indexer_disabled = [] # Use this feature if you don't run near-state-indexer tracing-instrumentation = ["configuration/tracing-instrumentation"] postgres_db = ["database/postgres_db"] scylla_db = ["database/scylla_db"] diff --git a/rpc-server/Dockerfile b/rpc-server/Dockerfile index d77fea83..61ff3c4e 100644 --- a/rpc-server/Dockerfile +++ b/rpc-server/Dockerfile @@ -1,11 +1,12 @@ -FROM rust:1.73 AS builder +FROM rust:1.76 AS builder ARG features="default" WORKDIR /tmp/ +COPY .cargo .cargo COPY Cargo.lock ./ COPY Cargo.toml ./ COPY config.toml ./ -RUN sed '/perf-testing/d; /state-indexer/d; /tx-indexer/d; /epoch-indexer/d' Cargo.toml > Cargo.toml.new && mv Cargo.toml.new Cargo.toml +RUN sed '/perf-testing/d; /state-indexer/d; /tx-indexer/d; /epoch-indexer/d; /near-state-indexer/d' Cargo.toml > Cargo.toml.new && mv Cargo.toml.new Cargo.toml COPY rpc-server/Cargo.toml rpc-server/Cargo.toml COPY configuration configuration COPY database database @@ -13,6 +14,7 @@ COPY readnode-primitives readnode-primitives RUN mkdir rpc-server/src && echo 'fn main() {}' > rpc-server/src/main.rs cargo build --release && rm -r rpc-server/src # copy your source tree +COPY rpc-server/build.rs rpc-server/build.rs COPY rpc-server/src ./rpc-server/src # build for release diff --git a/rpc-server/build.rs b/rpc-server/build.rs new file mode 100644 index 00000000..777e594b --- /dev/null +++ b/rpc-server/build.rs @@ -0,0 +1,20 @@ +/// This build.rs script is used to generate build-time information and set environment variables for the build process. +/// It retrieves the Rust compiler version and sets it as the `RUSTC_VERSION` environment variable. +/// It also sets the `BUILD_VERSION` environment variable to the value of `NEARCORE_VERSION` defined in the project. +/// Additionally, it prints messages to indicate which files should trigger a rebuild when changed. +fn get_rustc_version() -> anyhow::Result { + let version = rustc_version::version()?; + Ok(version.to_string()) +} + +fn main() -> anyhow::Result<()> { + println!("cargo:rerun-if-changed=.git/HEAD"); + println!("cargo:rerun-if-changed=.git/index"); + + println!("cargo:rustc-env=BUILD_VERSION={}", env!("NEARCORE_VERSION")); + + let rustc_version = get_rustc_version()?; + println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version); + + Ok(()) +} diff --git a/rpc-server/src/config.rs b/rpc-server/src/config.rs index 37d841da..6df8ea42 100644 --- a/rpc-server/src/config.rs +++ b/rpc-server/src/config.rs @@ -1,12 +1,12 @@ -use crate::modules::blocks::{CacheBlock, FinalBlockInfo}; -use futures::executor::block_on; use std::string::ToString; -// TODO: Improve versioning in future. -// For now, it's hardcoded and should be updated manually at each release.. -static NEARD_VERSION: &str = "1.36.0"; -static NEARD_BUILD: &str = "1.36.0"; -static RUSTC_VERSION: &str = "1.73.0"; +use futures::executor::block_on; + +use crate::modules::blocks::{BlocksInfoByFinality, CacheBlock}; + +static NEARD_VERSION: &str = env!("CARGO_PKG_VERSION"); +static NEARD_BUILD: &str = env!("BUILD_VERSION"); +static RUSTC_VERSION: &str = env!("RUSTC_VERSION"); // Struct to store genesis_config and genesis_block in the server context // Fetch once genesis info on start of the server and put it in the context @@ -40,7 +40,7 @@ impl GenesisInfo { Self { genesis_config, - genesis_block_cache: genesis_block.into(), + genesis_block_cache: CacheBlock::from(&genesis_block), } } } @@ -61,7 +61,7 @@ pub struct ServerContext { pub blocks_cache: std::sync::Arc>>, /// Final block info include final_block_cache and current_validators_info - pub final_block_info: std::sync::Arc>, + pub blocks_info_by_finality: std::sync::Arc>, /// Cache to store compiled contract codes pub compiled_contract_code_cache: std::sync::Arc, /// Cache to store contract codes @@ -118,8 +118,8 @@ impl ServerContext { )), }); - let final_block_info = std::sync::Arc::new(futures_locks::RwLock::new( - FinalBlockInfo::new(&near_rpc_client, &blocks_cache).await, + let blocks_info_by_finality = std::sync::Arc::new(futures_locks::RwLock::new( + BlocksInfoByFinality::new(&near_rpc_client, &blocks_cache).await, )); let s3_client = rpc_server_config.lake_config.lake_s3_client().await; @@ -150,13 +150,13 @@ impl ServerContext { near_rpc_client, s3_bucket_name: rpc_server_config.lake_config.aws_bucket_name.clone(), blocks_cache, - final_block_info, + blocks_info_by_finality, compiled_contract_code_cache, contract_code_cache, max_gas_burnt: rpc_server_config.general.max_gas_burnt, shadow_data_consistency_rate: rpc_server_config.general.shadow_data_consistency_rate, server_port: rpc_server_config.general.server_port, - boot_time_seconds: near_primitives::static_clock::StaticClock::utc().timestamp(), + boot_time_seconds: chrono::Utc::now().timestamp(), version: near_primitives::version::Version { version: NEARD_VERSION.to_string(), build: NEARD_BUILD.to_string(), diff --git a/rpc-server/src/errors.rs b/rpc-server/src/errors.rs index e0922b4f..c052c869 100644 --- a/rpc-server/src/errors.rs +++ b/rpc-server/src/errors.rs @@ -9,10 +9,14 @@ type BoxedSerialize = Box; pub struct RPCError(pub(crate) near_jsonrpc_primitives::errors::RpcError); impl RPCError { - pub(crate) fn unimplemented_error(msg: &str) -> Self { + pub(crate) fn unimplemented_error(method_name: &str) -> Self { Self::from(near_jsonrpc_primitives::errors::RpcError::new( -32601, - String::from(msg), + format!( + "Method `{}` is not implemented on this type of node. \ + Please send a request to NEAR JSON RPC instead.", + method_name + ), None, )) } diff --git a/rpc-server/src/health.rs b/rpc-server/src/health.rs index eddbbf4f..e7728aaa 100644 --- a/rpc-server/src/health.rs +++ b/rpc-server/src/health.rs @@ -50,10 +50,11 @@ impl RPCHealthStatusResponse { ), final_block_height: server_context - .final_block_info + .blocks_info_by_finality .read() .await - .final_block_cache + .final_block + .block_cache .block_height, } } diff --git a/rpc-server/src/main.rs b/rpc-server/src/main.rs index 3a30e7b2..045d088b 100644 --- a/rpc-server/src/main.rs +++ b/rpc-server/src/main.rs @@ -1,8 +1,6 @@ use actix_web::dev::Service; use jsonrpc_v2::{Data, Server}; -use crate::utils::update_final_block_height_regularly; - #[macro_use] extern crate lazy_static; @@ -39,49 +37,60 @@ async fn main() -> anyhow::Result<()> { config::ServerContext::init(rpc_server_config.clone(), near_rpc_client.clone()).await?; let blocks_cache = std::sync::Arc::clone(&server_context.blocks_cache); - let final_block_info = std::sync::Arc::clone(&server_context.final_block_info); + let blocks_info_by_finality = std::sync::Arc::clone(&server_context.blocks_info_by_finality); + + #[cfg(feature = "near_state_indexer_disabled")] tokio::spawn(async move { - update_final_block_height_regularly( + utils::update_final_block_regularly( blocks_cache, - final_block_info, + blocks_info_by_finality, rpc_server_config, near_rpc_client, ) .await }); + #[cfg(not(feature = "near_state_indexer_disabled"))] + { + let redis_client = redis::Client::open(rpc_server_config.general.redis_url.clone())?; + let redis_client_clone = redis_client.clone(); + tokio::spawn(async move { + utils::update_final_block_regularly( + blocks_cache, + blocks_info_by_finality, + redis_client_clone, + near_rpc_client, + ) + .await + }); + let blocks_info_by_finality = + std::sync::Arc::clone(&server_context.blocks_info_by_finality); + tokio::spawn(async move { + utils::update_optimistic_block_regularly(blocks_info_by_finality, redis_client).await + }); + } + let rpc = Server::new() .with_data(Data::new(server_context.clone())) - .with_method("query", modules::queries::methods::query) + // custom requests methods .with_method( "view_state_paginated", modules::state::methods::view_state_paginated, ) + // requests methods + .with_method("query", modules::queries::methods::query) + // basic requests methods .with_method("block", modules::blocks::methods::block) - .with_method( - "EXPERIMENTAL_changes", - modules::blocks::methods::changes_in_block_by_type, - ) - .with_method( - "EXPERIMENTAL_changes_in_block", - modules::blocks::methods::changes_in_block, - ) - .with_method("chunk", modules::blocks::methods::chunk) - .with_method("tx", modules::transactions::methods::tx) - .with_method( - "EXPERIMENTAL_tx_status", - modules::transactions::methods::tx_status, - ) .with_method( "broadcast_tx_async", - modules::transactions::methods::send_tx_async, + modules::transactions::methods::broadcast_tx_async, ) .with_method( "broadcast_tx_commit", - modules::transactions::methods::send_tx_commit, + modules::transactions::methods::broadcast_tx_commit, ) + .with_method("chunk", modules::blocks::methods::chunk) .with_method("gas_price", modules::gas::methods::gas_price) - .with_method("status", modules::network::methods::status) .with_method("health", modules::network::methods::health) .with_method( "light_client_proof", @@ -92,10 +101,18 @@ async fn main() -> anyhow::Result<()> { modules::clients::methods::next_light_client_block, ) .with_method("network_info", modules::network::methods::network_info) + .with_method("send_tx", modules::transactions::methods::send_tx) + .with_method("status", modules::network::methods::status) + .with_method("tx", modules::transactions::methods::tx) .with_method("validators", modules::network::methods::validators) + .with_method("client_config", modules::network::methods::client_config) .with_method( - "EXPERIMENTAL_validators_ordered", - modules::network::methods::validators_ordered, + "EXPERIMENTAL_changes", + modules::blocks::methods::changes_in_block_by_type, + ) + .with_method( + "EXPERIMENTAL_changes_in_block", + modules::blocks::methods::changes_in_block, ) .with_method( "EXPERIMENTAL_genesis_config", @@ -110,6 +127,22 @@ async fn main() -> anyhow::Result<()> { modules::network::methods::protocol_config, ) .with_method("EXPERIMENTAL_receipt", modules::receipts::methods::receipt) + .with_method( + "EXPERIMENTAL_tx_status", + modules::transactions::methods::tx_status, + ) + .with_method( + "EXPERIMENTAL_validators_ordered", + modules::network::methods::validators_ordered, + ) + .with_method( + "EXPERIMENTAL_maintenance_windows", + modules::network::methods::maintenance_windows, + ) + .with_method( + "EXPERIMENTAL_split_storage_info", + modules::network::methods::split_storage_info, + ) .finish(); actix_web::HttpServer::new(move || { diff --git a/rpc-server/src/modules/blocks/methods.rs b/rpc-server/src/modules/blocks/methods.rs index 10c45584..59204dda 100644 --- a/rpc-server/src/modules/blocks/methods.rs +++ b/rpc-server/src/modules/blocks/methods.rs @@ -17,6 +17,7 @@ pub async fn block( data: Data, Params(mut params): Params, ) -> Result { + #[cfg(feature = "near_state_indexer_disabled")] if let near_primitives::types::BlockReference::Finality(finality) = ¶ms.block_reference { if finality != &near_primitives::types::Finality::Final { // Increase the OPTIMISTIC_REQUESTS_TOTAL metric if the request has @@ -68,6 +69,7 @@ pub async fn changes_in_block_by_type( near_jsonrpc_primitives::types::changes::RpcStateChangesInBlockByTypeRequest, >, ) -> Result { + #[cfg(feature = "near_state_indexer_disabled")] if let near_primitives::types::BlockReference::Finality(finality) = ¶ms.block_reference { if finality != &near_primitives::types::Finality::Final { // Increase the OPTIMISTIC_REQUESTS_TOTAL metric if the request has @@ -93,6 +95,7 @@ pub async fn changes_in_block( >, ) -> Result { + #[cfg(feature = "near_state_indexer_disabled")] if let near_primitives::types::BlockReference::Finality(finality) = ¶ms.block_reference { if finality != &near_primitives::types::Finality::Final { // Increase the OPTIMISTIC_REQUESTS_TOTAL metric if the request has @@ -154,15 +157,15 @@ async fn changes_in_block_call( ) -> Result { crate::metrics::CHNGES_IN_BLOCK_REQUESTS_TOTAL.inc(); - let block = fetch_block_from_cache_or_get(&data, params.block_reference.clone()) + let cache_block = fetch_block_from_cache_or_get(&data, params.block_reference.clone()) .await .map_err(near_jsonrpc_primitives::errors::RpcError::from)?; - let result = fetch_changes_in_block(&data, block).await; + let result = fetch_changes_in_block(&data, cache_block, ¶ms.block_reference).await; #[cfg(feature = "shadow_data_consistency")] { if let near_primitives::types::BlockReference::Finality(_) = params.block_reference { params.block_reference = near_primitives::types::BlockReference::from( - near_primitives::types::BlockId::Height(block.block_height), + near_primitives::types::BlockId::Height(cache_block.block_height), ) } if let Some(err_code) = crate::utils::shadow_compare_results_handler( @@ -192,16 +195,22 @@ async fn changes_in_block_by_type_call( >, ) -> Result { crate::metrics::CHNGES_IN_BLOCK_BY_TYPE_REQUESTS_TOTAL.inc(); - let block = fetch_block_from_cache_or_get(&data, params.block_reference.clone()) + let cache_block = fetch_block_from_cache_or_get(&data, params.block_reference.clone()) .await .map_err(near_jsonrpc_primitives::errors::RpcError::from)?; - let result = fetch_changes_in_block_by_type(&data, block, ¶ms.state_changes_request).await; + let result = fetch_changes_in_block_by_type( + &data, + cache_block, + ¶ms.state_changes_request, + ¶ms.block_reference, + ) + .await; #[cfg(feature = "shadow_data_consistency")] { if let near_primitives::types::BlockReference::Finality(_) = params.block_reference { params.block_reference = near_primitives::types::BlockReference::from( - near_primitives::types::BlockId::Height(block.block_height), + near_primitives::types::BlockId::Height(cache_block.block_height), ) } if let Some(err_code) = crate::utils::shadow_compare_results_handler( @@ -244,19 +253,40 @@ pub async fn fetch_block( } } }, - near_primitives::types::BlockReference::Finality(finality) => match finality { - near_primitives::types::Finality::Final => Ok(data - .final_block_info - .read() - .await - .final_block_cache - .block_height), - _ => Err( - near_jsonrpc_primitives::types::blocks::RpcBlockError::InternalError { - error_message: "Finality other than final is not supported".to_string(), - }, - ), - }, + near_primitives::types::BlockReference::Finality(finality) => { + return match finality { + near_primitives::types::Finality::Final + | near_primitives::types::Finality::DoomSlug => { + let block_view = data + .blocks_info_by_finality + .read() + .await + .final_block + .block_view() + .await; + Ok(near_jsonrpc_primitives::types::blocks::RpcBlockResponse { block_view }) + } + near_primitives::types::Finality::None => { + if cfg!(feature = "near_state_indexer_disabled") { + Err( + near_jsonrpc_primitives::types::blocks::RpcBlockError::UnknownBlock { + error_message: "Finality::None is not supported by read-rpc" + .to_string(), + }, + ) + } else { + let block_view = data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .block_view() + .await; + Ok(near_jsonrpc_primitives::types::blocks::RpcBlockResponse { block_view }) + } + } + } + } // for archive node both SyncCheckpoint(Genesis and EarliestAvailable) // are returning the genesis block height near_primitives::types::BlockReference::SyncCheckpoint(_) => { @@ -338,16 +368,19 @@ pub async fn fetch_chunk( #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] async fn fetch_changes_in_block( data: &Data, - block: crate::modules::blocks::CacheBlock, + cache_block: crate::modules::blocks::CacheBlock, + block_reference: &near_primitives::types::BlockReference, ) -> Result< near_jsonrpc_primitives::types::changes::RpcStateChangesInBlockByTypeResponse, near_jsonrpc_primitives::types::changes::RpcStateChangesError, > { - let shards = fetch_shards(data, block).await.map_err(|err| { - near_jsonrpc_primitives::types::changes::RpcStateChangesError::UnknownBlock { - error_message: err.to_string(), - } - })?; + let shards = fetch_shards(data, cache_block, block_reference) + .await + .map_err(|err| { + near_jsonrpc_primitives::types::changes::RpcStateChangesError::UnknownBlock { + error_message: err.to_string(), + } + })?; let trie_keys = shards .into_iter() @@ -416,7 +449,7 @@ async fn fetch_changes_in_block( Ok( near_jsonrpc_primitives::types::changes::RpcStateChangesInBlockByTypeResponse { - block_hash: block.block_hash, + block_hash: cache_block.block_hash, changes, }, ) @@ -425,17 +458,20 @@ async fn fetch_changes_in_block( #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] async fn fetch_changes_in_block_by_type( data: &Data, - block: crate::modules::blocks::CacheBlock, + cache_block: crate::modules::blocks::CacheBlock, state_changes_request: &near_primitives::views::StateChangesRequestView, + block_reference: &near_primitives::types::BlockReference, ) -> Result< near_jsonrpc_primitives::types::changes::RpcStateChangesInBlockResponse, near_jsonrpc_primitives::types::changes::RpcStateChangesError, > { - let shards = fetch_shards(data, block).await.map_err(|err| { - near_jsonrpc_primitives::types::changes::RpcStateChangesError::UnknownBlock { - error_message: err.to_string(), - } - })?; + let shards = fetch_shards(data, cache_block, block_reference) + .await + .map_err(|err| { + near_jsonrpc_primitives::types::changes::RpcStateChangesError::UnknownBlock { + error_message: err.to_string(), + } + })?; let changes = shards .into_iter() .flat_map(|shard| shard.state_changes) @@ -443,7 +479,7 @@ async fn fetch_changes_in_block_by_type( .collect(); Ok( near_jsonrpc_primitives::types::changes::RpcStateChangesInBlockResponse { - block_hash: block.block_hash, + block_hash: cache_block.block_hash, changes, }, ) @@ -452,26 +488,55 @@ async fn fetch_changes_in_block_by_type( #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] async fn fetch_shards( data: &Data, - block: crate::modules::blocks::CacheBlock, + cache_block: crate::modules::blocks::CacheBlock, + block_reference: &near_primitives::types::BlockReference, ) -> anyhow::Result> { - let fetch_shards_futures = (0..block.chunks_included) - .collect::>() - .into_iter() - .map(|shard_id| { - near_lake_framework::s3_fetchers::fetch_shard( - &data.s3_client, - &data.s3_bucket_name, - block.block_height, - shard_id, - ) - }); - futures::future::try_join_all(fetch_shards_futures) - .await - .map_err(|err| { - anyhow::anyhow!( - "Failed to fetch shards for block {} with error: {}", - block.block_height, - err - ) - }) + if let near_primitives::types::BlockReference::Finality(finality) = block_reference { + match finality { + near_primitives::types::Finality::None => { + if cfg!(feature = "near_state_indexer_disabled") { + Err(anyhow::anyhow!( + "Failed to fetch shards! Finality::None is not supported by rpc_server", + )) + } else { + Ok(data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .shards() + .await) + } + } + near_primitives::types::Finality::DoomSlug + | near_primitives::types::Finality::Final => Ok(data + .blocks_info_by_finality + .read() + .await + .final_block + .shards() + .await), + } + } else { + let fetch_shards_futures = (0..cache_block.chunks_included) + .collect::>() + .into_iter() + .map(|shard_id| { + near_lake_framework::s3_fetchers::fetch_shard( + &data.s3_client, + &data.s3_bucket_name, + cache_block.block_height, + shard_id, + ) + }); + futures::future::try_join_all(fetch_shards_futures) + .await + .map_err(|err| { + anyhow::anyhow!( + "Failed to fetch shards for block {} with error: {}", + cache_block.block_height, + err + ) + }) + } } diff --git a/rpc-server/src/modules/blocks/mod.rs b/rpc-server/src/modules/blocks/mod.rs index d1589293..1a8335e3 100644 --- a/rpc-server/src/modules/blocks/mod.rs +++ b/rpc-server/src/modules/blocks/mod.rs @@ -1,3 +1,5 @@ +use near_primitives::views::StateChangeValueView; + pub mod methods; pub mod utils; @@ -13,8 +15,8 @@ pub struct CacheBlock { pub epoch_id: near_primitives::hash::CryptoHash, } -impl From for CacheBlock { - fn from(block: near_primitives::views::BlockView) -> Self { +impl From<&near_primitives::views::BlockView> for CacheBlock { + fn from(block: &near_primitives::views::BlockView) -> Self { Self { block_hash: block.header.hash, block_height: block.header.height, @@ -29,38 +31,288 @@ impl From for CacheBlock { } #[derive(Debug)] -pub struct FinalBlockInfo { - pub final_block_cache: CacheBlock, - pub current_protocol_config: near_chain_configs::ProtocolConfigView, +pub struct BlockInfo { + pub block_cache: CacheBlock, + pub stream_message: near_indexer_primitives::StreamerMessage, +} + +impl BlockInfo { + // Create new BlockInfo from BlockView. this method is useful only for start rpc-server. + pub async fn new_from_block_view(block_view: near_primitives::views::BlockView) -> Self { + Self { + block_cache: CacheBlock::from(&block_view), + stream_message: near_indexer_primitives::StreamerMessage { + block: block_view, + shards: vec![], // We left shards empty because block_view doesn't contain shards. + }, + } + } + + // Create new BlockInfo from StreamerMessage. + // This is using to update final and optimistic blocks regularly. + pub async fn new_from_streamer_message( + stream_message: near_indexer_primitives::StreamerMessage, + ) -> Self { + Self { + block_cache: CacheBlock::from(&stream_message.block), + stream_message, + } + } + + pub async fn block_view(&self) -> near_primitives::views::BlockView { + self.stream_message.block.clone() + } + + pub async fn shards(&self) -> Vec { + self.stream_message.shards.clone() + } + + // This method using for optimistic blocks info. + // We fetch the account changes in the block by specific AccountId. + // For optimistic block s we don't have information about account changes in the database, + // so we need to fetch it from the optimistic block streamer_message and merge it with data from database. + pub async fn account_changes_in_block( + &self, + target_account_id: &near_primitives::types::AccountId, + ) -> anyhow::Result> { + let mut result = None; + let mut is_account_updated = false; + let initial_state_changes = self + .shards() + .await + .into_iter() + .flat_map(|shard| shard.state_changes.into_iter()) + .filter(|state_change| { + matches!( + state_change.value, + StateChangeValueView::AccountUpdate { .. } + | StateChangeValueView::AccountDeletion { .. } + ) + }); + + for state_change in initial_state_changes { + match state_change.value { + StateChangeValueView::AccountUpdate { + account_id, + account, + } => { + if &account_id == target_account_id { + result = Some(account); + is_account_updated = true; + } + } + StateChangeValueView::AccountDeletion { account_id } => { + if &account_id == target_account_id { + result = None; + is_account_updated = true; + } + } + _ => anyhow::bail!("Invalid state change value"), + }; + } + if !is_account_updated { + anyhow::bail!("Account not updated in this block"); + } + Ok(result) + } + + // This method using for optimistic blocks info. + // We fetch the contract code changes in the block by specific AccountId. + // For optimistic block we don't have information about code changes in the database, + // so we need to fetch it from the optimistic block streamer_message and merge it with data from database. + pub async fn code_changes_in_block( + &self, + target_account_id: &near_primitives::types::AccountId, + ) -> anyhow::Result>> { + let mut result = None; + let mut is_code_updated = false; + let initial_state_changes = self + .shards() + .await + .into_iter() + .flat_map(|shard| shard.state_changes.into_iter()) + .filter(|state_change| { + matches!( + state_change.value, + StateChangeValueView::ContractCodeUpdate { .. } + | StateChangeValueView::ContractCodeDeletion { .. } + ) + }); + + for state_change in initial_state_changes { + match state_change.value { + StateChangeValueView::ContractCodeUpdate { account_id, code } => { + if &account_id == target_account_id { + result = Some(code); + is_code_updated = true; + } + } + StateChangeValueView::ContractCodeDeletion { account_id } => { + if &account_id == target_account_id { + result = None; + is_code_updated = true; + } + } + _ => anyhow::bail!("Invalid state change value"), + }; + } + if !is_code_updated { + anyhow::bail!("Contract code not updated in this block"); + } + Ok(result) + } + + // This method using for optimistic blocks info. + // We fetch the access_key changes in the block by specific AccountId and PublicKey. + // For optimistic block we don't have information about AccessKey changes in the database, + // so we need to fetch it from the optimistic block streamer_message and merge it with data from database. + pub async fn access_key_changes_in_block( + &self, + target_account_id: &near_primitives::types::AccountId, + target_public_key: &near_crypto::PublicKey, + ) -> anyhow::Result> { + let mut result = None; + let mut is_access_key_updated = false; + let initial_state_changes = self + .shards() + .await + .into_iter() + .flat_map(|shard| shard.state_changes.into_iter()) + .filter(|state_change| { + matches!( + state_change.value, + StateChangeValueView::AccessKeyUpdate { .. } + | StateChangeValueView::AccessKeyDeletion { .. } + ) + }); + + for state_change in initial_state_changes { + match state_change.value { + StateChangeValueView::AccessKeyUpdate { + account_id, + public_key, + access_key, + } => { + if &account_id == target_account_id && &public_key == target_public_key { + result = Some(access_key); + is_access_key_updated = true; + } + } + StateChangeValueView::AccessKeyDeletion { + account_id, + public_key, + } => { + if &account_id == target_account_id && &public_key == target_public_key { + result = None; + is_access_key_updated = true; + } + } + _ => anyhow::bail!("Invalid state change value"), + }; + } + if !is_access_key_updated { + anyhow::bail!("Access key not updated in this block"); + } + Ok(result) + } + + // This method using for optimistic blocks info. + // We fetch the state changes in the block by specific AccountId and key_prefix. + // if prefix is empty, we fetch all state changes by specific AccountId. + // For optimistic block we don't have information about state changes in the database, + // so we need to fetch it from the optimistic block streamer_message and merge it with data from database. + pub async fn state_changes_in_block( + &self, + target_account_id: &near_primitives::types::AccountId, + prefix: &[u8], + ) -> std::collections::HashMap< + readnode_primitives::StateKey, + Option, + > { + let mut block_state_changes = std::collections::HashMap::< + readnode_primitives::StateKey, + Option, + >::new(); + let hex_str_prefix = hex::encode(prefix); + + let initial_state_changes = self + .shards() + .await + .into_iter() + .flat_map(|shard| shard.state_changes.into_iter()) + .filter(|state_change| { + matches!( + state_change.value, + StateChangeValueView::DataUpdate { .. } + | StateChangeValueView::DataDeletion { .. } + ) + }); + + for state_change in initial_state_changes { + match state_change.value { + StateChangeValueView::DataUpdate { + account_id, + key, + value, + } => { + if &account_id == target_account_id { + let key: &[u8] = key.as_ref(); + if hex::encode(key).starts_with(&hex_str_prefix) { + block_state_changes.insert(key.to_vec(), Some(value.to_vec())); + } + } + } + StateChangeValueView::DataDeletion { account_id, key } => { + if &account_id == target_account_id { + let key: &[u8] = key.as_ref(); + if hex::encode(key).starts_with(&hex_str_prefix) { + block_state_changes.insert(key.to_vec(), None); + } + } + } + _ => {} + } + } + block_state_changes + } +} + +#[derive(Debug)] +pub struct BlocksInfoByFinality { + pub final_block: BlockInfo, + pub optimistic_block: BlockInfo, pub current_validators: near_primitives::views::EpochValidatorInfo, } -impl FinalBlockInfo { +impl BlocksInfoByFinality { pub async fn new( near_rpc_client: &crate::utils::JsonRpcClient, blocks_cache: &std::sync::Arc< futures_locks::RwLock>, >, ) -> Self { - let final_block = crate::utils::get_final_cache_block(near_rpc_client) - .await - .expect("Error to get final block"); - let protocol_config = crate::utils::get_current_protocol_config(near_rpc_client) - .await - .expect("Error to get protocol_config"); - - let validators = crate::utils::get_current_validators(near_rpc_client) - .await - .expect("Error to get protocol_config"); + let final_block_future = crate::utils::get_final_block(near_rpc_client, false); + let optimistic_block_future = crate::utils::get_final_block(near_rpc_client, true); + let validators_future = crate::utils::get_current_validators(near_rpc_client); + let (final_block, optimistic_block, validators) = tokio::try_join!( + final_block_future, + optimistic_block_future, + validators_future, + ) + .map_err(|err| { + tracing::error!("Error to fetch final block info: {:?}", err); + err + }) + .expect("Error to get final block info"); blocks_cache .write() .await - .put(final_block.block_height, final_block); + .put(final_block.header.height, CacheBlock::from(&final_block)); Self { - final_block_cache: final_block, - current_protocol_config: protocol_config, + final_block: BlockInfo::new_from_block_view(final_block).await, + optimistic_block: BlockInfo::new_from_block_view(optimistic_block).await, current_validators: validators, } } diff --git a/rpc-server/src/modules/blocks/utils.rs b/rpc-server/src/modules/blocks/utils.rs index 365adb37..abd07886 100644 --- a/rpc-server/src/modules/blocks/utils.rs +++ b/rpc-server/src/modules/blocks/utils.rs @@ -96,9 +96,41 @@ pub async fn fetch_block_from_cache_or_get( }; data.blocks_cache.write().await.get(&block_height).cloned() } - near_primitives::types::BlockReference::Finality(_) => { - // Returns the final_block_height for all the finalities. - Some(data.final_block_info.read().await.final_block_cache) + near_primitives::types::BlockReference::Finality(finality) => { + match finality { + near_primitives::types::Finality::None => { + if cfg!(feature = "near_state_indexer_disabled") { + // Returns the final_block for None. + Some( + data.blocks_info_by_finality + .read() + .await + .final_block + .block_cache, + ) + } else { + // Returns the optimistic_block for None. + Some( + data.blocks_info_by_finality + .read() + .await + .optimistic_block + .block_cache, + ) + } + } + near_primitives::types::Finality::DoomSlug + | near_primitives::types::Finality::Final => { + // Returns the final_block for DoomSlug and Final. + Some( + data.blocks_info_by_finality + .read() + .await + .final_block + .block_cache, + ) + } + } } near_primitives::types::BlockReference::SyncCheckpoint(_) => { // Return genesis_block_cache for all SyncCheckpoint @@ -111,7 +143,7 @@ pub async fn fetch_block_from_cache_or_get( Some(block) => Ok(block), None => { let block_from_s3 = fetch_block(data, block_reference).await?; - let block: CacheBlock = block_from_s3.block_view.into(); + let block = CacheBlock::from(&block_from_s3.block_view); data.blocks_cache .write() diff --git a/rpc-server/src/modules/network/methods.rs b/rpc-server/src/modules/network/methods.rs index 58f023be..f21b06ff 100644 --- a/rpc-server/src/modules/network/methods.rs +++ b/rpc-server/src/modules/network/methods.rs @@ -1,18 +1,38 @@ +use actix_web::cookie::time; use jsonrpc_v2::{Data, Params}; -use near_primitives::utils::from_timestamp; - use crate::config::ServerContext; use crate::errors::RPCError; use crate::modules::blocks::utils::fetch_block_from_cache_or_get; -use crate::modules::network::{clone_protocol_config, parse_validator_request}; +use crate::modules::network::parse_validator_request; + +pub async fn client_config( + _data: Data, + Params(_params): Params, +) -> Result<(), RPCError> { + Err(RPCError::unimplemented_error("client_config")) +} + +pub async fn maintenance_windows( + _data: Data, + Params(_params): Params, +) -> Result<(), RPCError> { + Err(RPCError::unimplemented_error("maintenance_windows")) +} + +pub async fn split_storage_info( + _data: Data, + Params(_params): Params, +) -> Result<(), RPCError> { + Err(RPCError::unimplemented_error("split_storage_info")) +} pub async fn status( data: Data, Params(_params): Params, ) -> Result { - let final_block_info = data.final_block_info.read().await; - let validators = final_block_info + let blocks_info_by_finality = data.blocks_info_by_finality.read().await; + let validators = blocks_info_by_finality .current_validators .current_validators .iter() @@ -26,26 +46,42 @@ pub async fn status( version: data.version.clone(), chain_id: data.genesis_info.genesis_config.chain_id.clone(), protocol_version: near_primitives::version::PROTOCOL_VERSION, - latest_protocol_version: final_block_info.final_block_cache.latest_protocol_version, + latest_protocol_version: blocks_info_by_finality + .final_block + .block_cache + .latest_protocol_version, // Address for current read_node RPC server. rpc_addr: Some(format!("0.0.0.0:{}", data.server_port)), validators, sync_info: near_primitives::views::StatusSyncInfo { - latest_block_hash: final_block_info.final_block_cache.block_hash, - latest_block_height: final_block_info.final_block_cache.block_height, - latest_state_root: final_block_info.final_block_cache.state_root, - latest_block_time: from_timestamp(final_block_info.final_block_cache.block_timestamp), + latest_block_hash: blocks_info_by_finality.final_block.block_cache.block_hash, + latest_block_height: blocks_info_by_finality.final_block.block_cache.block_height, + latest_state_root: blocks_info_by_finality.final_block.block_cache.state_root, + latest_block_time: time::OffsetDateTime::from_unix_timestamp_nanos( + blocks_info_by_finality + .final_block + .block_cache + .block_timestamp as i128, + ) + .expect("Failed to parse timestamp"), // Always false because read_node is not need to sync syncing: false, earliest_block_hash: Some(data.genesis_info.genesis_block_cache.block_hash), earliest_block_height: Some(data.genesis_info.genesis_block_cache.block_height), - earliest_block_time: Some(from_timestamp( - data.genesis_info.genesis_block_cache.block_timestamp, - )), + earliest_block_time: Some( + time::OffsetDateTime::from_unix_timestamp_nanos( + data.genesis_info.genesis_block_cache.block_timestamp as i128, + ) + .expect("Failed to parse timestamp"), + ), epoch_id: Some(near_primitives::types::EpochId( - final_block_info.final_block_cache.epoch_id, + blocks_info_by_finality.final_block.block_cache.epoch_id, )), - epoch_start_height: Some(final_block_info.current_validators.epoch_start_height), + epoch_start_height: Some( + blocks_info_by_finality + .current_validators + .epoch_start_height, + ), }, validator_account_id: None, validator_public_key: None, @@ -53,8 +89,7 @@ pub async fn status( node_public_key: near_crypto::PublicKey::empty(near_crypto::KeyType::ED25519), node_key: None, // return uptime current read_node - uptime_sec: near_primitives::static_clock::StaticClock::utc().timestamp() - - data.boot_time_seconds, + uptime_sec: chrono::Utc::now().timestamp() - data.boot_time_seconds, // Not using for status method detailed_debug_status: None, }) @@ -70,11 +105,13 @@ pub async fn health( } pub async fn network_info( + data: Data, Params(_params): Params, ) -> Result { - Err(RPCError::unimplemented_error( - "Method is not implemented on this type of node. Please send a request to NEAR JSON RPC instead.", - )) + Ok(data + .near_rpc_client + .call(near_jsonrpc_client::methods::network_info::RpcNetworkInfoRequest) + .await?) } pub async fn validators( @@ -97,10 +134,11 @@ pub async fn validators( // Current epoch validators fetches from the Near RPC node if let near_primitives::types::EpochReference::EpochId(epoch_id) = &request.epoch_reference { if data - .final_block_info + .blocks_info_by_finality .read() .await - .final_block_cache + .final_block + .block_cache .epoch_id == epoch_id.0 { @@ -235,25 +273,19 @@ async fn protocol_config_call( error_message: err.to_string(), } })?; - let protocol_config = if data - .final_block_info - .read() - .await - .final_block_cache - .epoch_id - == block.epoch_id - { - let protocol_config = &data.final_block_info.read().await.current_protocol_config; - clone_protocol_config(protocol_config) - } else { - data.db_manager - .get_protocol_config_by_epoch_id(block.epoch_id) - .await - .map_err(|err| { - near_jsonrpc_primitives::types::config::RpcProtocolConfigError::InternalError { - error_message: err.to_string(), - } - })? + + let store = near_parameters::RuntimeConfigStore::for_chain_id( + &data.genesis_info.genesis_config.chain_id, + ); + let runtime_config = store.get_config(block.latest_protocol_version); + let protocol_config = near_chain_configs::ProtocolConfig { + genesis_config: data.genesis_info.genesis_config.clone(), + runtime_config: near_parameters::RuntimeConfig { + fees: runtime_config.fees.clone(), + wasm_config: runtime_config.wasm_config.clone(), + account_creation_config: runtime_config.account_creation_config.clone(), + storage_proof_size_soft_limit: runtime_config.storage_proof_size_soft_limit, + }, }; - Ok(protocol_config) + Ok(protocol_config.into()) } diff --git a/rpc-server/src/modules/network/mod.rs b/rpc-server/src/modules/network/mod.rs index f424168b..c2a2e208 100644 --- a/rpc-server/src/modules/network/mod.rs +++ b/rpc-server/src/modules/network/mod.rs @@ -20,43 +20,3 @@ async fn parse_validator_request( }; Ok(request) } - -/// cannot move out of dereference of `futures_locks::RwLockReadGuard` -/// move occurs because value `current_protocol_config` has type `ProtocolConfigView`, -/// which does not implement the `Copy` trait -pub fn clone_protocol_config( - protocol_config: &near_chain_configs::ProtocolConfigView, -) -> near_chain_configs::ProtocolConfigView { - near_chain_configs::ProtocolConfigView { - protocol_version: protocol_config.protocol_version, - genesis_time: protocol_config.genesis_time, - chain_id: protocol_config.chain_id.clone(), - genesis_height: protocol_config.genesis_height, - num_block_producer_seats: protocol_config.num_block_producer_seats, - num_block_producer_seats_per_shard: protocol_config - .num_block_producer_seats_per_shard - .clone(), - avg_hidden_validator_seats_per_shard: protocol_config - .avg_hidden_validator_seats_per_shard - .clone(), - dynamic_resharding: protocol_config.dynamic_resharding, - protocol_upgrade_stake_threshold: protocol_config.protocol_upgrade_stake_threshold, - epoch_length: protocol_config.epoch_length, - gas_limit: protocol_config.gas_limit, - min_gas_price: protocol_config.min_gas_price, - max_gas_price: protocol_config.max_gas_price, - block_producer_kickout_threshold: protocol_config.block_producer_kickout_threshold, - chunk_producer_kickout_threshold: protocol_config.chunk_producer_kickout_threshold, - online_min_threshold: protocol_config.online_min_threshold, - online_max_threshold: protocol_config.online_max_threshold, - gas_price_adjustment_rate: protocol_config.gas_price_adjustment_rate, - runtime_config: protocol_config.runtime_config.clone(), - transaction_validity_period: protocol_config.transaction_validity_period, - protocol_reward_rate: protocol_config.protocol_reward_rate, - max_inflation_rate: protocol_config.max_inflation_rate, - num_blocks_per_year: protocol_config.num_blocks_per_year, - protocol_treasury_account: protocol_config.protocol_treasury_account.clone(), - fishermen_threshold: protocol_config.fishermen_threshold, - minimum_stake_divisor: protocol_config.minimum_stake_divisor, - } -} diff --git a/rpc-server/src/modules/queries/methods.rs b/rpc-server/src/modules/queries/methods.rs index 11f7a5c6..7ae5571a 100644 --- a/rpc-server/src/modules/queries/methods.rs +++ b/rpc-server/src/modules/queries/methods.rs @@ -4,29 +4,33 @@ use crate::modules::blocks::utils::fetch_block_from_cache_or_get; use crate::modules::blocks::CacheBlock; #[cfg(feature = "account_access_keys")] use crate::modules::queries::utils::fetch_list_access_keys_from_db; -use crate::modules::queries::utils::{fetch_state_from_db, run_contract}; +use crate::modules::queries::utils::{get_state_keys_from_db, run_contract, RunContractResponse}; use jsonrpc_v2::{Data, Params}; /// `query` rpc method implementation /// calls proxy_rpc_call to get `query` from near-rpc if request parameters not supported by read-rpc -/// as example: BlockReference for Finality::None is not supported by read-rpc +/// as example: BlockReference for Finality::None is not supported by read-rpc when near_state_indexer is not running /// another way to get `query` from read-rpc using `query_call` -#[allow(unused_mut)] #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] pub async fn query( data: Data, - Params(mut params): Params, + Params(params): Params, ) -> Result { if let near_primitives::types::BlockReference::Finality(finality) = ¶ms.block_reference { - if finality != &near_primitives::types::Finality::Final { - // Increase the OPTIMISTIC_REQUESTS_TOTAL metric if the request has - // optimistic finality or doom_slug finality - // and proxy to near-rpc - crate::metrics::OPTIMISTIC_REQUESTS_TOTAL.inc(); - return Ok(data.near_rpc_client.call(params).await?); + if finality == &near_primitives::types::Finality::None { + return if cfg!(feature = "near_state_indexer_disabled") { + // Increase the OPTIMISTIC_REQUESTS_TOTAL metric if the request has + // optimistic finality + // and proxy to near-rpc + crate::metrics::OPTIMISTIC_REQUESTS_TOTAL.inc(); + Ok(data.near_rpc_client.call(params).await?) + } else { + // query_call with optimistic block + query_call(data, Params(params), true).await + }; } }; - query_call(data, Params(params)).await + query_call(data, Params(params), false).await } /// fetch query result from read-rpc @@ -35,6 +39,7 @@ pub async fn query( async fn query_call( data: Data, Params(mut params): Params, + is_optimistic: bool, ) -> Result { tracing::debug!("`query` call. Params: {:?}", params,); @@ -44,18 +49,18 @@ async fn query_call( let result = match params.request.clone() { near_primitives::views::QueryRequest::ViewAccount { account_id } => { crate::metrics::QUERY_VIEW_ACCOUNT_REQUESTS_TOTAL.inc(); - view_account(&data, block, &account_id).await + view_account(&data, block, &account_id, is_optimistic).await } near_primitives::views::QueryRequest::ViewCode { account_id } => { crate::metrics::QUERY_VIEW_CODE_REQUESTS_TOTAL.inc(); - view_code(&data, block, &account_id).await + view_code(&data, block, &account_id, is_optimistic).await } near_primitives::views::QueryRequest::ViewAccessKey { account_id, public_key, } => { crate::metrics::QUERY_VIEW_ACCESS_KEY_REQUESTS_TOTAL.inc(); - view_access_key(&data, block, &account_id, public_key).await + view_access_key(&data, block, &account_id, public_key, is_optimistic).await } near_primitives::views::QueryRequest::ViewState { account_id, @@ -65,13 +70,13 @@ async fn query_call( crate::metrics::QUERY_VIEW_STATE_REQUESTS_TOTAL.inc(); if include_proof { // TODO: We can calculate the proof for state only on regular or archival nodes. - let final_block_info = data.final_block_info.read().await; + let blocks_info_by_finality = data.blocks_info_by_finality.read().await; // `expected_earliest_available_block` calculated by formula: // `final_block_height` - `node_epoch_count` * `epoch_length` // Now near store 5 epochs, it can be changed in the future // epoch_length = 43200 blocks let expected_earliest_available_block = - final_block_info.final_block_cache.block_height + blocks_info_by_finality.final_block.block_cache.block_height - 5 * data.genesis_info.genesis_config.epoch_length; return if block.block_height > expected_earliest_available_block { // Proxy to regular rpc if the block is available @@ -83,7 +88,7 @@ async fn query_call( Ok(data.near_rpc_client.archival_call(params).await?) }; } else { - view_state(&data, block, &account_id, prefix.as_ref()).await + view_state(&data, block, &account_id, prefix.as_ref(), is_optimistic).await } } near_primitives::views::QueryRequest::CallFunction { @@ -92,7 +97,15 @@ async fn query_call( args, } => { crate::metrics::QUERY_FUNCTION_CALL_REQUESTS_TOTAL.inc(); - function_call(&data, block, account_id, &method_name, args.clone()).await + function_call( + &data, + block, + account_id, + &method_name, + args.clone(), + is_optimistic, + ) + .await } #[allow(unused_variables)] // `account_id` is used in the `#[cfg(feature = "account_access_keys")]` branch. @@ -232,16 +245,67 @@ async fn view_account( data: &Data, block: CacheBlock, account_id: &near_primitives::types::AccountId, + is_optimistic: bool, ) -> Result< near_jsonrpc_primitives::types::query::RpcQueryResponse, near_jsonrpc_primitives::types::query::RpcQueryError, > { tracing::debug!( - "`view_account` call. AccountID {}, Block {}", + "`view_account` call. AccountID {}, Block {}, optimistic {}", account_id, - block.block_height + block.block_height, + is_optimistic ); + let account_view = if is_optimistic { + optimistic_view_account(data, block, account_id).await? + } else { + database_view_account(data, block, account_id).await? + }; + Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { + kind: near_jsonrpc_primitives::types::query::QueryResponseKind::ViewAccount(account_view), + block_height: block.block_height, + block_hash: block.block_hash, + }) +} + +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn optimistic_view_account( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, +) -> Result +{ + if let Ok(result) = data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .account_changes_in_block(account_id) + .await + { + if let Some(account_view) = result { + Ok(account_view) + } else { + Err( + near_jsonrpc_primitives::types::query::RpcQueryError::UnknownAccount { + requested_account_id: account_id.clone(), + block_height: block.block_height, + block_hash: block.block_hash, + }, + ) + } + } else { + database_view_account(data, block, account_id).await + } +} +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn database_view_account( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, +) -> Result +{ let account = data .db_manager .get_account(account_id, block.block_height) @@ -252,15 +316,9 @@ async fn view_account( block_height: block.block_height, block_hash: block.block_hash, }, - )?; - - Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { - kind: near_jsonrpc_primitives::types::query::QueryResponseKind::ViewAccount( - near_primitives::views::AccountView::from(account.data), - ), - block_height: block.block_height, - block_hash: block.block_hash, - }) + )? + .data; + Ok(near_primitives::views::AccountView::from(account)) } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] @@ -268,27 +326,79 @@ async fn view_code( data: &Data, block: CacheBlock, account_id: &near_primitives::types::AccountId, + is_optimistic: bool, ) -> Result< near_jsonrpc_primitives::types::query::RpcQueryResponse, near_jsonrpc_primitives::types::query::RpcQueryError, > { tracing::debug!( - "`view_code` call. AccountID {}, Block {}", + "`view_code` call. AccountID {}, Block {}, optimistic {}", account_id, - block.block_height + block.block_height, + is_optimistic ); - let contract = data - .db_manager - .get_account(account_id, block.block_height) - .await - .map_err( - |_err| near_jsonrpc_primitives::types::query::RpcQueryError::UnknownAccount { - requested_account_id: account_id.clone(), - block_height: block.block_height, - block_hash: block.block_hash, + let (code, account) = if is_optimistic { + tokio::try_join!( + optimistic_view_code(data, block, account_id), + optimistic_view_account(data, block, account_id), + )? + } else { + tokio::try_join!( + database_view_code(data, block, account_id), + database_view_account(data, block, account_id), + )? + }; + + Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { + kind: near_jsonrpc_primitives::types::query::QueryResponseKind::ViewCode( + near_primitives::views::ContractCodeView { + code, + hash: account.code_hash, }, - )?; - let contract_code = data + ), + block_height: block.block_height, + block_hash: block.block_hash, + }) +} + +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn optimistic_view_code( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, +) -> Result, near_jsonrpc_primitives::types::query::RpcQueryError> { + let contract_code = if let Ok(result) = data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .code_changes_in_block(account_id) + .await + { + if let Some(code) = result { + code + } else { + return Err( + near_jsonrpc_primitives::types::query::RpcQueryError::NoContractCode { + contract_account_id: account_id.clone(), + block_height: block.block_height, + block_hash: block.block_hash, + }, + ); + } + } else { + database_view_code(data, block, account_id).await? + }; + Ok(contract_code) +} + +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn database_view_code( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, +) -> Result, near_jsonrpc_primitives::types::query::RpcQueryError> { + Ok(data .db_manager .get_contract_code(account_id, block.block_height) .await @@ -298,19 +408,8 @@ async fn view_code( block_height: block.block_height, block_hash: block.block_hash, }, - )?; - Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { - kind: near_jsonrpc_primitives::types::query::QueryResponseKind::ViewCode( - near_primitives::views::ContractCodeView::from( - near_primitives::contract::ContractCode::new( - contract_code.data, - Some(contract.data.code_hash()), - ), - ), - ), - block_height: block.block_height, - block_hash: block.block_hash, - }) + )? + .data) } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] @@ -320,31 +419,27 @@ async fn function_call( account_id: near_primitives::types::AccountId, method_name: &str, args: near_primitives::types::FunctionArgs, + is_optimistic: bool, ) -> Result< near_jsonrpc_primitives::types::query::RpcQueryResponse, near_jsonrpc_primitives::types::query::RpcQueryError, > { tracing::debug!( - "`function_call` call. AccountID {}, block {}, method_name {}, args {:?}", + "`function_call` call. AccountID {}, block {}, method_name {}, args {:?}, optimistic {}", account_id, block.block_height, method_name, args, + is_optimistic, ); - let call_results = run_contract( - account_id, - method_name, - args, - data.db_manager.clone(), - &data.compiled_contract_code_cache, - &data.contract_code_cache, - &data.final_block_info, - block, - data.max_gas_burnt, - ) - .await - .map_err(|err| err.to_rpc_query_error(block.block_height, block.block_hash))?; + let call_results = if is_optimistic { + optimistic_function_call(data, block, account_id, method_name, args).await + } else { + database_function_call(data, block, account_id, method_name, args).await + }; + let call_results = + call_results.map_err(|err| err.to_rpc_query_error(block.block_height, block.block_hash))?; Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { kind: near_jsonrpc_primitives::types::query::QueryResponseKind::CallResult( near_primitives::views::CallResult { @@ -357,58 +452,260 @@ async fn function_call( }) } +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn optimistic_function_call( + data: &Data, + block: CacheBlock, + account_id: near_primitives::types::AccountId, + method_name: &str, + args: near_primitives::types::FunctionArgs, +) -> Result { + let optimistic_data = data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .state_changes_in_block(&account_id, &[]) + .await; + run_contract( + account_id, + method_name, + args, + data.db_manager.clone(), + &data.compiled_contract_code_cache, + &data.contract_code_cache, + &data.blocks_info_by_finality, + block, + data.max_gas_burnt, + optimistic_data, // run contract with optimistic data + ) + .await +} + +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn database_function_call( + data: &Data, + block: CacheBlock, + account_id: near_primitives::types::AccountId, + method_name: &str, + args: near_primitives::types::FunctionArgs, +) -> Result { + run_contract( + account_id, + method_name, + args, + data.db_manager.clone(), + &data.compiled_contract_code_cache, + &data.contract_code_cache, + &data.blocks_info_by_finality, + block, + data.max_gas_burnt, + Default::default(), // run contract with empty optimistic data + ) + .await +} + #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] async fn view_state( data: &Data, block: CacheBlock, account_id: &near_primitives::types::AccountId, prefix: &[u8], + is_optimistic: bool, ) -> Result< near_jsonrpc_primitives::types::query::RpcQueryResponse, near_jsonrpc_primitives::types::query::RpcQueryError, > { tracing::debug!( - "`view_state` call. AccountID {}, block {}, prefix {:?}", + "`view_state` call. AccountID {}, block {}, prefix {:?}, optimistic {}", account_id, block.block_height, prefix, + is_optimistic, ); - let contract_state = - fetch_state_from_db(&data.db_manager, account_id, block.block_height, prefix) - .await - .map_err(|_err| { - near_jsonrpc_primitives::types::query::RpcQueryError::UnknownAccount { - requested_account_id: account_id.clone(), - block_height: block.block_height, - block_hash: block.block_hash, - } - })?; + let state_item = if is_optimistic { + optimistic_view_state(data, block, account_id, prefix).await? + } else { + database_view_state(data, block, account_id, prefix).await? + }; Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { - kind: near_jsonrpc_primitives::types::query::QueryResponseKind::ViewState(contract_state), + kind: near_jsonrpc_primitives::types::query::QueryResponseKind::ViewState( + near_primitives::views::ViewStateResult { + values: state_item, + proof: vec![], // TODO: this is hardcoded empty value since we don't support proofs yet + }, + ), block_height: block.block_height, block_hash: block.block_hash, }) } +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn optimistic_view_state( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, + prefix: &[u8], +) -> Result< + Vec, + near_jsonrpc_primitives::types::query::RpcQueryError, +> { + let mut optimistic_data = data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .state_changes_in_block(account_id, prefix) + .await; + let state_from_db = + get_state_keys_from_db(&data.db_manager, account_id, block.block_height, prefix).await; + if state_from_db.is_empty() && optimistic_data.is_empty() { + Err( + near_jsonrpc_primitives::types::query::RpcQueryError::UnknownAccount { + requested_account_id: account_id.clone(), + block_height: block.block_height, + block_hash: block.block_hash, + }, + ) + } else { + let mut values: Vec = state_from_db + .into_iter() + .filter_map(|(key, value)| { + let value = if let Some(value) = optimistic_data.remove(&key) { + value.clone() + } else { + Some(value) + }; + value.map(|value| near_primitives::views::StateItem { + key: key.into(), + value: value.into(), + }) + }) + .collect(); + let optimistic_items: Vec = optimistic_data + .iter() + .filter_map(|(key, value)| { + value + .clone() + .map(|value| near_primitives::views::StateItem { + key: key.clone().into(), + value: value.clone().into(), + }) + }) + .collect(); + values.extend(optimistic_items); + Ok(values) + } +} + +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn database_view_state( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, + prefix: &[u8], +) -> Result< + Vec, + near_jsonrpc_primitives::types::query::RpcQueryError, +> { + let state_from_db = + get_state_keys_from_db(&data.db_manager, account_id, block.block_height, prefix).await; + if state_from_db.is_empty() { + Err( + near_jsonrpc_primitives::types::query::RpcQueryError::UnknownAccount { + requested_account_id: account_id.clone(), + block_height: block.block_height, + block_hash: block.block_hash, + }, + ) + } else { + let values: Vec = state_from_db + .into_iter() + .map(|(key, value)| near_primitives::views::StateItem { + key: key.into(), + value: value.into(), + }) + .collect(); + Ok(values) + } +} + #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] async fn view_access_key( data: &Data, block: CacheBlock, account_id: &near_primitives::types::AccountId, public_key: near_crypto::PublicKey, + is_optimistic: bool, ) -> Result< near_jsonrpc_primitives::types::query::RpcQueryResponse, near_jsonrpc_primitives::types::query::RpcQueryError, > { tracing::debug!( - "`view_access_key` call. AccountID {}, block {}, key_data {:?}", + "`view_access_key` call. AccountID {}, block {}, key_data {:?}, optimistic {}", account_id, block.block_height, public_key.to_string(), + is_optimistic, ); + let access_key_view = if is_optimistic { + optimistic_view_access_key(data, block, account_id, public_key).await? + } else { + database_view_access_key(data, block, account_id, public_key).await? + }; + Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { + kind: near_jsonrpc_primitives::types::query::QueryResponseKind::AccessKey(access_key_view), + block_height: block.block_height, + block_hash: block.block_hash, + }) +} + +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn optimistic_view_access_key( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, + public_key: near_crypto::PublicKey, +) -> Result< + near_primitives::views::AccessKeyView, + near_jsonrpc_primitives::types::query::RpcQueryError, +> { + if let Ok(result) = data + .blocks_info_by_finality + .read() + .await + .optimistic_block + .access_key_changes_in_block(account_id, &public_key) + .await + { + if let Some(access_key) = result { + Ok(access_key) + } else { + Err( + near_jsonrpc_primitives::types::query::RpcQueryError::UnknownAccessKey { + public_key, + block_height: block.block_height, + block_hash: block.block_hash, + }, + ) + } + } else { + database_view_access_key(data, block, account_id, public_key).await + } +} +#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] +async fn database_view_access_key( + data: &Data, + block: CacheBlock, + account_id: &near_primitives::types::AccountId, + public_key: near_crypto::PublicKey, +) -> Result< + near_primitives::views::AccessKeyView, + near_jsonrpc_primitives::types::query::RpcQueryError, +> { let access_key = data .db_manager .get_access_key(account_id, block.block_height, public_key.clone()) @@ -419,15 +716,9 @@ async fn view_access_key( block_height: block.block_height, block_hash: block.block_hash, }, - )?; - - Ok(near_jsonrpc_primitives::types::query::RpcQueryResponse { - kind: near_jsonrpc_primitives::types::query::QueryResponseKind::AccessKey( - near_primitives::views::AccessKeyView::from(access_key.data), - ), - block_height: block.block_height, - block_hash: block.block_hash, - }) + )? + .data; + Ok(near_primitives::views::AccessKeyView::from(access_key)) } #[cfg(feature = "account_access_keys")] diff --git a/rpc-server/src/modules/queries/mod.rs b/rpc-server/src/modules/queries/mod.rs index 3b192147..b4874fb3 100644 --- a/rpc-server/src/modules/queries/mod.rs +++ b/rpc-server/src/modules/queries/mod.rs @@ -14,6 +14,9 @@ pub struct CodeStorage { block_height: near_primitives::types::BlockHeight, validators: HashMap, data_count: u64, + is_optimistic: bool, + optimistic_data: + HashMap>, } pub struct StorageValuePtr { @@ -36,6 +39,10 @@ impl CodeStorage { account_id: near_primitives::types::AccountId, block_height: near_primitives::types::BlockHeight, validators: HashMap, + optimistic_data: HashMap< + readnode_primitives::StateKey, + Option, + >, ) -> Self { Self { db_manager, @@ -43,8 +50,56 @@ impl CodeStorage { block_height, validators, data_count: Default::default(), // TODO: Using for generate_data_id + is_optimistic: !optimistic_data.is_empty(), + optimistic_data, } } + + fn optimistic_storage_get( + &self, + key: &[u8], + ) -> Result>> { + if let Some(value) = self.optimistic_data.get(key) { + Ok(value.as_ref().map(|data| { + Box::new(StorageValuePtr { + value: data.clone(), + }) as Box<_> + })) + } else { + self.database_storage_get(key) + } + } + + fn database_storage_get( + &self, + key: &[u8], + ) -> Result>> { + let get_db_data = + self.db_manager + .get_state_key_value(&self.account_id, self.block_height, key.to_vec()); + let (_, data) = block_on(get_db_data); + Ok(if !data.is_empty() { + Some(Box::new(StorageValuePtr { value: data }) as Box<_>) + } else { + None + }) + } + + fn optimistic_storage_has_key(&mut self, key: &[u8]) -> Result { + if let Some(value) = self.optimistic_data.get(key) { + Ok(value.is_some()) + } else { + self.database_storage_has_key(key) + } + } + + fn database_storage_has_key(&mut self, key: &[u8]) -> Result { + let get_db_state_keys = + self.db_manager + .get_state_key_value(&self.account_id, self.block_height, key.to_vec()); + let (_, data) = block_on(get_db_state_keys); + Ok(!data.is_empty()) + } } impl near_vm_runner::logic::External for CodeStorage { @@ -66,15 +121,11 @@ impl near_vm_runner::logic::External for CodeStorage { key: &[u8], _mode: near_vm_runner::logic::StorageGetMode, ) -> Result>> { - let get_db_data = - self.db_manager - .get_state_key_value(&self.account_id, self.block_height, key.to_vec()); - let (_, data) = block_on(get_db_data); - Ok(if !data.is_empty() { - Some(Box::new(StorageValuePtr { value: data }) as Box<_>) + if self.is_optimistic { + self.optimistic_storage_get(key) } else { - None - }) + self.database_storage_get(key) + } } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(self)))] @@ -104,11 +155,11 @@ impl near_vm_runner::logic::External for CodeStorage { key: &[u8], _mode: near_vm_runner::logic::StorageGetMode, ) -> Result { - let get_db_state_keys = - self.db_manager - .get_state_key_value(&self.account_id, self.block_height, key.to_vec()); - let (_, data) = block_on(get_db_state_keys); - Ok(!data.is_empty()) + if self.is_optimistic { + self.optimistic_storage_has_key(key) + } else { + self.database_storage_has_key(key) + } } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(self)))] @@ -122,8 +173,8 @@ impl near_vm_runner::logic::External for CodeStorage { } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(self)))] - fn get_trie_nodes_count(&self) -> near_primitives::types::TrieNodesCount { - near_primitives::types::TrieNodesCount { + fn get_trie_nodes_count(&self) -> near_vm_runner::logic::TrieNodesCount { + near_vm_runner::logic::TrieNodesCount { db_reads: 0, mem_reads: 0, } @@ -141,4 +192,127 @@ impl near_vm_runner::logic::External for CodeStorage { fn validator_total_stake(&self) -> Result { Ok(self.validators.values().sum()) } + + fn create_action_receipt( + &mut self, + _receipt_indices: Vec, + _receiver_id: near_primitives::types::AccountId, + ) -> Result { + Err(near_vm_runner::logic::VMLogicError::HostError( + near_vm_runner::logic::HostError::ProhibitedInView { + method_name: String::from("create_action_receipt"), + }, + )) + } + + fn create_promise_yield_receipt( + &mut self, + _receiver_id: near_primitives::types::AccountId, + ) -> Result<( + near_vm_runner::logic::types::ReceiptIndex, + near_indexer_primitives::CryptoHash, + )> { + Err(near_vm_runner::logic::VMLogicError::HostError( + near_vm_runner::logic::HostError::ProhibitedInView { + method_name: String::from("create_promise_yield_receipt"), + }, + )) + } + + fn submit_promise_resume_data( + &mut self, + _data_id: near_indexer_primitives::CryptoHash, + _data: Vec, + ) -> Result { + Err(near_vm_runner::logic::VMLogicError::HostError( + near_vm_runner::logic::HostError::ProhibitedInView { + method_name: String::from("submit_promise_resume_data"), + }, + )) + } + + fn append_action_create_account( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + ) -> Result<()> { + Ok(()) + } + + fn append_action_deploy_contract( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _code: Vec, + ) -> Result<()> { + Ok(()) + } + + fn append_action_function_call_weight( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _method_name: Vec, + _args: Vec, + _attached_deposit: near_primitives::types::Balance, + _prepaid_gas: near_primitives::types::Gas, + _gas_weight: near_primitives::types::GasWeight, + ) -> Result<()> { + Ok(()) + } + + fn append_action_transfer( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _deposit: near_primitives::types::Balance, + ) -> Result<()> { + Ok(()) + } + + fn append_action_stake( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _stake: near_primitives::types::Balance, + _public_key: near_crypto::PublicKey, + ) { + } + + fn append_action_add_key_with_full_access( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _public_key: near_crypto::PublicKey, + _nonce: near_primitives::types::Nonce, + ) { + } + + fn append_action_add_key_with_function_call( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _public_key: near_crypto::PublicKey, + _nonce: near_primitives::types::Nonce, + _allowance: Option, + _receiver_id: near_primitives::types::AccountId, + _method_names: Vec>, + ) -> Result<()> { + Ok(()) + } + + fn append_action_delete_key( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _public_key: near_crypto::PublicKey, + ) { + } + + fn append_action_delete_account( + &mut self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + _beneficiary_id: near_primitives::types::AccountId, + ) -> Result<()> { + Ok(()) + } + + fn get_receipt_receiver( + &self, + _receipt_index: near_vm_runner::logic::types::ReceiptIndex, + ) -> &near_primitives::types::AccountId { + panic!("Prohibited in view. `get_receipt_receiver`"); + } } diff --git a/rpc-server/src/modules/queries/utils.rs b/rpc-server/src/modules/queries/utils.rs index 04e974ec..e3fdedaa 100644 --- a/rpc-server/src/modules/queries/utils.rs +++ b/rpc-server/src/modules/queries/utils.rs @@ -1,17 +1,11 @@ use std::collections::HashMap; use std::ops::Deref; -#[cfg(feature = "account_access_keys")] -use borsh::BorshDeserialize; -use borsh::BorshSerialize; use futures::StreamExt; -use near_crypto::{KeyType, PublicKey}; -use near_primitives::utils::create_random_seed; -use tokio::task; use crate::config::CompiledCodeCache; use crate::errors::FunctionCallError; -use crate::modules::blocks::FinalBlockInfo; +use crate::modules::blocks::BlocksInfoByFinality; use crate::modules::queries::CodeStorage; pub struct RunContractResponse { @@ -91,12 +85,12 @@ pub async fn fetch_list_access_keys_from_db( .into_iter() .map( |(public_key_hex, access_key)| near_primitives::views::AccessKeyInfoView { - public_key: near_crypto::PublicKey::try_from_slice( + public_key: borsh::from_slice::( &hex::decode(public_key_hex).unwrap(), ) .unwrap(), access_key: near_primitives::views::AccessKeyView::from( - near_primitives::account::AccessKey::try_from_slice(&access_key).unwrap(), + borsh::from_slice::(&access_key).unwrap(), ), }, ) @@ -104,66 +98,38 @@ pub async fn fetch_list_access_keys_from_db( Ok(account_keys_view) } -#[cfg_attr( - feature = "tracing-instrumentation", - tracing::instrument(skip(db_manager)) -)] -pub async fn fetch_state_from_db( - db_manager: &std::sync::Arc>, - account_id: &near_primitives::types::AccountId, - block_height: near_primitives::types::BlockHeight, - prefix: &[u8], -) -> anyhow::Result { - tracing::debug!( - "`fetch_state_from_db` call. AccountID {}, block {}, prefix {:?}", - account_id, - block_height, - prefix, - ); - let state_from_db = get_state_keys_from_db(db_manager, account_id, block_height, prefix).await; - if state_from_db.is_empty() { - anyhow::bail!("Data not found in db") - } else { - let values = state_from_db - .into_iter() - .map(|(key, value)| near_primitives::views::StateItem { - key: key.into(), - value: value.into(), - }) - .collect(); - Ok(near_primitives::views::ViewStateResult { - values, - proof: vec![], // TODO: this is hardcoded empty value since we don't support proofs yet - }) - } -} - #[allow(clippy::too_many_arguments)] #[cfg_attr( feature = "tracing-instrumentation", tracing::instrument(skip(context, code_storage, contract_code, compiled_contract_code_cache)) )] async fn run_code_in_vm_runner( - contract_code: near_primitives::contract::ContractCode, + contract_code: near_vm_runner::ContractCode, method_name: &str, context: near_vm_runner::logic::VMContext, mut code_storage: CodeStorage, - latest_protocol_version: near_primitives::types::ProtocolVersion, + protocol_version: near_primitives::types::ProtocolVersion, compiled_contract_code_cache: &std::sync::Arc, ) -> Result { let contract_method_name = String::from(method_name); let code_cache = std::sync::Arc::clone(compiled_contract_code_cache); - let results = task::spawn_blocking(move || { + let store = near_parameters::RuntimeConfigStore::free(); + let config = store.get_config(protocol_version).wasm_config.clone(); + let mut vm_config = near_parameters::vm::Config { + vm_kind: config.vm_kind.replace_with_wasmtime_if_unsupported(), + ..config + }; + vm_config.make_free(); + let results = tokio::task::spawn_blocking(move || { near_vm_runner::run( &contract_code, &contract_method_name, &mut code_storage, context, - &near_vm_runner::logic::VMConfig::free(), - &near_primitives::runtime::fees::RuntimeFeesConfig::free(), + &vm_config, + &near_parameters::RuntimeFeesConfig::free(), &[], - latest_protocol_version, Some(code_cache.deref()), ) }) @@ -229,9 +195,13 @@ pub async fn run_contract( crate::cache::LruMemoryCache>, >, >, - final_block_info: &std::sync::Arc>, + blocks_info_by_finality: &std::sync::Arc>, block: crate::modules::blocks::CacheBlock, max_gas_burnt: near_primitives::types::Gas, + optimistic_data: HashMap< + readnode_primitives::StateKey, + Option, + >, ) -> Result { let contract = db_manager .get_account(&account_id, block.block_height) @@ -247,9 +217,7 @@ pub async fn run_contract( .cloned(); let contract_code = match code { - Some(code) => { - near_primitives::contract::ContractCode::new(code, Some(contract.data.code_hash())) - } + Some(code) => near_vm_runner::ContractCode::new(code, Some(contract.data.code_hash())), None => { let code = db_manager .get_contract_code(&account_id, block.block_height) @@ -261,38 +229,48 @@ pub async fn run_contract( .write() .await .put(contract.data.code_hash(), code.data.clone()); - near_primitives::contract::ContractCode::new(code.data, Some(contract.data.code_hash())) + near_vm_runner::ContractCode::new(code.data, Some(contract.data.code_hash())) } }; - let (epoch_height, epoch_validators) = - if final_block_info.read().await.final_block_cache.epoch_id == block.epoch_id { - let validators = final_block_info.read().await.current_validators.clone(); - (validators.epoch_height, validators.current_validators) - } else { - let validators = db_manager - .get_validators_by_epoch_id(block.epoch_id) - .await - .map_err(|_| FunctionCallError::InternalError { - error_message: "Failed to get epoch info".to_string(), - })?; - ( - validators.epoch_height, - validators.validators_info.current_validators, - ) - }; + let (epoch_height, epoch_validators) = if blocks_info_by_finality + .read() + .await + .final_block + .block_cache + .epoch_id + == block.epoch_id + { + let validators = blocks_info_by_finality + .read() + .await + .current_validators + .clone(); + (validators.epoch_height, validators.current_validators) + } else { + let validators = db_manager + .get_validators_by_epoch_id(block.epoch_id) + .await + .map_err(|_| FunctionCallError::InternalError { + error_message: "Failed to get epoch info".to_string(), + })?; + ( + validators.epoch_height, + validators.validators_info.current_validators, + ) + }; - let public_key = PublicKey::empty(KeyType::ED25519); - let random_seed = create_random_seed( + let public_key = near_crypto::PublicKey::empty(near_crypto::KeyType::ED25519); + let random_seed = near_primitives::utils::create_random_seed( block.latest_protocol_version, near_primitives::hash::CryptoHash::default(), block.state_root, ); let context = near_vm_runner::logic::VMContext { - current_account_id: account_id.parse().unwrap(), - signer_account_id: account_id.parse().unwrap(), - signer_account_pk: public_key.try_to_vec().expect("Failed to serialize"), - predecessor_account_id: account_id.parse().unwrap(), + current_account_id: account_id.clone(), + signer_account_id: account_id.clone(), + signer_account_pk: borsh::to_vec(&public_key).expect("Failed to serialize"), + predecessor_account_id: account_id.clone(), input: args.into(), block_height: block.block_height, block_timestamp: block.block_timestamp, @@ -303,18 +281,19 @@ pub async fn run_contract( attached_deposit: 0, prepaid_gas: max_gas_burnt, random_seed, - view_config: Some(near_vm_runner::logic::ViewConfig { max_gas_burnt }), + view_config: Some(near_primitives::config::ViewConfig { max_gas_burnt }), output_data_receivers: vec![], }; let code_storage = CodeStorage::init( db_manager.clone(), - account_id.clone(), + account_id, block.block_height, epoch_validators .iter() .map(|validator| (validator.account_id.clone(), validator.stake)) .collect(), + optimistic_data, ); let result = run_code_in_vm_runner( diff --git a/rpc-server/src/modules/transactions/methods.rs b/rpc-server/src/modules/transactions/methods.rs index 6962a9c4..dbadbb97 100644 --- a/rpc-server/src/modules/transactions/methods.rs +++ b/rpc-server/src/modules/transactions/methods.rs @@ -9,6 +9,13 @@ use near_primitives::views::FinalExecutionOutcomeViewEnum::{ }; use serde_json::Value; +pub async fn send_tx( + data: Data, + Params(params): Params, +) -> Result { + Ok(data.near_rpc_client.call(params).await?) +} + /// Queries status of a transaction by hash and returns the final transaction result. #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] pub async fn tx( @@ -32,8 +39,10 @@ pub async fn tx( // Note there is a difference in the implementation of the `tx` method in the `near_jsonrpc_client` // The method is `near_jsonrpc_client::methods::tx::RpcTransactionStatusRequest` in the client // so we can't just pass `params` there, instead we need to craft a request manually + // tx_status_request, near_jsonrpc_client::methods::tx::RpcTransactionStatusRequest { transaction_info: tx_status_request.transaction_info, + wait_until: tx_status_request.wait_until, }, "TX", ) @@ -71,6 +80,7 @@ pub async fn tx_status( // so we can't just pass `params` there, instead we need to craft a request manually near_jsonrpc_client::methods::EXPERIMENTAL_tx_status::RpcTransactionStatusRequest { transaction_info: tx_status_request.transaction_info, + wait_until: tx_status_request.wait_until, }, "EXPERIMENTAL_TX_STATUS", ) @@ -84,11 +94,11 @@ pub async fn tx_status( } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] -pub async fn send_tx_async( +pub async fn broadcast_tx_async( data: Data, Params(params): Params, ) -> Result { - tracing::debug!("`send_tx_async` call. Params: {:?}", params); + tracing::debug!("`broadcast_tx_async` call. Params: {:?}", params); if cfg!(feature = "send_tx_methods") { let signed_transaction = match parse_signed_transaction(params).await { Ok(signed_transaction) => signed_transaction, @@ -110,11 +120,11 @@ pub async fn send_tx_async( } #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(data)))] -pub async fn send_tx_commit( +pub async fn broadcast_tx_commit( data: Data, Params(params): Params, ) -> Result { - tracing::debug!("`send_tx_commit` call. Params: {:?}", params); + tracing::debug!("`broadcast_tx_commit` call. Params: {:?}", params); if cfg!(feature = "send_tx_methods") { let signed_transaction = match parse_signed_transaction(params).await { Ok(signed_transaction) => signed_transaction, @@ -127,7 +137,11 @@ pub async fn send_tx_commit( match data.near_rpc_client.call(proxy_params).await { Ok(resp) => Ok( near_jsonrpc_primitives::types::transactions::RpcTransactionResponse { - final_execution_outcome: FinalExecutionOutcome(resp), + final_execution_outcome: Some(FinalExecutionOutcome(resp)), + // With the fact that we don't support non-finalised data yet, + // final_execution_status field can be always filled with FINAL. + // This logic will be more complicated when we add support of optimistic blocks. + final_execution_status: near_primitives::views::TxExecutionStatus::Final, }, ), Err(err) => Err(RPCError::from(err)), @@ -153,13 +167,13 @@ async fn tx_status_common( > { tracing::debug!("`tx_status_common` call."); let tx_hash = match &transaction_info { - near_jsonrpc_primitives::types::transactions::TransactionInfo::Transaction(tx) => { - tx.get_hash() - } + near_jsonrpc_primitives::types::transactions::TransactionInfo::Transaction( + near_jsonrpc_primitives::types::transactions::SignedTransaction::SignedTransaction(tx), + ) => tx.get_hash(), near_jsonrpc_primitives::types::transactions::TransactionInfo::TransactionId { - hash, + tx_hash, .. - } => *hash, + } => *tx_hash, }; let transaction_details = data @@ -175,17 +189,25 @@ async fn tx_status_common( if fetch_receipt { Ok( near_jsonrpc_primitives::types::transactions::RpcTransactionResponse { - final_execution_outcome: FinalExecutionOutcomeWithReceipt( + final_execution_outcome: Some(FinalExecutionOutcomeWithReceipt( transaction_details.to_final_execution_outcome_with_receipts(), - ), + )), + // With the fact that we don't support non-finalised data yet, + // final_execution_status field can be always filled with FINAL. + // This logic will be more complicated when we add support of optimistic blocks. + final_execution_status: near_primitives::views::TxExecutionStatus::Final, }, ) } else { Ok( near_jsonrpc_primitives::types::transactions::RpcTransactionResponse { - final_execution_outcome: FinalExecutionOutcome( + final_execution_outcome: Some(FinalExecutionOutcome( transaction_details.to_final_execution_outcome(), - ), + )), + // With the fact that we don't support non-finalised data yet, + // final_execution_status field can be always filled with FINAL. + // This logic will be more complicated when we add support of optimistic blocks. + final_execution_status: near_primitives::views::TxExecutionStatus::Final, }, ) } diff --git a/rpc-server/src/modules/transactions/mod.rs b/rpc-server/src/modules/transactions/mod.rs index cfec468f..8faff763 100644 --- a/rpc-server/src/modules/transactions/mod.rs +++ b/rpc-server/src/modules/transactions/mod.rs @@ -6,23 +6,24 @@ use serde_json::Value; pub async fn parse_transaction_status_common_request( value: Value, ) -> Result< - near_jsonrpc_primitives::types::transactions::RpcTransactionStatusCommonRequest, + near_jsonrpc_primitives::types::transactions::RpcTransactionStatusRequest, near_jsonrpc_primitives::errors::RpcError, > { tracing::debug!("`parse_transaction_status_common_request` call."); - if let Ok((hash, account_id)) = serde_json::from_value::<( + if let Ok((tx_hash, sender_account_id)) = serde_json::from_value::<( near_primitives::hash::CryptoHash, near_primitives::types::AccountId, )>(value.clone()) { let transaction_info = near_jsonrpc_primitives::types::transactions::TransactionInfo::TransactionId { - hash, - account_id, + tx_hash, + sender_account_id, }; Ok( - near_jsonrpc_primitives::types::transactions::RpcTransactionStatusCommonRequest { + near_jsonrpc_primitives::types::transactions::RpcTransactionStatusRequest { transaction_info, + wait_until: near_primitives::views::TxExecutionStatus::Final, }, ) } else { @@ -32,11 +33,14 @@ pub async fn parse_transaction_status_common_request( let transaction_info = near_jsonrpc_primitives::types::transactions::TransactionInfo::Transaction( - signed_transaction, + near_jsonrpc_primitives::types::transactions::SignedTransaction::SignedTransaction( + signed_transaction, + ), ); Ok( - near_jsonrpc_primitives::types::transactions::RpcTransactionStatusCommonRequest { + near_jsonrpc_primitives::types::transactions::RpcTransactionStatusRequest { transaction_info, + wait_until: near_primitives::views::TxExecutionStatus::Final, }, ) } diff --git a/rpc-server/src/utils.rs b/rpc-server/src/utils.rs index 72887ecc..5c78c418 100644 --- a/rpc-server/src/utils.rs +++ b/rpc-server/src/utils.rs @@ -1,8 +1,7 @@ -use crate::modules::blocks::{CacheBlock, FinalBlockInfo}; +use crate::modules::blocks::{BlockInfo, BlocksInfoByFinality, CacheBlock}; #[cfg(feature = "shadow_data_consistency")] use assert_json_diff::{assert_json_matches_no_panic, CompareMode, Config, NumericMode}; use futures::StreamExt; -use sysinfo::{System, SystemExt}; #[cfg(feature = "shadow_data_consistency")] const DEFAULT_RETRY_COUNT: u8 = 3; @@ -97,40 +96,26 @@ impl JsonRpcClient { } } -pub async fn get_final_cache_block(near_rpc_client: &JsonRpcClient) -> Option { +pub async fn get_final_block( + near_rpc_client: &JsonRpcClient, + optimistic: bool, +) -> anyhow::Result { let block_request_method = near_jsonrpc_client::methods::block::RpcBlockRequest { - block_reference: near_primitives::types::BlockReference::Finality( - near_primitives::types::Finality::Final, - ), + block_reference: near_primitives::types::BlockReference::Finality(if optimistic { + near_primitives::types::Finality::None + } else { + near_primitives::types::Finality::Final + }), }; - match near_rpc_client.call(block_request_method).await { - Ok(block_view) => { - // Updating the metric to expose the block height considered as final by the server - // this metric can be used to calculate the lag between the server and the network - // Prometheus Gauge Metric type do not support u64 - // https://github.com/tikv/rust-prometheus/issues/470 - crate::metrics::FINAL_BLOCK_HEIGHT - .set(i64::try_from(block_view.header.height).unwrap()); - - Some(block_view.into()) - } - Err(err) => { - tracing::warn!("Error to get final block: {:?}", err); - None - } + let block_view = near_rpc_client.call(block_request_method).await?; + if !optimistic { + // Updating the metric to expose the block height considered as final by the server + // this metric can be used to calculate the lag between the server and the network + // Prometheus Gauge Metric type do not support u64 + // https://github.com/tikv/rust-prometheus/issues/470 + crate::metrics::FINAL_BLOCK_HEIGHT.set(i64::try_from(block_view.header.height)?); } -} - -pub async fn get_current_protocol_config( - near_rpc_client: &JsonRpcClient, -) -> anyhow::Result { - let params = - near_jsonrpc_client::methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest { - block_reference: near_primitives::types::BlockReference::Finality( - near_primitives::types::Finality::Final, - ), - }; - Ok(near_rpc_client.call(params).await?) + Ok(block_view) } pub async fn get_current_validators( @@ -147,36 +132,53 @@ async fn handle_streamer_message( blocks_cache: std::sync::Arc< futures_locks::RwLock>, >, - final_block_info: std::sync::Arc>, + blocks_info_by_finality: std::sync::Arc>, near_rpc_client: &JsonRpcClient, ) -> anyhow::Result<()> { - let block: CacheBlock = streamer_message.block.into(); - - if final_block_info.read().await.final_block_cache.epoch_id != block.epoch_id { - tracing::info!("New epoch started: {:?}", block.epoch_id); - final_block_info.write().await.current_protocol_config = - get_current_protocol_config(near_rpc_client).await?; - final_block_info.write().await.current_validators = + let block = BlockInfo::new_from_streamer_message(streamer_message).await; + + if blocks_info_by_finality + .read() + .await + .final_block + .block_cache + .epoch_id + != block.block_cache.epoch_id + { + tracing::info!("New epoch started: {:?}", block.block_cache.epoch_id); + blocks_info_by_finality.write().await.current_validators = get_current_validators(near_rpc_client).await?; } - final_block_info.write().await.final_block_cache = block; - blocks_cache.write().await.put(block.block_height, block); - crate::metrics::FINAL_BLOCK_HEIGHT.set(i64::try_from(block.block_height)?); + let block_cache = block.block_cache; + blocks_info_by_finality.write().await.final_block = block; + blocks_cache + .write() + .await + .put(block_cache.block_height, block_cache); + crate::metrics::FINAL_BLOCK_HEIGHT.set(i64::try_from(block_cache.block_height)?); Ok(()) } -pub async fn update_final_block_height_regularly( +#[cfg(feature = "near_state_indexer_disabled")] +pub async fn update_final_block_regularly( blocks_cache: std::sync::Arc< futures_locks::RwLock>, >, - final_block_info: std::sync::Arc>, + blocks_info_by_finality: std::sync::Arc>, rpc_server_config: configuration::RpcServerConfig, near_rpc_client: JsonRpcClient, ) -> anyhow::Result<()> { tracing::info!("Task to get and store final block in the cache started"); let lake_config = rpc_server_config .lake_config - .lake_config(final_block_info.read().await.final_block_cache.block_height) + .lake_config( + blocks_info_by_finality + .read() + .await + .final_block + .block_cache + .block_height, + ) .await?; let (sender, stream) = near_lake_framework::streamer(lake_config); let mut handlers = tokio_stream::wrappers::ReceiverStream::new(stream) @@ -184,7 +186,7 @@ pub async fn update_final_block_height_regularly( handle_streamer_message( streamer_message, std::sync::Arc::clone(&blocks_cache), - std::sync::Arc::clone(&final_block_info), + std::sync::Arc::clone(&blocks_info_by_finality), &near_rpc_client, ) }) @@ -205,6 +207,83 @@ pub async fn update_final_block_height_regularly( } } +// Task to get and store final block in the cache +// Subscribe to the redis channel and update the finale block in the cache +#[cfg(not(feature = "near_state_indexer_disabled"))] +pub async fn update_final_block_regularly( + blocks_cache: std::sync::Arc< + futures_locks::RwLock>, + >, + blocks_info_by_finality: std::sync::Arc>, + redis_client: redis::Client, + near_rpc_client: JsonRpcClient, +) -> anyhow::Result<()> { + tracing::info!("Task to get and store final block in the cache started"); + let mut subscriber = redis_client.get_async_connection().await?.into_pubsub(); + subscriber.subscribe("final_block").await?; + let mut streamer = subscriber.on_message(); + while let Some(message) = streamer.next().await { + match message.get_payload::() { + Ok(payload) => match serde_json::from_str(&payload) { + Ok(streamer_message) => { + if let Err(err) = handle_streamer_message( + streamer_message, + std::sync::Arc::clone(&blocks_cache), + std::sync::Arc::clone(&blocks_info_by_finality), + &near_rpc_client, + ) + .await + { + tracing::error!("Error to handle_streamer_message: {:?}", err); + } + } + Err(err) => { + tracing::error!("Error parse payload: {:?}", err); + } + }, + Err(err) => { + tracing::error!("Error reading message: {:?}", err); + } + } + } + Ok(()) +} + +#[cfg(not(feature = "near_state_indexer_disabled"))] +// Task to get and store optimistic block in the cache +// Subscribe to the redis channel and update the optimistic block in the cache +pub async fn update_optimistic_block_regularly( + blocks_info_by_finality: std::sync::Arc>, + redis_client: redis::Client, +) -> anyhow::Result<()> { + tracing::info!("Task to get and store optimistic block in the cache started"); + let mut subscriber = redis_client.get_async_connection().await?.into_pubsub(); + subscriber.subscribe("optimistic_block").await?; + let mut streamer = subscriber.on_message(); + while let Some(message) = streamer.next().await { + match message.get_payload::() { + Ok(payload) => match serde_json::from_str(&payload) { + Ok(streamer_message) => { + let optimistic_block = + BlockInfo::new_from_streamer_message(streamer_message).await; + tracing::debug!( + "Received optimistic block: {:?}", + optimistic_block.block_cache + ); + blocks_info_by_finality.write().await.optimistic_block = optimistic_block; + } + Err(err) => { + tracing::error!("Error parse payload: {:?}", err); + } + }, + Err(err) => { + tracing::error!("Error reading message: {:?}", err); + } + } + } + Ok(()) +} + /// Calculate the cache size based on the available memory. /// For caching we use the limit or if it is not set then all available memory. /// We divide the memory equally between the 3 caches: blocks, compiled_contracts, contract_code. @@ -214,7 +293,7 @@ pub(crate) async fn calculate_contract_code_cache_sizes( block_cache_size: usize, limit_memory_cache: Option, ) -> usize { - let sys = System::new_all(); + let sys = sysinfo::System::new_all(); let total_memory = sys.total_memory() as usize; // Total memory in bytes let used_memory = sys.used_memory() as usize; // Used memory in bytes let available_memory = total_memory - used_memory - reserved_memory; // Available memory in bytes diff --git a/rust-toolchain b/rust-toolchain index 5e3a4256..32a6ce3c 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.73.0 +1.76.0 diff --git a/state-indexer/Cargo.toml b/state-indexer/Cargo.toml index 9edf1bbd..6aa108b7 100644 --- a/state-indexer/Cargo.toml +++ b/state-indexer/Cargo.toml @@ -10,30 +10,31 @@ license.workspace = true [dependencies] actix-web = "4.2.1" anyhow = "1.0.70" -borsh = "0.10.2" -clap = { version = "3.1.6", features = ["color", "derive"] } +borsh = "1.3.1" +clap = "4.4.18" futures = "0.3.5" hex = "0.4.3" humantime = "2.1.0" lazy_static = "1.4.0" openssl-probe = "0.1.5" prometheus = "0.13.1" -tokio = { version = "1.28.2", features = [ +tokio = { version = "1.36.0", features = [ "sync", "time", "macros", "rt-multi-thread", ] } -tokio-stream = { version = "0.1" } +tokio-stream = "0.1" tracing = "0.1.34" -configuration = { path = "../configuration" } -database = { path = "../database" } -epoch-indexer = { path = "../epoch-indexer" } -near-primitives = "1.36.0" -near-indexer-primitives = "1.36.0" -near-jsonrpc-client = "0.7.0" -near-lake-framework = "0.7.9" +configuration.workspace = true +database.workspace = true +epoch-indexer.workspace = true + +near-primitives.workspace = true +near-indexer-primitives.workspace = true +near-jsonrpc-client.workspace = true +near-lake-framework.workspace = true [features] default = ["scylla_db"] diff --git a/state-indexer/Dockerfile b/state-indexer/Dockerfile index 3394977c..74ef9fef 100644 --- a/state-indexer/Dockerfile +++ b/state-indexer/Dockerfile @@ -1,11 +1,11 @@ -FROM rust:1.73 AS builder +FROM rust:1.76 AS builder ARG features="default" WORKDIR /tmp/ COPY Cargo.lock ./ COPY Cargo.toml ./ COPY config.toml ./ -RUN sed '/perf-testing/d; /rpc-server/d; /tx-indexer/d' Cargo.toml > Cargo.toml.new && mv Cargo.toml.new Cargo.toml +RUN sed '/perf-testing/d; /rpc-server/d; /tx-indexer/d; /near-state-indexer/d' Cargo.toml > Cargo.toml.new && mv Cargo.toml.new Cargo.toml COPY state-indexer/Cargo.toml state-indexer/Cargo.toml COPY configuration configuration COPY database database diff --git a/state-indexer/src/configs.rs b/state-indexer/src/configs.rs index 6fc720f5..f73524b0 100644 --- a/state-indexer/src/configs.rs +++ b/state-indexer/src/configs.rs @@ -5,14 +5,6 @@ use near_lake_framework::near_indexer_primitives::types::{BlockReference, Finali /// NEAR Indexer for Explorer /// Watches for stream of blocks from the chain #[derive(Parser, Debug)] -#[clap( - version, - author, - about, - setting(clap::AppSettings::DisableHelpSubcommand), - setting(clap::AppSettings::PropagateVersion), - setting(clap::AppSettings::NextLineHelp) -)] pub(crate) struct Opts { #[clap(subcommand)] pub start_options: StartOptions, diff --git a/state-indexer/src/main.rs b/state-indexer/src/main.rs index 4b5050f0..66523a48 100644 --- a/state-indexer/src/main.rs +++ b/state-indexer/src/main.rs @@ -1,11 +1,9 @@ -use borsh::BorshSerialize; use clap::Parser; use futures::StreamExt; use crate::configs::Opts; use near_indexer_primitives::views::StateChangeValueView; use near_indexer_primitives::CryptoHash; -use near_primitives::account::Account; mod configs; mod metrics; @@ -45,7 +43,7 @@ async fn handle_streamer_message( rpc_client, db_manager, ); - let handle_block_future = handle_block( + let handle_block_future = db_manager.save_block( block_height, block_hash, streamer_message @@ -54,10 +52,9 @@ async fn handle_streamer_message( .iter() .map(|chunk| (chunk.chunk_hash.to_string(), chunk.shard_id, chunk.height_included)) .collect(), - db_manager, ); let handle_state_change_future = - handle_state_changes(streamer_message, db_manager, block_height, block_hash, &indexer_config); + handle_state_changes(&streamer_message, db_manager, block_height, block_hash, &indexer_config); let update_meta_future = db_manager.update_meta(&indexer_config.general.indexer_id, block_height); @@ -90,20 +87,6 @@ async fn handle_streamer_message( Ok(()) } -#[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(db_manager)))] -async fn handle_block( - block_height: u64, - block_hash: CryptoHash, - chunks: Vec<(database::primitives::ChunkHash, database::primitives::ShardId, database::primitives::HeightIncluded)>, - db_manager: &(impl database::StateIndexerDbManager + Sync + Send + 'static), -) -> anyhow::Result<()> { - let add_block_future = db_manager.add_block(block_height, block_hash); - let add_chunks_future = db_manager.add_chunks(block_height, chunks); - - futures::try_join!(add_block_future, add_chunks_future)?; - Ok(()) -} - #[cfg_attr(feature = "tracing-instrumentation", tracing::instrument(skip(db_manager)))] async fn handle_epoch( stats_current_epoch_id: Option, @@ -142,19 +125,19 @@ async fn handle_epoch( tracing::instrument(skip(streamer_message, db_manager)) )] async fn handle_state_changes( - streamer_message: near_indexer_primitives::StreamerMessage, + streamer_message: &near_indexer_primitives::StreamerMessage, db_manager: &(impl database::StateIndexerDbManager + Sync + Send + 'static), block_height: u64, block_hash: CryptoHash, indexer_config: &configuration::StateIndexerConfig, ) -> anyhow::Result> { let mut state_changes_to_store = - std::collections::HashMap::::new(); + std::collections::HashMap::::new(); let initial_state_changes = streamer_message .shards - .into_iter() - .flat_map(|shard| shard.state_changes.into_iter()); + .iter() + .flat_map(|shard| shard.state_changes.iter()); // Collecting a unique list of StateChangeWithCauseView for account_id + change kind + suffix // by overwriting the records in the HashMap @@ -168,7 +151,7 @@ async fn handle_state_changes( // returning a hex-encoded key to ensure we store data changes to the key // (if there is more than one change to the same key) let key: &[u8] = key.as_ref(); - format!("{}_data_{}", account_id.as_ref(), hex::encode(key)) + format!("{}_data_{}", account_id.as_str(), hex::encode(key)) } StateChangeValueView::AccessKeyUpdate { account_id, public_key, .. @@ -176,114 +159,27 @@ async fn handle_state_changes( | StateChangeValueView::AccessKeyDeletion { account_id, public_key } => { // returning a hex-encoded key to ensure we store data changes to the key // (if there is more than one change to the same key) - let data_key = public_key - .try_to_vec() - .expect("Failed to borsh-serialize the PublicKey"); - format!("{}_access_key_{}", account_id.as_ref(), hex::encode(data_key)) + let data_key = borsh::to_vec(&public_key)?; + format!("{}_access_key_{}", account_id.as_str(), hex::encode(data_key)) } // ContractCode and Account changes is not separate-able by any key, we can omit the suffix StateChangeValueView::ContractCodeUpdate { account_id, .. } - | StateChangeValueView::ContractCodeDeletion { account_id } => format!("{}_contract", account_id.as_ref()), + | StateChangeValueView::ContractCodeDeletion { account_id } => format!("{}_contract", account_id.as_str()), StateChangeValueView::AccountUpdate { account_id, .. } - | StateChangeValueView::AccountDeletion { account_id } => format!("{}_account", account_id.as_ref()), + | StateChangeValueView::AccountDeletion { account_id } => format!("{}_account", account_id.as_str()), }; // This will override the previous record for this account_id + state change kind + suffix state_changes_to_store.insert(key, state_change); } // Asynchronous storing of StateChangeWithCauseView into the storage. - let futures = state_changes_to_store.into_values().map(|state_change_with_cause| { - store_state_change(state_change_with_cause, db_manager, block_height, block_hash) - }); + let futures = state_changes_to_store + .into_values() + .map(|state_change_with_cause| db_manager.save_state_change(state_change_with_cause, block_height, block_hash)); futures::future::try_join_all(futures).await } -#[cfg_attr( - feature = "tracing-instrumentation", - tracing::instrument(skip(state_change, db_manager)) -)] -async fn store_state_change( - state_change: near_indexer_primitives::views::StateChangeWithCauseView, - db_manager: &(impl database::StateIndexerDbManager + Sync + Send + 'static), - block_height: u64, - block_hash: CryptoHash, -) -> anyhow::Result<()> { - match state_change.value { - StateChangeValueView::DataUpdate { account_id, key, value } => { - db_manager - .add_state_changes(account_id, block_height, block_hash, key.as_ref(), value.as_ref()) - .await? - } - StateChangeValueView::DataDeletion { account_id, key } => { - db_manager - .delete_state_changes(account_id, block_height, block_hash, key.as_ref()) - .await? - } - StateChangeValueView::AccessKeyUpdate { - account_id, - public_key, - access_key, - } => { - let data_key = public_key - .try_to_vec() - .expect("Failed to borsh-serialize the PublicKey"); - let data_value = access_key - .try_to_vec() - .expect("Failed to borsh-serialize the AccessKey"); - let add_access_key_future = - db_manager.add_access_key(account_id.clone(), block_height, block_hash, &data_key, &data_value); - - #[cfg(feature = "account_access_keys")] - { - let add_account_access_keys_future = - db_manager.add_account_access_keys(account_id, block_height, &data_key, Some(&data_value)); - futures::try_join!(add_access_key_future, add_account_access_keys_future)?; - } - #[cfg(not(feature = "account_access_keys"))] - add_access_key_future.await?; - } - StateChangeValueView::AccessKeyDeletion { account_id, public_key } => { - let data_key = public_key - .try_to_vec() - .expect("Failed to borsh-serialize the PublicKey"); - let delete_access_key_future = - db_manager.delete_access_key(account_id.clone(), block_height, block_hash, &data_key); - - #[cfg(feature = "account_access_keys")] - { - let delete_account_access_keys_future = - db_manager.add_account_access_keys(account_id, block_height, &data_key, None); - futures::try_join!(delete_access_key_future, delete_account_access_keys_future)?; - } - #[cfg(not(feature = "account_access_keys"))] - delete_access_key_future.await?; - } - StateChangeValueView::ContractCodeUpdate { account_id, code } => { - db_manager - .add_contract_code(account_id, block_height, block_hash, code.as_ref()) - .await? - } - StateChangeValueView::ContractCodeDeletion { account_id } => { - db_manager - .delete_contract_code(account_id, block_height, block_hash) - .await? - } - StateChangeValueView::AccountUpdate { account_id, account } => { - let value = Account::from(account) - .try_to_vec() - .expect("Failed to borsh-serialize the Account"); - db_manager - .add_account(account_id, block_height, block_hash, value) - .await? - } - StateChangeValueView::AccountDeletion { account_id } => { - db_manager.delete_account(account_id, block_height, block_hash).await? - } - } - Ok(()) -} - #[tokio::main] async fn main() -> anyhow::Result<()> { // We use it to automatically search the for root certificates to perform HTTPS calls diff --git a/tx-indexer/Cargo.toml b/tx-indexer/Cargo.toml index 84177c8b..7753329f 100644 --- a/tx-indexer/Cargo.toml +++ b/tx-indexer/Cargo.toml @@ -8,30 +8,30 @@ repository.workspace = true license.workspace = true [dependencies] -actix-web = "4.2.1" +actix-web = "4.5.1" anyhow = "1.0.70" -clap = { version = "3.2.22", features = ["color", "derive", "env"] } +clap = "4.4.18" futures = "0.3.5" futures-locks = "0.7.1" humantime = "2.1.0" lazy_static = "1.4.0" prometheus = "0.13.1" -tokio = { version = "1.28.2", features = [ +tokio = { version = "1.36.0", features = [ "sync", "time", "macros", "rt-multi-thread", ] } -tokio-stream = { version = "0.1.12" } +tokio-stream = "0.1.12" tracing = "0.1.34" -configuration = { path = "../configuration" } -database = { path = "../database" } -readnode-primitives = { path = "../readnode-primitives" } +configuration.workspace = true +database.workspace = true +readnode-primitives.workspace = true -near-indexer-primitives = "1.36.0" -near-jsonrpc-client = "0.7.0" -near-lake-framework = "0.7.9" +near-indexer-primitives.workspace = true +near-jsonrpc-client.workspace = true +near-lake-framework.workspace = true [features] default = ["scylla_db"] diff --git a/tx-indexer/Dockerfile b/tx-indexer/Dockerfile index e126acd1..f495f4f3 100644 --- a/tx-indexer/Dockerfile +++ b/tx-indexer/Dockerfile @@ -1,11 +1,11 @@ -FROM rust:1.73 AS builder +FROM rust:1.76 AS builder ARG features="default" WORKDIR /tmp/ COPY Cargo.lock ./ COPY Cargo.toml ./ COPY config.toml ./ -RUN sed '/perf-testing/d; /rpc-server/d; /state-indexer/d; /epoch-indexer/d' Cargo.toml > Cargo.toml.new && mv Cargo.toml.new Cargo.toml +RUN sed '/perf-testing/d; /rpc-server/d; /state-indexer/d; /epoch-indexer/d; /near-state-indexer/d' Cargo.toml > Cargo.toml.new && mv Cargo.toml.new Cargo.toml COPY tx-indexer/Cargo.toml tx-indexer/Cargo.toml COPY configuration configuration COPY database database diff --git a/tx-indexer/src/config.rs b/tx-indexer/src/config.rs index cdf13039..372d0ff3 100644 --- a/tx-indexer/src/config.rs +++ b/tx-indexer/src/config.rs @@ -5,14 +5,6 @@ use near_jsonrpc_client::{methods, JsonRpcClient}; /// NEAR Indexer for Explorer /// Watches for stream of blocks from the chain #[derive(Parser, Debug)] -#[clap( - version, - author, - about, - setting(clap::AppSettings::DisableHelpSubcommand), - setting(clap::AppSettings::PropagateVersion), - setting(clap::AppSettings::NextLineHelp) -)] pub(crate) struct Opts { #[clap(subcommand)] pub start_options: StartOptions,