Skip to content

Commit

Permalink
Merge pull request #30 from worldcoin/ewoolsey/fix-tests
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
0xOsiris authored Oct 10, 2024
2 parents 087536b + 2737a71 commit e60d081
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 18 deletions.
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

0 comments on commit e60d081

Please sign in to comment.