Skip to content

Commit

Permalink
Merge pull request #71 from paradigmxyz/undo_last_two
Browse files Browse the repository at this point in the history
revert 2 commits for refactor merge, will add back in exponential backoff code after merging refactor
  • Loading branch information
sslivkoff authored Oct 10, 2023
2 parents 5e4c4e9 + a03790b commit d234dd3
Show file tree
Hide file tree
Showing 40 changed files with 252 additions and 3,524 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ governor = "0.5.1"
hex = "0.4.3"
indexmap = "2.0.0"
indicatif = "0.17.5"
lazy_static = "1.4.0"
polars = { version = "0.32.1", features = [
"parquet",
"string_encoding",
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@ Many `cryo` cli options will affect output schemas by adding/removing columns or
#### Schema Design Guide

An attempt is made to ensure that the dataset schemas conform to a common set of design guidelines:
- By default, rows should contain enough information in their columns to be order-able (unless the rows do not have an intrinsic order)
- By default, rows should contain enough information be order-able
- Columns should be named by their JSON-RPC or ethers.rs defaults, except in cases where a much more explicit name is available
- To make joins across tables easier, a given piece of information should use the same datatype and column name across tables when possible
- Large ints such as `u256` should allow multiple conversions. A `value` column of type `u256` should allow: `value_binary`, `value_string`, `value_f32`, `value_f64`, `value_u32`, `value_u64`, and `value_d128`
- By default, columns related to non-identifying cryptographic signatures are omitted by default. For example, `state_root` of a block or `v`/`r`/`s` of a transaction
- Integer values that can never be negative should be stored as unsigned integers
- Every table should allow an optional `chain_id` column so that data from multiple chains can be easily stored in the same table.

Standard types across tables:
- `block_number`: `u32`
Expand Down
42 changes: 3 additions & 39 deletions crates/cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ pub struct Args {
#[arg(short('l'), long, value_name = "limit", help_heading = "Acquisition Options")]
pub requests_per_second: Option<u32>,

/// Specify max retries on provider errors
#[arg(long, default_value_t = 5, value_name = "R", help_heading = "Acquisition Options")]
pub max_retries: u32,

/// Specify initial backoff for retry strategy (ms)
#[arg(long, default_value_t = 500, value_name = "B", help_heading = "Acquisition Options")]
pub initial_backoff: u64,

/// Global number of concurrent requests
#[arg(long, value_name = "M", help_heading = "Acquisition Options")]
pub max_concurrent_requests: Option<u64>,
Expand Down Expand Up @@ -155,37 +147,9 @@ pub struct Args {
#[arg(long, help_heading = "Output Options")]
pub no_report: bool,

/// Address
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..))]
pub address: Option<Vec<String>>,

/// To Address
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..), value_name="TO")]
pub to_address: Option<Vec<String>>,

/// From Address
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..), value_name="FROM")]
pub from_address: Option<Vec<String>>,

/// [eth_calls] Call data to use for eth_calls
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..))]
pub call_data: Option<Vec<String>>,

/// [eth_calls] Function to use for eth_calls
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..))]
pub function: Option<Vec<String>>,

/// [eth_calls] Inputs to use for eth_calls
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..))]
pub inputs: Option<Vec<String>>,

/// [slots] Slots
#[arg(long, help_heading = "Dataset-specific Options", num_args(1..))]
pub slots: Option<Vec<String>>,

/// [logs] filter logs by contract address
#[arg(long, help_heading = "Dataset-specific Options")]
pub contract: Option<Vec<String>>,
pub contract: Option<String>,

/// [logs] filter logs by topic0
#[arg(long, visible_alias = "event", help_heading = "Dataset-specific Options")]
Expand All @@ -206,14 +170,14 @@ pub struct Args {
/// [logs] Blocks per request
#[arg(
long,
value_name = "SIZE",
value_name = "BLOCKS",
default_value_t = 1,
help_heading = "Dataset-specific Options"
)]
pub inner_request_size: u64,

/// [logs] event signature to parse
#[arg(long, value_name = "SIGNATURE", help_heading = "Dataset-specific Options")]
#[arg(long, help_heading = "Dataset-specific Options")]
pub event_signature: Option<String>,
}

Expand Down
12 changes: 2 additions & 10 deletions crates/cli/src/parse/blocks.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use ethers::prelude::*;
use polars::prelude::*;
use std::collections::HashMap;

use cryo_freeze::{BlockChunk, Chunk, ChunkData, Datatype, Fetcher, ParseError, Subchunk, Table};
use cryo_freeze::{BlockChunk, Chunk, ChunkData, Fetcher, ParseError, Subchunk};

use crate::args::Args;

Expand Down Expand Up @@ -124,15 +123,8 @@ async fn postprocess_block_chunks<P: JsonRpcClient>(
pub(crate) async fn get_default_block_chunks<P: JsonRpcClient>(
args: &Args,
fetcher: Arc<Fetcher<P>>,
schemas: &HashMap<Datatype, Table>,
) -> Result<Vec<(Chunk, Option<String>)>, ParseError> {
let default_blocks = schemas
.keys()
.map(|datatype| datatype.dataset().default_blocks())
.find(|blocks| !blocks.is_none())
.unwrap_or(Some("0:latest".to_string()))
.unwrap();
let block_chunks = parse_block_inputs(&default_blocks, &fetcher).await?;
let block_chunks = parse_block_inputs(&String::from(r"0:latest"), &fetcher).await?;
postprocess_block_chunks(block_chunks, args, fetcher).await
}

Expand Down
7 changes: 4 additions & 3 deletions crates/cli/src/parse/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
mod args;
mod blocks;
mod file_output;
mod parse_utils;
mod query;
mod schemas;
mod source;
mod transactions;

pub use args::*;
use schemas::*;
// use blocks::*;
// use file_output::*;
// use query::*;
// use source::*;
83 changes: 0 additions & 83 deletions crates/cli/src/parse/parse_utils.rs

This file was deleted.

Loading

0 comments on commit d234dd3

Please sign in to comment.