Skip to content

Commit

Permalink
add --txs support for state_diffs and vm_traces
Browse files Browse the repository at this point in the history
  • Loading branch information
sslivkoff committed Aug 8, 2023
1 parent d8352b5 commit f81cd69
Show file tree
Hide file tree
Showing 6 changed files with 325 additions and 40 deletions.
29 changes: 27 additions & 2 deletions crates/freeze/src/datasets/balance_diffs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use polars::prelude::*;

use super::state_diffs;
use crate::types::{
BalanceDiffs, BlockChunk, CollectError, ColumnType, Dataset, Datatype, RowFilter, Source, Table,
BalanceDiffs, BlockChunk, CollectError, ColumnType, Dataset, Datatype, RowFilter, Source,
Table, TransactionChunk,
};

#[async_trait::async_trait]
Expand Down Expand Up @@ -51,6 +52,30 @@ impl Dataset for BalanceDiffs {
schema: &Table,
filter: Option<&RowFilter>,
) -> Result<DataFrame, CollectError> {
state_diffs::collect_single(&Datatype::BalanceDiffs, chunk, source, schema, filter).await
state_diffs::collect_block_state_diffs(
&Datatype::BalanceDiffs,
chunk,
source,
schema,
filter,
)
.await
}

async fn collect_transaction_chunk(
&self,
chunk: &TransactionChunk,
source: &Source,
schema: &Table,
filter: Option<&RowFilter>,
) -> Result<DataFrame, CollectError> {
state_diffs::collect_transaction_state_diffs(
&Datatype::BalanceDiffs,
chunk,
source,
schema,
filter,
)
.await
}
}
21 changes: 20 additions & 1 deletion crates/freeze/src/datasets/code_diffs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use polars::prelude::*;
use super::state_diffs;
use crate::types::{
BlockChunk, CodeDiffs, CollectError, ColumnType, Dataset, Datatype, RowFilter, Source, Table,
TransactionChunk,
};

#[async_trait::async_trait]
Expand Down Expand Up @@ -51,6 +52,24 @@ impl Dataset for CodeDiffs {
schema: &Table,
filter: Option<&RowFilter>,
) -> Result<DataFrame, CollectError> {
state_diffs::collect_single(&Datatype::CodeDiffs, chunk, source, schema, filter).await
state_diffs::collect_block_state_diffs(&Datatype::CodeDiffs, chunk, source, schema, filter)
.await
}

async fn collect_transaction_chunk(
&self,
chunk: &TransactionChunk,
source: &Source,
schema: &Table,
filter: Option<&RowFilter>,
) -> Result<DataFrame, CollectError> {
state_diffs::collect_transaction_state_diffs(
&Datatype::CodeDiffs,
chunk,
source,
schema,
filter,
)
.await
}
}
21 changes: 20 additions & 1 deletion crates/freeze/src/datasets/nonce_diffs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use polars::prelude::*;
use super::state_diffs;
use crate::types::{
BlockChunk, CollectError, ColumnType, Dataset, Datatype, NonceDiffs, RowFilter, Source, Table,
TransactionChunk,
};

#[async_trait::async_trait]
Expand Down Expand Up @@ -51,6 +52,24 @@ impl Dataset for NonceDiffs {
schema: &Table,
filter: Option<&RowFilter>,
) -> Result<DataFrame, CollectError> {
state_diffs::collect_single(&Datatype::NonceDiffs, chunk, source, schema, filter).await
state_diffs::collect_block_state_diffs(&Datatype::NonceDiffs, chunk, source, schema, filter)
.await
}

async fn collect_transaction_chunk(
&self,
chunk: &TransactionChunk,
source: &Source,
schema: &Table,
filter: Option<&RowFilter>,
) -> Result<DataFrame, CollectError> {
state_diffs::collect_transaction_state_diffs(
&Datatype::NonceDiffs,
chunk,
source,
schema,
filter,
)
.await
}
}
Loading

0 comments on commit f81cd69

Please sign in to comment.