From 9c03b841b8ba038d1d911e92574add8e7053e67f Mon Sep 17 00:00:00 2001 From: austbot Date: Tue, 24 Jan 2023 13:36:11 -0600 Subject: [PATCH] enable tls --- Cargo.lock | 148 +++++++++++++++++- plerkle/Cargo.toml | 6 +- plerkle/src/geyser_plugin_nft.rs | 8 +- plerkle_messenger/Cargo.toml | 4 +- plerkle_messenger/src/redis_messenger.rs | 5 + plerkle_serialization/Cargo.toml | 2 +- .../src/serializer/serializer_stable.rs | 4 +- 7 files changed, 160 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e33d574f..8d0abc8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -522,6 +522,16 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -891,6 +901,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -1538,6 +1563,24 @@ dependencies = [ "syn", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -1611,6 +1654,51 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "ouroboros" version = "0.15.5" @@ -1724,7 +1812,7 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "plerkle" -version = "1.1.3" +version = "1.2.0" dependencies = [ "async-trait", "base64 0.13.0", @@ -1755,7 +1843,7 @@ dependencies = [ [[package]] name = "plerkle_messenger" -version = "1.1.3" +version = "1.2.0" dependencies = [ "async-mutex", "async-trait", @@ -1770,7 +1858,7 @@ dependencies = [ [[package]] name = "plerkle_serialization" -version = "1.1.3" +version = "1.2.0" dependencies = [ "chrono", "flatbuffers", @@ -1966,20 +2054,22 @@ dependencies = [ [[package]] name = "redis" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513b3649f1a111c17954296e4a3b9eecb108b766c803e2b99f179ebe27005985" +checksum = "5c1aada340fba5deba625c84d109d0a83cc3565452d38083417992a702c2428d" dependencies = [ "async-trait", "bytes", "combine", "futures-util", "itoa", + "native-tls", "percent-encoding", "pin-project-lite", "ryu", "sha1_smol", "tokio", + "tokio-native-tls", "tokio-util", "url", ] @@ -2132,6 +2222,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + [[package]] name = "scopeguard" version = "1.1.0" @@ -2154,6 +2253,29 @@ dependencies = [ "untrusted", ] +[[package]] +name = "security-framework" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645926f31b250a2dca3c232496c2d898d91036e45ca0e97e0e2390c54e11be36" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.14" @@ -3078,6 +3200,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.23.4" @@ -3241,6 +3373,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" diff --git a/plerkle/Cargo.toml b/plerkle/Cargo.toml index 93eb55d5..e706dcfc 100644 --- a/plerkle/Cargo.toml +++ b/plerkle/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "plerkle" description = "Geyser plugin with dynamic config reloading, message bus agnostic abstractions and a whole lot of fun." -version = "1.1.3" +version = "1.2.0" authors = ["Metaplex Developers "] repository = "https://github.com/metaplex-foundation/digital-asset-validator-plugin" license = "AGPL-3.0" @@ -31,9 +31,9 @@ cadence-macros = "0.29.0" chrono = "0.4.19" tracing = "0.1.35" hex = "0.4.3" -plerkle_messenger = { path = "../plerkle_messenger", version = "1.1.3", features = ["redis"] } +plerkle_messenger = { path = "../plerkle_messenger", version = "1.2.0", features = ["redis"] } flatbuffers = "22.10.26" -plerkle_serialization = { path = "../plerkle_serialization", version = "1.1.3" } +plerkle_serialization = { path = "../plerkle_serialization", version = "1.2.0" } tokio = { version = "1.23.0", features = ["full"] } figment = { version = "0.10.6", features = ["env", "test"] } diff --git a/plerkle/src/geyser_plugin_nft.rs b/plerkle/src/geyser_plugin_nft.rs index 432e94f4..d96d7b2e 100644 --- a/plerkle/src/geyser_plugin_nft.rs +++ b/plerkle/src/geyser_plugin_nft.rs @@ -381,7 +381,7 @@ impl GeyserPlugin for Plerkle<'static> { if transaction_info.is_vote || transaction_info.transaction_status_meta.status.is_err() { return Ok(()); } - + // Check if transaction was selected in config. if let Some(transaction_selector) = &self.transaction_selector { if !transaction_selector.is_transaction_selected( @@ -408,9 +408,9 @@ impl GeyserPlugin for Plerkle<'static> { builder, }; let _ = sender.send(data).await; - safe_metric(|| { - statsd_count!("transaction_seen_event", 1, "slot-idx" => &slt_idx); - }); + }); + safe_metric(|| { + statsd_count!("transaction_seen_event", 1, "slot-idx" => &slt_idx); }); Ok(()) } diff --git a/plerkle_messenger/Cargo.toml b/plerkle_messenger/Cargo.toml index 0f4aef7d..ebe8fe06 100644 --- a/plerkle_messenger/Cargo.toml +++ b/plerkle_messenger/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "plerkle_messenger" description = "Metaplex Messenger trait for Geyser plugin producer/consumer patterns." -version = "1.1.3" +version = "1.2.0" authors = ["Metaplex Developers "] repository = "https://github.com/metaplex-foundation/digital-asset-validator-plugin" license = "AGPL-3.0" @@ -9,7 +9,7 @@ edition = "2021" readme = "Readme.md" [dependencies] -redis = { version = "0.22.1", features = ["aio", "tokio-comp", "streams"], optional = true} +redis = { version = "0.22.2", features = ["aio", "tokio-comp", "streams", "tokio-native-tls-comp"], optional = true} log = "0.4.11" thiserror = "1.0.30" async-trait = "0.1.53" diff --git a/plerkle_messenger/src/redis_messenger.rs b/plerkle_messenger/src/redis_messenger.rs index 1700552d..17750675 100644 --- a/plerkle_messenger/src/redis_messenger.rs +++ b/plerkle_messenger/src/redis_messenger.rs @@ -166,6 +166,11 @@ impl Messenger for RedisMessenger { MessengerError::ConnectionError { msg: e.to_string() } })?; + let cluster_mode = config + .get("cluster_mode") + .and_then(|r| r.clone().to_bool()) + .unwrap_or(false); + let consumer_id = config .get("consumer_id") .and_then(|id| id.clone().into_string()) diff --git a/plerkle_serialization/Cargo.toml b/plerkle_serialization/Cargo.toml index 5eb82504..73ff58ed 100644 --- a/plerkle_serialization/Cargo.toml +++ b/plerkle_serialization/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "plerkle_serialization" description = "Metaplex Flatbuffers Plerkle Serialization for Geyser plugin producer/consumer patterns." -version = "1.1.3" +version = "1.2.0" authors = ["Metaplex Developers "] repository = "https://github.com/metaplex-foundation/digital-asset-validator-plugin" license = "AGPL-3.0" diff --git a/plerkle_serialization/src/serializer/serializer_stable.rs b/plerkle_serialization/src/serializer/serializer_stable.rs index c01779ea..af74c9ba 100644 --- a/plerkle_serialization/src/serializer/serializer_stable.rs +++ b/plerkle_serialization/src/serializer/serializer_stable.rs @@ -4,10 +4,10 @@ use crate::{ Reward, RewardArgs, RewardType as FBRewardType, SlotStatusInfo, SlotStatusInfoArgs, Status as FBSlotStatus, TransactionInfo, TransactionInfoArgs, }; -use chrono::{Utc, format::format}; +use chrono::{format::format, Utc}; use flatbuffers::FlatBufferBuilder; use solana_geyser_plugin_interface::geyser_plugin_interface::{ - ReplicaBlockInfo, SlotStatus, ReplicaTransactionInfoV2, ReplicaAccountInfoV2, + ReplicaAccountInfoV2, ReplicaBlockInfo, ReplicaTransactionInfoV2, SlotStatus, }; use solana_runtime::bank::RewardType;