From 2920d666fa315b54dc844130981c26e054ca5746 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 13:23:32 -0300 Subject: [PATCH 01/16] fix(publisher): Rollback NATS_URL for Publisher --- crates/fuel-indexer/src/main.rs | 5 ++-- .../src/nats/nats_client_opts.rs | 12 ++++++---- crates/fuel-streams-publisher/src/cli.rs | 11 ++++----- crates/fuel-streams-publisher/src/main.rs | 2 +- .../src/publisher/mod.rs | 5 ++-- .../fuel-streams-publisher/src/server/http.rs | 12 ++++++---- crates/fuel-streams/src/client/client_impl.rs | 2 +- tests/src/lib.rs | 4 ++-- tests/src/main.rs | 4 ++-- tests/tests/client.rs | 24 +++++++++---------- tests/tests/publisher.rs | 4 ++-- 11 files changed, 46 insertions(+), 39 deletions(-) diff --git a/crates/fuel-indexer/src/main.rs b/crates/fuel-indexer/src/main.rs index 453156e0..5be92fe0 100644 --- a/crates/fuel-indexer/src/main.rs +++ b/crates/fuel-indexer/src/main.rs @@ -1,5 +1,5 @@ use fuel_streams_core::{ - nats::{types::DeliverPolicy, FuelNetwork, NatsClient, NatsClientOpts}, + nats::{types::DeliverPolicy, NatsClient, NatsClientOpts}, types::{Block, Transaction}, StreamEncoder, Streamable, @@ -44,7 +44,8 @@ async fn main() -> anyhow::Result<()> { db.use_ns("fuel_indexer").use_db("fuel_indexer").await?; - let nats_client_opts = NatsClientOpts::admin_opts(FuelNetwork::Testnet); + let nats_client_opts = NatsClientOpts::admin_opts(None) + .with_custom_url("nats:4222".to_string()); let nats_client = NatsClient::connect(&nats_client_opts).await?; tokio::try_join!( diff --git a/crates/fuel-streams-core/src/nats/nats_client_opts.rs b/crates/fuel-streams-core/src/nats/nats_client_opts.rs index 124e393d..a7e8355a 100644 --- a/crates/fuel-streams-core/src/nats/nats_client_opts.rs +++ b/crates/fuel-streams-core/src/nats/nats_client_opts.rs @@ -75,21 +75,21 @@ pub struct NatsClientOpts { } impl NatsClientOpts { - pub fn new(network: FuelNetwork) -> Self { + pub fn new(network: Option) -> Self { Self { - url: network.to_url(), + url: network.unwrap_or_default().to_url(), role: NatsUserRole::default(), namespace: NatsNamespace::default(), timeout_secs: 5, } } - pub fn default_opts(network: FuelNetwork) -> Self { + pub fn default_opts(network: Option) -> Self { Self::new(network).with_role(NatsUserRole::Default) } #[cfg(any(test, feature = "test-helpers"))] - pub fn admin_opts(network: FuelNetwork) -> Self { + pub fn admin_opts(network: Option) -> Self { Self::new(network).with_role(NatsUserRole::Admin) } @@ -107,6 +107,10 @@ impl NatsClientOpts { } } + pub fn with_custom_url(self, url: String) -> Self { + Self { url, ..self } + } + #[cfg(any(test, feature = "test-helpers"))] pub fn with_rdn_namespace(self) -> Self { let namespace = format!(r"namespace-{}", Self::random_int()); diff --git a/crates/fuel-streams-publisher/src/cli.rs b/crates/fuel-streams-publisher/src/cli.rs index 0ca778e3..6f18d6ef 100644 --- a/crates/fuel-streams-publisher/src/cli.rs +++ b/crates/fuel-streams-publisher/src/cli.rs @@ -2,7 +2,6 @@ //! to publish streams that can consumed via the `fuel-streams` SDK. use clap::Parser; -use fuel_streams::types::FuelNetwork; /// CLI structure for parsing command-line arguments. /// @@ -13,12 +12,12 @@ pub struct Cli { /// Fuel Network to connect to. #[arg( long, - value_name = "NETWORK", - env = "NETWORK", - default_value = "Local", - value_parser = clap::value_parser!(FuelNetwork) + value_name = "NATS_URL", + env = "NATS_URL", + default_value = "nats:4222", + help = "NATS URL to connect to." )] - pub network: FuelNetwork, + pub nats_url: String, /// Flattened command structure for Fuel Core configuration. #[command(flatten)] pub fuel_core_config: fuel_core_bin::cli::run::Command, diff --git a/crates/fuel-streams-publisher/src/main.rs b/crates/fuel-streams-publisher/src/main.rs index 6e439fec..b9468356 100644 --- a/crates/fuel-streams-publisher/src/main.rs +++ b/crates/fuel-streams-publisher/src/main.rs @@ -26,7 +26,7 @@ async fn main() -> anyhow::Result<()> { let publisher = fuel_streams_publisher::Publisher::new( Arc::clone(&fuel_core), - cli.network, + cli.nats_url, telemetry.clone(), ) .await?; diff --git a/crates/fuel-streams-publisher/src/publisher/mod.rs b/crates/fuel-streams-publisher/src/publisher/mod.rs index 198120ef..cd86ebe5 100644 --- a/crates/fuel-streams-publisher/src/publisher/mod.rs +++ b/crates/fuel-streams-publisher/src/publisher/mod.rs @@ -35,10 +35,11 @@ pub struct Publisher { impl Publisher { pub async fn new( fuel_core: Arc, - network: FuelNetwork, + nats_url: String, telemetry: Arc, ) -> anyhow::Result { - let nats_client_opts = NatsClientOpts::admin_opts(network); + let nats_client_opts = + NatsClientOpts::admin_opts(None).with_custom_url(nats_url); let nats_client = NatsClient::connect(&nats_client_opts).await?; let streams = Arc::new(Streams::new(&nats_client).await); diff --git a/crates/fuel-streams-publisher/src/server/http.rs b/crates/fuel-streams-publisher/src/server/http.rs index 2ae2d1c7..884dd88b 100644 --- a/crates/fuel-streams-publisher/src/server/http.rs +++ b/crates/fuel-streams-publisher/src/server/http.rs @@ -66,7 +66,6 @@ mod tests { use fuel_core::service::Config; use fuel_core_bin::FuelService; use fuel_core_services::State; - use fuel_streams::types::{FuelNetwork, NatsClientOpts}; use crate::{ server::state::{HealthResponse, ServerState}, @@ -84,10 +83,13 @@ mod tests { let telemetry = Telemetry::new().await.unwrap(); let fuel_core = FuelCore::from(fuel_service); - let publisher = - Publisher::new(fuel_core.arc(), FuelNetwork::Local, telemetry) - .await - .unwrap(); + let publisher = Publisher::new( + fuel_core.arc(), + "nats://nats:4222".to_string(), + telemetry, + ) + .await + .unwrap(); let state = ServerState::new(publisher).await; assert!(state.publisher.nats_client.is_connected()); diff --git a/crates/fuel-streams/src/client/client_impl.rs b/crates/fuel-streams/src/client/client_impl.rs index 004f623d..0660dc05 100644 --- a/crates/fuel-streams/src/client/client_impl.rs +++ b/crates/fuel-streams/src/client/client_impl.rs @@ -33,7 +33,7 @@ impl Client { /// # } /// ``` pub async fn connect(network: FuelNetwork) -> Result { - let opts = NatsClientOpts::new(network); + let opts = NatsClientOpts::new(Some(network)); let conn = NatsClient::connect(&opts) .await .map_err(ClientError::ConnectionFailed)?; diff --git a/tests/src/lib.rs b/tests/src/lib.rs index f6dbc31a..ac6267df 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -31,8 +31,8 @@ impl Streams { } pub async fn server_setup() -> BoxedResult<(NatsClient, Streams)> { - let opts = - NatsClientOpts::admin_opts(FuelNetwork::Local).with_rdn_namespace(); + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) + .with_rdn_namespace(); let client = NatsClient::connect(&opts).await?; let streams = Streams::new(&client).await; Ok((client, streams)) diff --git a/tests/src/main.rs b/tests/src/main.rs index bff73368..47bfc0f7 100644 --- a/tests/src/main.rs +++ b/tests/src/main.rs @@ -75,7 +75,7 @@ async fn main() -> BoxedResult<()> { .expect("Failed to change directory to workspace root"); // ensure nats is connected and running - let client_opts = NatsClientOpts::admin_opts(FuelNetwork::Local) + let client_opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); let is_connected = Client::with_opts(&client_opts) @@ -124,7 +124,7 @@ async fn main() -> BoxedResult<()> { } } _ = action_interval.tick() => { - let client_opts = NatsClientOpts::admin_opts(FuelNetwork::Local) + let client_opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); let is_nats_connected = Client::with_opts(&client_opts).await.ok().map(|c| c.conn.is_connected()).unwrap_or_default(); diff --git a/tests/tests/client.rs b/tests/tests/client.rs index 445fb62a..06831bbd 100644 --- a/tests/tests/client.rs +++ b/tests/tests/client.rs @@ -41,7 +41,7 @@ async fn conn_streams_has_required_streams() -> BoxedResult<()> { #[tokio::test] async fn fuel_streams_client_connection() -> BoxedResult<()> { - let opts = NatsClientOpts::admin_opts(FuelNetwork::Local); + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)); let client = NatsClient::connect(&opts).await?; assert!(client.is_connected()); let client = Client::with_opts(&opts).await?; @@ -51,7 +51,7 @@ async fn fuel_streams_client_connection() -> BoxedResult<()> { #[tokio::test] async fn multiple_client_connections() -> BoxedResult<()> { - let opts = NatsClientOpts::admin_opts(FuelNetwork::Local); + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)); let tasks: Vec<_> = (0..100) .map(|_| { let opts = opts.clone(); @@ -69,7 +69,7 @@ async fn multiple_client_connections() -> BoxedResult<()> { #[tokio::test] async fn public_user_cannot_create_streams() -> BoxedResult<()> { - let opts = NatsClientOpts::default_opts(FuelNetwork::Local) + let opts = NatsClientOpts::default_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); let client = NatsClient::connect(&opts).await?; @@ -91,7 +91,7 @@ async fn public_user_cannot_create_streams() -> BoxedResult<()> { #[tokio::test] async fn public_user_cannot_create_stores() -> BoxedResult<()> { - let opts = NatsClientOpts::default_opts(FuelNetwork::Local) + let opts = NatsClientOpts::default_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); @@ -112,7 +112,7 @@ async fn public_user_cannot_create_stores() -> BoxedResult<()> { #[tokio::test] async fn public_user_cannot_delete_stores() -> BoxedResult<()> { - let opts = NatsClientOpts::admin_opts(FuelNetwork::Local) + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); @@ -127,7 +127,7 @@ async fn public_user_cannot_delete_stores() -> BoxedResult<()> { }) .await?; - let opts = NatsClientOpts::default_opts(FuelNetwork::Local) + let opts = NatsClientOpts::default_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); let client = NatsClient::connect(&opts).await?; @@ -143,7 +143,7 @@ async fn public_user_cannot_delete_stores() -> BoxedResult<()> { #[tokio::test] async fn public_user_cannot_delete_stream() -> BoxedResult<()> { - let opts = NatsClientOpts::admin_opts(FuelNetwork::Local) + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); let client = NatsClient::connect(&opts).await?; @@ -177,7 +177,7 @@ async fn public_user_cannot_delete_stream() -> BoxedResult<()> { #[tokio::test] async fn public_user_can_access_streams_after_created() { - let opts = NatsClientOpts::new(FuelNetwork::Local) + let opts = NatsClientOpts::new(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); @@ -191,7 +191,7 @@ async fn public_user_can_access_streams_after_created() { #[tokio::test] async fn public_and_admin_user_can_access_streams_after_created( ) -> BoxedResult<()> { - let admin_opts = NatsClientOpts::admin_opts(FuelNetwork::Local); + let admin_opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)); let admin_tasks: Vec>> = (0..100) .map(|_| { let opts: NatsClientOpts = admin_opts.clone(); @@ -204,7 +204,7 @@ async fn public_and_admin_user_can_access_streams_after_created( }) .collect(); - let public_opts = NatsClientOpts::default_opts(FuelNetwork::Local); + let public_opts = NatsClientOpts::default_opts(Some(FuelNetwork::Local)); let public_tasks: Vec>> = (0..100) .map(|_| { let opts: NatsClientOpts = public_opts.clone(); @@ -229,7 +229,7 @@ async fn public_and_admin_user_can_access_streams_after_created( #[tokio::test] async fn admin_user_can_delete_stream() -> BoxedResult<()> { - let opts = NatsClientOpts::admin_opts(FuelNetwork::Local) + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); let client = NatsClient::connect(&opts).await?; @@ -254,7 +254,7 @@ async fn admin_user_can_delete_stream() -> BoxedResult<()> { #[tokio::test] async fn admin_user_can_delete_stores() -> BoxedResult<()> { - let opts = NatsClientOpts::admin_opts(FuelNetwork::Local) + let opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) .with_rdn_namespace() .with_timeout(1); diff --git a/tests/tests/publisher.rs b/tests/tests/publisher.rs index d6e6a373..461f766f 100644 --- a/tests/tests/publisher.rs +++ b/tests/tests/publisher.rs @@ -312,8 +312,8 @@ fn create_test_block() -> ImporterResult { } async fn nats_client() -> NatsClient { - let nats_client_opts = - NatsClientOpts::admin_opts(FuelNetwork::Local).with_rdn_namespace(); + let nats_client_opts = NatsClientOpts::admin_opts(Some(FuelNetwork::Local)) + .with_rdn_namespace(); NatsClient::connect(&nats_client_opts) .await .expect("NATS connection failed") From e5fb527cec9487bc61190aa2506c73c2ed4d7b87 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 14:03:21 -0300 Subject: [PATCH 02/16] fix(repo): NATS_URL on missed places --- .env.sample | 1 + .github/workflows/ci.yaml | 1 + .github/workflows/publish_release.yaml | 1 + cluster/charts/fuel-streams-publisher/values.yaml | 1 + crates/fuel-streams-publisher/src/cli.rs | 2 +- docker/docker-compose.yml | 1 + docker/fuel-streams-publisher.Dockerfile | 4 ++-- scripts/run_publisher.sh | 2 +- 8 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env.sample b/.env.sample index 6d496a3b..bdf474d5 100644 --- a/.env.sample +++ b/.env.sample @@ -1,5 +1,6 @@ # Common Configuration KEYPAIR=generated-p2p-secret +NATS_URL=nats://localhost:4222 NATS_ADMIN_PASS=generated-secret NATS_PUBLIC_PASS=temp-public-pass SURREALDB_URL=127.0.0.1:8000 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 873c5b97..215e5e57 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -169,6 +169,7 @@ jobs: name: Test runs-on: ubuntu-latest env: + NATS_URL: nats://127.0.0.1:4222 NATS_ADMIN_PASS: secret NATS_PUBLIC_PASS: secret diff --git a/.github/workflows/publish_release.yaml b/.github/workflows/publish_release.yaml index 3851ccb8..bfe20fee 100644 --- a/.github/workflows/publish_release.yaml +++ b/.github/workflows/publish_release.yaml @@ -26,6 +26,7 @@ jobs: echo "$1=${!1:-$2}" >> $GITHUB_ENV echo "$1=${!1:-$2}" >> .env } + set_env_var "NATS_URL" "nats://127.0.0.1:4222" set_env_var "NATS_ADMIN_PASS" "default_pass" set_env_var "NATS_PUBLIC_PASS" "temp-public-pass" diff --git a/cluster/charts/fuel-streams-publisher/values.yaml b/cluster/charts/fuel-streams-publisher/values.yaml index 6ae65f50..7af75f9f 100644 --- a/cluster/charts/fuel-streams-publisher/values.yaml +++ b/cluster/charts/fuel-streams-publisher/values.yaml @@ -114,6 +114,7 @@ env: DB_PATH: "/mnt/db/" POA_INSTANT: "false" SERVICE_NAME: "NATS Publisher Node" + NATS_URL: "nats:4222" # Additional environment variables with complex structures # extraEnv: # - name: RELAYER diff --git a/crates/fuel-streams-publisher/src/cli.rs b/crates/fuel-streams-publisher/src/cli.rs index 6f18d6ef..5572ce77 100644 --- a/crates/fuel-streams-publisher/src/cli.rs +++ b/crates/fuel-streams-publisher/src/cli.rs @@ -14,7 +14,7 @@ pub struct Cli { long, value_name = "NATS_URL", env = "NATS_URL", - default_value = "nats:4222", + default_value = "localhost:4222", help = "NATS URL to connect to." )] pub nats_url: String, diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 725d602a..60d82dd3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -42,6 +42,7 @@ services: - RESERVED_NODES=${RESERVED_NODES} - RELAYER_V2_LISTENING_CONTRACTS=${RELAYER_V2_LISTENING_CONTRACTS} - RELAYER_DA_DEPLOY_HEIGHT=${RELAYER_DA_DEPLOY_HEIGHT} + - NATS_URL=nats://nats:4222 - RELAYER=${RELAYER} - SYNC_HEADER_BATCH_SIZE=${SYNC_HEADER_BATCH_SIZE} - RELAYER_LOG_PAGE_SIZE=${RELAYER_LOG_PAGE_SIZE} diff --git a/docker/fuel-streams-publisher.Dockerfile b/docker/fuel-streams-publisher.Dockerfile index 023e74b7..f1ba1b75 100644 --- a/docker/fuel-streams-publisher.Dockerfile +++ b/docker/fuel-streams-publisher.Dockerfile @@ -82,7 +82,7 @@ ENV RELAYER= ENV RELAYER_V2_LISTENING_CONTRACTS= ENV RELAYER_DA_DEPLOY_HEIGHT= ENV CHAIN_CONFIG= -ENV NETWORK= +ENV NATS_URL= ENV USE_PUBLISHER_METRICS= ENV USE_ELASTIC_LOGGING= @@ -108,7 +108,7 @@ EXPOSE ${TELEMETRY_PORT} # hadolint ignore=DL3025 CMD exec ./fuel-streams-publisher \ --service-name "${SERVICE_NAME}" \ - --network $NETWORK \ + --nats_url $NATS_URL \ --keypair $KEYPAIR \ --relayer $RELAYER \ --ip $IP \ diff --git a/scripts/run_publisher.sh b/scripts/run_publisher.sh index 2dfc0b7c..349e427a 100755 --- a/scripts/run_publisher.sh +++ b/scripts/run_publisher.sh @@ -100,7 +100,7 @@ COMMON_ARGS=( "--service-name" "fuel-${NETWORK}-node" "--db-path" "./docker/db-${NETWORK}" "--snapshot" "./docker/chain-config/${NETWORK}" - "--network" "local" + "--nats_url" "nats://localhost:4222" "--port" "${PORT}" "--telemetry-port" "${TELEMETRY_PORT}" "--peering-port" "30333" From bd89ab310392194f3969196e98c2c3cfcf81bb95 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 14:04:57 -0300 Subject: [PATCH 03/16] fix(publisher): NATS_URL for server tests --- crates/fuel-streams-publisher/src/server/http.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fuel-streams-publisher/src/server/http.rs b/crates/fuel-streams-publisher/src/server/http.rs index 884dd88b..32d0ec73 100644 --- a/crates/fuel-streams-publisher/src/server/http.rs +++ b/crates/fuel-streams-publisher/src/server/http.rs @@ -85,7 +85,7 @@ mod tests { let fuel_core = FuelCore::from(fuel_service); let publisher = Publisher::new( fuel_core.arc(), - "nats://nats:4222".to_string(), + "nats://localhost:4222".to_string(), telemetry, ) .await From 1c48b6400f94843f754811e1241a25742fe07025 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 14:12:35 -0300 Subject: [PATCH 04/16] ci(repo): fix tests --- crates/fuel-streams-core/README.md | 2 +- crates/fuel-streams-core/src/nats/nats_client.rs | 4 ++-- .../fuel-streams-core/src/nats/nats_client_opts.rs | 12 ++++++------ crates/fuel-streams/src/client/client_impl.rs | 2 +- crates/fuel-streams/src/client/types.rs | 2 ++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/fuel-streams-core/README.md b/crates/fuel-streams-core/README.md index 2897182e..0304865e 100644 --- a/crates/fuel-streams-core/README.md +++ b/crates/fuel-streams-core/README.md @@ -60,7 +60,7 @@ use futures::StreamExt; #[tokio::main] async fn main() -> BoxedResult<()> { // Connect to NATS server - let opts = NatsClientOpts::new(FuelNetwork::Local); + let opts = NatsClientOpts::new(Some(FuelNetwork::Local)); let client = NatsClient::connect(&opts).await?; // Create a stream for blocks diff --git a/crates/fuel-streams-core/src/nats/nats_client.rs b/crates/fuel-streams-core/src/nats/nats_client.rs index 85a578fc..3daae364 100644 --- a/crates/fuel-streams-core/src/nats/nats_client.rs +++ b/crates/fuel-streams-core/src/nats/nats_client.rs @@ -17,7 +17,7 @@ use super::{types::*, NatsClientOpts, NatsError, NatsNamespace}; /// use fuel_streams_core::prelude::*; /// /// async fn example() -> BoxedResult<()> { -/// let opts = NatsClientOpts::new(FuelNetwork::Local); +/// let opts = NatsClientOpts::new(Some(FuelNetwork::Local)); /// let client = NatsClient::connect(&opts).await?; /// Ok(()) /// } @@ -30,7 +30,7 @@ use super::{types::*, NatsClientOpts, NatsError, NatsNamespace}; /// use async_nats::jetstream::kv; /// /// async fn example() -> BoxedResult<()> { -/// let opts = NatsClientOpts::new(FuelNetwork::Local); +/// let opts = NatsClientOpts::new(Some(FuelNetwork::Local)); /// let client = NatsClient::connect(&opts).await?; /// let kv_config = kv::Config { /// bucket: "my-bucket".into(), diff --git a/crates/fuel-streams-core/src/nats/nats_client_opts.rs b/crates/fuel-streams-core/src/nats/nats_client_opts.rs index a7e8355a..139ae32f 100644 --- a/crates/fuel-streams-core/src/nats/nats_client_opts.rs +++ b/crates/fuel-streams-core/src/nats/nats_client_opts.rs @@ -40,25 +40,25 @@ impl FuelNetwork { /// Creating a new `NatsClientOpts` instance: /// /// ``` -/// use fuel_streams_core::nats::NatsClientOpts; +/// use fuel_streams_core::nats::{NatsClientOpts, FuelNetwork}; /// -/// let opts = NatsClientOpts::new(FuelNetwork::Local); +/// let opts = NatsClientOpts::new(Some(FuelNetwork::Local)); /// ``` /// /// Creating a public `NatsClientOpts`: /// /// ``` -/// use fuel_streams_core::nats::NatsClientOpts; +/// use fuel_streams_core::nats::{NatsClientOpts, FuelNetwork}; /// -/// let opts = NatsClientOpts::default_opts(FuelNetwork::Local); +/// let opts = NatsClientOpts::default_opts(Some(FuelNetwork::Local)); /// ``` /// /// Modifying `NatsClientOpts`: /// /// ``` -/// use fuel_streams_core::nats::{NatsClientOpts, NatsUserRole}; +/// use fuel_streams_core::nats::{NatsClientOpts, NatsUserRole, FuelNetwork}; /// -/// let opts = NatsClientOpts::new(FuelNetwork::Local) +/// let opts = NatsClientOpts::new(Some(FuelNetwork::Local)) /// .with_role(NatsUserRole::Admin) /// .with_timeout(10); /// ``` diff --git a/crates/fuel-streams/src/client/client_impl.rs b/crates/fuel-streams/src/client/client_impl.rs index 0660dc05..f3773e6c 100644 --- a/crates/fuel-streams/src/client/client_impl.rs +++ b/crates/fuel-streams/src/client/client_impl.rs @@ -57,7 +57,7 @@ impl Client { /// use fuel_streams_core::nats::NatsClientOpts; /// /// # async fn example() -> Result<(), fuel_streams::Error> { - /// let opts = NatsClientOpts::new(FuelNetwork::Local); + /// let opts = NatsClientOpts::new(Some(FuelNetwork::Local)); /// let client = Client::with_opts(&opts).await?; /// # Ok(()) /// # } diff --git a/crates/fuel-streams/src/client/types.rs b/crates/fuel-streams/src/client/types.rs index c49b0ad9..d3e2632e 100644 --- a/crates/fuel-streams/src/client/types.rs +++ b/crates/fuel-streams/src/client/types.rs @@ -1,3 +1,5 @@ +pub use fuel_streams_core::nats::FuelNetwork; + #[derive(Debug, Clone, Eq, PartialEq, Default)] pub enum ClientStatus { #[default] From bb6e24be716412f81dfa0aa37467f393f70d6fce Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 14:43:40 -0300 Subject: [PATCH 05/16] ci(repo): fix test to run doctests also --- Makefile | 12 +++++------- scripts/setup.sh | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 117993cb..2740d32c 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ MODES = dev profiling .PHONY: all install setup build clean lint fmt help test doc bench coverage audit \ version bump-version release release-dry-run docs docs-serve \ - test-all test-watch validate-env dev-watch ci \ + test-watch validate-env dev-watch ci \ fmt-cargo fmt-rust fmt-prettier fmt-markdown \ check lint-cargo lint-rust lint-clippy lint-prettier lint-markdown lint-machete \ coverage audit audit-fix audit-fix-test \ @@ -236,16 +236,15 @@ run-publisher: check-network # Testing # ------------------------------------------------------------ -test-all: test coverage bench - test-watch: cargo watch -x test test: - cargo nextest run --workspace --color always --locked + @cargo nextest run --workspace --color always --locked + @cargo test --doc --workspace -coverage: - RUSTFLAGS="-Z threads=8" cargo +$(RUST_NIGHTLY_VERSION) tarpaulin --config ./tarpaulin.toml +# coverage: +# RUSTFLAGS="-Z threads=8" cargo +$(RUST_NIGHTLY_VERSION) tarpaulin --config ./tarpaulin.toml # ------------------------------------------------------------ # Formatting & Linting @@ -396,7 +395,6 @@ help: @echo "" @echo "Testing:" @echo " test - Run tests" - @echo " test-all - Run all tests, coverage, and benchmarks" @echo " test-watch - Run tests in watch mode" @echo " coverage - Generate test coverage" @echo " bench - Run benchmarks" diff --git a/scripts/setup.sh b/scripts/setup.sh index ce254bed..81c3022c 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -13,11 +13,18 @@ pnpm install # Install fixed nightly toolchain rustup toolchain install nightly-2024-11-06 -c rustfmt +install_cmd="cargo binstall --force --no-confirm" + # Install cargo global crates cargo install cargo-binstall -cargo install cargo-tarpaulin -cargo install --features=ssl websocat -cargo install samply --locked -cargo install cargo-audit --locked --features=fix -cargo install cargo-nextest --locked --features=fix -cargo binstall --no-confirm cargo-watch knope cargo-sort typos-cli +$install_cmd cargo-tarpaulin +$install_cmd samply +$install_cmd cargo-watch +$install_cmd knope +$install_cmd cargo-sort +$install_cmd typos-cli +$install_cmd cargo-nextest --secure + +# Binstall does not support --features +cargo install websocat --features=ssl --force +cargo install cargo-audit --locked --features=fix --force From d7d8ae45bec875c3e00472cac01217ed5d815784 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 15:27:59 -0300 Subject: [PATCH 06/16] ci(repo): fix tests action --- .github/workflows/ci.yaml | 24 ++++++++++++++++++++---- Makefile | 11 +++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 215e5e57..8c8b9d71 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -159,19 +159,32 @@ jobs: with: config: ./.typos.toml - - uses: taiki-e/install-action@cargo-machete + - uses: taiki-e/cache-cargo-install-action@v2 + with: + tool: cargo-machete + - name: Lint project run: make lint test: needs: - cargo-verifications - name: Test + name: Test ${{ matrix.package }} runs-on: ubuntu-latest env: NATS_URL: nats://127.0.0.1:4222 NATS_ADMIN_PASS: secret NATS_PUBLIC_PASS: secret + strategy: + fail-fast: false + matrix: + package: + # - fuel-data-parser + # - fuel-indexer + - fuel-streams + - fuel-streams-core + - fuel-streams-macros + - fuel-streams-publisher steps: - uses: actions/checkout@v4 @@ -182,14 +195,17 @@ jobs: toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - name: Install nextest - uses: taiki-e/install-action@nextest + uses: taiki-e/cache-cargo-install-action@v2 + with: + tool: cargo-nextest + locked: true - name: Start Nats run: | make start/nats - name: Run tests - run: make test + run: make test PROJECT=${{ matrix.package }} - name: Stop Nats if: always() diff --git a/Makefile b/Makefile index 2740d32c..5c7efe33 100644 --- a/Makefile +++ b/Makefile @@ -236,12 +236,19 @@ run-publisher: check-network # Testing # ------------------------------------------------------------ +TEST_PROJECT ?= all + test-watch: cargo watch -x test test: - @cargo nextest run --workspace --color always --locked - @cargo test --doc --workspace + @if [ "$(TEST_PROJECT)" = "all" ]; then \ + cargo nextest run --workspace --color always --locked && \ + cargo test --doc --workspace; \ + else \ + cargo nextest run -p $(TEST_PROJECT) --color always --locked && \ + cargo test --doc -p $(TEST_PROJECT); \ + fi # coverage: # RUSTFLAGS="-Z threads=8" cargo +$(RUST_NIGHTLY_VERSION) tarpaulin --config ./tarpaulin.toml From 2da2575f1466afea9b6fc57b7d3d4443bb3e2914 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 15:39:45 -0300 Subject: [PATCH 07/16] ci(repo): decrease number of builds for prs --- .github/workflows/ci.yaml | 248 +++----------------------------------- 1 file changed, 15 insertions(+), 233 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8c8b9d71..78f6a099 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,152 +23,9 @@ concurrency: cancel-in-progress: true jobs: - validate-title: - name: Validate PR Title - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - requireScope: true - subjectPattern: ^([A-Z]).+$ - types: | - build - ci - docs - feat - fix - perf - refactor - test - scopes: | - benches - repo - deps - release - core - publisher - data-parser - fuel-streams - macros - - lockfile: - name: Validate Lockfile - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Rust - uses: ./.github/actions/setup-rust - - run: cargo update --workspace --locked - - pre-commit: - name: Pre-commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Check workflow files - uses: docker://rhysd/actionlint:latest - env: - SHELLCHECK_OPTS: --exclude=SC2086,SC2129 - with: - args: -color - - - name: Install Rust - uses: ./.github/actions/setup-rust - with: - toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - - - name: Install Python - uses: actions/setup-python@v5 - - - name: Setup Node && PNPM - uses: ./.github/actions/setup-node - - - name: Run Pre Commit - uses: pre-commit/action@v3.0.1 - - commitlint: - name: Validating commits - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node && PNPM - uses: ./.github/actions/setup-node - - - name: Validate current commit (last commit) with commitlint - if: github.event_name == 'push' - run: pnpm commitlint --last --verbose - - - name: Validate PR commits with commitlint - if: github.event_name == 'pull_request' - run: | - pnpm commitlint \ - --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \ - --to ${{ github.event.pull_request.head.sha }} \ - --verbose - - publish-crates-check: - name: Publish Check - needs: - - lockfile - - pre-commit - - commitlint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Rust - uses: ./.github/actions/setup-rust - with: - cache: false - - - name: Publish crate check - uses: katyo/publish-crates@v2 - with: - no-verify: true - dry-run: true - check-repo: false - ignore-unpublished-changes: true - - cargo-verifications: - name: Cargo verifications - needs: - - lockfile - - pre-commit - - commitlint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Rust - uses: ./.github/actions/setup-rust - with: - toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - - - name: Setup Node && PNPM - uses: ./.github/actions/setup-node - - - name: Check for typos - uses: crate-ci/typos@master - with: - config: ./.typos.toml - - - uses: taiki-e/cache-cargo-install-action@v2 - with: - tool: cargo-machete - - - name: Lint project - run: make lint - test: - needs: - - cargo-verifications + # needs: + # - cargo-verifications name: Test ${{ matrix.package }} runs-on: ubuntu-latest env: @@ -211,59 +68,9 @@ jobs: if: always() run: make stop/nats - # test-coverage: - # # if: github.event_name == 'push' && github.ref == 'refs/heads/main' - # needs: - # - cargo-verifications - # name: Test & Coverage - # runs-on: ubuntu-latest - # env: - # NATS_ADMIN_PASS: secret - # NATS_PUBLIC_PASS: temp-public-pass - # steps: - # - uses: actions/checkout@v4 - # - # - name: Install Rust - # uses: ./.github/actions/setup-rust - # with: - # toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - # target: x86_64-unknown-linux-gnu,wasm32-unknown-unknown - # cache: false - # - # - name: Start Nats - # run: | - # make start/nats - # - # - name: Install dependencies - # run: | - # sudo apt-get update - # sudo apt-get install -y libclang-dev curl - # - # - name: Install Tarpaulin (Pre-built Binary) - # uses: taiki-e/cache-cargo-install-action@v2 - # with: - # tool: cargo-tarpaulin@0.31 - # - # - name: Generate Code Coverage - # run: make coverage - # - # - name: Upload to codecov.io - # uses: codecov/codecov-action@v4 - # if: always() - # with: - # name: codecov-data-systems - # fail_ci_if_error: false - # verbose: true - # files: ./cov-reports/cobertura.xml ./cov-reports/tarpaulin-report.xml - # token: ${{ secrets.CODECOV_TOKEN }} - # - # - name: Stop Nats - # if: always() - # run: make stop/nats - build: - needs: - - cargo-verifications + # needs: + # - cargo-verifications name: Build ${{ matrix.package }} for ${{ matrix.platform.target }} runs-on: ${{ matrix.platform.os }} strategy: @@ -271,30 +78,41 @@ jobs: matrix: package: - fuel-streams-publisher + is_release: + - ${{ github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, 'ci(release): Preparing') || github.event_name == 'workflow_dispatch' }} platform: # linux x86_64 - os_name: Linux-x86_64-gnu os: ubuntu-latest target: x86_64-unknown-linux-gnu + build_on_pr: true - os_name: Linux-x86_64-musl os: ubuntu-latest target: x86_64-unknown-linux-musl + build_on_pr: false # linux aarch64 - os_name: Linux-aarch64-gnu os: ubuntu-latest target: aarch64-unknown-linux-gnu + build_on_pr: false - os_name: Linux-aarch64-musl os: ubuntu-latest target: aarch64-unknown-linux-musl + build_on_pr: false # macOS - os_name: macOS-x86_64 os: macOS-latest target: x86_64-apple-darwin + build_on_pr: true - os_name: macOS-aarch64 os: macOS-latest target: aarch64-apple-darwin + build_on_pr: false + exclude: + - is_release: false + platform: {build_on_pr: false} steps: - uses: actions/checkout@v4 @@ -356,39 +174,3 @@ jobs: path: ${{ matrix.package }}-* if-no-files-found: error retention-days: 30 - - release: - name: Create Release with Knope - if: >- - (github.event_name == 'push' && - github.ref == 'refs/heads/main' && - contains(github.event.head_commit.message, 'ci(release): Preparing')) || - github.event_name == 'workflow_dispatch' - needs: - - build - runs-on: ubuntu-latest - permissions: - contents: read - actions: write - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - merge-multiple: true - - - name: List Artifacts - run: ls -R artifacts - - - name: Run Knope Action - uses: knope-dev/action@v2.1.0 - with: - github-token: ${{ secrets.REPO_TOKEN }} - - - name: Knope Release - run: knope release - env: - GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} From b888af20e603db4ab91ddc6879d44572e259ef36 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 15:42:15 -0300 Subject: [PATCH 08/16] ci(repo): fix ci.yaml typo --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 78f6a099..7781dc9f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -79,7 +79,7 @@ jobs: package: - fuel-streams-publisher is_release: - - ${{ github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, 'ci(release): Preparing') || github.event_name == 'workflow_dispatch' }} + - ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }} platform: # linux x86_64 - os_name: Linux-x86_64-gnu From c7df55b9ba1fad13449b2816c7f499e6c35b13b4 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 15:51:45 -0300 Subject: [PATCH 09/16] ci(repo): adjust cache on setup rust --- .github/actions/setup-rust/action.yaml | 6 ++++++ .github/workflows/ci.yaml | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-rust/action.yaml b/.github/actions/setup-rust/action.yaml index 68763bc9..b35131f3 100644 --- a/.github/actions/setup-rust/action.yaml +++ b/.github/actions/setup-rust/action.yaml @@ -43,6 +43,12 @@ runs: if: inputs.cache == 'true' with: cache-on-failure: true + shared-key: "workspace-${{ inputs.target }}" + save-if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'pull_request' }} + cache-all-crates: false + cache-targets: true + workspaces: | + . -> target - name: Run sccache-cache only on non-release runs if: inputs.cache == 'true' && github.event_name != 'release' && github.event_name != 'workflow_dispatch' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7781dc9f..88a983dd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,9 +23,22 @@ concurrency: cancel-in-progress: true jobs: + compile: + name: Compile packages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: ./.github/actions/setup-rust + with: + toolchain: ${{ env.RUST_NIGHTLY_VERSION }} + + - name: Compile all packages + run: cargo build --workspace + test: - # needs: - # - cargo-verifications + needs: compile name: Test ${{ matrix.package }} runs-on: ubuntu-latest env: From a3e7380332563e15c0342fc742c30450703dbc0c Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 16:02:19 -0300 Subject: [PATCH 10/16] ci(repo): adjust profile for running tests --- .cargo/config.toml | 12 ++++++++++++ .github/workflows/ci.yaml | 4 ++-- Makefile | 11 ++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index deddd862..d639e715 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -9,3 +9,15 @@ linker = "aarch64-linux-gnu-gcc" [profile.profiling] inherits = "release" debug = 1 + +[profile.ci] +inherits = "dev" +debug = 0 +opt-level = 0 +debug-assertions = true +codegen-units = 16 +incremental = false +rpath = false +lto = false +panic = 'unwind' +overflow-checks = true diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 88a983dd..6ec79102 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,7 @@ jobs: toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - name: Compile all packages - run: cargo build --workspace + run: cargo build --profile ci --workspace test: needs: compile @@ -75,7 +75,7 @@ jobs: make start/nats - name: Run tests - run: make test PROJECT=${{ matrix.package }} + run: make test PROJECT=${{ matrix.package }} CARGO_PROFILE=ci - name: Stop Nats if: always() diff --git a/Makefile b/Makefile index 5c7efe33..fba75582 100644 --- a/Makefile +++ b/Makefile @@ -237,17 +237,18 @@ run-publisher: check-network # ------------------------------------------------------------ TEST_PROJECT ?= all +CARGO_PROFILE ?= dev test-watch: - cargo watch -x test + cargo watch -x "test --profile $(CARGO_PROFILE)" test: @if [ "$(TEST_PROJECT)" = "all" ]; then \ - cargo nextest run --workspace --color always --locked && \ - cargo test --doc --workspace; \ + cargo nextest run --profile $(CARGO_PROFILE) --workspace --color always --locked && \ + cargo test --profile $(CARGO_PROFILE) --doc --workspace; \ else \ - cargo nextest run -p $(TEST_PROJECT) --color always --locked && \ - cargo test --doc -p $(TEST_PROJECT); \ + cargo nextest run --profile $(CARGO_PROFILE) -p $(TEST_PROJECT) --color always --locked && \ + cargo test --profile $(CARGO_PROFILE) --doc -p $(TEST_PROJECT); \ fi # coverage: From 5068eaa350ec98be80392738cc2efdf75a9c27da Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 16:21:20 -0300 Subject: [PATCH 11/16] ci(repo): optimize github actions --- .cargo/config.toml | 8 ++++-- .github/actions/setup-rust/action.yaml | 2 +- .github/workflows/ci.yaml | 38 ++++++++++++++++++++++---- .github/workflows/prepare_release.yaml | 2 +- .github/workflows/publish_release.yaml | 2 +- .github/workflows/update_deps.yaml | 2 +- Makefile | 4 +-- 7 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index d639e715..b1bcc86a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -15,9 +15,13 @@ inherits = "dev" debug = 0 opt-level = 0 debug-assertions = true -codegen-units = 16 -incremental = false +codegen-units = 32 +incremental = true rpath = false lto = false panic = 'unwind' overflow-checks = true + +[net] +git-fetch-with-cli = true +parallel = true diff --git a/.github/actions/setup-rust/action.yaml b/.github/actions/setup-rust/action.yaml index b35131f3..11d83426 100644 --- a/.github/actions/setup-rust/action.yaml +++ b/.github/actions/setup-rust/action.yaml @@ -9,7 +9,7 @@ inputs: toolchain: description: Rust toolchain version to install required: true - default: 1.79.0 + default: 1.81.0 cache: description: Use sscache required: false diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ec79102..d217e82e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,9 +23,38 @@ concurrency: cancel-in-progress: true jobs: + install-deps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: ./.github/actions/setup-rust + with: + toolchain: ${{ env.RUST_NIGHTLY_VERSION }} + cache: true + + - name: Install nextest + uses: taiki-e/cache-cargo-install-action@v2 + with: + tool: cargo-nextest + locked: true + + - name: Install dependencies + run: cargo fetch + compile: - name: Compile packages + needs: install-deps + name: Compile ${{ matrix.package }} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: + - fuel-streams + - fuel-streams-core + - fuel-streams-macros + - fuel-streams-publisher steps: - uses: actions/checkout@v4 @@ -34,8 +63,8 @@ jobs: with: toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - - name: Compile all packages - run: cargo build --profile ci --workspace + - name: Compile package + run: cargo build --profile ci --package ${{ matrix.package }} test: needs: compile @@ -82,8 +111,7 @@ jobs: run: make stop/nats build: - # needs: - # - cargo-verifications + needs: test name: Build ${{ matrix.package }} for ${{ matrix.platform.target }} runs-on: ${{ matrix.platform.os }} strategy: diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 927f72d2..ec7082c6 100644 --- a/.github/workflows/prepare_release.yaml +++ b/.github/workflows/prepare_release.yaml @@ -14,7 +14,7 @@ concurrency: env: CARGO_TERM_COLOR: always CLICOLOR: 1 - RUST_VERSION: 1.79.0 + RUST_VERSION: 1.81.0 RUST_NIGHTLY_VERSION: nightly-2024-11-06 jobs: diff --git a/.github/workflows/publish_release.yaml b/.github/workflows/publish_release.yaml index bfe20fee..1e8cb9f9 100644 --- a/.github/workflows/publish_release.yaml +++ b/.github/workflows/publish_release.yaml @@ -7,7 +7,7 @@ on: env: CI: true - RUST_VERSION: 1.79.0 + RUST_VERSION: 1.81.0 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/update_deps.yaml b/.github/workflows/update_deps.yaml index 2d7f6320..2edcfea4 100644 --- a/.github/workflows/update_deps.yaml +++ b/.github/workflows/update_deps.yaml @@ -22,7 +22,7 @@ defaults: env: # Prevents cargo from complaining about unstable features RUSTC_BOOTSTRAP: 1 - RUST_VERSION: 1.79.0 + RUST_VERSION: 1.81.0 PR_TITLE: "chore(deps): weekly `cargo update`" PR_MESSAGE: | Automation to keep dependencies in `Cargo.lock` current. diff --git a/Makefile b/Makefile index fba75582..a98cfada 100644 --- a/Makefile +++ b/Makefile @@ -244,10 +244,10 @@ test-watch: test: @if [ "$(TEST_PROJECT)" = "all" ]; then \ - cargo nextest run --profile $(CARGO_PROFILE) --workspace --color always --locked && \ + cargo nextest run --cargo-profile $(CARGO_PROFILE) --workspace --color always --locked && \ cargo test --profile $(CARGO_PROFILE) --doc --workspace; \ else \ - cargo nextest run --profile $(CARGO_PROFILE) -p $(TEST_PROJECT) --color always --locked && \ + cargo nextest run --cargo-profile $(CARGO_PROFILE) -p $(TEST_PROJECT) --color always --locked && \ cargo test --profile $(CARGO_PROFILE) --doc -p $(TEST_PROJECT); \ fi From ad13592e9f3a482f2e5cec0229b1c7fd4288a5ae Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 16:42:26 -0300 Subject: [PATCH 12/16] ci(repo): test action fix --- .cargo/config.toml | 1 - .github/workflows/ci.yaml | 27 ++------------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index b1bcc86a..0eff1822 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -24,4 +24,3 @@ overflow-checks = true [net] git-fetch-with-cli = true -parallel = true diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d217e82e..8a8e5514 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,31 +43,8 @@ jobs: - name: Install dependencies run: cargo fetch - compile: - needs: install-deps - name: Compile ${{ matrix.package }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - package: - - fuel-streams - - fuel-streams-core - - fuel-streams-macros - - fuel-streams-publisher - steps: - - uses: actions/checkout@v4 - - - name: Install Rust - uses: ./.github/actions/setup-rust - with: - toolchain: ${{ env.RUST_NIGHTLY_VERSION }} - - - name: Compile package - run: cargo build --profile ci --package ${{ matrix.package }} - test: - needs: compile + needs: install-deps name: Test ${{ matrix.package }} runs-on: ubuntu-latest env: @@ -104,7 +81,7 @@ jobs: make start/nats - name: Run tests - run: make test PROJECT=${{ matrix.package }} CARGO_PROFILE=ci + run: make test PROFILE=ci TEST_PROJECT=${{ matrix.package }} - name: Stop Nats if: always() From 5be155687396ec215136089891b1514c1119ce0e Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 17:06:11 -0300 Subject: [PATCH 13/16] ci(repo): fix makefile --- .github/workflows/ci.yaml | 2 +- Makefile | 121 ++++++++++++++++++++++++-------------- 2 files changed, 78 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8a8e5514..dca427ae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -81,7 +81,7 @@ jobs: make start/nats - name: Run tests - run: make test PROFILE=ci TEST_PROJECT=${{ matrix.package }} + run: make test PROFILE=ci PACKAGE=${{ matrix.package }} - name: Stop Nats if: always() diff --git a/Makefile b/Makefile index a98cfada..7f46e4f8 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,35 @@ # ------------------------------------------------------------ -# Variables +# Core Variables (Simple Assignment) # ------------------------------------------------------------ -PACKAGE ?= fuel-streams -COMMANDS ?= rustup npm pre-commit docker python3 -RUST_NIGHTLY_VERSION ?= nightly-2024-10-18 -RUST_VERSION ?= 1.81.0 -VERSION ?= $(shell cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "$(PACKAGE)") | .version') -TILTFILE ?= ./Tiltfile +PACKAGE := fuel-streams +VERSION := $(shell cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "$(PACKAGE)") | .version') +TILTFILE := ./Tiltfile -PORT ?= 4000 -TELEMETRY_PORT ?= 8080 -MODE ?= profiling -MODES = dev profiling +# ------------------------------------------------------------ +# Tool Versions (Simple Assignment) +# ------------------------------------------------------------ + +RUST_VERSION := 1.81.0 +RUST_NIGHTLY_VERSION := nightly-2024-11-06 + +# ------------------------------------------------------------ +# Required Commands and Tools (Simple Assignment) +# ------------------------------------------------------------ + +COMMANDS := rustup npm pre-commit docker python3 + +# ------------------------------------------------------------ +# Docker Configuration (Simple Assignment) +# ------------------------------------------------------------ + +NETWORKS := mainnet testnet +PROFILES := all dev nats fuel monitoring indexer logging +MODES := dev profiling +DOCKER_COMPOSE := ./scripts/set_envs.sh && docker compose -f docker/docker-compose.yml --env-file .env # ------------------------------------------------------------ -# Phony Targets +# Phony Targets Declaration # ------------------------------------------------------------ .PHONY: all install setup build clean lint fmt help test doc bench coverage audit \ @@ -42,6 +56,7 @@ all: help version: @echo "Current version: $(VERSION)" +bump-version: NEW_VERSION ?= bump-version: @if [ -z "$(NEW_VERSION)" ]; then \ echo "Error: NEW_VERSION is required"; \ @@ -55,6 +70,7 @@ bump-version: # Release Management # ------------------------------------------------------------ +release: NEW_VERSION ?= release: validate-env test lint @if [ -z "$(NEW_VERSION)" ]; then \ echo "Error: NEW_VERSION is required"; \ @@ -70,7 +86,7 @@ release-dry-run: @knope prepare-release --dry-run # ------------------------------------------------------------ -# Setup & Validation +# Setup & Validation Targets # ------------------------------------------------------------ install: @@ -83,6 +99,7 @@ validate-env: check-commands check-versions check-dev-env @cargo --version >/dev/null 2>&1 || { echo "cargo is required but not installed"; exit 1; } @echo "Environment validation complete" +check-commands: COMMANDS ?= rustup npm pre-commit docker python3 check-commands: @for cmd in $(COMMANDS); do \ if ! command -v $$cmd >/dev/null 2>&1; then \ @@ -91,10 +108,11 @@ check-commands: fi \ done +check-network: NETWORK ?= testnet check-network: @if [ "$(NETWORK)" != "mainnet" ] && [ "$(NETWORK)" != "testnet" ]; then \ echo "Error: NETWORK must be either 'mainnet' or 'testnet'"; \ - exit 1; \ + exit 1; \ fi check-versions: @@ -110,12 +128,12 @@ check-dev-env: cp .env.example .env; \ fi -setup: COMMANDS=rustup npm pre-commit +setup: COMMANDS := rustup npm pre-commit setup: check-commands check-versions check-dev-env ./scripts/setup.sh # ------------------------------------------------------------ -# Development +# Development Targets # ------------------------------------------------------------ dev-watch: @@ -130,11 +148,9 @@ clean/build: rm -rf target/ rm -rf node_modules/ - -REPO_OWNER ?= fuellabs -REPO_NAME ?= data-systems -DAYS_TO_KEEP ?= 15 - +cleanup_artifacts: REPO_OWNER ?= fuellabs +cleanup_artifacts: REPO_NAME ?= data-systems +cleanup_artifacts: DAYS_TO_KEEP ?= 15 cleanup_artifacts: @echo "Running artifact cleanup..." @./scripts/cleanup_artifacts.sh $(REPO_OWNER) $(REPO_NAME) $(DAYS_TO_KEEP) @@ -167,17 +183,6 @@ define docker_cmd NETWORK=$(1) PORT=$(2) TELEMETRY_PORT=$(3) $(DOCKER_COMPOSE) --profile $(4) $(5) endef -start: - $(call docker_cmd,$(NETWORK),$(PORT),$(TELEMETRY_PORT),$(PROFILE),up -d) - -stop: - $(call docker_cmd,$(NETWORK),$(PORT),$(TELEMETRY_PORT),$(PROFILE),down) - -restart: stop start - -clean/docker: stop - $(call docker_cmd,$(NETWORK),$(PORT),$(TELEMETRY_PORT),$(PROFILE),down -v --rmi all --remove-orphans) - # Define rules for network-only, profile-only, and network-profile combinations define profile_rules # Original profile rules (without network) @@ -210,14 +215,33 @@ $(foreach p,$(PROFILES),$(eval $(call profile_rules,,$(p)))) # Generate rules for all network-profile combinations $(foreach n,$(NETWORKS),$(foreach p,$(PROFILES),$(eval $(call profile_rules,$(n),$(p))))) +start: NETWORK ?= testnet +start: PORT ?= 4000 +start: TELEMETRY_PORT ?= 8080 +start: PROFILE ?= all +start: + $(call docker_cmd,$(NETWORK),$(PORT),$(TELEMETRY_PORT),$(PROFILE),up -d) + +stop: NETWORK ?= testnet +stop: PORT ?= 4000 +stop: TELEMETRY_PORT ?= 8080 +stop: PROFILE ?= all +stop: + $(call docker_cmd,$(NETWORK),$(PORT),$(TELEMETRY_PORT),$(PROFILE),down) + +restart: stop start + +clean/docker: stop + $(call docker_cmd,$(NETWORK),$(PORT),$(TELEMETRY_PORT),$(PROFILE),down -v --rmi all --remove-orphans) + # ------------------------------------------------------------ # Publisher Run Commands (Local Development) # ------------------------------------------------------------ -PUBLISHER_SCRIPT = ./scripts/run_publisher.sh -EXTRA_ARGS ?= +PUBLISHER_SCRIPT := ./scripts/run_publisher.sh # Define how to run the publisher script +publisher_%: EXTRA_ARGS ?= publisher_%: @network=$$(echo "$**" | cut -d'-' -f2) && \ $(PUBLISHER_SCRIPT) --network $$network --mode $$mode --port $(PORT) --telemetry-port $(TELEMETRY_PORT) $(if $(EXTRA_ARGS),--extra-args "$(EXTRA_ARGS)") @@ -229,6 +253,11 @@ run-testnet-dev: check-network publisher_testnet-dev ## Run publisher in run-testnet-profiling: check-network publisher_testnet-profiling ## Run publisher in testnet profiling mode # Generic publisher command using environment variables +run-publisher: NETWORK ?= testnet +run-publisher: MODE ?= dev +run-publisher: PORT ?= 4000 +run-publisher: TELEMETRY_PORT ?= 8080 +run-publisher: EXTRA_ARGS ?= run-publisher: check-network @$(PUBLISHER_SCRIPT) --network $(NETWORK) --mode $(MODE) --port $(PORT) --telemetry-port $(TELEMETRY_PORT) $(if $(EXTRA_ARGS),--extra-args "$(EXTRA_ARGS)") @@ -236,24 +265,27 @@ run-publisher: check-network # Testing # ------------------------------------------------------------ -TEST_PROJECT ?= all -CARGO_PROFILE ?= dev - +test-watch: PROFILE ?= dev test-watch: - cargo watch -x "test --profile $(CARGO_PROFILE)" + cargo watch -x "test --profile $(PROFILE)" +test: PACKAGE ?= all +test: PROFILE ?= dev test: - @if [ "$(TEST_PROJECT)" = "all" ]; then \ - cargo nextest run --cargo-profile $(CARGO_PROFILE) --workspace --color always --locked && \ - cargo test --profile $(CARGO_PROFILE) --doc --workspace; \ + @if [ "$(PACKAGE)" = "all" ]; then \ + cargo nextest run --cargo-profile $(PROFILE) --workspace --color always --locked --no-tests=pass && \ + cargo test --profile $(PROFILE) --doc --workspace; \ else \ - cargo nextest run --cargo-profile $(CARGO_PROFILE) -p $(TEST_PROJECT) --color always --locked && \ - cargo test --profile $(CARGO_PROFILE) --doc -p $(TEST_PROJECT); \ + cargo nextest run --cargo-profile $(PROFILE) -p $(PACKAGE) --color always --locked --no-tests=pass && \ + cargo test --profile $(PROFILE) --doc -p $(PACKAGE); \ fi # coverage: # RUSTFLAGS="-Z threads=8" cargo +$(RUST_NIGHTLY_VERSION) tarpaulin --config ./tarpaulin.toml +bench: + cargo bench -p data-parser -p nats-publisher -p bench-consumers + # ------------------------------------------------------------ # Formatting & Linting # ------------------------------------------------------------ @@ -262,6 +294,7 @@ check: cargo check --all-targets --all-features fmt: fmt-cargo fmt-rust fmt-prettier fmt-markdown + lint: check lint-cargo lint-rust lint-clippy lint-prettier lint-markdown lint-machete fmt-cargo: @@ -308,7 +341,7 @@ audit-fix: cargo audit fix # ------------------------------------------------------------ -# Build, Test, and Documentation +# Build & Documentation # ------------------------------------------------------------ build: From 6911664e716b81be4fdb92b6f70137346d748185 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 17:24:34 -0300 Subject: [PATCH 14/16] ci(repo): add missing ci checks --- .github/workflows/ci.yaml | 181 +++++++++++++++++++++++++++++++++++++- 1 file changed, 180 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dca427ae..1a0c58f3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,7 +23,150 @@ concurrency: cancel-in-progress: true jobs: + validate-title: + name: Validate PR Title + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + requireScope: true + subjectPattern: ^([A-Z]).+$ + types: | + build + ci + docs + feat + fix + perf + refactor + test + scopes: | + benches + repo + deps + release + core + publisher + data-parser + fuel-streams + macros + + lockfile: + name: Validate Lockfile + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: ./.github/actions/setup-rust + - run: cargo update --workspace --locked + + pre-commit: + name: Pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check workflow files + uses: docker://rhysd/actionlint:latest + env: + SHELLCHECK_OPTS: --exclude=SC2086,SC2129 + with: + args: -color + + - name: Install Rust + uses: ./.github/actions/setup-rust + with: + toolchain: ${{ env.RUST_NIGHTLY_VERSION }} + + - name: Install Python + uses: actions/setup-python@v5 + + - name: Setup Node && PNPM + uses: ./.github/actions/setup-node + + - name: Run Pre Commit + uses: pre-commit/action@v3.0.1 + + commitlint: + name: Validating commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node && PNPM + uses: ./.github/actions/setup-node + + - name: Validate current commit (last commit) with commitlint + if: github.event_name == 'push' + run: pnpm commitlint --last --verbose + + - name: Validate PR commits with commitlint + if: github.event_name == 'pull_request' + run: | + pnpm commitlint \ + --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \ + --to ${{ github.event.pull_request.head.sha }} \ + --verbose + + publish-crates-check: + name: Publish Check + needs: + - lockfile + - pre-commit + - commitlint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: ./.github/actions/setup-rust + with: + cache: false + + - name: Publish crate check + uses: katyo/publish-crates@v2 + with: + no-verify: true + dry-run: true + check-repo: false + ignore-unpublished-changes: true + + cargo-verifications: + name: Cargo verifications + needs: + - lockfile + - pre-commit + - commitlint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: ./.github/actions/setup-rust + with: + toolchain: ${{ env.RUST_NIGHTLY_VERSION }} + + - name: Setup Node && PNPM + uses: ./.github/actions/setup-node + + - name: Check for typos + uses: crate-ci/typos@master + with: + config: ./.typos.toml + + - uses: taiki-e/install-action@cargo-machete + - name: Lint project + run: make lint + install-deps: + needs: + - cargo-verifications + - publish-crates-check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -88,7 +231,7 @@ jobs: run: make stop/nats build: - needs: test + needs: install-deps name: Build ${{ matrix.package }} for ${{ matrix.platform.target }} runs-on: ${{ matrix.platform.os }} strategy: @@ -192,3 +335,39 @@ jobs: path: ${{ matrix.package }}-* if-no-files-found: error retention-days: 30 + + release: + name: Create Release with Knope + if: >- + (github.event_name == 'push' && + github.ref == 'refs/heads/main' && + contains(github.event.head_commit.message, 'ci(release): Preparing')) || + github.event_name == 'workflow_dispatch' + needs: + - build + runs-on: ubuntu-latest + permissions: + contents: read + actions: write + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + merge-multiple: true + + - name: List Artifacts + run: ls -R artifacts + + - name: Run Knope Action + uses: knope-dev/action@v2.1.0 + with: + github-token: ${{ secrets.REPO_TOKEN }} + + - name: Knope Release + run: knope release + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} From bd2ed343b2117072b5bddc4317da091a7f5f63bf Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 17:26:26 -0300 Subject: [PATCH 15/16] build(repo): bump helm chart --- .../charts/fuel-streams-publisher/Chart.yaml | 2 +- .../charts/fuel-streams-publisher/values.yaml | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cluster/charts/fuel-streams-publisher/Chart.yaml b/cluster/charts/fuel-streams-publisher/Chart.yaml index c9aee49c..a0d0d27c 100644 --- a/cluster/charts/fuel-streams-publisher/Chart.yaml +++ b/cluster/charts/fuel-streams-publisher/Chart.yaml @@ -13,7 +13,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.3.8 +version: 0.3.9 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. diff --git a/cluster/charts/fuel-streams-publisher/values.yaml b/cluster/charts/fuel-streams-publisher/values.yaml index 7af75f9f..1a145e23 100644 --- a/cluster/charts/fuel-streams-publisher/values.yaml +++ b/cluster/charts/fuel-streams-publisher/values.yaml @@ -102,19 +102,6 @@ persistence: accessMode: ReadWriteOnce annotations: {} -env: - RELAYER_V2_LISTENING_CONTRACTS: "0xAEB0c00D0125A8a788956ade4f4F12Ead9f65DDf" - RELAYER_DA_DEPLOY_HEIGHT: "20620434" - RELAYER_LOG_PAGE_SIZE: "2000" - SYNC_HEADER_BATCH_SIZE: "100" - P2P_PORT: "30333" - RESERVED_NODES: "/dnsaddr/mainnet.fuel.network" - CHAIN_CONFIG: "mainnet" - PUBLISHER_MAX_THREADS: "32" - DB_PATH: "/mnt/db/" - POA_INSTANT: "false" - SERVICE_NAME: "NATS Publisher Node" - NATS_URL: "nats:4222" # Additional environment variables with complex structures # extraEnv: # - name: RELAYER @@ -139,3 +126,16 @@ env: # - secretRef: # name: additional-secrets +env: + RELAYER_V2_LISTENING_CONTRACTS: "0xAEB0c00D0125A8a788956ade4f4F12Ead9f65DDf" + RELAYER_DA_DEPLOY_HEIGHT: "20620434" + RELAYER_LOG_PAGE_SIZE: "2000" + SYNC_HEADER_BATCH_SIZE: "100" + P2P_PORT: "30333" + RESERVED_NODES: "/dnsaddr/mainnet.fuel.network" + CHAIN_CONFIG: "mainnet" + PUBLISHER_MAX_THREADS: "32" + DB_PATH: "/mnt/db/" + POA_INSTANT: "false" + SERVICE_NAME: "NATS Publisher Node" + NATS_URL: "nats:4222" From 85a42d18203d81c62ee903763be609dbcbcc2f08 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 3 Dec 2024 17:48:01 -0300 Subject: [PATCH 16/16] build(repo): small adjustments --- .github/workflows/ci.yaml | 1 + Makefile | 6 +++--- crates/fuel-streams-publisher/src/telemetry/mod.rs | 1 + crates/fuel-streams-publisher/src/telemetry/system.rs | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1a0c58f3..ef0d6ac6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -164,6 +164,7 @@ jobs: run: make lint install-deps: + name: Install dependencies needs: - cargo-verifications - publish-crates-check diff --git a/Makefile b/Makefile index 7f46e4f8..dd751812 100644 --- a/Makefile +++ b/Makefile @@ -310,13 +310,13 @@ fmt-markdown: pnpm md:fix lint-cargo: - cargo sort -w --check + cargo sort -w --check --workspace lint-rust: - cargo +$(RUST_NIGHTLY_VERSION) fmt -- --check --color always + cargo +$(RUST_NIGHTLY_VERSION) fmt --all --check -- --color always lint-clippy: - cargo clippy --workspace -- -D warnings + cargo clippy --workspace --all-targets --all-features -- -D warnings lint-prettier: pnpm prettier:validate diff --git a/crates/fuel-streams-publisher/src/telemetry/mod.rs b/crates/fuel-streams-publisher/src/telemetry/mod.rs index a8ad7dcf..13e1ebe1 100644 --- a/crates/fuel-streams-publisher/src/telemetry/mod.rs +++ b/crates/fuel-streams-publisher/src/telemetry/mod.rs @@ -1,6 +1,7 @@ mod elastic_search; mod publisher; mod runtime; +#[allow(clippy::needless_borrows_for_generic_args)] mod system; use std::{sync::Arc, time::Duration}; diff --git a/crates/fuel-streams-publisher/src/telemetry/system.rs b/crates/fuel-streams-publisher/src/telemetry/system.rs index dfd1acbd..ec0f14eb 100644 --- a/crates/fuel-streams-publisher/src/telemetry/system.rs +++ b/crates/fuel-streams-publisher/src/telemetry/system.rs @@ -596,6 +596,7 @@ mod tests { .collect(), }, }; + let output = serde_prometheus::to_string(&metrics, None, &[]) .expect("prometheus");