diff --git a/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts b/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts index 8cdb33e0dd4..444376f1d2b 100644 --- a/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts +++ b/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts @@ -113,7 +113,7 @@ describe('e2e_2_rpc_servers', () => { await expectTokenBalance(walletA, tokenAddress, userA.address, initialBalance); await expectTokenBalance(walletB, tokenAddress, userB.address, 0n); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Balance set in constructor']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServerA, ['Balance set in constructor']); // Transfer funds from A to B via RPC server A const contractWithWalletA = await PrivateTokenContract.at(tokenAddress, walletA); @@ -130,7 +130,7 @@ describe('e2e_2_rpc_servers', () => { await expectTokenBalance(walletA, tokenAddress, userA.address, initialBalance - transferAmount1); await expectTokenBalance(walletB, tokenAddress, userB.address, transferAmount1); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServerA, ['Coins transferred']); // Transfer funds from B to A via RPC server B const contractWithWalletB = await PrivateTokenContract.at(tokenAddress, walletB); @@ -147,7 +147,7 @@ describe('e2e_2_rpc_servers', () => { await expectTokenBalance(walletA, tokenAddress, userA.address, initialBalance - transferAmount1 + transferAmount2); await expectTokenBalance(walletB, tokenAddress, userB.address, transferAmount1 - transferAmount2); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServerA, ['Coins transferred']); }, 120_000); const deployChildContractViaServerA = async () => { diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts index fec8584a164..7ace13af30d 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts @@ -96,7 +96,7 @@ describe('e2e_multiple_accounts_1_enc_key', () => { } await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServer, ['Coins transferred']); logger(`Transfer ${transferAmount} from ${sender} to ${receiver} successful`); }; diff --git a/yarn-project/end-to-end/src/e2e_private_token_contract.test.ts b/yarn-project/end-to-end/src/e2e_private_token_contract.test.ts index c6ef1ab8b49..03a5df9272e 100644 --- a/yarn-project/end-to-end/src/e2e_private_token_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_private_token_contract.test.ts @@ -58,7 +58,7 @@ describe('e2e_private_token_contract', () => { await expectBalance(receiver, 0n); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Balance set in constructor']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServer, ['Balance set in constructor']); }, 30_000); /** @@ -81,7 +81,7 @@ describe('e2e_private_token_contract', () => { await expectBalance(owner, mintAmount); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins minted']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServer, ['Coins minted']); }, 60_000); /** @@ -97,7 +97,7 @@ describe('e2e_private_token_contract', () => { await expectBalance(receiver, 0n); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Balance set in constructor']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServer, ['Balance set in constructor']); const tx = contract.methods.transfer(transferAmount, owner, receiver).send({ origin: owner }); @@ -110,6 +110,6 @@ describe('e2e_private_token_contract', () => { await expectBalance(receiver, transferAmount); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2); - await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']); + await expectUnencryptedLogsFromLastBlockToBe(aztecRpcServer, ['Coins transferred']); }, 60_000); }); diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 92f5633d71c..f8b3c380b3b 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -426,23 +426,13 @@ export const expectsNumOfEncryptedLogsInTheLastBlockToBe = async ( /** * Checks that the last block contains the given expected unencrypted log messages. - * @param aztecNode - The instance of aztec node for retrieving the logs. + * @param rpc - The instance of AztecRPC for retrieving the logs. * @param logMessages - The set of expected log messages. * @returns */ -export const expectUnencryptedLogsFromLastBlockToBe = async ( - aztecNode: AztecNodeService | AztecRPC, - logMessages: string[], -) => { - let l2BlockNum: number; - let unencryptedLogs: L2BlockL2Logs[]; - if (aztecNode instanceof AztecNodeService) { - l2BlockNum = await aztecNode.getBlockHeight(); - unencryptedLogs = await aztecNode.getLogs(l2BlockNum, 1, LogType.UNENCRYPTED); - } else { - l2BlockNum = await aztecNode.getBlockNum(); - unencryptedLogs = await aztecNode.getUnencryptedLogs(l2BlockNum, 1); - } +export const expectUnencryptedLogsFromLastBlockToBe = async (rpc: AztecRPC, logMessages: string[]) => { + const l2BlockNum = await rpc.getBlockNum(); + const unencryptedLogs = await rpc.getUnencryptedLogs(l2BlockNum, 1); const unrolledLogs = L2BlockL2Logs.unrollLogs(unencryptedLogs); const asciiLogs = unrolledLogs.map(log => log.toString('ascii'));