diff --git a/Cargo.lock b/Cargo.lock index 04e4ae25..2e812733 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,7 +162,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" dependencies = [ - "quote 1.0.23", + "quote 1.0.26", "syn 1.0.107", ] @@ -174,7 +174,7 @@ checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ "num-bigint 0.4.3", "num-traits", - "quote 1.0.23", + "quote 1.0.26", "syn 1.0.107", ] @@ -224,9 +224,9 @@ checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" [[package]] name = "asn1-rs" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" dependencies = [ "asn1-rs-derive", "asn1-rs-impl", @@ -235,7 +235,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.19", + "time 0.3.20", ] [[package]] @@ -244,8 +244,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "synstructure", ] @@ -256,8 +256,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -294,12 +294,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" dependencies = [ "event-listener", - "futures-lite", ] [[package]] @@ -317,8 +316,8 @@ version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -359,9 +358,9 @@ checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" [[package]] name = "base64ct" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "beef" @@ -382,10 +381,11 @@ dependencies = [ "dirs", "log", "rand 0.8.5", + "rand_chacha 0.3.1", "serde", "serde_json", "solana-rpc-client", - "solana-sdk 1.15.0", + "solana-sdk", "tokio", "tracing-subscriber", ] @@ -472,7 +472,7 @@ dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.51", + "proc-macro2 1.0.56", "syn 1.0.107", ] @@ -482,8 +482,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -493,8 +493,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -527,9 +527,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" +checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", "serde", @@ -566,8 +566,8 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aca418a974d83d40a0c1f0c5cba6ff4bc28d8df099109ca459a2118d40b6322" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -697,8 +697,8 @@ checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -806,8 +806,8 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a4f51209740b5e1589e702b3044cdd4562cef41b6da404904192ffffb852d62" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -922,9 +922,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af91f40b7355f82b0a891f50e70399475945bb0b0da4f1700ce60761c9d3e359" +checksum = "0b015497079b9a9d69c02ad25de6c0a6edef051ea6360a327d0bd05802ef64ad" dependencies = [ "csv-core", "itoa", @@ -985,8 +985,8 @@ dependencies = [ "cc", "codespan-reporting", "once_cell", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "scratch", "syn 1.0.107", ] @@ -1003,8 +1003,8 @@ version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1026,8 +1026,8 @@ checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "strsim 0.10.0", "syn 1.0.107", ] @@ -1039,7 +1039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" dependencies = [ "darling_core", - "quote 1.0.23", + "quote 1.0.26", "syn 1.0.107", ] @@ -1073,9 +1073,9 @@ dependencies = [ [[package]] name = "der-parser" -version = "8.1.0" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" dependencies = [ "asn1-rs", "displaydoc", @@ -1097,8 +1097,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1136,22 +1136,22 @@ dependencies = [ [[package]] name = "dirs" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "dece029acd3353e3a58ac2e3eb3c8d6c35827a892edc6cc4138ef9c33df46ecd" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b" dependencies = [ "libc", "redox_users", - "winapi", + "windows-sys 0.45.0", ] [[package]] @@ -1160,8 +1160,8 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1271,8 +1271,8 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "828de45d0ca18782232dfb8f3ea9cc428e8ced380eb26a520baaacfc70de39ce" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1283,8 +1283,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11f36e95862220b211a6e2aa5eca09b4fa391b13cd52ceb8035a24bf65a79de2" dependencies = [ "once_cell", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1312,6 +1312,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -1391,9 +1402,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -1406,9 +1417,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -1416,15 +1427,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -1433,47 +1444,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" - -[[package]] -name = "futures-lite" -version = "1.12.0" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-macro" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", - "syn 1.0.107", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 2.0.13", ] [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-timer" @@ -1487,9 +1483,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -1788,7 +1784,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -1931,7 +1927,7 @@ checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix", + "rustix 0.36.8", "windows-sys 0.45.0", ] @@ -2081,8 +2077,8 @@ checksum = "baa6da1e4199c10d7b1d0a6e5e8bd8e55f351163b6f4b3cbb044672a69bd4c1c" dependencies = [ "heck", "proc-macro-crate 1.3.0", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -2239,6 +2235,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + [[package]] name = "lite-rpc" version = "0.1.0" @@ -2261,15 +2263,17 @@ dependencies = [ "native-tls", "postgres-native-tls", "prometheus", + "quinn", + "rustls", "serde", "serde_json", "solana-client", + "solana-net-utils", "solana-pubsub-client", - "solana-quic-client", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk 1.15.0", - "solana-tpu-client", + "solana-sdk", + "solana-streamer", "solana-transaction-status", "solana-version", "thiserror", @@ -2506,8 +2510,8 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -2579,8 +2583,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0629cbd6b897944899b1f10496d9c4a7ac5878d45fd61bc22e9e79bfbbc29597" dependencies = [ "proc-macro-crate 1.3.0", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -2613,9 +2617,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.45" +version = "0.10.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" dependencies = [ "bitflags", "cfg-if", @@ -2628,13 +2632,13 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", - "syn 1.0.107", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 2.0.13", ] [[package]] @@ -2645,11 +2649,10 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.80" +version = "0.9.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" dependencies = [ - "autocfg", "cc", "libc", "pkg-config", @@ -2668,12 +2671,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - [[package]] name = "parking_lot" version = "0.12.1" @@ -2692,7 +2689,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -2788,8 +2785,8 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -2861,11 +2858,11 @@ dependencies = [ [[package]] name = "postgres-protocol" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878c6cbf956e03af9aa8204b407b9cbf47c072164800aa918c516cd4b056c50c" +checksum = "78b7fa9f396f51dffd61546fd8573ee20592287996568e6175ceb0f8699ad75d" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "byteorder", "bytes", "fallible-iterator", @@ -2879,9 +2876,9 @@ dependencies = [ [[package]] name = "postgres-types" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d946ec7d256b04dfadc4e6a3292324e6f417124750fc5c0950f981b703a0f1" +checksum = "f028f05971fe20f512bcc679e2c10227e57809a3af86a7606304435bc8896cd6" dependencies = [ "bytes", "fallible-iterator", @@ -2920,8 +2917,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "version_check", ] @@ -2932,8 +2929,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "version_check", ] @@ -2948,9 +2945,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -3005,9 +3002,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4ced82a24bb281af338b9e8f94429b6eca01b4e66d899f40031f074e74c9" +checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" dependencies = [ "bytes", "rand 0.8.5", @@ -3030,7 +3027,7 @@ checksum = "641538578b21f5e5c8ea733b736895576d0fe329bb883b937db6f4d163dbaaf4" dependencies = [ "libc", "quinn-proto", - "socket2", + "socket2 0.4.9", "tracing", "windows-sys 0.42.0", ] @@ -3046,11 +3043,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ - "proc-macro2 1.0.51", + "proc-macro2 1.0.56", ] [[package]] @@ -3163,7 +3160,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.19", + "time 0.3.20", "yasna", ] @@ -3176,6 +3173,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -3183,7 +3189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.8", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] @@ -3204,15 +3210,6 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "reqwest" version = "0.11.14" @@ -3336,10 +3333,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", - "errno", + "errno 0.2.8", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" +dependencies = [ + "bitflags", + "errno 0.3.0", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.1", "windows-sys 0.45.0", ] @@ -3424,8 +3435,8 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -3516,8 +3527,8 @@ version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -3561,8 +3572,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1966009f3c05f095697c537312f5415d1e3ed31ce0a56942bac4c771c5c335e" dependencies = [ "darling", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -3699,14 +3710,24 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", ] +[[package]] +name = "socket2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc8d618c6641ae355025c449427f9e96b98abf99a772be3cef6708d15c77147a" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "soketto" version = "0.7.1" @@ -3725,8 +3746,9 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e4ac2e5e6474d17f19341df43c62b62ee1e362bae9b06bc30223252dd4a362" dependencies = [ "Inflector", "base64 0.13.1", @@ -3739,7 +3761,7 @@ dependencies = [ "serde_json", "solana-address-lookup-table-program", "solana-config-program", - "solana-sdk 1.15.0", + "solana-sdk", "spl-token", "spl-token-2022", "thiserror", @@ -3748,8 +3770,9 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baac6a0dfc38f64e5e5e178e9eeade05ef1a2c644c95062523c6bc21f19f8866" dependencies = [ "bincode", "bytemuck", @@ -3758,25 +3781,26 @@ dependencies = [ "num-traits", "rustc_version 0.4.0", "serde", - "solana-frozen-abi 1.15.0", - "solana-frozen-abi-macro 1.15.0", - "solana-program 1.15.0", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-program", "solana-program-runtime", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", ] [[package]] name = "solana-clap-utils" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0a43f9bcf2405e50190cf3943046663caae557db9eb71a628f359e3f4f3eea" dependencies = [ "chrono", "clap 2.34.0", "rpassword", "solana-perf", "solana-remote-wallet", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", "tiny-bip39", "uriparse", @@ -3785,8 +3809,9 @@ dependencies = [ [[package]] name = "solana-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe890559c3d8e29123ed0bfba47d5d714acb1db2e4a9a981c9171960ae01425" dependencies = [ "async-trait", "bincode", @@ -3799,6 +3824,7 @@ dependencies = [ "quinn", "rand 0.7.3", "rayon", + "solana-connection-cache", "solana-measure", "solana-metrics", "solana-net-utils", @@ -3807,7 +3833,7 @@ dependencies = [ "solana-rpc-client", "solana-rpc-client-api", "solana-rpc-client-nonce-utils", - "solana-sdk 1.15.0", + "solana-sdk", "solana-streamer", "solana-thin-client", "solana-tpu-client", @@ -3818,48 +3844,37 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb520c573b28060cadd8ae0fa6ae116cf74dac01078bc437d8b3e3ab00efd22" dependencies = [ "bincode", "chrono", "serde", "serde_derive", "solana-program-runtime", - "solana-sdk 1.15.0", + "solana-sdk", ] [[package]] -name = "solana-frozen-abi" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +name = "solana-connection-cache" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c913dfcaf847cecd8866e4aeaa440b34c8a5dae6c1c90b7a8cb3265ff9fc775" dependencies = [ - "ahash", - "blake3", - "block-buffer 0.9.0", - "bs58", - "bv", - "byteorder", - "cc", - "either", - "generic-array", - "getrandom 0.1.16", - "hashbrown 0.12.3", - "im", - "lazy_static", + "async-trait", + "bincode", + "futures-util", + "indexmap", "log", - "memmap2", - "once_cell", - "rand_core 0.6.4", - "rustc_version 0.4.0", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", - "sha2 0.10.6", - "solana-frozen-abi-macro 1.15.0", - "subtle", + "rand 0.7.3", + "rayon", + "solana-measure", + "solana-metrics", + "solana-net-utils", + "solana-sdk", "thiserror", + "tokio", ] [[package]] @@ -3891,44 +3906,23 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.10.6", - "solana-frozen-abi-macro 1.15.2", + "solana-frozen-abi-macro", "subtle", "thiserror", ] -[[package]] -name = "solana-frozen-abi-macro" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" -dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", - "rustc_version 0.4.0", - "syn 1.0.107", -] - [[package]] name = "solana-frozen-abi-macro" version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06395428329810ade1d2518a7e75d8a6f02d01fe548aabb60ff1ba6a2eaebbe5" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "rustc_version 0.4.0", "syn 1.0.107", ] -[[package]] -name = "solana-logger" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - [[package]] name = "solana-logger" version = "1.15.2" @@ -3942,30 +3936,33 @@ dependencies = [ [[package]] name = "solana-measure" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b03528be5a0fbbe4c06a4e1758d155363b51f7c782435b1eb1d4804ab124e3" dependencies = [ "log", - "solana-sdk 1.15.0", + "solana-sdk", ] [[package]] name = "solana-metrics" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5ff9cbbe50e9918576ff46b4e38d9a946c33fc442982ce7ff397a3b851922a" dependencies = [ "crossbeam-channel", "gethostname", "lazy_static", "log", "reqwest", - "solana-sdk 1.15.0", + "solana-sdk", ] [[package]] name = "solana-net-utils" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f35dff5b963ec471514e89bd99c7ac43545756221c99b63c2229cf5f37ebb2" dependencies = [ "bincode", "clap 3.2.23", @@ -3975,9 +3972,9 @@ dependencies = [ "rand 0.7.3", "serde", "serde_derive", - "socket2", - "solana-logger 1.15.0", - "solana-sdk 1.15.0", + "socket2 0.4.9", + "solana-logger", + "solana-sdk", "solana-version", "tokio", "url", @@ -3985,8 +3982,9 @@ dependencies = [ [[package]] name = "solana-perf" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d630964a18fb466d79c3f5e191f37083b52b584a3f596e17f4bd41a145254d" dependencies = [ "ahash", "bincode", @@ -4005,63 +4003,10 @@ dependencies = [ "serde", "solana-metrics", "solana-rayon-threadlimit", - "solana-sdk 1.15.0", + "solana-sdk", "solana-vote-program", ] -[[package]] -name = "solana-program" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" -dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ff", - "array-bytes", - "base64 0.13.1", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58", - "bv", - "bytemuck", - "cc", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.2.8", - "itertools", - "js-sys", - "lazy_static", - "libc", - "libsecp256k1", - "log", - "memoffset 0.6.5", - "num-bigint 0.4.3", - "num-derive", - "num-traits", - "parking_lot", - "rand 0.7.3", - "rand_chacha 0.2.2", - "rustc_version 0.4.0", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", - "sha2 0.10.6", - "sha3 0.10.6", - "solana-frozen-abi 1.15.0", - "solana-frozen-abi-macro 1.15.0", - "solana-sdk-macro 1.15.0", - "thiserror", - "tiny-bip39", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "solana-program" version = "1.15.2" @@ -4107,9 +4052,9 @@ dependencies = [ "serde_json", "sha2 0.10.6", "sha3 0.10.6", - "solana-frozen-abi 1.15.2", - "solana-frozen-abi-macro 1.15.2", - "solana-sdk-macro 1.15.2", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro", "thiserror", "tiny-bip39", "wasm-bindgen", @@ -4118,8 +4063,9 @@ dependencies = [ [[package]] name = "solana-program-runtime" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb3250dc9a0abc87693437ae0bb3eb02603396dcf7698c06f77c33b2c0291ca" dependencies = [ "base64 0.13.1", "bincode", @@ -4134,19 +4080,20 @@ dependencies = [ "rand 0.7.3", "rustc_version 0.4.0", "serde", - "solana-frozen-abi 1.15.0", - "solana-frozen-abi-macro 1.15.0", + "solana-frozen-abi", + "solana-frozen-abi-macro", "solana-measure", "solana-metrics", - "solana-sdk 1.15.0", + "solana-sdk", "solana_rbpf", "thiserror", ] [[package]] name = "solana-pubsub-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e441892b9a00fdceebb0e7eee3226f2f5985a15d081aab1924a298f24cdadb2" dependencies = [ "crossbeam-channel", "futures-util", @@ -4158,7 +4105,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-rpc-client-api", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", "tokio", "tokio-stream", @@ -4169,8 +4116,9 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d19f3bd22bd8cef3bd7007e878f8ee1e9534a2b2ad99abc1ac05ed3d9f9bed" dependencies = [ "async-mutex", "async-trait", @@ -4182,11 +4130,12 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustls", + "solana-connection-cache", "solana-measure", "solana-metrics", "solana-net-utils", "solana-rpc-client-api", - "solana-sdk 1.15.0", + "solana-sdk", "solana-streamer", "solana-tpu-client", "thiserror", @@ -4195,8 +4144,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30893a53deeb0a3e32451f4f7cb063484e1504a06b127c4b40c223ea90093d7b" dependencies = [ "lazy_static", "num_cpus", @@ -4204,8 +4154,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970f142fbf6bda164847f60977ad56adde32cafb7c798d2e005110410754aa85" dependencies = [ "console", "dialoguer", @@ -4215,15 +4166,16 @@ dependencies = [ "parking_lot", "qstring", "semver 1.0.16", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", "uriparse", ] [[package]] name = "solana-rpc-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "075485c8ce9300df10b67f01bb9e9ecb79c4c96c58e4b8aacac20e63c6144149" dependencies = [ "async-trait", "base64 0.13.1", @@ -4238,7 +4190,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-rpc-client-api", - "solana-sdk 1.15.0", + "solana-sdk", "solana-transaction-status", "solana-version", "solana-vote-program", @@ -4247,8 +4199,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0623112b87c9e65ef00538e27203b6129518d40376a4aa2ddc4fae5bf78a8a2c" dependencies = [ "base64 0.13.1", "bs58", @@ -4259,7 +4212,7 @@ dependencies = [ "serde_derive", "serde_json", "solana-account-decoder", - "solana-sdk 1.15.0", + "solana-sdk", "solana-transaction-status", "solana-version", "spl-token-2022", @@ -4268,68 +4221,17 @@ dependencies = [ [[package]] name = "solana-rpc-client-nonce-utils" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70673c11ff5d831c4e569b41aeb86c0e9c68dba79515b7c6f42b8f842be76fe" dependencies = [ "clap 2.34.0", "solana-clap-utils", "solana-rpc-client", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", ] -[[package]] -name = "solana-sdk" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" -dependencies = [ - "assert_matches", - "base64 0.13.1", - "bincode", - "bitflags", - "borsh", - "bs58", - "bytemuck", - "byteorder", - "chrono", - "derivation-path", - "digest 0.10.6", - "ed25519-dalek", - "ed25519-dalek-bip32", - "generic-array", - "hmac 0.12.1", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "memmap2", - "num-derive", - "num-traits", - "num_enum", - "pbkdf2 0.11.0", - "qstring", - "rand 0.7.3", - "rand_chacha 0.2.2", - "rustc_version 0.4.0", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", - "serde_with", - "sha2 0.10.6", - "sha3 0.10.6", - "solana-frozen-abi 1.15.0", - "solana-frozen-abi-macro 1.15.0", - "solana-logger 1.15.0", - "solana-program 1.15.0", - "solana-sdk-macro 1.15.0", - "thiserror", - "uriparse", - "wasm-bindgen", -] - [[package]] name = "solana-sdk" version = "1.15.2" @@ -4373,28 +4275,16 @@ dependencies = [ "serde_with", "sha2 0.10.6", "sha3 0.10.6", - "solana-frozen-abi 1.15.2", - "solana-frozen-abi-macro 1.15.2", - "solana-logger 1.15.2", - "solana-program 1.15.2", - "solana-sdk-macro 1.15.2", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-program", + "solana-sdk-macro", "thiserror", "uriparse", "wasm-bindgen", ] -[[package]] -name = "solana-sdk-macro" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" -dependencies = [ - "bs58", - "proc-macro2 1.0.51", - "quote 1.0.23", - "rustversion", - "syn 1.0.107", -] - [[package]] name = "solana-sdk-macro" version = "1.15.2" @@ -4402,16 +4292,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f809319358d5da7c3a0ac08ebf4d87b21170d928dbb7260254e8f3061f7f9e0e" dependencies = [ "bs58", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "rustversion", "syn 1.0.107", ] [[package]] name = "solana-streamer" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd5b3dad02879b083b7218b9f9596d97cee8deda2b625bff67db95d8920f5f7" dependencies = [ "crossbeam-channel", "futures-util", @@ -4432,7 +4323,7 @@ dependencies = [ "rustls", "solana-metrics", "solana-perf", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", "tokio", "x509-parser", @@ -4440,21 +4331,25 @@ dependencies = [ [[package]] name = "solana-thin-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16bdd6347caf841a007952c748cd35c3ec8395aa3816ac59b4a9b4c102237de" dependencies = [ "bincode", "log", + "rayon", + "solana-connection-cache", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk 1.15.0", + "solana-sdk", "solana-tpu-client", ] [[package]] name = "solana-tpu-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50a7dfa7a85ba000656d91c8847b61f8fa9b8067443449fab8e4c35fe01dee5c" dependencies = [ "async-trait", "bincode", @@ -4464,21 +4359,23 @@ dependencies = [ "log", "rand 0.7.3", "rayon", + "solana-connection-cache", "solana-measure", "solana-metrics", "solana-net-utils", "solana-pubsub-client", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", "tokio", ] [[package]] name = "solana-transaction-status" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b803e356fc2de0074866a6da007e721c950e754747e761a263b7f9e4c17edefa" dependencies = [ "Inflector", "base64 0.13.1", @@ -4492,7 +4389,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-address-lookup-table-program", - "solana-sdk 1.15.0", + "solana-sdk", "spl-associated-token-account", "spl-memo", "spl-token", @@ -4502,12 +4399,14 @@ dependencies = [ [[package]] name = "solana-udp-client" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1b0d7efeb2cb7dafbf3b085c895e440b8947fe5def6bdad17ebae9badfdecb0" dependencies = [ "async-trait", + "solana-connection-cache", "solana-net-utils", - "solana-sdk 1.15.0", + "solana-sdk", "solana-streamer", "solana-tpu-client", "thiserror", @@ -4516,23 +4415,25 @@ dependencies = [ [[package]] name = "solana-version" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3df7b4a4dc0a39da78d790845089a8d112fcd6d2d003ae93830387a564cfc5" dependencies = [ "log", "rustc_version 0.4.0", "semver 1.0.16", "serde", "serde_derive", - "solana-frozen-abi 1.15.0", - "solana-frozen-abi-macro 1.15.0", - "solana-sdk 1.15.0", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk", ] [[package]] name = "solana-vote-program" -version = "1.15.0" -source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439b8c68f000f8c3713eceabb5cabc8528d276e5bc971c694d4103d4be958ff" dependencies = [ "bincode", "log", @@ -4541,12 +4442,12 @@ dependencies = [ "rustc_version 0.4.0", "serde", "serde_derive", - "solana-frozen-abi 1.15.0", - "solana-frozen-abi-macro 1.15.0", + "solana-frozen-abi", + "solana-frozen-abi-macro", "solana-metrics", - "solana-program 1.15.0", + "solana-program", "solana-program-runtime", - "solana-sdk 1.15.0", + "solana-sdk", "thiserror", ] @@ -4574,8 +4475,8 @@ dependencies = [ "serde", "serde_json", "sha3 0.9.1", - "solana-program 1.15.2", - "solana-sdk 1.15.2", + "solana-program", + "solana-sdk", "subtle", "thiserror", "zeroize", @@ -4626,7 +4527,7 @@ dependencies = [ "borsh", "num-derive", "num-traits", - "solana-program 1.15.2", + "solana-program", "spl-token", "spl-token-2022", "thiserror", @@ -4638,7 +4539,7 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" dependencies = [ - "solana-program 1.15.2", + "solana-program", ] [[package]] @@ -4652,7 +4553,7 @@ dependencies = [ "num-derive", "num-traits", "num_enum", - "solana-program 1.15.2", + "solana-program", "thiserror", ] @@ -4667,7 +4568,7 @@ dependencies = [ "num-derive", "num-traits", "num_enum", - "solana-program 1.15.2", + "solana-program", "solana-zk-token-sdk", "spl-memo", "spl-token", @@ -4719,8 +4620,19 @@ version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", "unicode-ident", ] @@ -4730,24 +4642,23 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "unicode-xid 0.2.4", ] [[package]] name = "tempfile" -version = "3.3.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", + "redox_syscall 0.3.5", + "rustix 0.37.3", + "windows-sys 0.45.0", ] [[package]] @@ -4776,22 +4687,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", - "syn 1.0.107", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 2.0.13", ] [[package]] @@ -4817,9 +4728,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ "itoa", "serde", @@ -4835,9 +4746,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a460aeb8de6dcb0f381e1ee05f1cd56fcf5a5f6eb8187ff3d8f0b11078d38b7c" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" dependencies = [ "time-core", ] @@ -4878,33 +4789,32 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ "autocfg", "bytes", "libc", - "memchr", "mio", "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.4.9", "tokio-macros", "windows-sys 0.45.0", ] [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", - "syn 1.0.107", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 2.0.13", ] [[package]] @@ -4919,9 +4829,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a12c1b3e0704ae7dfc25562629798b29c72e6b1d0a681b6f29ab4ae5e7f7bf" +checksum = "6e89f6234aa8fd43779746012fcf53603cdb91fdd8399aa0de868c2d56b6dde1" dependencies = [ "async-trait", "byteorder", @@ -4936,7 +4846,7 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", - "socket2", + "socket2 0.5.1", "tokio", "tokio-util", ] @@ -5062,8 +4972,8 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -5263,12 +5173,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "want" version = "0.3.0" @@ -5316,8 +5220,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "wasm-bindgen-shared", ] @@ -5340,7 +5244,7 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ - "quote 1.0.23", + "quote 1.0.26", "wasm-bindgen-macro-support", ] @@ -5350,8 +5254,8 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -5528,7 +5432,7 @@ dependencies = [ "oid-registry", "rusticata-macros", "thiserror", - "time 0.3.19", + "time 0.3.20", ] [[package]] @@ -5537,7 +5441,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" dependencies = [ - "time 0.3.19", + "time 0.3.20", ] [[package]] @@ -5555,8 +5459,8 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ - "proc-macro2 1.0.51", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "synstructure", ] diff --git a/Cargo.toml b/Cargo.toml index f6203c44..db22b469 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,33 +3,31 @@ name = "lite-rpc" version = "0.1.0" edition = "2021" description = "A lite version of solana rpc to send and confirm transactions" +rust-version = "1.67.1" [workspace] members = [ "bench" ] -[dev-dependencies] -bench = { path = "./bench" } - -[dependencies] -solana-sdk = { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-rpc-client = { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-rpc-client-api= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-tpu-client= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-quic-client= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-pubsub-client= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-transaction-status = { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-version= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-client= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } +[workspace.dependencies] +solana-sdk = "1.15.2" +solana-rpc-client = "1.15.2" +solana-rpc-client-api = "1.15.2" +solana-transaction-status = "1.15.2" +solana-version = "1.15.2" +solana-client = "1.15.2" +solana-net-utils = "1.15.2" +solana-pubsub-client = "1.15.2" +solana-streamer = "1.15.2" serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.93" -tokio = { version = "1.25.0", features = ["full"]} +tokio = { version = "1.27.0", features = ["full", "fs"]} bincode = "1.3.3" bs58 = "0.4.0" base64 = "0.21.0" -thiserror = "1.0.38" -futures = "0.3.26" +thiserror = "1.0.40" +futures = "0.3.28" bytes = "1.4.0" anyhow = "1.0.69" log = "0.4.17" @@ -45,3 +43,44 @@ prometheus = "0.13.3" lazy_static = "1.4.0" dotenv = "0.15.0" async-channel = "1.8.0" +quinn = "0.9.3" +rustls = { version = "0.20.6", default-features = false } + +[dev-dependencies] +bench = { path = "./bench" } + +[dependencies] +solana-sdk = { workspace = true } +solana-rpc-client = { workspace = true } +solana-rpc-client-api = { workspace = true } +solana-transaction-status = { workspace = true } +solana-version = { workspace = true } +solana-client = { workspace = true } +solana-net-utils = { workspace = true } +solana-pubsub-client = { workspace = true } +solana-streamer = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +tokio = { workspace = true } +bincode = { workspace = true } +bs58 = { workspace = true } +base64 = { workspace = true } +thiserror = { workspace = true } +futures = { workspace = true } +bytes = { workspace = true } +anyhow = { workspace = true } +log = { workspace = true } +clap = { workspace = true } +dashmap = { workspace = true } +const_env = { workspace = true } +jsonrpsee = { workspace = true } +tracing-subscriber = { workspace = true } +tokio-postgres = { workspace = true } +native-tls = { workspace = true } +postgres-native-tls = { workspace = true } +prometheus = { workspace = true } +lazy_static = { workspace = true } +dotenv = { workspace = true } +async-channel = { workspace = true } +quinn = { workspace = true } +rustls = { workspace = true } diff --git a/bench/Cargo.toml b/bench/Cargo.toml index d5571df2..3d5cd2ee 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -4,16 +4,17 @@ version = "0.1.0" edition = "2021" [dependencies] -solana-sdk = { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -solana-rpc-client = { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" } -log = "0.4.17" -anyhow = "1.0.69" -serde = "1.0.152" -serde_json = "1.0.93" -csv = "1.2.0" -clap = { version = "4.1.6", features = ["derive"] } -tokio = { version = "1.25.0", features = ["full", "fs"]} -tracing-subscriber = "0.3.16" -dirs = "4.0.0" +solana-sdk = { workspace = true } +solana-rpc-client = { workspace = true } +log = { workspace = true } +anyhow = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +clap = { workspace = true } +tokio = { workspace = true } +tracing-subscriber = { workspace = true } +csv = "1.2.1" +dirs = "5.0.0" rand = "0.8.5" +rand_chacha = "0.3.1" diff --git a/bench/src/helpers.rs b/bench/src/helpers.rs index 5b8ac882..622b52bc 100644 --- a/bench/src/helpers.rs +++ b/bench/src/helpers.rs @@ -1,7 +1,7 @@ -use std::str::FromStr; +use std::{str::FromStr, time::Duration}; use anyhow::Context; -use rand::{distributions::Alphanumeric, prelude::Distribution}; +use rand::{distributions::Alphanumeric, prelude::Distribution, SeedableRng}; use solana_rpc_client::nonblocking::rpc_client::RpcClient; use solana_sdk::{ commitment_config::CommitmentConfig, @@ -14,8 +14,10 @@ use solana_sdk::{ system_instruction, transaction::Transaction, }; +use tokio::time::Instant; const MEMO_PROGRAM_ID: &str = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"; +const WAIT_LIMIT_IN_SECONDS: u64 = 60; pub struct BenchHelper; @@ -40,7 +42,11 @@ impl BenchHelper { sig: &Signature, commitment_config: CommitmentConfig, ) -> anyhow::Result<()> { + let instant = Instant::now(); loop { + if instant.elapsed() > Duration::from_secs(WAIT_LIMIT_IN_SECONDS) { + return Err(anyhow::Error::msg("Timedout waiting")); + } if let Some(err) = rpc_client .get_signature_status_with_commitment(sig, commitment_config) .await? @@ -68,13 +74,13 @@ impl BenchHelper { num_of_txs: usize, funded_payer: &Keypair, blockhash: Hash, + random_seed: Option, ) -> Vec { + let seed = random_seed.map_or(0, |x| x); + let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(seed); (0..num_of_txs) .map(|_| { - let random_bytes: Vec = Alphanumeric - .sample_iter(rand::thread_rng()) - .take(10) - .collect(); + let random_bytes: Vec = Alphanumeric.sample_iter(&mut rng).take(10).collect(); Self::create_memo_tx(&random_bytes, funded_payer, blockhash) }) diff --git a/bench/src/main.rs b/bench/src/main.rs index 8ef3f444..314574d2 100644 --- a/bench/src/main.rs +++ b/bench/src/main.rs @@ -62,7 +62,7 @@ async fn bench(rpc_client: Arc, tx_count: usize) -> Metric { let funded_payer = BenchHelper::get_payer().await.unwrap(); let blockhash = rpc_client.get_latest_blockhash().await.unwrap(); - let txs = BenchHelper::generate_txs(tx_count, &funded_payer, blockhash); + let txs = BenchHelper::generate_txs(tx_count, &funded_payer, blockhash, None); let mut un_confirmed_txs: HashMap> = HashMap::with_capacity(txs.len()); diff --git a/src/bridge.rs b/src/bridge.rs index 08ea70ff..bc8f1402 100644 --- a/src/bridge.rs +++ b/src/bridge.rs @@ -3,17 +3,18 @@ use crate::{ configs::{IsBlockHashValidConfig, SendTransactionConfig}, encoding::BinaryEncoding, rpc::LiteRpcServer, - tpu_manager::TpuManager, workers::{ - BlockListener, Cleaner, MetricsCapture, Postgres, PrometheusSync, TxSender, WireTransaction, + tpu_utils::tpu_service::TpuService, BlockListener, Cleaner, MetricsCapture, Postgres, + PrometheusSync, TxSender, WireTransaction, }, + DEFAULT_MAX_NUMBER_OF_TXS_IN_QUEUE, }; use std::{ops::Deref, str::FromStr, sync::Arc, time::Duration}; use anyhow::bail; -use log::info; +use log::{error, info}; use jsonrpsee::{server::ServerBuilder, types::SubscriptionResult, SubscriptionSink}; @@ -30,7 +31,7 @@ use solana_sdk::{ use solana_transaction_status::TransactionStatus; use tokio::{ net::ToSocketAddrs, - sync::mpsc::{self, UnboundedSender}, + sync::mpsc::{self, Sender}, task::JoinHandle, }; @@ -55,9 +56,9 @@ lazy_static::lazy_static! { /// A bridge between clients and tpu pub struct LiteBridge { pub rpc_client: Arc, - pub tpu_manager: Arc, + pub tpu_service: Arc, // None if LiteBridge is not executed - pub tx_send_channel: Option>, + pub tx_send_channel: Option>, pub tx_sender: TxSender, pub block_listner: BlockListener, pub block_store: BlockStore, @@ -71,11 +72,19 @@ impl LiteBridge { identity: Keypair, ) -> anyhow::Result { let rpc_client = Arc::new(RpcClient::new(rpc_url.clone())); + let current_slot = rpc_client.get_slot().await?; + + let tpu_service = TpuService::new( + Arc::new(std::sync::atomic::AtomicU64::new(current_slot)), + fanout_slots, + Arc::new(identity), + rpc_client.clone(), + ws_addr, + ) + .await?; + let tpu_service = Arc::new(tpu_service); - let tpu_manager = - Arc::new(TpuManager::new(rpc_client.clone(), ws_addr, fanout_slots, identity).await?); - - let tx_sender = TxSender::new(tpu_manager.clone()); + let tx_sender = TxSender::new(tpu_service.clone()); let block_store = BlockStore::new(&rpc_client).await?; @@ -84,7 +93,7 @@ impl LiteBridge { Ok(Self { rpc_client, - tpu_manager, + tpu_service, tx_send_channel: None, tx_sender, block_listner, @@ -98,8 +107,6 @@ impl LiteBridge { mut self, http_addr: T, ws_addr: T, - tx_batch_size: usize, - tx_send_interval: Duration, clean_interval: Duration, enable_postgres: bool, prometheus_addr: T, @@ -114,15 +121,15 @@ impl LiteBridge { (None, None) }; - let (tx_send, tx_recv) = mpsc::unbounded_channel(); + let mut tpu_services = self.tpu_service.start().await?; + + let (tx_send, tx_recv) = mpsc::channel(DEFAULT_MAX_NUMBER_OF_TXS_IN_QUEUE); self.tx_send_channel = Some(tx_send); - let tx_sender = self.tx_sender.clone().execute( - tx_recv, - tx_batch_size, - tx_send_interval, - postgres_send.clone(), - ); + let tx_sender = self + .tx_sender + .clone() + .execute(tx_recv, postgres_send.clone()); let metrics_capture = MetricsCapture::new(self.tx_sender.clone()).capture(); let prometheus_sync = PrometheusSync.sync(prometheus_addr); @@ -141,7 +148,6 @@ impl LiteBridge { self.tx_sender.clone(), self.block_listner.clone(), self.block_store.clone(), - self.tpu_manager.clone(), ) .start(clean_interval); @@ -186,6 +192,8 @@ impl LiteBridge { cleaner, ]; + services.append(&mut tpu_services); + if let Some(postgres) = postgres { services.push(postgres); } @@ -231,11 +239,18 @@ impl LiteRpcServer for LiteBridge { return Err(jsonrpsee::core::Error::Custom("Blockhash not found in block store".to_string())); }; - self.tx_send_channel + if let Err(e) = self + .tx_send_channel .as_ref() .expect("Lite Bridge Not Executed") .send((sig.to_string(), raw_tx, slot)) - .unwrap(); + .await + { + error!( + "Internal error sending transaction on send channel error {}", + e + ); + } TXS_IN_CHANNEL.inc(); Ok(BinaryEncoding::Base58.encode(sig)) diff --git a/src/cli.rs b/src/cli.rs index c8725245..c33a0eb0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,7 +1,4 @@ -use crate::{ - DEFAULT_CLEAN_INTERVAL_MS, DEFAULT_FANOUT_SIZE, DEFAULT_RPC_ADDR, DEFAULT_TX_BATCH_INTERVAL_MS, - DEFAULT_TX_BATCH_SIZE, DEFAULT_WS_ADDR, -}; +use crate::{DEFAULT_CLEAN_INTERVAL_MS, DEFAULT_FANOUT_SIZE, DEFAULT_RPC_ADDR, DEFAULT_WS_ADDR}; use clap::Parser; #[derive(Parser, Debug)] @@ -15,15 +12,9 @@ pub struct Args { pub lite_rpc_http_addr: String, #[arg(short = 's', long, default_value_t = String::from("[::]:8891"))] pub lite_rpc_ws_addr: String, - /// batch size of each batch forward - #[arg(short = 'b', long, default_value_t = DEFAULT_TX_BATCH_SIZE)] - pub tx_batch_size: usize, /// tpu fanout #[arg(short = 'f', long, default_value_t = DEFAULT_FANOUT_SIZE) ] pub fanout_size: u64, - /// interval between each batch forward - #[arg(short = 'i', long, default_value_t = DEFAULT_TX_BATCH_INTERVAL_MS)] - pub tx_batch_interval_ms: u64, /// interval between clean #[arg(short = 'c', long, default_value_t = DEFAULT_CLEAN_INTERVAL_MS)] pub clean_interval_ms: u64, diff --git a/src/lib.rs b/src/lib.rs index e49c1784..88946da8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,6 @@ pub mod configs; pub mod encoding; pub mod errors; pub mod rpc; -pub mod tpu_manager; pub mod workers; #[from_env] @@ -20,13 +19,14 @@ pub const DEFAULT_WS_ADDR: &str = "ws://0.0.0.0:8900"; #[from_env] pub const DEFAULT_TX_MAX_RETRIES: u16 = 1; #[from_env] -pub const DEFAULT_TX_BATCH_SIZE: usize = 512; +pub const DEFAULT_TX_BATCH_SIZE: usize = 32; -/// 25 slots in 10s send to little more leaders #[from_env] -pub const DEFAULT_FANOUT_SIZE: u64 = 30; +pub const DEFAULT_MAX_NUMBER_OF_TXS_IN_QUEUE: usize = 40_000; + +/// 25 slots in 10s send to little more leaders #[from_env] -pub const DEFAULT_TX_BATCH_INTERVAL_MS: u64 = 100; +pub const DEFAULT_FANOUT_SIZE: u64 = 100; #[from_env] pub const DEFAULT_CLEAN_INTERVAL_MS: u64 = 5 * 60 * 1000; // five minute pub const DEFAULT_TRANSACTION_CONFIRMATION_STATUS: TransactionConfirmationStatus = diff --git a/src/main.rs b/src/main.rs index 63b2daca..ec51436c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,10 +38,8 @@ pub async fn main() -> anyhow::Result<()> { let Args { rpc_addr, ws_addr, - tx_batch_size, lite_rpc_ws_addr, lite_rpc_http_addr, - tx_batch_interval_ms, clean_interval_ms, fanout_size, enable_postgres, @@ -53,7 +51,6 @@ pub async fn main() -> anyhow::Result<()> { let identity = get_identity_keypair(&identity_keypair).await; - let tx_batch_interval_ms = Duration::from_millis(tx_batch_interval_ms); let clean_interval_ms = Duration::from_millis(clean_interval_ms); let light_bridge = LiteBridge::new(rpc_addr, ws_addr, fanout_size, identity).await?; @@ -62,8 +59,6 @@ pub async fn main() -> anyhow::Result<()> { .start_services( lite_rpc_http_addr, lite_rpc_ws_addr, - tx_batch_size, - tx_batch_interval_ms, clean_interval_ms, enable_postgres, prometheus_addr, diff --git a/src/tpu_manager.rs b/src/tpu_manager.rs deleted file mode 100644 index 10574d97..00000000 --- a/src/tpu_manager.rs +++ /dev/null @@ -1,145 +0,0 @@ -use std::{ - net::{IpAddr, Ipv4Addr}, - sync::{ - atomic::{AtomicU32, Ordering}, - Arc, - }, -}; - -use log::info; -use prometheus::{opts, register_int_counter, IntCounter}; -use solana_quic_client::{QuicConfig, QuicPool}; -use solana_rpc_client::nonblocking::rpc_client::RpcClient; -use solana_sdk::signature::Keypair; -use solana_tpu_client::{ - nonblocking::tpu_client::TpuClient, - tpu_client::TpuClientConfig, - tpu_connection_cache::{NewTpuConfig, TpuConnectionCache}, -}; -use tokio::sync::RwLock; - -pub type QuicTpuClient = TpuClient; -pub type QuicConnectionCache = TpuConnectionCache; - -const TPU_CONNECTION_CACHE_SIZE: usize = 4; - -lazy_static::lazy_static! { -static ref TPU_CONNECTION_RESET: IntCounter = - register_int_counter!(opts!("literpc_tpu_connection_reset", "Number of times tpu connection was reseted")).unwrap(); -} - -#[derive(Clone)] -pub struct TpuManager { - error_count: Arc, - rpc_client: Arc, - // why arc twice / one is so that we clone rwlock and other so that we can clone tpu client - tpu_client: Arc>>, - pub ws_addr: String, - fanout_slots: u64, - identity: Arc, -} - -impl TpuManager { - pub async fn new( - rpc_client: Arc, - ws_addr: String, - fanout_slots: u64, - identity: Keypair, - ) -> anyhow::Result { - let mut tpu_config = QuicConfig::new().unwrap(); - tpu_config - .update_client_certificate(&identity, IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))) - .unwrap(); - - let connection_cache = - QuicConnectionCache::new_with_config(TPU_CONNECTION_CACHE_SIZE, tpu_config); - let connection_cache = Arc::new(connection_cache); - let tpu_client = - Self::new_tpu_client(rpc_client.clone(), &ws_addr, fanout_slots, connection_cache) - .await?; - let tpu_client = Arc::new(RwLock::new(Arc::new(tpu_client))); - - Ok(Self { - rpc_client, - tpu_client, - ws_addr, - fanout_slots, - error_count: Default::default(), - identity: Arc::new(identity), - }) - } - - pub async fn new_tpu_client( - rpc_client: Arc, - ws_addr: &str, - fanout_slots: u64, - connection_cache: Arc, - ) -> anyhow::Result { - Ok(TpuClient::new_with_connection_cache( - rpc_client.clone(), - ws_addr, - TpuClientConfig { fanout_slots }, - connection_cache, - ) - .await?) - } - - pub async fn reset_tpu_client(&self) -> anyhow::Result<()> { - let mut tpu_config = QuicConfig::new().unwrap(); - tpu_config - .update_client_certificate(&self.identity, IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))) - .unwrap(); - let connection_cache = - QuicConnectionCache::new_with_config(TPU_CONNECTION_CACHE_SIZE, tpu_config); - let connection_cache = Arc::new(connection_cache); - - let tpu_client = Self::new_tpu_client( - self.rpc_client.clone(), - &self.ws_addr, - self.fanout_slots, - connection_cache, - ) - .await?; - self.error_count.store(0, Ordering::Relaxed); - *self.tpu_client.write().await = Arc::new(tpu_client); - TPU_CONNECTION_RESET.inc(); - Ok(()) - } - - pub async fn reset(&self) -> anyhow::Result<()> { - self.error_count.fetch_add(1, Ordering::Relaxed); - - if self.error_count.load(Ordering::Relaxed) > 5 { - self.reset_tpu_client().await?; - info!("TPU Reset after 5 errors"); - } - - Ok(()) - } - - async fn get_tpu_client(&self) -> Arc { - self.tpu_client.read().await.clone() - } - - pub async fn try_send_wire_transaction_batch( - &self, - wire_transactions: Vec>, - ) -> anyhow::Result<()> { - let tpu_client = self.get_tpu_client().await; - match tpu_client - .try_send_wire_transaction_batch(wire_transactions) - .await - { - Ok(_) => Ok(()), - Err(err) => { - self.reset().await?; - Err(err.into()) - } - } - } - - pub async fn estimated_current_slot(&self) -> u64 { - let tpu_client = self.get_tpu_client().await; - tpu_client.estimated_current_slot() - } -} diff --git a/src/workers/block_listenser.rs b/src/workers/block_listenser.rs index 5a83bf53..e38a0f6e 100644 --- a/src/workers/block_listenser.rs +++ b/src/workers/block_listenser.rs @@ -6,7 +6,7 @@ use std::{ use dashmap::DashMap; use jsonrpsee::SubscriptionSink; -use log::{info, warn}; +use log::{info, trace, warn}; use prometheus::{ core::GenericGauge, histogram_opts, opts, register_histogram, register_int_counter, register_int_gauge, Histogram, IntCounter, @@ -243,6 +243,11 @@ impl BlockListener { TXS_CONFIRMED.inc(); } + info!( + "got transaction {} confrimation level {}", + sig, commitment_config.commitment + ); + tx_status.value_mut().status = Some(TransactionStatus { slot, confirmations: None, @@ -290,7 +295,7 @@ impl BlockListener { } } - info!( + trace!( "Number of transactions processed {} for slot {} for commitment {} time taken {} ms", transactions_processed, slot, diff --git a/src/workers/cleaner.rs b/src/workers/cleaner.rs index 68f127bd..1b650799 100644 --- a/src/workers/cleaner.rs +++ b/src/workers/cleaner.rs @@ -1,9 +1,9 @@ -use std::{sync::Arc, time::Duration}; +use std::time::Duration; use log::info; use tokio::task::JoinHandle; -use crate::{block_store::BlockStore, tpu_manager::TpuManager}; +use crate::block_store::BlockStore; use super::{BlockListener, TxSender}; @@ -13,7 +13,6 @@ pub struct Cleaner { tx_sender: TxSender, block_listenser: BlockListener, block_store: BlockStore, - tpu_manager: Arc, } impl Cleaner { @@ -21,13 +20,11 @@ impl Cleaner { tx_sender: TxSender, block_listenser: BlockListener, block_store: BlockStore, - tpu_manager: Arc, ) -> Self { Self { tx_sender, block_listenser, block_store, - tpu_manager, } } @@ -56,7 +53,6 @@ impl Cleaner { self.clean_tx_sender(ttl_duration); self.clean_block_listeners(ttl_duration); self.clean_block_store(ttl_duration).await; - let _ = self.tpu_manager.reset_tpu_client().await; } }) } diff --git a/src/workers/mod.rs b/src/workers/mod.rs index 0cd4d788..cdad24ab 100644 --- a/src/workers/mod.rs +++ b/src/workers/mod.rs @@ -3,6 +3,7 @@ mod cleaner; mod metrics_capture; mod postgres; mod prometheus_sync; +pub mod tpu_utils; mod tx_sender; pub use block_listenser::*; diff --git a/src/workers/tpu_utils/mod.rs b/src/workers/tpu_utils/mod.rs new file mode 100644 index 00000000..9836be96 --- /dev/null +++ b/src/workers/tpu_utils/mod.rs @@ -0,0 +1,3 @@ +pub mod rotating_queue; +pub mod tpu_connection_manager; +pub mod tpu_service; diff --git a/src/workers/tpu_utils/rotating_queue.rs b/src/workers/tpu_utils/rotating_queue.rs new file mode 100644 index 00000000..d0a24a4d --- /dev/null +++ b/src/workers/tpu_utils/rotating_queue.rs @@ -0,0 +1,34 @@ +use std::{ + collections::VecDeque, + sync::{Arc, RwLock}, +}; + +#[derive(Clone)] +pub struct RotatingQueue { + deque: Arc>>, +} + +impl RotatingQueue { + pub fn new(size: usize, creator_functor: F) -> Self + where + F: Fn() -> T, + { + let item = Self { + deque: Arc::new(RwLock::new(VecDeque::::new())), + }; + { + let mut deque = item.deque.write().unwrap(); + for _i in 0..size { + deque.push_back(creator_functor()); + } + } + item + } + + pub fn get(&self) -> T { + let mut deque = self.deque.write().unwrap(); + let current = deque.pop_front().unwrap(); + deque.push_back(current.clone()); + current + } +} diff --git a/src/workers/tpu_utils/tpu_connection_manager.rs b/src/workers/tpu_utils/tpu_connection_manager.rs new file mode 100644 index 00000000..cc4c97b8 --- /dev/null +++ b/src/workers/tpu_utils/tpu_connection_manager.rs @@ -0,0 +1,362 @@ +use std::{ + collections::HashMap, + net::{IpAddr, Ipv4Addr, SocketAddr}, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, + time::Duration, +}; + +use dashmap::DashMap; +use log::{error, info, trace}; +use prometheus::{core::GenericGauge, opts, register_int_gauge}; +use quinn::{ + ClientConfig, Connection, ConnectionError, Endpoint, EndpointConfig, IdleTimeout, TokioRuntime, + TransportConfig, +}; +use solana_sdk::pubkey::Pubkey; +use tokio::{ + sync::{broadcast::Receiver, broadcast::Sender}, + time::timeout, +}; + +use super::rotating_queue::RotatingQueue; + +pub const ALPN_TPU_PROTOCOL_ID: &[u8] = b"solana-tpu"; +const QUIC_CONNECTION_TIMEOUT_DURATION_IN_SEC: u64 = 5; + +lazy_static::lazy_static! { + static ref NB_QUIC_CONNECTIONS: GenericGauge = + register_int_gauge!(opts!("literpc_nb_active_quic_connections", "Number of quic connections open")).unwrap(); + static ref NB_QUIC_TASKS: GenericGauge = + register_int_gauge!(opts!("literpc_nb_quic_tasks", "Number quic tasks that are running")).unwrap(); +} + +struct ActiveConnection { + pub endpoint: Endpoint, + pub identity: Pubkey, + pub tpu_address: SocketAddr, + pub exit_signal: Arc, +} + +impl ActiveConnection { + pub fn new(endpoint: Endpoint, tpu_address: SocketAddr, identity: Pubkey) -> Self { + Self { + endpoint, + tpu_address, + identity, + exit_signal: Arc::new(AtomicBool::new(false)), + } + } + + async fn make_connection(endpoint: Endpoint, addr: SocketAddr) -> anyhow::Result { + let connecting = endpoint.connect(addr, "connect")?; + + // let res = timeout( + // Duration::from_secs(QUIC_CONNECTION_TIMEOUT_DURATION_IN_SEC), + // connecting, + // ) + // .await?; + let res = connecting.await; + Ok(res.unwrap()) + } + + async fn make_connection_0rtt( + endpoint: Endpoint, + addr: SocketAddr, + ) -> anyhow::Result { + let connecting = endpoint.connect(addr, "connect")?; + let connection = match connecting.into_0rtt() { + Ok((connection, zero_rtt)) => { + if let Ok(_) = timeout( + Duration::from_secs(QUIC_CONNECTION_TIMEOUT_DURATION_IN_SEC), + zero_rtt, + ) + .await + { + connection + } else { + error!("timeout while connecting"); + return Err(ConnectionError::TimedOut.into()); + } + } + Err(connecting) => { + if let Ok(connecting_result) = timeout( + Duration::from_millis(QUIC_CONNECTION_TIMEOUT_DURATION_IN_SEC), + connecting, + ) + .await + { + connecting_result? + } else { + error!("timeout while connecting"); + return Err(ConnectionError::TimedOut.into()); + } + } + }; + Ok(connection) + } + + async fn listen( + transaction_reciever: Receiver>, + exit_oneshot_channel: tokio::sync::mpsc::Receiver<()>, + endpoint: Endpoint, + addr: SocketAddr, + exit_signal: Arc, + identity: Pubkey, + ) { + NB_QUIC_TASKS.inc(); + let mut already_connected = false; + let mut connection: Option = None; + let mut transaction_reciever = transaction_reciever; + let mut exit_oneshot_channel = exit_oneshot_channel; + loop { + // exit signal set + if exit_signal.load(Ordering::Relaxed) { + break; + } + + tokio::select! { + tx_or_timeout = timeout(Duration::from_secs(QUIC_CONNECTION_TIMEOUT_DURATION_IN_SEC), transaction_reciever.recv() ) => { + // exit signal set + if exit_signal.load(Ordering::Relaxed) { + break; + } + + match tx_or_timeout { + Ok(tx) => { + let tx: Vec = match tx { + Ok(tx) => tx, + Err(e) => { + error!( + "Broadcast channel error on recv for {} error {}", + identity, e + ); + continue; + } + }; + let mut send_stream = match &connection { + Some(conn) => { + let unistream = conn.open_uni().await; + if let Err(e) = unistream { + error!("error opening a unistream for {} error {}", identity, e); + continue; + } + unistream.unwrap() + }, + None => { + let conn = if already_connected { + info!("making make_connection_0rtt"); + Self::make_connection_0rtt(endpoint.clone(), addr.clone()).await + } else { + info!("making make_connection"); + Self::make_connection(endpoint.clone(), addr.clone()).await + }; + match conn { + Ok(conn) => { + NB_QUIC_CONNECTIONS.inc(); + already_connected = true; + let unistream = conn.open_uni().await; + if let Err(e) = unistream { + error!("error opening a unistream for {} error {}", identity, e); + continue; + } + + connection = Some(conn); + unistream.unwrap() + }, + Err(e) => { + error!("Could not connect to {} because of error {}", identity, e); + continue; + } + } + + } + }; + + trace!("Sending {} transaction", identity); + if let Err(e) = send_stream.write_all(tx.as_slice()).await { + error!( + "Error while writing transaction for {} error {}", + identity, e + ); + } + if let Err(e) = send_stream.finish().await { + error!( + "Error finishing for {}, error {}", + identity, e, + ) + } + }, + Err(_) => { + // timed out + if let Some(_) = &mut connection { + NB_QUIC_CONNECTIONS.dec(); + connection = None; + } + } + } + }, + _ = exit_oneshot_channel.recv() => { + if let Some(_) = &mut connection { + NB_QUIC_CONNECTIONS.dec(); + connection = None; + } + + break; + } + }; + } + + if let Some(_) = &mut connection { + NB_QUIC_CONNECTIONS.dec(); + } + NB_QUIC_TASKS.dec(); + } + + pub fn start_listening( + &self, + transaction_reciever: Receiver>, + exit_oneshot_channel: tokio::sync::mpsc::Receiver<()>, + ) { + let endpoint = self.endpoint.clone(); + let addr = self.tpu_address.clone(); + let exit_signal = self.exit_signal.clone(); + let identity = self.identity.clone(); + tokio::spawn(async move { + Self::listen( + transaction_reciever, + exit_oneshot_channel, + endpoint, + addr, + exit_signal, + identity, + ) + .await; + }); + } +} + +struct ActiveConnectionWithExitChannel { + pub active_connection: ActiveConnection, + pub exit_channel: tokio::sync::mpsc::Sender<()>, +} + +pub struct TpuConnectionManager { + endpoints: RotatingQueue, + identity_to_active_connection: Arc>>, +} + +impl TpuConnectionManager { + pub fn new(certificate: rustls::Certificate, key: rustls::PrivateKey, fanout: usize) -> Self { + let number_of_clients = if fanout > 5 { fanout / 4 } else { 1 }; + Self { + endpoints: RotatingQueue::new(number_of_clients, || { + Self::create_endpoint(certificate.clone(), key.clone()) + }), + identity_to_active_connection: Arc::new(DashMap::new()), + } + } + + fn create_endpoint(certificate: rustls::Certificate, key: rustls::PrivateKey) -> Endpoint { + let mut endpoint = { + let client_socket = + solana_net_utils::bind_in_range(IpAddr::V4(Ipv4Addr::UNSPECIFIED), (8000, 10000)) + .expect("create_endpoint bind_in_range") + .1; + let config = EndpointConfig::default(); + quinn::Endpoint::new(config, None, client_socket, TokioRuntime) + .expect("create_endpoint quinn::Endpoint::new") + }; + + let mut crypto = rustls::ClientConfig::builder() + .with_safe_defaults() + .with_custom_certificate_verifier(SkipServerVerification::new()) + .with_single_cert(vec![certificate], key) + .expect("Failed to set QUIC client certificates"); + + crypto.enable_early_data = true; + crypto.alpn_protocols = vec![ALPN_TPU_PROTOCOL_ID.to_vec()]; + + let mut config = ClientConfig::new(Arc::new(crypto)); + let mut transport_config = TransportConfig::default(); + + let timeout = IdleTimeout::try_from(Duration::from_secs(1)).unwrap(); + transport_config.max_idle_timeout(Some(timeout)); + transport_config.keep_alive_interval(Some(Duration::from_millis(500))); + config.transport_config(Arc::new(transport_config)); + + endpoint.set_default_client_config(config); + + endpoint + } + + pub async fn update_connections( + &self, + transaction_sender: Arc>>, + connections_to_keep: HashMap, + ) { + for (identity, socket_addr) in &connections_to_keep { + if self.identity_to_active_connection.get(&identity).is_none() { + info!("added a connection for {}, {}", identity, socket_addr); + let endpoint = self.endpoints.get(); + let active_connection = + ActiveConnection::new(endpoint, socket_addr.clone(), identity.clone()); + // using mpsc as a oneshot channel/ because with one shot channel we cannot reuse the reciever + let (sx, rx) = tokio::sync::mpsc::channel(1); + + let transaction_reciever = transaction_sender.subscribe(); + active_connection.start_listening(transaction_reciever, rx); + self.identity_to_active_connection.insert( + identity.clone(), + Arc::new(ActiveConnectionWithExitChannel { + active_connection, + exit_channel: sx, + }), + ); + } + } + + // remove connections which are no longer needed + let collect_current_active_connections = self + .identity_to_active_connection + .iter() + .map(|x| (x.key().clone(), x.value().clone())) + .collect::>(); + for (identity, value) in collect_current_active_connections.iter() { + if !connections_to_keep.contains_key(identity) { + info!("removing a connection for {}", identity); + // ignore error for exit channel + value + .active_connection + .exit_signal + .store(true, Ordering::Relaxed); + let _ = value.exit_channel.send(()).await; + self.identity_to_active_connection.remove(identity); + } + } + } +} + +struct SkipServerVerification; + +impl SkipServerVerification { + pub fn new() -> Arc { + Arc::new(Self) + } +} + +impl rustls::client::ServerCertVerifier for SkipServerVerification { + fn verify_server_cert( + &self, + _end_entity: &rustls::Certificate, + _intermediates: &[rustls::Certificate], + _server_name: &rustls::ServerName, + _scts: &mut dyn Iterator, + _ocsp_response: &[u8], + _now: std::time::SystemTime, + ) -> Result { + Ok(rustls::client::ServerCertVerified::assertion()) + } +} diff --git a/src/workers/tpu_utils/tpu_service.rs b/src/workers/tpu_utils/tpu_service.rs new file mode 100644 index 00000000..b81d6778 --- /dev/null +++ b/src/workers/tpu_utils/tpu_service.rs @@ -0,0 +1,319 @@ +use anyhow::Result; +use dashmap::DashMap; +use futures::StreamExt; +use log::{error, info, warn}; +use prometheus::{core::GenericGauge, opts, register_int_gauge}; +use solana_client::{ + nonblocking::{pubsub_client::PubsubClient, rpc_client::RpcClient}, + rpc_response::RpcContactInfo, +}; + +use solana_sdk::{pubkey::Pubkey, quic::QUIC_PORT_OFFSET, signature::Keypair, slot_history::Slot}; +use solana_streamer::tls_certificates::new_self_signed_tls_certificate; +use std::{ + collections::VecDeque, + net::{IpAddr, Ipv4Addr}, + str::FromStr, + sync::{ + atomic::{AtomicU64, Ordering}, + Arc, + }, +}; +use tokio::{ + sync::RwLock, + task::JoinHandle, + time::{Duration, Instant}, +}; + +use super::tpu_connection_manager::TpuConnectionManager; + +const CACHE_NEXT_SLOT_LEADERS_PUBKEY_SIZE: usize = 1024; // Save pubkey and contact info of next 1024 leaders in the queue +const CLUSTERINFO_REFRESH_TIME: u64 = 60; // refresh cluster every minute +const LEADER_SCHEDULE_UPDATE_INTERVAL: u64 = 10; // update leader schedule every 10s +const AVERAGE_SLOT_CHANGE_TIME_IN_MILLIS: u64 = 400; +const MAXIMUM_TRANSACTIONS_IN_QUEUE: usize = 1024; + +lazy_static::lazy_static! { + static ref NB_CLUSTER_NODES: GenericGauge = + register_int_gauge!(opts!("literpc_nb_cluster_nodes", "Number of cluster nodes in saved")).unwrap(); + + static ref NB_OF_LEADERS_IN_SCHEDULE: GenericGauge = + register_int_gauge!(opts!("literpc_cached_leader", "Number of leaders in schedule cache")).unwrap(); + + static ref CURRENT_SLOT: GenericGauge = + register_int_gauge!(opts!("literpc_current_slot", "Current slot seen by last rpc")).unwrap(); + + static ref ESTIMATED_SLOT: GenericGauge = + register_int_gauge!(opts!("literpc_estimated_slot", "Estimated slot seen by last rpc")).unwrap(); +} + +pub struct LeaderData { + contact_info: Arc, + leader_slot: Slot, +} + +#[derive(Clone)] +pub struct TpuService { + cluster_nodes: Arc>>, + current_slot: Arc, + estimated_slot: Arc, + leader_schedule: Arc>>, + fanout_slots: u64, + rpc_client: Arc, + pubsub_client: Arc, + broadcast_sender: Arc>>, + tpu_connection_manager: Arc, +} + +impl TpuService { + pub async fn new( + current_slot: Arc, + fanout_slots: u64, + identity: Arc, + rpc_client: Arc, + rpc_ws_address: String, + ) -> anyhow::Result { + let slot = current_slot.load(Ordering::Relaxed); + let pubsub_client = PubsubClient::new(&rpc_ws_address).await?; + let (sender, _) = tokio::sync::broadcast::channel(MAXIMUM_TRANSACTIONS_IN_QUEUE); + let (certificate, key) = new_self_signed_tls_certificate( + identity.as_ref(), + IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), + ) + .expect("Failed to initialize QUIC client certificates"); + + let tpu_connection_manager = + TpuConnectionManager::new(certificate, key, fanout_slots as usize); + + Ok(Self { + cluster_nodes: Arc::new(DashMap::new()), + current_slot: current_slot, + estimated_slot: Arc::new(AtomicU64::new(slot)), + leader_schedule: Arc::new(RwLock::new(VecDeque::new())), + fanout_slots, + rpc_client, + pubsub_client: Arc::new(pubsub_client), + broadcast_sender: Arc::new(sender), + tpu_connection_manager: Arc::new(tpu_connection_manager), + }) + } + + pub async fn update_cluster_nodes(&self) -> Result<()> { + let cluster_nodes = self.rpc_client.get_cluster_nodes().await?; + cluster_nodes.iter().for_each(|x| { + if let Ok(pubkey) = Pubkey::from_str(x.pubkey.as_str()) { + self.cluster_nodes.insert(pubkey, Arc::new(x.clone())); + } + }); + NB_CLUSTER_NODES.set(self.cluster_nodes.len() as i64); + Ok(()) + } + + pub fn send_transaction(&self, transaction: Vec) -> anyhow::Result<()> { + self.broadcast_sender.send(transaction)?; + Ok(()) + } + + pub async fn update_leader_schedule(&self) -> Result<()> { + let current_slot = self.current_slot.load(Ordering::Relaxed); + + let (queue_begin_slot, queue_end_slot) = { + let mut leader_queue = self.leader_schedule.write().await; + // remove old leaders + while leader_queue.front().map_or(current_slot, |x| x.leader_slot) < current_slot { + leader_queue.pop_front(); + } + + let last_element = leader_queue.back().map_or(current_slot, |x| x.leader_slot); + (current_slot, last_element) + }; + + let last_slot_needed = queue_begin_slot + CACHE_NEXT_SLOT_LEADERS_PUBKEY_SIZE as u64; + + if last_slot_needed > queue_end_slot + 1 { + let first_slot_to_fetch = queue_end_slot + 1; + let leaders = self + .rpc_client + .get_slot_leaders(first_slot_to_fetch, last_slot_needed - first_slot_to_fetch) + .await?; + + let mut leader_queue = self.leader_schedule.write().await; + for i in first_slot_to_fetch..last_slot_needed { + let current_leader = (i - first_slot_to_fetch) as usize; + let leader = leaders[current_leader]; + match self.cluster_nodes.get(&leader) { + Some(r) => { + // push back the leader in the queue + leader_queue.push_back(LeaderData { + contact_info: r.value().clone(), + leader_slot: i, + }); + } + None => { + warn!("leader not found in cluster info : {}", leader.to_string()); + } + } + } + NB_OF_LEADERS_IN_SCHEDULE.set(leader_queue.len() as i64); + } + Ok(()) + } + + async fn update_quic_connections(&self) { + let estimated_slot = self.estimated_slot.load(Ordering::Relaxed); + let current_slot = self.current_slot.load(Ordering::Relaxed); + let load_slot = if estimated_slot <= current_slot { + current_slot + } else { + if estimated_slot - current_slot > 8 { + estimated_slot - 8 + } else { + current_slot + } + }; + let fanout = self.fanout_slots; + + let next_leaders = { + let leader_schedule = self.leader_schedule.read().await; + let mut next_leaders = vec![]; + for leader in leader_schedule.iter() { + if leader.leader_slot >= load_slot && leader.leader_slot <= load_slot + fanout { + next_leaders.push(leader.contact_info.clone()); + } else if leader.leader_slot > load_slot + fanout { + break; + } + } + next_leaders + }; + let connections_to_keep = next_leaders + .iter() + .filter(|x| x.tpu.is_some()) + .map(|x| { + let mut addr = x.tpu.unwrap().clone(); + // add quic port offset + addr.set_port(addr.port() + QUIC_PORT_OFFSET); + (Pubkey::from_str(x.pubkey.as_str()).unwrap(), addr) + }) + .collect(); + self.tpu_connection_manager + .update_connections(self.broadcast_sender.clone(), connections_to_keep) + .await; + } + + pub async fn start(&self) -> anyhow::Result>>> { + self.update_cluster_nodes().await?; + self.update_leader_schedule().await?; + self.update_quic_connections().await; + + let this = self.clone(); + let jh_update_leaders = tokio::spawn(async move { + let mut last_cluster_info_update = Instant::now(); + let leader_schedule_update_interval = + Duration::from_secs(LEADER_SCHEDULE_UPDATE_INTERVAL); + let cluster_info_update_interval = Duration::from_secs(CLUSTERINFO_REFRESH_TIME); + loop { + tokio::time::sleep(leader_schedule_update_interval).await; + info!("update leader schedule and cluster nodes"); + if this.update_leader_schedule().await.is_err() { + error!("unable to update leader shedule"); + } + if last_cluster_info_update.elapsed() > cluster_info_update_interval { + if this.update_cluster_nodes().await.is_err() { + error!("unable to update cluster infos"); + } else { + last_cluster_info_update = Instant::now(); + } + } + } + }); + + let pubsub_client = self.pubsub_client.clone(); + let current_slot = self.current_slot.clone(); + let (slot_sender, slot_reciever) = tokio::sync::mpsc::unbounded_channel::(); + + let slot_sub_task = tokio::spawn(async move { + let pubsub_client = pubsub_client.clone(); + let current_slot = current_slot.clone(); + loop { + let res = pubsub_client.slot_subscribe().await; + if let Ok((mut client, unsub)) = res { + loop { + let next = + tokio::time::timeout(Duration::from_millis(2000), client.next()).await; + match next { + Ok(slot_info) => { + if let Some(slot_info) = slot_info { + if slot_info.slot > current_slot.load(Ordering::Relaxed) { + current_slot.store(slot_info.slot, Ordering::Relaxed); + CURRENT_SLOT.set(slot_info.slot as i64); + let _ = slot_sender.send(slot_info.slot); + } + } + } + Err(_) => { + // timedout reconnect to pubsub + warn!("slot pub sub disconnected reconnecting"); + break; + } + } + } + unsub(); + } else if let Err(e) = res { + error!("could not subsribe to the slot {}", e); + } + } + }); + + let estimated_slot = self.estimated_slot.clone(); + let current_slot = self.current_slot.clone(); + let this = self.clone(); + let estimated_slot_calculation = tokio::spawn(async move { + // this is an estimated slot. we get the current slot and if we do not recieve any notification in 400ms we update it manually + let mut slot_reciever = slot_reciever; + loop { + let update_connections = match tokio::time::timeout( + Duration::from_millis(AVERAGE_SLOT_CHANGE_TIME_IN_MILLIS), + slot_reciever.recv(), + ) + .await + { + Ok(recv) => { + if let Some(slot) = recv { + if slot > estimated_slot.load(Ordering::Relaxed) { + // incase of multilple slot update events / take the current slot + let current_slot = current_slot.load(Ordering::Relaxed); + estimated_slot.store(current_slot, Ordering::Relaxed); + ESTIMATED_SLOT.set(current_slot as i64); + true + } else { + // queue is late estimate slot is already ahead + false + } + } else { + false + } + } + Err(_) => { + let slot = estimated_slot.fetch_add(1, Ordering::Relaxed); + ESTIMATED_SLOT.set((slot + 1) as i64); + true + } + }; + + if update_connections { + this.update_quic_connections().await; + } + } + }); + + Ok(vec![ + jh_update_leaders, + slot_sub_task, + estimated_slot_calculation, + ]) + } + + pub fn get_estimated_slot(&self) -> u64 { + self.estimated_slot.load(Ordering::Relaxed) + } +} diff --git a/src/workers/tx_sender.rs b/src/workers/tx_sender.rs index a3024472..c17109ae 100644 --- a/src/workers/tx_sender.rs +++ b/src/workers/tx_sender.rs @@ -1,8 +1,5 @@ use std::{ - sync::{ - atomic::{AtomicU64, Ordering}, - Arc, - }, + sync::Arc, time::{Duration, Instant}, }; @@ -15,16 +12,13 @@ use prometheus::{ register_int_gauge, Histogram, IntCounter, }; use solana_transaction_status::TransactionStatus; -use tokio::{ - sync::Semaphore, - sync::{mpsc::UnboundedReceiver, OwnedSemaphorePermit}, - task::JoinHandle, -}; +use tokio::{sync::mpsc::Receiver, task::JoinHandle}; use crate::{ bridge::TXS_IN_CHANNEL, - tpu_manager::TpuManager, - workers::{PostgresMsg, PostgresTx, MESSAGES_IN_POSTGRES_CHANNEL}, + workers::{ + tpu_utils::tpu_service::TpuService, PostgresMsg, PostgresTx, MESSAGES_IN_POSTGRES_CHANNEL, + }, }; use super::PostgresMpscSend; @@ -41,15 +35,13 @@ lazy_static::lazy_static! { )) .unwrap(); static ref TX_TIMED_OUT: GenericGauge = register_int_gauge!(opts!("literpc_tx_timeout", "Number of transactions that timeout")).unwrap(); - static ref TOKIO_SEND_TASKS: GenericGauge = register_int_gauge!(opts!("literpc_send_tasks_count", "Number of tasks sending confirmed transactions")).unwrap(); } pub type WireTransaction = Vec; -const NUMBER_OF_TX_SENDERS: usize = 7; // making 250 as sleep time will effectively make lite rpc send // (1000/250) * 5 * 512 = 10240 tps -const SLEEP_TIME_FOR_SENDING_TASK_MS: u64 = 250; -const MAX_NUMBER_OF_TOKIO_TASKS_SENDING_TXS: u64 = 1024; +const INTERVAL_PER_BATCH_IN_MS: u64 = 50; +const MAX_BATCH_SIZE_IN_PER_INTERVAL: usize = 2000; /// Retry transactions to a maximum of `u16` times, keep a track of confirmed transactions #[derive(Clone)] @@ -57,7 +49,7 @@ pub struct TxSender { /// Tx(s) forwarded to tpu pub txs_sent_store: Arc>, /// TpuClient to call the tpu port - pub tpu_manager: Arc, + pub tpu_service: Arc, } /// Transaction Properties @@ -77,9 +69,9 @@ impl Default for TxProps { } impl TxSender { - pub fn new(tpu_manager: Arc) -> Self { + pub fn new(tpu_service: Arc) -> Self { Self { - tpu_manager, + tpu_service, txs_sent_store: Default::default(), } } @@ -90,8 +82,6 @@ impl TxSender { sigs_and_slots: Vec<(String, u64)>, txs: Vec, postgres: Option, - permit: OwnedSemaphorePermit, - tasks_counter: Arc, ) { assert_eq!(sigs_and_slots.len(), txs.len()); @@ -102,125 +92,99 @@ impl TxSender { let histo_timer = TT_SENT_TIMER.start_timer(); let start = Instant::now(); - let tpu_client = self.tpu_manager.clone(); + let tpu_client = self.tpu_service.clone(); let txs_sent = self.txs_sent_store.clone(); for (sig, _) in &sigs_and_slots { + info!("sending transaction {}", sig); txs_sent.insert(sig.to_owned(), TxProps::default()); } - let forwarded_slot = tpu_client.estimated_current_slot().await; - let transaction_batch_size = txs.len() as u64; - let current_nb_tasks = tasks_counter.fetch_add(1, Ordering::Relaxed); - TOKIO_SEND_TASKS.set((current_nb_tasks + 1) as i64); - let tasks_counter_clone = tasks_counter.clone(); + let forwarded_slot = tpu_client.get_estimated_slot(); - tokio::spawn(async move { - let quic_response = match tpu_client.try_send_wire_transaction_batch(txs).await { + let mut quic_responses = vec![]; + for tx in txs { + let quic_response = match tpu_client.send_transaction(tx) { Ok(_) => { - TXS_SENT.inc_by(transaction_batch_size); + TXS_SENT.inc_by(1); 1 } Err(err) => { - TXS_SENT_ERRORS.inc_by(transaction_batch_size); + TXS_SENT_ERRORS.inc_by(1); warn!("{err}"); 0 } }; - tasks_counter.fetch_sub(1, Ordering::Relaxed); - - if let Some(postgres) = postgres { - let postgres_msgs = sigs_and_slots - .iter() - .map(|(sig, recent_slot)| PostgresTx { - signature: sig.clone(), - recent_slot: *recent_slot as i64, - forwarded_slot: forwarded_slot as i64, - processed_slot: None, - cu_consumed: None, - cu_requested: None, - quic_response, - }) - .collect(); - - postgres - .send(PostgresMsg::PostgresTx(postgres_msgs)) - .expect("Error writing to postgres service"); - - MESSAGES_IN_POSTGRES_CHANNEL.inc(); - } - - histo_timer.observe_duration(); - - info!( - "It took {} ms to send a batch of {} transaction(s)", - start.elapsed().as_millis(), - sigs_and_slots.len() - ); - }); - loop { - tokio::time::sleep(Duration::from_millis(SLEEP_TIME_FOR_SENDING_TASK_MS)).await; - if tasks_counter_clone.load(std::sync::atomic::Ordering::Relaxed) - < MAX_NUMBER_OF_TOKIO_TASKS_SENDING_TXS - { - break; - } - // else currently tokio has lanched too many tasks wait for some of them to get finished + quic_responses.push(quic_response); + } + if let Some(postgres) = &postgres { + let postgres_msgs = sigs_and_slots + .iter() + .enumerate() + .map(|(index, (sig, recent_slot))| PostgresTx { + signature: sig.clone(), + recent_slot: *recent_slot as i64, + forwarded_slot: forwarded_slot as i64, + processed_slot: None, + cu_consumed: None, + cu_requested: None, + quic_response: quic_responses[index], + }) + .collect(); + postgres + .send(PostgresMsg::PostgresTx(postgres_msgs)) + .expect("Error writing to postgres service"); + + MESSAGES_IN_POSTGRES_CHANNEL.inc(); } - drop(permit); + histo_timer.observe_duration(); + info!( + "It took {} ms to send a batch of {} transaction(s)", + start.elapsed().as_millis(), + sigs_and_slots.len() + ); } /// retry and confirm transactions every 2ms (avg time to confirm tx) pub fn execute( self, - mut recv: UnboundedReceiver<(String, WireTransaction, u64)>, - tx_batch_size: usize, - tx_send_interval: Duration, + mut recv: Receiver<(String, WireTransaction, u64)>, postgres_send: Option, ) -> JoinHandle> { tokio::spawn(async move { - info!( - "Batching tx(s) with batch size of {tx_batch_size} every {}ms", - tx_send_interval.as_millis() - ); - - let semaphore = Arc::new(Semaphore::new(NUMBER_OF_TX_SENDERS)); - - // To limit the maximum number of background tasks sending transactions to MAX_NUMBER_OF_TOKIO_TASKS_SENDING_TXS - let tasks_counter = Arc::new(AtomicU64::new(0)); + let tx_sender = self.clone(); loop { - let mut sigs_and_slots = Vec::with_capacity(tx_batch_size); - let mut txs = Vec::with_capacity(tx_batch_size); - let mut permit = None; - let tasks_counter = tasks_counter.clone(); - let mut timeout_interval = tx_send_interval.as_millis() as u64; + let mut sigs_and_slots = Vec::with_capacity(MAX_BATCH_SIZE_IN_PER_INTERVAL); + let mut txs = Vec::with_capacity(MAX_BATCH_SIZE_IN_PER_INTERVAL); + let mut timeout_interval = INTERVAL_PER_BATCH_IN_MS; - while txs.len() <= tx_batch_size { + // In solana there in sig verify stage rate is limited to 2000 txs in 50ms + // taking this as reference + while txs.len() <= MAX_BATCH_SIZE_IN_PER_INTERVAL { let instance = tokio::time::Instant::now(); match tokio::time::timeout(Duration::from_millis(timeout_interval), recv.recv()) .await { Ok(value) => match value { Some((sig, tx, slot)) => { + if self.txs_sent_store.contains_key(&sig) { + // duplicate transaction + continue; + } TXS_IN_CHANNEL.dec(); sigs_and_slots.push((sig, slot)); txs.push(tx); // update the timeout inteval timeout_interval = timeout_interval - .saturating_sub(instance.elapsed().as_millis() as u64).max(1); + .saturating_sub(instance.elapsed().as_millis() as u64) + .max(1); } None => { bail!("Channel Disconnected"); } }, Err(_) => { - permit = semaphore.clone().try_acquire_owned().ok(); - if permit.is_some() { - break; - } else { - // already timed out, but could not get a permit - timeout_interval = 1; - } + break; } } } @@ -231,30 +195,10 @@ impl TxSender { continue; } - let permit = match permit { - Some(permit) => permit, - None => { - // get the permit - semaphore.clone().acquire_owned().await.unwrap() - } - }; - - if !txs.is_empty() { - TX_BATCH_SIZES.set(txs.len() as i64); - let postgres = postgres_send.clone(); - let tx_sender = self.clone(); - tokio::spawn(async move { - tx_sender - .forward_txs( - sigs_and_slots, - txs, - postgres, - permit, - tasks_counter.clone(), - ) - .await; - }); - } + TX_BATCH_SIZES.set(txs.len() as i64); + tx_sender + .forward_txs(sigs_and_slots, txs, postgres_send.clone()) + .await; } }) } diff --git a/tests/client.rs b/tests/client.rs index 574df201..99ba1e8f 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -1,7 +1,7 @@ use bench::helpers::BenchHelper; use lite_rpc::DEFAULT_LITE_RPC_ADDR; use log::info; -use solana_rpc_client::{nonblocking::rpc_client::RpcClient, rpc_client::SerializableTransaction}; +use solana_rpc_client::nonblocking::rpc_client::RpcClient; use solana_sdk::commitment_config::CommitmentConfig; #[tokio::test] @@ -13,15 +13,17 @@ async fn send_and_confirm_txs_get_signature_statuses() { let funded_payer = BenchHelper::get_payer().await.unwrap(); let blockhash = rpc_client.get_latest_blockhash().await.unwrap(); - let tx = &BenchHelper::generate_txs(1, &funded_payer, blockhash)[0]; - let sig = tx.get_signature(); - - rpc_client.send_transaction(tx).await.unwrap(); - info!("{sig}"); - - BenchHelper::wait_till_signature_status(&rpc_client, sig, CommitmentConfig::confirmed()) - .await - .unwrap(); + let txs = BenchHelper::generate_txs(5, &funded_payer, blockhash, Some(1)); + let signatures = txs.iter().map(|x| x.signatures[0]).collect::>(); + + for tx in txs { + rpc_client.send_transaction(&tx).await.unwrap(); + } + for sig in signatures { + BenchHelper::wait_till_signature_status(&rpc_client, &sig, CommitmentConfig::confirmed()) + .await + .unwrap(); + } } #[tokio::test] @@ -31,10 +33,11 @@ async fn send_and_confirm_tx_rpc_client() { let funded_payer = BenchHelper::get_payer().await.unwrap(); let blockhash = rpc_client.get_latest_blockhash().await.unwrap(); - let tx = &BenchHelper::generate_txs(1, &funded_payer, blockhash)[0]; - let sig = tx.get_signature(); + let txs = BenchHelper::generate_txs(5, &funded_payer, blockhash, Some(2)); - rpc_client.send_and_confirm_transaction(tx).await.unwrap(); + for tx in txs { + rpc_client.send_and_confirm_transaction(&tx).await.unwrap(); - info!("Sent and Confirmed {sig}"); + info!("Sent and Confirmed {}", tx.signatures[0]); + } } diff --git a/tests/workers.rs b/tests/workers.rs index 18aa5c28..b8c832b6 100644 --- a/tests/workers.rs +++ b/tests/workers.rs @@ -1,13 +1,15 @@ -use std::{sync::Arc, time::Duration}; +use std::{ + sync::{atomic::AtomicU64, Arc}, + time::Duration, +}; use bench::helpers::BenchHelper; use futures::future::try_join_all; use lite_rpc::{ block_store::BlockStore, encoding::BinaryEncoding, - tpu_manager::TpuManager, - workers::{BlockListener, TxSender}, - DEFAULT_RPC_ADDR, DEFAULT_TX_BATCH_INTERVAL_MS, DEFAULT_TX_BATCH_SIZE, DEFAULT_WS_ADDR, + workers::{tpu_utils::tpu_service::TpuService, BlockListener, TxSender}, + DEFAULT_RPC_ADDR, DEFAULT_WS_ADDR, }; use solana_rpc_client::nonblocking::rpc_client::RpcClient; @@ -18,35 +20,32 @@ use tokio::sync::mpsc; #[tokio::test] async fn send_and_confirm_txs() { let rpc_client = Arc::new(RpcClient::new(DEFAULT_RPC_ADDR.to_string())); + let current_slot = rpc_client.get_slot().await.unwrap(); + + let tpu_service = TpuService::new( + Arc::new(AtomicU64::new(current_slot)), + 32, + Arc::new(Keypair::new()), + rpc_client.clone(), + DEFAULT_WS_ADDR.into(), + ) + .await + .unwrap(); - let tpu_client = Arc::new( - TpuManager::new( - rpc_client.clone(), - DEFAULT_WS_ADDR.into(), - Default::default(), - Keypair::new(), - ) - .await - .unwrap(), - ); + let tpu_client = Arc::new(tpu_service); let tx_sender = TxSender::new(tpu_client); let block_store = BlockStore::new(&rpc_client).await.unwrap(); let block_listener = BlockListener::new(rpc_client.clone(), tx_sender.clone(), block_store); - let (tx_send, tx_recv) = mpsc::unbounded_channel(); + let (tx_send, tx_recv) = mpsc::channel(1024); let services = try_join_all(vec![ block_listener .clone() .listen(CommitmentConfig::confirmed(), None), - tx_sender.clone().execute( - tx_recv, - DEFAULT_TX_BATCH_SIZE, - Duration::from_millis(DEFAULT_TX_BATCH_INTERVAL_MS), - None, - ), + tx_sender.clone().execute(tx_recv, None), ]); let confirm = tokio::spawn(async move { @@ -59,9 +58,7 @@ async fn send_and_confirm_txs() { let tx = BinaryEncoding::Base58.encode(bincode::serialize(&tx).unwrap()); let sig = sig.to_string(); - tx_send - .send((sig.clone(), tx.as_bytes().to_vec(), 0)) - .unwrap(); + let _ = tx_send.send((sig.clone(), tx.as_bytes().to_vec(), 0)).await; for _ in 0..2 { let tx_status = tx_sender.txs_sent_store.get(&sig).unwrap();