Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@kadena/graph] Simulate script error and inclusion of build in start script (Fix) #1206

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/slow-scissors-provide.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion packages/apps/graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 7 additions & 1 deletion packages/apps/graph/src/devnet/simulation/simulate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down
Loading