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 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": { 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,