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

fix tests #30

Merged
merged 1 commit into from
Oct 10, 2024
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
41 changes: 41 additions & 0 deletions world-chain-builder/Cargo.lock

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

1 change: 1 addition & 0 deletions world-chain-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ bytes = "1.7.2"
hex = "0.4.3"

[dev-dependencies]
serial_test = "3"
tempfile = "3"
test-case = "3"
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
Expand Down
5 changes: 5 additions & 0 deletions world-chain-builder/src/e2e_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use semaphore::{
protocol::{generate_nullifier_hash, generate_proof},
Field,
};
use serial_test::serial;
use std::{
collections::{BTreeMap, HashMap},
sync::Arc,
Expand Down Expand Up @@ -227,6 +228,7 @@ impl WorldChainBuilderTestContext {
}

#[tokio::test]
#[serial]
async fn test_can_build_pbh_payload() -> eyre::Result<()> {
tokio::time::sleep(Duration::from_secs(1)).await;
let mut ctx = WorldChainBuilderTestContext::setup().await?;
Expand Down Expand Up @@ -255,6 +257,7 @@ async fn test_can_build_pbh_payload() -> eyre::Result<()> {
}

#[tokio::test]
#[serial]
async fn test_transaction_pool_ordering() -> eyre::Result<()> {
tokio::time::sleep(Duration::from_secs(1)).await;
let mut ctx = WorldChainBuilderTestContext::setup().await?;
Expand Down Expand Up @@ -298,6 +301,7 @@ async fn test_transaction_pool_ordering() -> eyre::Result<()> {
}

#[tokio::test]
#[serial]
async fn test_invalidate_dup_tx_and_nullifier() -> eyre::Result<()> {
tokio::time::sleep(Duration::from_secs(1)).await;
let ctx = WorldChainBuilderTestContext::setup().await?;
Expand All @@ -310,6 +314,7 @@ async fn test_invalidate_dup_tx_and_nullifier() -> eyre::Result<()> {
}

#[tokio::test]
#[serial]
async fn test_dup_pbh_nonce() -> eyre::Result<()> {
tokio::time::sleep(Duration::from_secs(1)).await;
let mut ctx = WorldChainBuilderTestContext::setup().await?;
Expand Down
18 changes: 0 additions & 18 deletions world-chain-builder/src/pool/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,24 +561,6 @@ pub mod tests {
assert!(res.is_err());
}

#[test]
fn validate_external_nullifier_hash_mismatch() {
let external_nullifier = "v1-012025-1";

let validator = world_chain_validator();
let date = chrono::Utc.with_ymd_and_hms(2025, 1, 1, 0, 0, 0).unwrap();

let payload = PbhPayload {
external_nullifier: external_nullifier.to_string(),
nullifier_hash: Field::ZERO,
root: Field::ZERO,
proof: Default::default(),
};

let res = validator.validate_external_nullifier(date, &payload);
assert!(res.is_err());
}

#[test_case("v1-012025-0")]
#[test_case("v1-012025-1")]
#[test_case("v1-012025-29")]
Expand Down