From 0fbfa816ba0990e6430e428166364a8d2e2ca956 Mon Sep 17 00:00:00 2001 From: derpy-duck <115193320+derpy-duck@users.noreply.github.com> Date: Wed, 14 Jun 2023 11:09:42 -0400 Subject: [PATCH] relayer: fix messageTest + rm lib/forge-std + rm lib/openzeppelin (#3044) (#3089) * relayer: fix messageTest + rm lib/forge-std + rm lib/openzeppelin * save * useLastRun -> false Co-authored-by: Joe Howarth --- ethereum/Makefile | 2 +- .../relayer/config/testnet/contracts.json | 2 +- .../relayer/mockIntegration/messageUtils.ts | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ethereum/Makefile b/ethereum/Makefile index 2be9b1e27..a1502645e 100644 --- a/ethereum/Makefile +++ b/ethereum/Makefile @@ -86,4 +86,4 @@ test-forge: dependencies forge test clean: - rm -rf ganache.log .env node_modules build flattened build-forge ethers-contracts + rm -rf ganache.log .env node_modules build flattened build-forge ethers-contracts lib/forge-std lib/openzeppelin-contracts diff --git a/ethereum/ts-scripts/relayer/config/testnet/contracts.json b/ethereum/ts-scripts/relayer/config/testnet/contracts.json index 43a108c6d..0c6f0af57 100644 --- a/ethereum/ts-scripts/relayer/config/testnet/contracts.json +++ b/ethereum/ts-scripts/relayer/config/testnet/contracts.json @@ -1,6 +1,6 @@ { "description": "This file contains the addresses for the contracts on each chain. If useLastRun is true, this file will be ignored, and the addresses will be taken from the lastrun.json of the deployment scripts.", - "useLastRun": true, + "useLastRun": false, "deliveryProviders": [ { "chainId": 6, diff --git a/ethereum/ts-scripts/relayer/mockIntegration/messageUtils.ts b/ethereum/ts-scripts/relayer/mockIntegration/messageUtils.ts index 86485ba45..7f7e9ae4c 100644 --- a/ethereum/ts-scripts/relayer/mockIntegration/messageUtils.ts +++ b/ethereum/ts-scripts/relayer/mockIntegration/messageUtils.ts @@ -22,9 +22,9 @@ export async function sendMessage( const sourceRelayer = await getWormholeRelayer(sourceChain); const sourceProvider = await sourceRelayer.getDefaultDeliveryProvider(); - const relayQuote = await ( - await sourceRelayer.quoteGas(targetChain.chainId, 2000000, sourceProvider) - ).add(10000000000); + const relayQuote = await await sourceRelayer[ + "quoteEVMDeliveryPrice(uint16,uint256,uint256,address)" + ](targetChain.chainId, 0, 2000000, sourceProvider); console.log("relay quote: " + relayQuote); const mockIntegration = getMockIntegration(sourceChain); @@ -38,10 +38,11 @@ export async function sendMessage( const tx = await mockIntegration.sendMessage( Buffer.from(sentMessage), targetChain.chainId, - targetAddress, + 2000000, + 0, { gasLimit: 1000000, - value: relayQuote, + value: relayQuote[0], } ); const rx = await tx.wait(); @@ -79,19 +80,19 @@ async function queryMessageOnTarget( sentMessage: string, targetChain: ChainInfo ): Promise { - let messageHistory: string[][] = []; + let messageHistory: string[] = []; const targetIntegration = getMockIntegration(targetChain); let notFound = true; for (let i = 0; i < 20 && notFound; i++) { await new Promise((resolve) => setTimeout(() => resolve(), 2000)); const messageHistoryResp = await targetIntegration.getMessageHistory(); - messageHistory = messageHistoryResp.map((messages) => - messages.map((message) => ethers.utils.toUtf8String(message)) + messageHistory = messageHistoryResp.map((message) => + ethers.utils.toUtf8String(message) ); notFound = !messageHistory .slice(messageHistory.length - 20) - .find((msgs) => msgs.find((m) => m === sentMessage)); + .find((msg) => msg === sentMessage); process.stdout.write(".."); } console.log("");