Skip to content

Commit

Permalink
fix: resolve test compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis committed Nov 28, 2023
1 parent 6f7316a commit c618318
Showing 1 changed file with 2 additions and 46 deletions.
48 changes: 2 additions & 46 deletions common/src/tap_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,54 +120,10 @@ mod test {
use tap_core::{eip_712_signed_message::EIP712SignedMessage, tap_receipt::Receipt};
use toolshed::thegraph::DeploymentId;

use crate::test_vectors::{self, create_signed_receipt};
use crate::test_vectors::{self, create_signed_receipt, TAP_SENDER};

use super::*;

/// Fixture to generate a wallet and address
pub fn keys() -> (LocalWallet, Address) {
let wallet: LocalWallet = MnemonicBuilder::<English>::default()
.phrase("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about")
.build()
.unwrap();
let address = wallet.address();

(wallet, Address::from_slice(address.as_bytes()))
}

pub fn domain() -> Eip712Domain {
eip712_domain! {
name: "TAP",
version: "1",
chain_id: 1,
verifying_contract: Address::from([0x11u8; 20]),
}
}

/// Fixture to generate a signed receipt using the wallet from `keys()`
/// and the given `query_id` and `value`
pub async fn create_signed_receipt(
allocation_id: Address,
nonce: u64,
timestamp_ns: u64,
value: u128,
) -> SignedReceipt {
let (wallet, _) = keys();

EIP712SignedMessage::new(
&domain(),
Receipt {
allocation_id,
nonce,
timestamp_ns,
value,
},
&wallet,
)
.await
.unwrap()
}

#[sqlx::test(migrations = "../migrations")]
async fn test_verify_and_store_receipt(pgpool: PgPool) {
// Listen to pg_notify events
Expand Down Expand Up @@ -207,7 +163,7 @@ mod test {

// Mock escrow accounts
let escrow_accounts =
Eventual::from_value(HashMap::from_iter(vec![(keys().1, U256::from(123))]));
Eventual::from_value(HashMap::from_iter(vec![(TAP_SENDER.1, U256::from(123))]));

let tap_manager = TapManager::new(
pgpool.clone(),
Expand Down

0 comments on commit c618318

Please sign in to comment.