diff --git a/aptos-indexer-processors-sdk/Cargo.lock b/aptos-indexer-processors-sdk/Cargo.lock index 3b4f4bb..9e77eaa 100644 --- a/aptos-indexer-processors-sdk/Cargo.lock +++ b/aptos-indexer-processors-sdk/Cargo.lock @@ -104,12 +104,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "antidote" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" - [[package]] name = "anyhow" version = "1.0.86" @@ -156,29 +150,6 @@ dependencies = [ "url", ] -[[package]] -name = "aptos-indexer-processor-sdk-server-framework" -version = "1.0.0" -dependencies = [ - "anyhow", - "aptos-indexer-processor-sdk", - "aptos-system-utils", - "async-trait", - "autometrics", - "axum", - "backtrace", - "clap", - "instrumented-channel", - "prometheus-client", - "serde", - "serde_yaml", - "tempfile", - "tokio", - "toml", - "tracing", - "tracing-subscriber", -] - [[package]] name = "aptos-indexer-testing-framework" version = "0.1.0" @@ -230,19 +201,6 @@ dependencies = [ "chrono", ] -[[package]] -name = "aptos-profiler" -version = "0.1.0" -source = "git+https://github.com/aptos-labs/aptos-core.git?rev=4541add3fd29826ec57f22658ca286d2d6134b93#4541add3fd29826ec57f22658ca286d2d6134b93" -dependencies = [ - "anyhow", - "backtrace", - "jemalloc-sys", - "jemallocator", - "pprof", - "regex", -] - [[package]] name = "aptos-protos" version = "1.3.1" @@ -254,41 +212,6 @@ dependencies = [ "tonic", ] -[[package]] -name = "aptos-system-utils" -version = "0.1.0" -source = "git+https://github.com/aptos-labs/aptos-core.git?rev=4541add3fd29826ec57f22658ca286d2d6134b93#4541add3fd29826ec57f22658ca286d2d6134b93" -dependencies = [ - "anyhow", - "aptos-profiler", - "async-mutex", - "http 0.2.12", - "hyper 0.14.29", - "lazy_static", - "mime", - "pprof", - "regex", - "rstack-self", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - [[package]] name = "async-stream" version = "0.3.5" @@ -342,7 +265,7 @@ checksum = "10eaae539e7319a3813dc8cd53776a7128bdd6d82067275c12586f5a0fce9137" dependencies = [ "autometrics-macros", "cfg_aliases", - "http 1.1.0", + "http", "linkme", "metrics-exporter-prometheus", "once_cell", @@ -377,10 +300,10 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-util", "itoa", "matchit", @@ -410,8 +333,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", "mime", "pin-project-lite", @@ -478,15 +401,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -521,9 +435,9 @@ dependencies = [ "futures-util", "hex", "home", - "http 1.1.0", + "http", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-named-pipe", "hyper-rustls 0.26.0", "hyper-util", @@ -564,12 +478,6 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" -[[package]] -name = "bytemuck" -version = "1.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" - [[package]] name = "byteorder" version = "1.5.0" @@ -682,15 +590,6 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" -[[package]] -name = "cpp_demangle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" -dependencies = [ - "cfg-if", -] - [[package]] name = "cpufeatures" version = "0.2.14" @@ -781,15 +680,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - [[package]] name = "delegate" version = "0.12.0" @@ -908,27 +798,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "dw" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef0ed82b765c2ab79fb48e4bf2c95bd583202f4078a702bc714cc6e6f3ca80c3" -dependencies = [ - "dw-sys", - "foreign-types 0.5.0", - "libc", -] - -[[package]] -name = "dw-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14eb35c87ff6626cd1021bb32bc7d9a5372ea72547e1eaf0343a841d9d55a973" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "either" version = "1.12.0" @@ -972,12 +841,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -990,18 +853,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" -[[package]] -name = "findshlibs" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" -dependencies = [ - "cc", - "lazy_static", - "libc", - "winapi", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -1030,28 +881,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "foreign-types-shared", ] [[package]] @@ -1060,12 +890,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1203,25 +1027,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.2.6", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.6" @@ -1233,7 +1038,7 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http 1.1.0", + "http", "indexmap 2.2.6", "slab", "tokio", @@ -1354,17 +1159,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.1.0" @@ -1376,17 +1170,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -1394,7 +1177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http", ] [[package]] @@ -1405,8 +1188,8 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "pin-project-lite", ] @@ -1422,30 +1205,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "hyper" -version = "0.14.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.4.1" @@ -1455,9 +1214,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", - "http 1.1.0", - "http-body 1.0.1", + "h2", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -1474,7 +1233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" dependencies = [ "hex", - "hyper 1.4.1", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -1489,8 +1248,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.4.1", + "http", + "hyper", "hyper-util", "log", "rustls 0.22.4", @@ -1508,8 +1267,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.4.1", + "http", + "hyper", "hyper-util", "rustls 0.23.10", "rustls-native-certs 0.8.0", @@ -1526,7 +1285,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 1.4.1", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -1542,9 +1301,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "hyper 1.4.1", + "http", + "http-body", + "hyper", "pin-project-lite", "socket2", "tokio", @@ -1561,7 +1320,7 @@ checksum = "acf569d43fa9848e510358c07b80f4adf34084ddc28c6a4a651ee8474c070dcc" dependencies = [ "hex", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -1759,24 +1518,6 @@ dependencies = [ "serde", ] -[[package]] -name = "inferno" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321f0f839cd44a4686e9504b0a62b4d69a50b62072144c71c68f5873c167b8d9" -dependencies = [ - "ahash", - "indexmap 2.2.6", - "is-terminal", - "itoa", - "log", - "num-format", - "once_cell", - "quick-xml", - "rgb", - "str_stack", -] - [[package]] name = "instrumented-channel" version = "0.1.0" @@ -1808,17 +1549,6 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.0" @@ -1840,26 +1570,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "jemalloc-sys" -version = "0.5.4+5.3.0-patched" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac6c1946e1cea1788cbfde01c993b52a10e2da07f4bac608228d1bed20bfebf2" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "jemallocator" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0de374a9f8e63150e6f5e8a60cc14c668226d7a347d8aee1a45766e3c4dd3bc" -dependencies = [ - "jemalloc-sys", - "libc", -] - [[package]] name = "jobserver" version = "0.1.31" @@ -2025,15 +1735,6 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] - [[package]] name = "metrics" version = "0.21.1" @@ -2155,17 +1856,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2192,16 +1882,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-format" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" -dependencies = [ - "arrayvec", - "itoa", -] - [[package]] name = "num-integer" version = "0.1.46" @@ -2253,7 +1933,7 @@ checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.5.0", "cfg-if", - "foreign-types 0.3.2", + "foreign-types", "libc", "once_cell", "openssl-macros", @@ -2540,29 +2220,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" -[[package]] -name = "pprof" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196ded5d4be535690899a4631cc9f18cdc41b7ebf24a79400f46f48e49a11059" -dependencies = [ - "backtrace", - "cfg-if", - "findshlibs", - "inferno", - "libc", - "log", - "nix", - "once_cell", - "parking_lot", - "protobuf", - "protobuf-codegen-pure", - "smallvec", - "symbolic-demangle", - "tempfile", - "thiserror", -] - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2671,25 +2328,6 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" -[[package]] -name = "protobuf-codegen" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "033460afb75cf755fcfc16dfaed20b86468082a2ea24e05ac35ab4a099a017d6" -dependencies = [ - "protobuf", -] - -[[package]] -name = "protobuf-codegen-pure" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a29399fc94bcd3eeaa951c715f7bea69409b2445356b00519740bcd6ddd865" -dependencies = [ - "protobuf", - "protobuf-codegen", -] - [[package]] name = "quanta" version = "0.11.1" @@ -2712,15 +2350,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-xml" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" -dependencies = [ - "memchr", -] - [[package]] name = "quinn" version = "0.11.5" @@ -2892,12 +2521,12 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.4.6", + "h2", "hickory-resolver", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-rustls 0.27.3", "hyper-util", "ipnet", @@ -2937,15 +2566,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "rgb" -version = "0.8.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aee83dc281d5a3200d37b299acd13b81066ea126a7f16f0eae70fc9aed241d9" -dependencies = [ - "bytemuck", -] - [[package]] name = "ring" version = "0.17.8" @@ -2961,34 +2581,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rstack" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7df9d3ebd4f17b52e6134efe2fa20021c80688cbe823d481a729a993b730493" -dependencies = [ - "cfg-if", - "dw", - "lazy_static", - "libc", - "log", -] - -[[package]] -name = "rstack-self" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd5030da3aba0ec731502f74ec38e63798eea6bc8b8ba5972129afe3eababd2" -dependencies = [ - "antidote", - "backtrace", - "bincode", - "lazy_static", - "libc", - "rstack", - "serde", -] - [[package]] name = "rustc-demangle" version = "0.1.24" @@ -3358,12 +2950,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "str_stack" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091b6114800a5f2141aee1d1b9d6ca3592ac062dc5decb3764ec5895a47b4eb" - [[package]] name = "stringprep" version = "0.1.5" @@ -3410,29 +2996,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" -[[package]] -name = "symbolic-common" -version = "10.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b55cdc318ede251d0957f07afe5fed912119b8c1bc5a7804151826db999e737" -dependencies = [ - "debugid", - "memmap2", - "stable_deref_trait", - "uuid", -] - -[[package]] -name = "symbolic-demangle" -version = "10.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79be897be8a483a81fff6a3a4e195b4ac838ef73ca42d348b3f722da9902e489" -dependencies = [ - "cpp_demangle", - "rustc-demangle", - "symbolic-common", -] - [[package]] name = "syn" version = "2.0.66" @@ -3781,11 +3344,11 @@ dependencies = [ "base64 0.22.1", "bytes", "flate2", - "h2 0.4.6", - "http 1.1.0", - "http-body 1.0.1", + "h2", + "http", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-timeout", "hyper-util", "percent-encoding", @@ -3992,12 +3555,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "uuid" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" - [[package]] name = "valuable" version = "0.1.0" diff --git a/aptos-indexer-processors-sdk/Cargo.toml b/aptos-indexer-processors-sdk/Cargo.toml index ff9920a..81c3856 100644 --- a/aptos-indexer-processors-sdk/Cargo.toml +++ b/aptos-indexer-processors-sdk/Cargo.toml @@ -6,7 +6,6 @@ members = [ "moving-average", "sample", "sdk", - "sdk-server-framework", "testing-framework", "transaction-stream", ] diff --git a/aptos-indexer-processors-sdk/sdk-server-framework/Cargo.toml b/aptos-indexer-processors-sdk/sdk-server-framework/Cargo.toml deleted file mode 100644 index d51c814..0000000 --- a/aptos-indexer-processors-sdk/sdk-server-framework/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "aptos-indexer-processor-sdk-server-framework" -version = "1.0.0" - -# Workspace inherited keys -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -publish = { workspace = true } -repository = { workspace = true } -rust-version = { workspace = true } - -[dependencies] -aptos-indexer-processor-sdk = { workspace = true } - -anyhow = { workspace = true } -async-trait = { workspace = true } -autometrics = { workspace = true } -axum = { workspace = true } -backtrace = { workspace = true } -clap = { workspace = true } -instrumented-channel = { workspace = true } -prometheus-client = { workspace = true } -serde = { workspace = true } -serde_yaml = { workspace = true } -tempfile = { workspace = true } -tokio = { workspace = true } -toml = { workspace = true } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } - -[target.'cfg(target_os = "linux")'.dependencies] -aptos-system-utils = { workspace = true } diff --git a/aptos-indexer-processors-sdk/sdk-server-framework/src/lib.rs b/aptos-indexer-processors-sdk/sdk-server-framework/src/lib.rs deleted file mode 100644 index c54bcf2..0000000 --- a/aptos-indexer-processors-sdk/sdk-server-framework/src/lib.rs +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright © Aptos Foundation - -use anyhow::{Context, Result}; -use aptos_indexer_processor_sdk::{ - instrumented_channel::channel_metrics::init_channel_metrics_registry, - traits::processor_trait::ProcessorTrait, utils::step_metrics::init_step_metrics_registry, -}; -#[cfg(target_os = "linux")] -use aptos_system_utils::profiling::start_cpu_profiling; -use autometrics::settings::AutometricsSettings; -use axum::{http::StatusCode, response::IntoResponse, routing::get, Router}; -use backtrace::Backtrace; -use clap::Parser; -use prometheus_client::registry::Registry; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; -// TODO: remove deprecated lint when new clippy nightly is released -#[allow(deprecated)] -use std::{fs::File, io::Read, panic::PanicInfo, path::PathBuf, process}; -use tokio::runtime::Handle; -use tracing::error; -use tracing_subscriber::EnvFilter; - -// pub mod config; - -/// ServerArgs bootstraps a server with all common pieces. And then triggers the run method for -/// the specific service. -#[derive(Parser)] -pub struct ServerArgs { - #[clap(short, long, value_parser)] - pub config_path: PathBuf, -} - -impl ServerArgs { - pub async fn run(&self, handle: Handle) -> Result<()> - where - C: RunnableConfig, - P: ProcessorTrait, - { - // Set up the server. - setup_logging(); - setup_panic_handler(); - let config = load::>(&self.config_path)?; - run_server_with_config(config, handle).await - } -} - -/// Run a server and the necessary probes. For spawning these tasks, the user must -/// provide a handle to a runtime they already have. -pub async fn run_server_with_config(config: GenericConfig, handle: Handle) -> Result<()> -where - C: RunnableConfig, -{ - let health_port = config.health_check_port; - let additional_labels = config.metrics_config.additional_labels.clone(); - // Start liveness and readiness probes. - let task_handler = handle.spawn(async move { - register_probes_and_metrics_handler(health_port, additional_labels).await; - anyhow::Ok(()) - }); - let main_task_handler = handle.spawn(async move { config.run().await }); - tokio::select! { - res = task_handler => { - res.expect("Probes and metrics handler unexpectedly exited") - }, - res = main_task_handler => { - res.expect("Main task handler unexpectedly exited") - }, - } -} - -#[derive(Deserialize, Debug, Serialize)] -pub struct GenericConfig { - // Shared configuration among all services. - pub health_check_port: u16, - - #[serde(default)] - pub metrics_config: MetricsConfig, - - // Specific configuration for each service. - pub server_config: T, -} - -#[derive(Clone, Deserialize, Debug, Default, Serialize)] -pub struct MetricsConfig { - /// Additional labels to use for metrics. - pub additional_labels: Vec<(String, String)>, -} - -#[async_trait::async_trait] -impl RunnableConfig for GenericConfig -where - T: RunnableConfig, -{ - async fn run(&self) -> Result<()> { - self.server_config.run().await - } - - fn get_server_name(&self) -> String { - self.server_config.get_server_name() - } -} - -/// RunnableConfig is a trait that all services must implement for their configuration. -#[async_trait::async_trait] -pub trait RunnableConfig: DeserializeOwned + Send + Sync + 'static { - async fn run(&self) -> Result<()>; - fn get_server_name(&self) -> String; -} - -/// Parse a yaml file into a struct. -pub fn load Deserialize<'de>>(path: &PathBuf) -> Result { - let mut file = - File::open(path).with_context(|| format!("failed to open the file at path: {:?}", path))?; - let mut contents = String::new(); - file.read_to_string(&mut contents) - .with_context(|| format!("failed to read the file at path: {:?}", path))?; - serde_yaml::from_str::(&contents).context("Unable to parse yaml file") -} - -#[derive(Debug, Serialize)] -pub struct CrashInfo { - details: String, - backtrace: String, -} - -/// Invoke to ensure process exits on a thread panic. -/// -/// Tokio's default behavior is to catch panics and ignore them. Invoking this function will -/// ensure that all subsequent thread panics (even Tokio threads) will report the -/// details/backtrace and then exit. -pub fn setup_panic_handler() { - // TODO: remove deprecated lint when new clippy nightly is released - #[allow(deprecated)] - std::panic::set_hook(Box::new(move |pi: &PanicInfo<'_>| { - handle_panic(pi); - })); -} - -// Formats and logs panic information -// TODO: remove deprecated lint when new clippy nightly is released -#[allow(deprecated)] -fn handle_panic(panic_info: &PanicInfo<'_>) { - // The Display formatter for a PanicInfo contains the message, payload and location. - let details = format!("{}", panic_info); - let backtrace = format!("{:#?}", Backtrace::new()); - let info = CrashInfo { details, backtrace }; - let crash_info = toml::to_string_pretty(&info).unwrap(); - error!("{}", crash_info); - // TODO / HACK ALARM: Write crash info synchronously via eprintln! to ensure it is written before the process exits which error! doesn't guarantee. - // This is a workaround until https://github.com/aptos-labs/aptos-core/issues/2038 is resolved. - eprintln!("{}", crash_info); - // Kill the process - process::exit(12); -} - -/// Set up logging for the server. -pub fn setup_logging() { - let env_filter = EnvFilter::try_from_default_env() - .or_else(|_| EnvFilter::try_new("info")) - .unwrap(); - tracing_subscriber::fmt() - .json() - .with_file(true) - .with_line_number(true) - .with_thread_ids(true) - .with_target(false) - .with_thread_names(true) - .with_env_filter(env_filter) - .flatten_event(true) - .init(); -} - -/// Register readiness and liveness probes and set up metrics endpoint. -pub async fn register_probes_and_metrics_handler( - port: u16, - additional_labels: Vec<(String, String)>, -) { - let mut registry = Registry::with_labels( - additional_labels - .into_iter() - .map(|(k, v)| (k.into(), v.into())), - ); - init_step_metrics_registry(&mut registry); - init_channel_metrics_registry(&mut registry); - AutometricsSettings::builder() - .prometheus_client_registry(registry) - .init(); - - let router = Router::new() - .route("/readiness", get(StatusCode::OK)) - .route("/metrics", get(metrics_handler)); - - #[cfg(target_os = "linux")] - let router = router.merge(Router::new().route("/profilez", get(profilez_handler))); - - let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", port)) - .await - .expect("Failed to bind TCP listener"); - axum::serve(listener, router).await.unwrap(); -} - -async fn metrics_handler() -> impl IntoResponse { - match autometrics::prometheus_exporter::encode_to_string() { - Ok(prometheus_client_rust_metrics) => ( - StatusCode::OK, - [("Content-Type", "text/plain; version=0.0.4")], - prometheus_client_rust_metrics, - ) - .into_response(), - Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, format!("{:?}", err)).into_response(), - } -} - -#[cfg(target_os = "linux")] -async fn profilez_handler() -> impl IntoResponse { - match start_cpu_profiling(10, 99, false).await { - Ok(body) => ( - StatusCode::OK, - [ - ("Content-Length", body.len().to_string()), - ("Content-Disposition", "inline".to_string()), - ("Content-Type", "image/svg+xml".to_string()), - ], - body, - ) - .into_response(), - Err(e) => ( - StatusCode::INTERNAL_SERVER_ERROR, - format!("Profiling failed: {e:?}."), - ) - .into_response(), - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::io::Write; - use tempfile::tempdir; - - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(deny_unknown_fields)] - pub struct TestConfig { - test: u32, - test_name: String, - } - - #[async_trait::async_trait] - impl RunnableConfig for TestConfig { - async fn run(&self) -> Result<()> { - assert_eq!(self.test, 123); - assert_eq!(self.test_name, "test"); - Ok(()) - } - - fn get_server_name(&self) -> String { - self.test_name.clone() - } - } - - #[test] - fn test_random_config_creation() { - let dir = tempdir().expect("tempdir failure"); - - let file_path = dir.path().join("testing_yaml.yaml"); - let mut file = File::create(&file_path).expect("create failure"); - let raw_yaml_content = r#" - health_check_port: 12345 - server_config: - test: 123 - test_name: "test" - "#; - writeln!(file, "{}", raw_yaml_content).expect("write_all failure"); - - let config = load::>(&file_path).unwrap(); - assert_eq!(config.health_check_port, 12345); - assert_eq!(config.server_config.test, 123); - assert_eq!(config.server_config.test_name, "test"); - } - - #[test] - fn verify_tool() { - use clap::CommandFactory; - ServerArgs::command().debug_assert() - } -} diff --git a/aptos-indexer-processors-sdk/sdk/src/common_steps/transaction_stream_step.rs b/aptos-indexer-processors-sdk/sdk/src/common_steps/transaction_stream_step.rs index 9c7e490..55db9ab 100644 --- a/aptos-indexer-processors-sdk/sdk/src/common_steps/transaction_stream_step.rs +++ b/aptos-indexer-processors-sdk/sdk/src/common_steps/transaction_stream_step.rs @@ -1,4 +1,5 @@ use crate::{ + config::indexer_processor_config::{DbConfig, IndexerProcessorConfig}, traits::{NamedStep, PollableAsyncRunType, PollableAsyncStep, Processable}, types::transaction_context::{TransactionContext, TransactionMetadata}, utils::errors::ProcessorError, @@ -10,28 +11,37 @@ use aptos_indexer_transaction_stream::{ use aptos_protos::transaction::v1::Transaction; use async_trait::async_trait; use mockall::mock; -use std::time::Duration; +use std::{marker::PhantomData, time::Duration}; use tokio::sync::Mutex; use tracing::{error, info, warn}; // TransactionStreamStep is establishes a gRPC connection with Transaction Stream // fetches transactions, and outputs them for processing. It also handles reconnections with retries. // This is usually the initial step in a processor. -pub struct TransactionStreamStep -where - Self: Sized + Send + 'static, -{ +pub struct TransactionStreamStep { transaction_stream_config: TransactionStreamConfig, pub transaction_stream: Mutex, + phantom: PhantomData, } -impl TransactionStreamStep +impl TransactionStreamStep where Self: Sized + Send + 'static, + D: DbConfig, { pub async fn new( - transaction_stream_config: TransactionStreamConfig, + indexer_processor_config: IndexerProcessorConfig, ) -> Result { + let starting_version = indexer_processor_config + .get_starting_version() + .await + .map_err(|e| ProcessorError::StepInitError { + message: format!("Error getting starting version: {:?}", e), + })?; + let transaction_stream_config = TransactionStreamConfig { + starting_version: Some(starting_version), + ..indexer_processor_config.transaction_stream_config + }; let transaction_stream_res = TransactionStreamInternal::new(transaction_stream_config.clone()).await; match transaction_stream_res { @@ -41,15 +51,17 @@ where Ok(transaction_stream) => Ok(Self { transaction_stream: Mutex::new(transaction_stream), transaction_stream_config, + phantom: PhantomData, }), } } } #[async_trait] -impl Processable for TransactionStreamStep +impl Processable for TransactionStreamStep where Self: Sized + Send + 'static, + D: DbConfig, { type Input = (); // The TransactionStreamStep will output a batch of transactions for processing @@ -65,9 +77,10 @@ where } #[async_trait] -impl PollableAsyncStep for TransactionStreamStep +impl PollableAsyncStep for TransactionStreamStep where Self: Sized + Send + Sync + 'static, + D: DbConfig, { fn poll_interval(&self) -> std::time::Duration { Duration::from_secs(0) @@ -148,7 +161,10 @@ where } } -impl NamedStep for TransactionStreamStep { +impl NamedStep for TransactionStreamStep +where + D: DbConfig, +{ fn name(&self) -> String { "TransactionStreamStep".to_string() } diff --git a/aptos-indexer-processors-sdk/sdk/src/config/indexer_processor_config.rs b/aptos-indexer-processors-sdk/sdk/src/config/indexer_processor_config.rs index 58122bc..a089d55 100644 --- a/aptos-indexer-processors-sdk/sdk/src/config/indexer_processor_config.rs +++ b/aptos-indexer-processors-sdk/sdk/src/config/indexer_processor_config.rs @@ -7,9 +7,11 @@ use crate::{ config::processor_status_saver::ProcessorStatusSaver, }; use anyhow::{Context, Result}; +use aptos_indexer_transaction_stream::TransactionStream; use async_trait::async_trait; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use std::any::Any; +use tracing::info; pub const QUERY_DEFAULT_RETRIES: u32 = 5; pub const QUERY_DEFAULT_RETRY_DELAY_MS: u64 = 500; @@ -63,6 +65,16 @@ where // Ok(()) // } + /// Get the appropriate starting version for the processor. + /// + /// If it is a regular processor, this will return the higher of the checkpointed version, + /// or `staring_version` from the config, or 0 if not set. + /// + /// If this is a backfill processor and threre is an in-progress backfill, this will return + /// the checkpointed version + 1. + /// + /// If this is a backfill processor and there is not an in-progress backfill (i.e., no checkpoint or + /// backfill status is COMPLETE), this will return `starting_version` from the config, or 0 if not set. pub async fn get_starting_version(&self) -> Result { match self.mode { ProcessorMode::Testing => { @@ -133,6 +145,40 @@ where }, } } + + pub async fn check_or_update_chain_id(&self) -> Result<()> { + info!("Checking if chain id is correct"); + + let transaction_stream = + TransactionStream::new(self.transaction_stream_config.clone()).await?; + let grpc_chain_id = transaction_stream.get_chain_id().await?; + + let runnable_db_config = self + .db_config + .clone() + .into_runnable_config() + .await + .context("Failed to initialize DB config")?; + let maybe_existing_chain_id = runnable_db_config.get_chain_id().await?; + match maybe_existing_chain_id { + Some(chain_id) => { + anyhow::ensure!(chain_id == grpc_chain_id, "Wrong chain detected! Trying to index chain {} now but existing data is for chain {}", grpc_chain_id, chain_id); + info!( + chain_id = chain_id, + "Chain id matches! Continue to index...", + ); + Ok(()) + }, + None => { + info!( + chain_id = grpc_chain_id, + "Adding chain id to db, continue to index..." + ); + runnable_db_config.save_chain_id(grpc_chain_id).await?; + Ok(()) + }, + } + } } fn log_ascii_warning(version: u64) {