Skip to content

Commit

Permalink
add reproduction steps to error
Browse files Browse the repository at this point in the history
  • Loading branch information
pLabarta committed Nov 4, 2024
1 parent fd469ee commit 1d296a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions test/helpers/storageQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ export async function processRandomStoragePrefixes(
api: ApiPromise,
storagePrefix: string,
blockHash: string,
processor: (batchResult: { key: `0x${string}`; value: string }[]) => void
processor: (batchResult: { key: `0x${string}`; value: string }[]) => void,
override: string = "",
) {
const maxKeys = 1000;
let total = 0;
const preFilteredPrefixes = splitPrefix(storagePrefix);
const chanceToSample = 0.05;
const prefixes = preFilteredPrefixes.filter(() => Math.random() < chanceToSample);

const prefixes = override ? [override] : preFilteredPrefixes.filter(() => Math.random() < chanceToSample);
console.log(`Processing ${prefixes.length} prefixes: ${prefixes.join(", ")}`);
const limiter = rateLimiter();
const stopReport = startReport(() => total);

Expand Down Expand Up @@ -146,6 +147,8 @@ export async function processRandomStoragePrefixes(
);
} catch (e) {
console.log(`Error processing ${prefix}: ${e}`);
console.log(`Replace the empty string in smoke/test-ethereum-contract-code.ts:L51
with the prefix to reproduce`);
}

total += keys.length;
Expand Down
3 changes: 2 additions & 1 deletion test/suites/smoke/test-ethereum-contract-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ describeSuite({
}
}
totalContracts += BigInt(items.length);
});
// WHEN DEBUGGING REPLACE THE EMPTY STRING WITH A PREFIX TO FETCH
}, "");

const t1 = performance.now();
const checkTime = (t1 - t0) / 1000;
Expand Down

0 comments on commit 1d296a7

Please sign in to comment.