From 3ea80320098237006bfee609cf34a8dd052f9ed5 Mon Sep 17 00:00:00 2001 From: sslivkoff Date: Sat, 20 Jan 2024 20:11:59 -0800 Subject: [PATCH] add logs n_data_bytes column --- crates/cli/src/parse/source.rs | 12 +++++++++--- crates/freeze/src/datasets/logs.rs | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/cli/src/parse/source.rs b/crates/cli/src/parse/source.rs index c8e1a604..90cff194 100644 --- a/crates/cli/src/parse/source.rs +++ b/crates/cli/src/parse/source.rs @@ -80,10 +80,16 @@ pub(crate) fn parse_rpc_url(args: &Args) -> Result { // get MESC url let mesc_url = if mesc::is_mesc_enabled() { let endpoint = match &args.rpc { - Some(url) => mesc::get_endpoint_by_query(url, Some("cryo"))?, - None => mesc::get_default_endpoint(Some("cryo"))?, + Some(url) => mesc::get_endpoint_by_query(url, Some("cryo")), + None => mesc::get_default_endpoint(Some("cryo")), }; - endpoint.map(|endpoint| endpoint.url) + match endpoint { + Ok(endpoint) => endpoint.map(|endpoint| endpoint.url), + Err(e) => { + eprintln!("Could not load MESC data: {}", e); + None + } + } } else { None }; diff --git a/crates/freeze/src/datasets/logs.rs b/crates/freeze/src/datasets/logs.rs index 666d7c9d..ca34c540 100644 --- a/crates/freeze/src/datasets/logs.rs +++ b/crates/freeze/src/datasets/logs.rs @@ -18,6 +18,7 @@ pub struct Logs { topic2: Vec>>, topic3: Vec>>, data: Vec>, + n_data_bytes: Vec, event_cols: indexmap::IndexMap>, chain_id: Vec, } @@ -41,6 +42,7 @@ impl Dataset for Logs { "topic2", "topic3", "data", + "n_data_bytes", // "event_cols", "chain_id", ]) @@ -129,6 +131,7 @@ fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); store!(schema, columns, address, log.address.as_bytes().to_vec()); store!(schema, columns, data, log.data.to_vec()); + store!(schema, columns, n_data_bytes, log.data.len() as u32); // topics for i in 0..4 {