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

Genesis test #103

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ secrets/
node_modules/
deployment/.env
dev_env
.idea/
187 changes: 185 additions & 2 deletions indexer/Cargo.lock

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

2 changes: 2 additions & 0 deletions indexer/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ edition = "2021"
sea-orm = { git = "https://github.com/dcSpark/sea-orm", branch = "insert-many-returning", features = [
"runtime-tokio-rustls",
"sqlx-postgres",
"sqlx-sqlite",
"mock",
"macros",
], default-features = false }
serde = "1.0.136"
2 changes: 1 addition & 1 deletion indexer/entity/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum Relation {

impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum EraValue {
Byron,
Shelley,
Expand Down
5 changes: 5 additions & 0 deletions indexer/tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ serde = { version = "1.0", features = ["derive"] }
tracing-subscriber = "0.3.9"
tracing = "0.1.31"

[dev-dependencies]
rand = "0.8.5"
sea-orm-macros = "0.8.0"
proptest = "1.0.0"

[features]
default = ["build_rust_task"]
build_rust_task = []
Expand Down
1 change: 1 addition & 0 deletions indexer/tasks/src/dsl/database_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use shred::DispatcherBuilder;
use std::sync::{Arc, Mutex};

/// Misc information about blocks that can't be computed from just the block data itself
#[derive(Debug)]
pub struct BlockGlobalInfo {
pub era: EraValue,
pub epoch: Option<u64>,
Expand Down
12 changes: 12 additions & 0 deletions indexer/tasks/src/execution_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use std::fs;
use toml::Value;
use tracing_subscriber::prelude::*;

#[derive(Debug)]
pub struct ExecutionPlan(pub toml::value::Table);

impl ExecutionPlan {
pub fn load_from_file(path: &str) -> ExecutionPlan {
match &fs::read_to_string(path) {
Expand All @@ -20,3 +22,13 @@ impl ExecutionPlan {
}
}
}

impl From<Vec<&str>> for ExecutionPlan {
fn from(tasks: Vec<&str>) -> Self {
let map = tasks
.into_iter()
.map(|task| (task.to_string(), Value::Table(toml::value::Table::new())))
.collect();
ExecutionPlan(map)
}
}
Loading