Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ rand_chacha = { default-features = false, version = "0.9" }
rayon = { version = "1.10" }
reqwest = { version = "0.13" }
rstest = { version = "0.26" }
rusqlite = { features = ["bundled"], version = "0.37" }
rusqlite = { features = ["array", "bundled"], version = "0.37" }
serde = { features = ["derive"], version = "1" }
serial_test = { version = "3.2" }
sha2 = { version = "0.10" }
Expand Down
1 change: 0 additions & 1 deletion bin/validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ anyhow = { workspace = true }
aws-config = { version = "1.8.14" }
aws-sdk-kms = { version = "1.100" }
clap = { features = ["env", "string"], workspace = true }
diesel = { workspace = true }
fs-err = { workspace = true }
hex = { workspace = true }
miden-node-db = { workspace = true }
Expand Down
5 changes: 0 additions & 5 deletions bin/validator/diesel.toml

This file was deleted.

4 changes: 2 additions & 2 deletions bin/validator/src/commands/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ async fn build_and_write_genesis(
)
.await
.context("failed to initialize validator database during bootstrap")?;
db.transact("upsert_block_header", move |conn| {
miden_validator::db::upsert_block_header(conn, &genesis_header)
db.write("upsert_block_header", move |tx| {
miden_validator::db::upsert_block_header(tx, &genesis_header)
})
.await
.context("failed to persist genesis block header as chain tip")?;
Expand Down
34 changes: 1 addition & 33 deletions bin/validator/src/db/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ pub fn verify_latest_schema(database_filepath: &Path) -> std::result::Result<(),

#[cfg(test)]
mod tests {
use std::process::Command;

use anyhow::{Context, Result, ensure};
use anyhow::Result;
use miden_node_db::migration::{SchemaHash, SchemaHashes};

use super::*;
Expand All @@ -83,34 +81,4 @@ mod tests {
assert_eq!(migrator.schema_hashes(), SchemaHashes(&EXPECTED_SCHEMA_HASHES));
Ok(())
}

#[test]
#[ignore = "requires diesel CLI; CI runs this in the diesel-schema job"]
fn diesel_schema_is_in_sync_with_migrations() -> Result<()> {
let temp_dir = tempfile::tempdir()?;
let database_filepath = temp_dir.path().join("validator.sqlite3");
bootstrap_database(&database_filepath)?;

let output = Command::new("diesel")
.arg("print-schema")
.arg("--database-url")
.arg(&database_filepath)
.current_dir(env!("CARGO_MANIFEST_DIR"))
.output()
.context(
"failed to run diesel CLI; install it with \
`cargo install diesel_cli --no-default-features --features sqlite`",
)?;

ensure!(
output.status.success(),
"diesel print-schema failed: {}",
String::from_utf8_lossy(&output.stderr)
);

let generated =
String::from_utf8(output.stdout).context("diesel CLI output is not UTF-8")?;
assert_eq!(generated, include_str!("schema.rs"));
Ok(())
}
}
Loading
Loading