From 1df181e604515912e2c16f323c8b246fc74b82ed Mon Sep 17 00:00:00 2001 From: Liam Monninger Date: Wed, 24 Jan 2024 21:32:21 -0800 Subject: [PATCH] fix: cleaning up proxy and mevm. --- m1/scripts/run.debug.sh | 2 +- m1/scripts/start-subnet.sh | 21 - m1/subnet-request-proxy/Cargo.lock | 1660 ----------------- m1/subnet-request-proxy/Cargo.toml | 19 - m1/subnet-request-proxy/src/apis/accounts.rs | 134 -- m1/subnet-request-proxy/src/apis/blocks.rs | 50 - m1/subnet-request-proxy/src/apis/chain.rs | 45 - m1/subnet-request-proxy/src/apis/mod.rs | 14 - m1/subnet-request-proxy/src/apis/tables.rs | 66 - .../src/apis/transactions.rs | 99 - m1/subnet-request-proxy/src/main.rs | 102 - m1/subnet-request-proxy/src/rate/layer.rs | 26 - m1/subnet-request-proxy/src/rate/mod.rs | 8 - m1/subnet-request-proxy/src/rate/rate.rs | 30 - m1/subnet-request-proxy/src/rate/service.rs | 150 -- m1/subnet-request-proxy/src/subnet.rs | 59 - m1/subnet-request-proxy/src/types.rs | 7 - m1/subnet-request-proxy/src/utils.rs | 65 - m1/tests/e2e/src/tests/mod.rs | 23 +- 19 files changed, 17 insertions(+), 2563 deletions(-) delete mode 100755 m1/scripts/start-subnet.sh delete mode 100644 m1/subnet-request-proxy/Cargo.lock delete mode 100644 m1/subnet-request-proxy/Cargo.toml delete mode 100644 m1/subnet-request-proxy/src/apis/accounts.rs delete mode 100644 m1/subnet-request-proxy/src/apis/blocks.rs delete mode 100644 m1/subnet-request-proxy/src/apis/chain.rs delete mode 100644 m1/subnet-request-proxy/src/apis/mod.rs delete mode 100644 m1/subnet-request-proxy/src/apis/tables.rs delete mode 100644 m1/subnet-request-proxy/src/apis/transactions.rs delete mode 100644 m1/subnet-request-proxy/src/main.rs delete mode 100644 m1/subnet-request-proxy/src/rate/layer.rs delete mode 100644 m1/subnet-request-proxy/src/rate/mod.rs delete mode 100644 m1/subnet-request-proxy/src/rate/rate.rs delete mode 100644 m1/subnet-request-proxy/src/rate/service.rs delete mode 100644 m1/subnet-request-proxy/src/subnet.rs delete mode 100644 m1/subnet-request-proxy/src/types.rs delete mode 100644 m1/subnet-request-proxy/src/utils.rs diff --git a/m1/scripts/run.debug.sh b/m1/scripts/run.debug.sh index 129663a6..6d49d306 100755 --- a/m1/scripts/run.debug.sh +++ b/m1/scripts/run.debug.sh @@ -5,4 +5,4 @@ if ! [[ "$0" =~ scripts/run.debug.sh ]]; then exit 255 fi -SUBNET_TIMEOUT=300000 ./scripts/tests.debug.sh \ No newline at end of file +SUBNET_TIMEOUT=-1 ./scripts/tests.debug.sh \ No newline at end of file diff --git a/m1/scripts/start-subnet.sh b/m1/scripts/start-subnet.sh deleted file mode 100755 index 64808a23..00000000 --- a/m1/scripts/start-subnet.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -e -export AVALANCHEGO_EXEC_PATH=$(which avalanchego) -export AVALANCHEGO_PLUGIN_PATH=$(pwd)/plugins - -echo hello > /tmp/subnet.genesis.json - -avalanche-network-runner control start \ ---log-level debug \ ---endpoint="0.0.0.0:8080" \ -<<<<<<< HEAD ---avalanchego-path="${AVALANCHEGO_EXEC_PATH}" -======= ---avalanchego-path="${AVALANCHEGO_EXEC_PATH}" \ ->>>>>>> indexer-fix ---blockchain-specs '[{"vm_name":"subnet","genesis":"/tmp/subnet.genesis.json","blockchain_alias":"movement"}]' \ - -# avalanche-network-runner control create-blockchains '[{"vm_name":"movement", "subnet_id": "srEXiWaHZNDcVtfHLb38cFiwKVLJ8xnhDF5qpWbYdowxEiyid"}]' \ -# --log-level debug \ -# --endpoint="0.0.0.0:8080" - -curl -X POST -k http://localhost:8081/v1/control/status \ No newline at end of file diff --git a/m1/subnet-request-proxy/Cargo.lock b/m1/subnet-request-proxy/Cargo.lock deleted file mode 100644 index dc2d5173..00000000 --- a/m1/subnet-request-proxy/Cargo.lock +++ /dev/null @@ -1,1660 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "async-trait" -version = "0.1.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "axum" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "810a80b128d70e6ed2bdf3fe8ed72c0ae56f5f5948d01c2753282dd92a84fce8" -dependencies = [ - "async-trait", - "axum-core", - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "http-body-util", - "hyper 1.0.1", - "hyper-util", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0ddc355eab88f4955090a823715df47acf0b7660aab7a69ad5ce6301ee3b73" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "http-body-util", - "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", - "tower-layer", - "tower-service", -] - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" - -[[package]] -name = "futures-io" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" - -[[package]] -name = "futures-macro" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" - -[[package]] -name = "futures-task" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" - -[[package]] -name = "futures-util" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" -dependencies = [ - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "h2" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.11", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "h2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 1.0.0", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "hdrhistogram" -version = "7.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8" -dependencies = [ - "byteorder", - "num-traits", -] - -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - -[[package]] -name = "http" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http 0.2.11", - "pin-project-lite", -] - -[[package]] -name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http 1.0.0", -] - -[[package]] -name = "http-body-util" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" -dependencies = [ - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.22", - "http 0.2.11", - "http-body 0.4.5", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.10", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f9214f3e703236b221f1a9cd88ec8b4adfa5296de01ab96216361f4692f56" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2 0.4.0", - "http 1.0.0", - "http-body 1.0.0", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.27", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "hyper-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca339002caeb0d159cc6e023dff48e199f081e42fa039895c7c6f38b37f2e9d" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "hyper 1.0.1", - "pin-project-lite", - "socket2 0.5.5", - "tokio", - "tower", - "tower-service", - "tracing", -] - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", -] - -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.150" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" - -[[package]] -name = "linux-raw-sys" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - -[[package]] -name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.48.0", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "openssl" -version = "0.10.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" -dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "proc-macro2" -version = "1.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "reqwest" -version = "0.11.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.3.22", - "http 0.2.11", - "http-body 0.4.5", - "hyper 0.14.27", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "winreg", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.38.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "security-framework" -version = "2.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "serde" -version = "1.0.193" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.193" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_path_to_error" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" -dependencies = [ - "itoa", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "subnet-rust" -version = "0.1.0" -dependencies = [ - "axum", - "futures-core", - "http-body-util", - "reqwest", - "serde", - "serde_json", - "tokio", - "tower", - "tower-http", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "syn" -version = "2.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2 0.5.5", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[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-util" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "hdrhistogram", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand", - "slab", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e12e6351354851911bdf8c2b8f2ab15050c567d70a8b9a37ae7b8301a4080d" -dependencies = [ - "bitflags 2.4.1", - "bytes", - "http 1.0.0", - "http-body 1.0.0", - "http-body-util", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "log", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "nu-ansi-term", - "sharded-slab", - "smallvec", - "thread_local", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" - -[[package]] -name = "wasm-streams" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" -dependencies = [ - "futures-util", - "js-sys", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "web-sys" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[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-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -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", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] diff --git a/m1/subnet-request-proxy/Cargo.toml b/m1/subnet-request-proxy/Cargo.toml deleted file mode 100644 index 353117f1..00000000 --- a/m1/subnet-request-proxy/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "subnet-rust" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -axum = { version = "0.7.1", features = ["default"] } -http-body-util = "0.1.0" -reqwest = { version = "0.11.22", features = ["json", "stream"] } -serde = { version = "1.0.193", features = ["derive"] } -serde_json = "1.0.108" -tokio = { version = "1.34.0", features = ["full"] } -tower = { version = "0.4.13", features = ["full"] } -tower-http = { version = "0.5.0", features = ["cors", "map-request-body", "util", "limit"] } -tracing = { version = "0.1.2", default-features = false, features = ["std"]} -futures-core = { version = "0.3" } -tracing-subscriber = "0.3.18" diff --git a/m1/subnet-request-proxy/src/apis/accounts.rs b/m1/subnet-request-proxy/src/apis/accounts.rs deleted file mode 100644 index f3e5115e..00000000 --- a/m1/subnet-request-proxy/src/apis/accounts.rs +++ /dev/null @@ -1,134 +0,0 @@ -use axum::{ - body::Body, - extract::{Path, Query, Request}, - http::StatusCode, - response::{IntoResponse, Response}, -}; -use http_body_util::BodyExt; -use serde::{Deserialize, Serialize}; -use serde_json::json; - -use crate::subnet::*; -use crate::types::*; -use crate::utils::*; - -#[derive(Debug, Default, Deserialize, Serialize)] -pub struct AccountParams { - pub data: Option, - pub start: Option, - pub limit: Option, - pub ledger_version: Option, -} -pub async fn get_accounts_transactions(Path(address): Path) -> impl IntoResponse { - println!("get_accounts_transactions"); - let json_data = request_to_subnet_ext::("getAccountsTransactions", Some(json!({ "data": address }))).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_account( - Path(address): Path, - params: Option>, -) -> impl IntoResponse { - let Query(mut params) = params.unwrap_or_default(); - params.data = Some(address); - - println!("get_account"); - let json_data = request_to_subnet_ext::("getAccount", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_account_resources( - Path(address): Path, - params: Option>, -) -> impl IntoResponse { - let Query(mut params) = params.unwrap_or_default(); - params.data = Some(address); - - println!("get_account_resources"); - let json_data = request_to_subnet_ext::("getAccountResources", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_account_modules( - Path(address): Path, - params: Option>, -) -> impl IntoResponse { - let Query(mut params) = params.unwrap_or_default(); - params.data = Some(address); - - println!("get_account_modules"); - let json_data = request_to_subnet_ext::("getAccountResources", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_account_resources_state( - Path(address): Path, - Path(resource_type): Path, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let params = json!({ - "account": address, - "resource": resource_type, - "ledger_version": params.ledger_version - }); - - println!("get_account_resources_state"); - let json_data = request_to_subnet_ext::("getAccountResourcesState", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_account_modules_state( - Path(address): Path, - Path(module_name): Path, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let params = json!({ - "account": address, - "resource": module_name, - "ledger_version": params.ledger_version - }); - - println!("get_account_modules_state"); - let json_data = request_to_subnet_ext::("getAccountModulesState", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_events_by_creation_number( - Path(address): Path, - Path(creation_number): Path, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let params = json!({ - "address": address, - "creation_number": creation_number, - "start": params.start, - "limit": params.limit - }); - - println!("get_events_by_creation_number"); - let json_data = request_to_subnet_ext::("getEventsByCreationNumber", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_events_by_event_handle( - Path(address): Path, - Path(event_handle): Path, - Path(field_name): Path, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let params = json!({ - "address": address, - "event_handle": event_handle, - "field_name": field_name, - "start": params.start, - "limit": params.limit - }); - - println!("get_events_by_event_handle"); - let json_data = request_to_subnet_ext::("getEventsByEventHandle", Some(params)).await.unwrap(); - make_response(&json_data) -} diff --git a/m1/subnet-request-proxy/src/apis/blocks.rs b/m1/subnet-request-proxy/src/apis/blocks.rs deleted file mode 100644 index 5e3977b5..00000000 --- a/m1/subnet-request-proxy/src/apis/blocks.rs +++ /dev/null @@ -1,50 +0,0 @@ -use axum::{ - body::Body, - extract::{Path, Query, Request}, - http::StatusCode, - response::{IntoResponse, Response}, -}; -use http_body_util::BodyExt; -use serde::{Deserialize, Serialize}; -use serde_json::json; - -use crate::subnet::*; -use crate::types::*; -use crate::utils::*; - -#[derive(Debug, Default, Deserialize, Serialize)] -pub struct BlockParams { - pub with_transactions: Option, -} - -pub async fn get_block_by_height( - Path(height): Path, - params: Option>, -) -> impl IntoResponse { - - let Query(params) = params.unwrap_or_default(); - let params = json!({ - "with_transactions": params.with_transactions.unwrap_or(false), - "height_or_version": height - }); - println!("get_block_by_height params ={}", params); - - let json_data = request_to_subnet_ext::("getBlockByHeight", Some(params)).await.unwrap(); - make_response(&json_data) -} - -pub async fn get_block_by_version( - Path(version): Path, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let params = json!({ - "with_transactions": params.with_transactions.unwrap_or(false), - "height_or_version": version - }); - - println!("get_block_by_version params ={}", params); - - let json_data = request_to_subnet_ext::("getBlockByVersion", Some(params)).await.unwrap(); - make_response(&json_data) -} diff --git a/m1/subnet-request-proxy/src/apis/chain.rs b/m1/subnet-request-proxy/src/apis/chain.rs deleted file mode 100644 index 95249696..00000000 --- a/m1/subnet-request-proxy/src/apis/chain.rs +++ /dev/null @@ -1,45 +0,0 @@ -use axum::{ - body::Body, - extract::{Path, Query, Request}, - http::StatusCode, - response::{IntoResponse, Response}, -}; -use http_body_util::BodyExt; -use serde_json::json; - -use crate::subnet::*; -use crate::types::*; -use crate::utils::*; - -pub async fn get_ledger_info() -> impl IntoResponse { - println!("get_ledger_info"); - let json_data = request_to_subnet_ext::("getLedgerInfo", None) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn healthy() -> impl IntoResponse { - (StatusCode::OK, "OK".to_string()) -} - -// TODO: implement this after checking `getAccount` api for balance check -pub async fn faucet() -> impl IntoResponse { - StatusCode::OK -} - -pub async fn view_request(request: Request) -> impl IntoResponse { - let (_parts, body) = request.into_parts(); - let bytes = body.collect().await.unwrap().to_bytes().to_vec(); - - println!("get_transaction_by_version"); - let json_data = request_to_subnet_ext::( - "viewFunction", - Some(json!({ - "data": bytes.clone() - })), - ) - .await - .unwrap(); - make_response(&json_data) -} diff --git a/m1/subnet-request-proxy/src/apis/mod.rs b/m1/subnet-request-proxy/src/apis/mod.rs deleted file mode 100644 index cab0f6d1..00000000 --- a/m1/subnet-request-proxy/src/apis/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub mod transactions; -pub use transactions::*; - -pub mod accounts; -pub use accounts::*; - -pub mod blocks; -pub use blocks::*; - -pub mod chain; -pub use chain::*; - -pub mod tables; -pub use tables::*; diff --git a/m1/subnet-request-proxy/src/apis/tables.rs b/m1/subnet-request-proxy/src/apis/tables.rs deleted file mode 100644 index 2dd04280..00000000 --- a/m1/subnet-request-proxy/src/apis/tables.rs +++ /dev/null @@ -1,66 +0,0 @@ -use axum::{ - body::Body, - extract::{Path, Query, Request}, - http::StatusCode, - response::{IntoResponse, Response}, -}; -use http_body_util::BodyExt; -use serde::{Deserialize, Serialize}; -use serde_json::json; - -use crate::subnet::*; -use crate::types::*; -use crate::utils::*; - -#[derive(Debug, Default, Deserialize, Serialize)] -pub struct TableParams { - pub ledger_version: Option, -} - -pub async fn get_table_item( - Path(table_handle): Path, - request: Request, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let (_parts, body) = request.into_parts(); - let bytes = body.collect().await.unwrap().to_bytes().to_vec(); - - println!("get_table_item"); - - let json_data = request_to_subnet_ext::( - "getTableItem", - Some(json!({ - "data": bytes.clone(), - "query": table_handle, - "ledge_version": params.ledger_version - })), - ) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn get_raw_table_item( - Path(table_handle): Path, - request: Request, - params: Option>, -) -> impl IntoResponse { - let Query(params) = params.unwrap_or_default(); - let (_parts, body) = request.into_parts(); - let bytes = body.collect().await.unwrap().to_bytes().to_vec(); - - println!("get_raw_table_item"); - - let json_data = request_to_subnet_ext::( - "getRawTableItem", - Some(json!({ - "data": bytes.clone(), - "query": table_handle, - "ledge_version": params.ledger_version - })), - ) - .await - .unwrap(); - make_response(&json_data) -} diff --git a/m1/subnet-request-proxy/src/apis/transactions.rs b/m1/subnet-request-proxy/src/apis/transactions.rs deleted file mode 100644 index 62299fcd..00000000 --- a/m1/subnet-request-proxy/src/apis/transactions.rs +++ /dev/null @@ -1,99 +0,0 @@ -use axum::{ - body::Body, - extract::{Path, Query, Request}, - http::StatusCode, - response::{IntoResponse, Response}, -}; -use http_body_util::BodyExt; -use serde_json::{json, Value}; - -use crate::subnet::*; -use crate::types::*; -use crate::utils::*; - -pub async fn transactions(pagination: Option>) -> impl IntoResponse { - let Query(pagination) = pagination.unwrap_or_default(); - println!("transactions = {:?}", pagination); - - let json_data = request_to_subnet_ext::("getTransactions", Some(pagination)) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn submit_transactions(request: Request) -> impl IntoResponse { - let (_parts, body) = request.into_parts(); - let bytes = body.collect().await.unwrap().to_bytes().to_vec(); - - println!("submit_transactions"); - - let json_data = request_to_subnet_ext::( - "submitTransaction", - Some(json!({ - "data": bytes.clone() - })), - ) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn submit_transaction_batch(request: Request) -> impl IntoResponse { - let (_parts, body) = request.into_parts(); - let bytes = body.collect().await.unwrap().to_bytes().to_vec(); - - println!("submit_transaction_batch"); - - let json_data = request_to_subnet_ext::( - "submitTransactionBatch", - Some(json!({ - "data": bytes.clone() - })), - ) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn simulate_transaction(request: Request) -> impl IntoResponse { - let (_parts, body) = request.into_parts(); - let bytes = body.collect().await.unwrap().to_bytes().to_vec(); - - println!("simulate_transaction"); - - let json_data = request_to_subnet_ext::( - "simulateTransaction", - Some(json!({ - "data": bytes.clone() - })), - ) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn get_transaction_by_hash(Path(txn_hash): Path) -> impl IntoResponse { - let param = if txn_hash.starts_with("0x") { - txn_hash.strip_prefix("0x").unwrap().to_string() - } else { - txn_hash - }; - - println!("get_transaction_by_hash"); - let json_data = - request_to_subnet_ext::("getTransactionByHash", Some(json!({ "data": param }))) - .await - .unwrap(); - make_response(&json_data) -} - -pub async fn get_transaction_by_version(Path(txn_version): Path) -> impl IntoResponse { - println!("get_transaction_by_version"); - let json_data = request_to_subnet_ext::( - "getTransactionByVersion", - Some(json!({ "version": txn_version })), - ) - .await - .unwrap(); - make_response(&json_data) -} diff --git a/m1/subnet-request-proxy/src/main.rs b/m1/subnet-request-proxy/src/main.rs deleted file mode 100644 index 30ecb191..00000000 --- a/m1/subnet-request-proxy/src/main.rs +++ /dev/null @@ -1,102 +0,0 @@ -use axum::{ - body::Body, - extract::{Path, Query, Request}, - http::{header::CONTENT_TYPE, HeaderMap, HeaderValue, Method, StatusCode}, - response::Html, - response::{IntoResponse, Response}, - routing::{get, post}, - Json, Router, -}; -use serde::{Deserialize, Serialize}; -use serde_json::json; -use std::net::SocketAddr; -use tower_http::cors::CorsLayer; - -use crate::rate::RateLimitLayer; - - -use http_body_util::BodyExt; - -mod apis; -mod subnet; -mod types; -mod utils; -mod rate; -use crate::apis::*; - -#[tokio::main] -async fn main() { - // initialize tracing - tracing_subscriber::fmt::init(); - - // built app with a route - let app = Router::new() - // - .route("/v1/", get(get_ledger_info)) - .route("/v1/mint", post(faucet)) - .route("/v1/-/healthy", get(healthy)) - .route("/v1/view", get(view_request)) - .route( - "/v1/transactions", - get(transactions).post(submit_transactions), - ) - .route("/v1/transactions/batch", post(submit_transaction_batch)) - .route( - "/v1/transactions/by_hash/:txn_hash", - get(get_transaction_by_hash), - ) - .route( - "/v1/transactions/by_version/:txn_version", - get(get_transaction_by_version), - ) - .route("/v1/transactions/simulate", post(simulate_transaction)) - .route( - "/v1/accounts/:address/transactions", - get(get_accounts_transactions), - ) - .route("/v1/accounts/:address", get(get_account)) - .route( - "/v1/accounts/:address/resources", - get(get_account_resources), - ) - .route("/v1/accounts/:address/modules", get(get_account_modules)) - .route( - "/v1/accounts/:address/resource/:resource_type", - get(get_account_resources_state), - ) - .route( - "/v1/accounts/:address/module/:module_name", - get(get_account_modules_state), - ) - .route( - "/v1/accounts/:address/events/:creation_number", - post(get_events_by_creation_number), - ) - .route( - "/v1/accounts/:address/events/:event_handle/:field_name", - post(get_events_by_event_handle), - ) - // - .route("/v1/blocks/by_height/:height", get(get_block_by_height)) - // - .route("/v1/blocks/by_version/:version", get(get_block_by_version)) - // .route("/v1/tables/:table_handle/item", post(get_table_item)) - // .route("/v1/tables/:table_handle/raw_item", post(get_raw_table_item)) - .layer( - CorsLayer::new() - .allow_origin("*".parse::().unwrap()) - .allow_methods([Method::GET, Method::POST]) - .allow_headers([CONTENT_TYPE]) - ) - .layer( - RateLimitLayer::new( - 1, core::time::Duration::from_secs(10) - ) - ); - - let listener = tokio::net::TcpListener::bind("127.0.0.1:3011") - .await - .unwrap(); - println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); -} diff --git a/m1/subnet-request-proxy/src/rate/layer.rs b/m1/subnet-request-proxy/src/rate/layer.rs deleted file mode 100644 index 9de7c77a..00000000 --- a/m1/subnet-request-proxy/src/rate/layer.rs +++ /dev/null @@ -1,26 +0,0 @@ -use super::{Rate, RateLimit}; -use std::time::Duration; -use tower::Layer; - -/// Enforces a rate limit on the number of requests the underlying -/// service can handle over a period of time. -#[derive(Debug, Clone)] -pub struct RateLimitLayer { - rate: Rate, -} - -impl RateLimitLayer { - /// Create new rate limit layer. - pub fn new(num: u64, per: Duration) -> Self { - let rate = Rate::new(num, per); - RateLimitLayer { rate } - } -} - -impl Layer for RateLimitLayer { - type Service = RateLimit; - - fn layer(&self, service: S) -> Self::Service { - RateLimit::new(service, self.rate) - } -} diff --git a/m1/subnet-request-proxy/src/rate/mod.rs b/m1/subnet-request-proxy/src/rate/mod.rs deleted file mode 100644 index 2834ace3..00000000 --- a/m1/subnet-request-proxy/src/rate/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Limit the rate at which requests are processed. - -mod layer; -#[allow(clippy::module_inception)] -mod rate; -mod service; - -pub use self::{layer::RateLimitLayer, rate::Rate, service::RateLimit}; \ No newline at end of file diff --git a/m1/subnet-request-proxy/src/rate/rate.rs b/m1/subnet-request-proxy/src/rate/rate.rs deleted file mode 100644 index ca5a913f..00000000 --- a/m1/subnet-request-proxy/src/rate/rate.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::time::Duration; - -/// A rate of requests per time period. -#[derive(Debug, Copy, Clone)] -pub struct Rate { - num: u64, - per: Duration, -} - -impl Rate { - /// Create a new rate. - /// - /// # Panics - /// - /// This function panics if `num` or `per` is 0. - pub fn new(num: u64, per: Duration) -> Self { - assert!(num > 0); - assert!(per > Duration::from_millis(0)); - - Rate { num, per } - } - - pub(crate) fn num(&self) -> u64 { - self.num - } - - pub(crate) fn per(&self) -> Duration { - self.per - } -} \ No newline at end of file diff --git a/m1/subnet-request-proxy/src/rate/service.rs b/m1/subnet-request-proxy/src/rate/service.rs deleted file mode 100644 index 8fb232fb..00000000 --- a/m1/subnet-request-proxy/src/rate/service.rs +++ /dev/null @@ -1,150 +0,0 @@ -use super::Rate; -use futures_core::ready; -use std::{ - future::Future, - pin::Pin, - task::{Context, Poll}, -}; -use tokio::time::{Instant, Sleep}; -use tower::Service; - -/// Enforces a rate limit on the number of requests the underlying -/// service can handle over a period of time. -#[derive(Debug)] -pub struct RateLimit { - inner: T, - rate: Rate, - state: State, - sleep: Pin>, -} - -#[derive(Debug, Clone)] -enum State { - // The service has hit its limit - Limited, - Ready { until: Instant, rem: u64 }, -} - -impl Clone for RateLimit { - fn clone(&self) -> Self { - let until = self.sleep.deadline(); - println!("clone until : {:?}", until); - Self { - inner: self.inner.clone(), - rate: self.rate.clone(), - state: self.state.clone(), - sleep: Box::pin(tokio::time::sleep_until(until)) - } - } -} - -impl RateLimit { - /// Create a new rate limiter - pub fn new(inner: T, rate: Rate) -> Self { - - let until = Instant::now(); - let state = State::Ready { - until, - rem: rate.num(), - }; - - RateLimit { - inner, - rate, - state, - // The sleep won't actually be used with this duration, but - // we create it eagerly so that we can reset it in place rather than - // `Box::pin`ning a new `Sleep` every time we need one. - sleep: Box::pin(tokio::time::sleep_until(until)), - } - } - - /// Get a reference to the inner service - pub fn get_ref(&self) -> &T { - &self.inner - } - - /// Get a mutable reference to the inner service - pub fn get_mut(&mut self) -> &mut T { - &mut self.inner - } - - /// Consume `self`, returning the inner service - pub fn into_inner(self) -> T { - self.inner - } -} - -impl Service for RateLimit -where - S: Service, -{ - type Response = S::Response; - type Error = S::Error; - type Future = S::Future; - - fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { - match self.state { - State::Ready { .. } => return Poll::Ready(ready!(self.inner.poll_ready(cx))), - State::Limited => { - if Pin::new(&mut self.sleep).poll(cx).is_pending() { - tracing::trace!("rate limit exceeded; sleeping."); - return Poll::Pending; - } - } - } - - self.state = State::Ready { - until: Instant::now() + self.rate.per(), - rem: self.rate.num(), - }; - - Poll::Ready(ready!(self.inner.poll_ready(cx))) - } - - fn call(&mut self, request: Request) -> Self::Future { - match self.state { - State::Ready { mut until, mut rem } => { - let now = Instant::now(); - - // If the period has elapsed, reset it. - - println!("before now: {:?} until: {:?}", now, until); - if now >= until { - until = now + self.rate.per(); - rem = self.rate.num(); - } - - println!("after now: {:?} until: {:?} rem: {:?}", now, until, rem); - - if rem > 1 { - rem -= 1; - self.state = State::Ready { until, rem }; - } else { - // The service is disabled until further notice - // Reset the sleep future in place, so that we don't have to - // deallocate the existing box and allocate a new one. - self.sleep.as_mut().reset(until); - self.state = State::Limited; - } - - println!("call state = {:?}", self.state); - // Call the inner future - self.inner.call(request) - } - State::Limited => panic!("service not ready; poll_ready must be called first"), - } - } -} - -#[cfg(feature = "load")] -#[cfg_attr(docsrs, doc(cfg(feature = "load")))] -impl crate::load::Load for RateLimit -where - S: crate::load::Load, -{ - type Metric = S::Metric; - fn load(&self) -> Self::Metric { - self.inner.load() - } -} \ No newline at end of file diff --git a/m1/subnet-request-proxy/src/subnet.rs b/m1/subnet-request-proxy/src/subnet.rs deleted file mode 100644 index 500aaf48..00000000 --- a/m1/subnet-request-proxy/src/subnet.rs +++ /dev/null @@ -1,59 +0,0 @@ -use axum::response::{IntoResponse, Response as AxumResponse}; -use reqwest::Response; -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -use crate::utils::set_headers; - -const URL: &'static str = - "http://127.0.0.1:9650/ext/bc/28oE37BKazkbVp2EYrm7obGN6PES8pEj5uWnqSHch5YdNdeiHu/rpc"; -static mut COUNTER: u64 = 0; - -pub async fn request_to_subnet_ext( - method: &'static str, - _params: Option, -) -> Result { - unsafe { COUNTER += 1 }; - let client = reqwest::Client::new(); - let params = match _params { - Some(t) => vec![t], - _ => vec![], - }; - let response = client - .post(URL) - .json(&serde_json::json!({ - "jsonrpc": "2.0", - "method": method, - "params": params, - "id": 0 - })) - .send() - .await?; - - let json_data = response - .json::() - .await - .unwrap_or(serde_json::Value::default()); - Ok(json_data) -} - -pub fn make_response(data: &Value) -> impl IntoResponse { - match data["result"]["data"].as_str() { - Some(v) => { - let mut response = AxumResponse::new(v.to_string()); - let header_data = &data["result"]["header"]; - set_headers(&mut response, header_data); - response - }, - _ => { - let response = AxumResponse::new( - serde_json::json!({ - "error_code": "account_not_found", - "message": "A message describing the error", - }) - .to_string(), - ); - response - } - } -} diff --git a/m1/subnet-request-proxy/src/types.rs b/m1/subnet-request-proxy/src/types.rs deleted file mode 100644 index d30a7a2b..00000000 --- a/m1/subnet-request-proxy/src/types.rs +++ /dev/null @@ -1,7 +0,0 @@ -use serde::{ Deserialize, Serialize }; - -#[derive(Debug, Default, Serialize, Deserialize)] -pub struct Pagination { - pub start: Option, - pub limit: Option, -} \ No newline at end of file diff --git a/m1/subnet-request-proxy/src/utils.rs b/m1/subnet-request-proxy/src/utils.rs deleted file mode 100644 index 5d523d65..00000000 --- a/m1/subnet-request-proxy/src/utils.rs +++ /dev/null @@ -1,65 +0,0 @@ -use axum::http::{HeaderMap, HeaderValue, Response}; - -fn set_header_value( - headers: &mut HeaderMap, - header_key: &'static str, - header_data: &serde_json::Value, - data_key: &'static str, - default_value: Option<&str>, -) { - if let Some(v) = header_data[data_key].as_str() { - headers.insert(header_key, HeaderValue::from_str(v).unwrap()); - } else { - if let Some(def_v) = default_value { - headers.insert(header_key, HeaderValue::from_str(def_v).unwrap()); - } - } -} - -pub fn set_headers(response: &mut Response, header_data: &serde_json::Value) { - let headers = response.headers_mut(); - set_header_value( - headers, - "X-APTOS-BLOCK-HEIGHT", - header_data, - "block_height", - Some("0"), - ); - set_header_value( - headers, - "X-APTOS-CHAIN-ID", - header_data, - "chain_id", - Some("0"), - ); - set_header_value(headers, "X-APTOS-EPOCH", header_data, "epoch", Some("0")); - set_header_value( - headers, - "X-APTOS-LEDGER-OLDEST-VERSION", - header_data, - "ledger_oldest_version", - Some("0"), - ); - set_header_value( - headers, - "X-APTOS-LEDGER-TIMESTAMPUSEC", - header_data, - "ledger_timestamp_usec", - Some("0"), - ); - set_header_value( - headers, - "X-APTOS-LEDGER-VERSION", - header_data, - "ledger_version", - Some("0"), - ); - set_header_value( - headers, - "X-APTOS-OLDEST-BLOCK-HEIGHT", - header_data, - "oldest_block_height", - Some("0"), - ); - set_header_value(headers, "X-APTOS-CURSOR", header_data, "cursor", None); -} diff --git a/m1/tests/e2e/src/tests/mod.rs b/m1/tests/e2e/src/tests/mod.rs index c1285fbf..6382b619 100644 --- a/m1/tests/e2e/src/tests/mod.rs +++ b/m1/tests/e2e/src/tests/mod.rs @@ -1,3 +1,4 @@ +use core::time; use std::{ io, fs::{self, File}, @@ -224,13 +225,21 @@ async fn e2e() { // keep alive by sleeping for duration provided by SUBNET_TIMEOUT environment variable // use sensible default - let timeout = Duration::from_secs( - std::env::var("SUBNET_TIMEOUT") - .unwrap_or_else(|_| "0".to_string()) - .parse::() - .unwrap(), - ); + + let val = std::env::var("SUBNET_TIMEOUT") + .unwrap_or_else(|_| "0".to_string()) + .parse::() + .unwrap(); + log::info!("sleeping for {} seconds", timeout.as_secs()); - thread::sleep(timeout); + if val < 0 { + // run forever + loop { + thread::sleep(Duration::from_secs(1000)); + } + } else { + let timeout = Duration::from_secs(val as u64); + thread::sleep(timeout); + } }