From 6cd7b8f055527afdff7088bc5349b672b0cf35fc Mon Sep 17 00:00:00 2001 From: Nil Amrutlal Date: Thu, 9 Nov 2023 13:27:16 +0100 Subject: [PATCH 1/3] add build step in generate script --- packages/apps/graph/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apps/graph/package.json b/packages/apps/graph/package.json index 180c449461..a3be67ee89 100644 --- a/packages/apps/graph/package.json +++ b/packages/apps/graph/package.json @@ -26,7 +26,7 @@ "prisma:studio": "prisma studio", "simulate": "ts-node -T src/devnet/simulation/index.ts traffic", "start": "npx ts-node-dev --respawn --no-notify --exit-child src/index.ts", - "start:generate": "pnpm run prisma:generate && npx ts-node-dev --respawn --no-notify --exit-child src/index.ts", + "start:generate": "pnpm build && npx ts-node-dev --respawn --no-notify --exit-child src/index.ts", "test": "echo \"no test specified\"" }, "dependencies": { From 78ab3743d2e8fb67b0736af94f2d7fe7dc359b1a Mon Sep 17 00:00:00 2001 From: Nil Amrutlal Date: Thu, 9 Nov 2023 13:27:24 +0100 Subject: [PATCH 2/3] fix issue with simulate --- packages/apps/graph/src/devnet/simulation/simulate.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/apps/graph/src/devnet/simulation/simulate.ts b/packages/apps/graph/src/devnet/simulation/simulate.ts index 22222a2c43..2574fdb21f 100644 --- a/packages/apps/graph/src/devnet/simulation/simulate.ts +++ b/packages/apps/graph/src/devnet/simulation/simulate.ts @@ -119,7 +119,7 @@ export async function simulate({ // This is to simulate cross chain transfers if (transferType === 'xchaintransfer') { - while (account.chainId === nextAccount.chainId) { + if (account.chainId === nextAccount.chainId) { nextAccount = { ...nextAccount, chainId: `${getRandomNumber( @@ -128,6 +128,12 @@ export async function simulate({ )}` as ChainId, }; } + + if (account.chainId === nextAccount.chainId) { + logger.info('Skipping cross chain transfer to same chain'); + continue; + } + logger.info('Cross chain transfer', account, nextAccount); result = await crossChainTransfer({ from: account, From 0a36ed900870e3328e130573cb61257affac417b Mon Sep 17 00:00:00 2001 From: Nil Amrutlal Date: Thu, 9 Nov 2023 13:28:42 +0100 Subject: [PATCH 3/3] changeset file --- .changeset/slow-scissors-provide.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/slow-scissors-provide.md diff --git a/.changeset/slow-scissors-provide.md b/.changeset/slow-scissors-provide.md new file mode 100644 index 0000000000..c546b459d7 --- /dev/null +++ b/.changeset/slow-scissors-provide.md @@ -0,0 +1,6 @@ +--- +'@kadena/graph': patch +--- + +Fix simulate script edge case (when it attempts cross-chain transfers to the +same chain). Add build step in start:generate script