From 8618fe8998d071951c17d65e67b2349d93b5cf27 Mon Sep 17 00:00:00 2001 From: Nagaprasadvr Date: Fri, 17 Jan 2025 11:58:58 +0530 Subject: [PATCH] resolve comments and fix clippy --- digital_asset_types/src/dapi/change_logs.rs | 2 +- digital_asset_types/tests/common.rs | 2 ++ grpc-ingest/src/config.rs | 23 ++++---------- grpc-ingest/src/prom.rs | 2 +- grpc-ingest/src/redis.rs | 33 ++++++++++----------- nft_ingester/src/backfiller.rs | 1 + program_transformers/src/bubblegum/db.rs | 2 +- 7 files changed, 27 insertions(+), 38 deletions(-) diff --git a/digital_asset_types/src/dapi/change_logs.rs b/digital_asset_types/src/dapi/change_logs.rs index fdd19ddf9..4742696f0 100644 --- a/digital_asset_types/src/dapi/change_logs.rs +++ b/digital_asset_types/src/dapi/change_logs.rs @@ -206,7 +206,7 @@ fn build_asset_proof( let mut final_node_list = vec![SimpleChangeLog::default(); req_indexes.len()]; for node in required_nodes.iter() { if node.level < final_node_list.len().try_into().unwrap() { - final_node_list[node.level as usize] = node.to_owned(); + node.clone_into(&mut final_node_list[node.level as usize]) } } for (i, (n, nin)) in final_node_list diff --git a/digital_asset_types/tests/common.rs b/digital_asset_types/tests/common.rs index 6f40f610e..414cff714 100644 --- a/digital_asset_types/tests/common.rs +++ b/digital_asset_types/tests/common.rs @@ -31,8 +31,10 @@ pub struct MockMetadataArgs { /// Since we cannot easily change Metadata, we add the new DataV2 fields here at the end. pub token_standard: Option, /// Collection + #[allow(dead_code)] pub collection: Option, /// Uses + #[allow(dead_code)] pub uses: Option, pub creators: Vec, } diff --git a/grpc-ingest/src/config.rs b/grpc-ingest/src/config.rs index b34ba8fe8..9699215bc 100644 --- a/grpc-ingest/src/config.rs +++ b/grpc-ingest/src/config.rs @@ -111,19 +111,6 @@ impl ConfigIngestStream { } } -#[derive(Debug, Clone, Deserialize, Default)] -#[serde(default)] -pub struct ConfigTopograph { - #[serde(default = "ConfigTopograph::default_num_threads")] - pub num_threads: usize, -} - -impl ConfigTopograph { - pub const fn default_num_threads() -> usize { - 5 - } -} - #[derive(Debug, Clone, Default, Deserialize)] #[serde(default)] pub struct ConfigPrometheus { @@ -297,12 +284,12 @@ pub struct ConfigIngesterDownloadMetadata { default = "ConfigIngesterDownloadMetadata::default_num_threads", deserialize_with = "deserialize_usize_str" )] - pub num_threads: usize, + pub _num_threads: usize, #[serde( default = "ConfigIngesterDownloadMetadata::default_max_attempts", deserialize_with = "deserialize_usize_str" )] - pub max_attempts: usize, + pub _max_attempts: usize, #[serde( default = "ConfigIngesterDownloadMetadata::default_request_timeout", deserialize_with = "deserialize_duration_str", @@ -318,13 +305,13 @@ pub struct ConfigIngesterDownloadMetadata { default = "ConfigIngesterDownloadMetadata::default_stream_max_size", deserialize_with = "deserialize_usize_str" )] - pub pipeline_max_size: usize, + pub _pipeline_max_size: usize, #[serde( default = "ConfigIngesterDownloadMetadata::default_pipeline_max_idle", deserialize_with = "deserialize_duration_str", rename = "pipeline_max_idle_ms" )] - pub pipeline_max_idle: Duration, + pub _pipeline_max_idle: Duration, } impl ConfigIngesterDownloadMetadata { @@ -366,7 +353,7 @@ pub struct ConfigBubblegumVerify { default = "ConfigBubblegumVerify::default_report_interval", deserialize_with = "deserialize_duration_str" )] - pub report_interval: Duration, + pub _report_interval: Duration, #[serde(default)] pub only_trees: Option>, #[serde( diff --git a/grpc-ingest/src/prom.rs b/grpc-ingest/src/prom.rs index 41280b67e..b4ff567fe 100644 --- a/grpc-ingest/src/prom.rs +++ b/grpc-ingest/src/prom.rs @@ -261,7 +261,7 @@ pub fn grpc_tasks_total_dec(label: &str, stream: &str) { GRPC_TASKS.with_label_values(&[label, stream]).dec() } -pub fn download_metadata_json_task_inc(status: u16) { +pub fn download_metadata_json_task_status_count_inc(status: u16) { DOWNLOAD_METADATA_FETCHED_COUNT .with_label_values(&[&status.to_string()]) .inc(); diff --git a/grpc-ingest/src/redis.rs b/grpc-ingest/src/redis.rs index 8ed5ac689..7188f2147 100644 --- a/grpc-ingest/src/redis.rs +++ b/grpc-ingest/src/redis.rs @@ -2,7 +2,7 @@ use { crate::{ config::{ConfigIngestStream, REDIS_STREAM_DATA_KEY}, prom::{ - ack_tasks_total_dec, ack_tasks_total_inc, download_metadata_json_task_inc, + ack_tasks_total_dec, ack_tasks_total_inc, download_metadata_json_task_status_count_inc, ingest_job_time_set, ingest_tasks_total_dec, ingest_tasks_total_inc, program_transformer_task_status_inc, redis_xack_inc, redis_xlen_set, redis_xread_inc, ProgramTransformerTaskStatusKind, @@ -203,22 +203,21 @@ impl MessageHandler for DownloadMetadataJsonHandle { Box::pin(async move { let info = DownloadMetadataInfo::try_parse_msg(input)?; - download_metadata - .handle_download(&info) - .await - .map(|_| { - download_metadata_json_task_inc(200); - }) - .map_err(|e| { - if let MetadataJsonTaskError::Fetch(FetchMetadataJsonError::Response { - status: StatusCode::Code(code), - .. - }) = &e - { - download_metadata_json_task_inc(code.as_u16()); - } - IngestMessageError::DownloadMetadataJson(e) - }) + let response = download_metadata.handle_download(&info).await; + let status = + if let Err(MetadataJsonTaskError::Fetch(FetchMetadataJsonError::Response { + status: StatusCode::Code(code), + .. + })) = response + { + code.as_u16() + } else { + 200 + }; + + download_metadata_json_task_status_count_inc(status); + + response.map_err(IngestMessageError::DownloadMetadataJson) }) } } diff --git a/nft_ingester/src/backfiller.rs b/nft_ingester/src/backfiller.rs index 7fbb1c214..39d8106c2 100644 --- a/nft_ingester/src/backfiller.rs +++ b/nft_ingester/src/backfiller.rs @@ -66,6 +66,7 @@ const BLOCK_CACHE_SIZE: usize = 300_000; const MAX_CACHE_COST: i64 = 32; const BLOCK_CACHE_DURATION: u64 = 172800; +#[allow(dead_code)] struct SlotSeq(u64, u64); /// Main public entry point for backfiller task. pub fn setup_backfiller( diff --git a/program_transformers/src/bubblegum/db.rs b/program_transformers/src/bubblegum/db.rs index 4c8c33f4a..470fab631 100644 --- a/program_transformers/src/bubblegum/db.rs +++ b/program_transformers/src/bubblegum/db.rs @@ -504,7 +504,7 @@ where pub async fn upsert_asset_creators( txn: &T, id: Vec, - creators: &Vec, + creators: &[Creator], slot_updated: i64, seq: i64, ) -> ProgramTransformerResult<()>