Skip to content

Commit

Permalink
add logs n_data_bytes column
Browse files Browse the repository at this point in the history
  • Loading branch information
sslivkoff committed Jan 21, 2024
1 parent bc8fb03 commit 3ea8032
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/cli/src/parse/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,16 @@ pub(crate) fn parse_rpc_url(args: &Args) -> Result<String, ParseError> {
// 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
};
Expand Down
3 changes: 3 additions & 0 deletions crates/freeze/src/datasets/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct Logs {
topic2: Vec<Option<Vec<u8>>>,
topic3: Vec<Option<Vec<u8>>>,
data: Vec<Vec<u8>>,
n_data_bytes: Vec<u32>,
event_cols: indexmap::IndexMap<String, Vec<ethers_core::abi::Token>>,
chain_id: Vec<u64>,
}
Expand All @@ -41,6 +42,7 @@ impl Dataset for Logs {
"topic2",
"topic3",
"data",
"n_data_bytes",
// "event_cols",
"chain_id",
])
Expand Down Expand Up @@ -129,6 +131,7 @@ fn process_logs(logs: Vec<Log>, 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 {
Expand Down

0 comments on commit 3ea8032

Please sign in to comment.