Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate execution modules in events ingester #30

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chaindexing-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ chaindexing = { path = "../chaindexing", features = ["postgres"] }
ethers = "2.0"
dotenvy = "0.15"
diesel = { version = "2", features = ["postgres", "chrono"] }
rand = "0.8.5"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.29", features = ["full"] }

6 changes: 5 additions & 1 deletion chaindexing-tests/src/factory/json_rpcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use chaindexing::EventsIngesterJsonRpc;
use ethers::providers::ProviderError;
use ethers::types::{Block, Filter, Log, TxHash, U64};

use rand::seq::SliceRandom;

pub fn empty_json_rpc() -> impl EventsIngesterJsonRpc {
#[derive(Clone)]
struct JsonRpc;
Expand Down Expand Up @@ -30,6 +32,8 @@ use ethers::types::{Bytes, H160, H256};
use std::str::FromStr;

pub fn transfer_log(contract_address: &str) -> Log {
let log_index = *(1..800).collect::<Vec<_>>().choose(&mut rand::thread_rng()).unwrap();

Log {
address: H160::from_str(contract_address).unwrap(),
topics: vec![
Expand All @@ -47,7 +51,7 @@ pub fn transfer_log(contract_address: &str) -> Log {
"0x83d751998ff98cd609bc9b18bb36bdef8659cde2f74d6d7a1b0fef2c2bf8f839",
)),
transaction_index: Some(89.into()),
log_index: Some(218.into()),
log_index: Some(log_index.into()),
transaction_log_index: None,
log_type: None,
removed: Some(false),
Expand Down
6 changes: 0 additions & 6 deletions chaindexing-tests/src/tests/events_ingester.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
mod tests {
use ethers::types::U64;
use std::sync::Arc;
use tokio::sync::Mutex;

Expand Down Expand Up @@ -37,7 +36,6 @@ mod tests {
json_rpc,
&Chain::Mainnet,
&MinConfirmationCount::new(1),
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -85,7 +83,6 @@ mod tests {
json_rpc,
&Chain::Mainnet,
&MinConfirmationCount::new(1),
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -117,7 +114,6 @@ mod tests {
json_rpc,
&Chain::Mainnet,
&MinConfirmationCount::new(1),
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -155,7 +151,6 @@ mod tests {
json_rpc,
&Chain::Mainnet,
&MinConfirmationCount::new(1),
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -184,7 +179,6 @@ mod tests {
json_rpc,
&Chain::Mainnet,
&MinConfirmationCount::new(1),
false,
)
.await
.unwrap();
Expand Down
Loading