From c6183180198448e775df170427c94e46ab17977f Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Tue, 28 Nov 2023 13:31:55 +0100 Subject: [PATCH] fix: resolve test compilation errors --- common/src/tap_manager.rs | 48 ++------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/common/src/tap_manager.rs b/common/src/tap_manager.rs index 156a1dd8..c76263b1 100644 --- a/common/src/tap_manager.rs +++ b/common/src/tap_manager.rs @@ -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::::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 @@ -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(),