Skip to content

Commit

Permalink
fixes for state overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
aburkut committed Jan 20, 2025
1 parent 63bb318 commit a5cdf56
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/tenderly-simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,22 @@ export class TenderlySimulation implements TransactionSimulator {
) {
const testNetRPC = new StaticJsonRpcProvider(this.rpcURL);

await Promise.all(
Object.keys(stateOverridesParams).map(address => {
const storage = stateOverridesParams[address].storage;
Object.keys(storage).map(async slot => {
const txHash = await testNetRPC!.send('tenderly_setStorageAt', [
address,
slot,
storage[slot],
]);

const transaction = await testNetRPC!.waitForTransaction(txHash);
if (!transaction.status) {
console.log(`Transaction failed: ${txHash}`);
}
});
}),
);
// need to execute promises sequentially here
for await (const addr of Object.keys(stateOverridesParams)) {
const storage = stateOverridesParams[addr].storage;

for await (const slot of Object.keys(storage)) {
const txHash = await testNetRPC!.send('tenderly_setStorageAt', [
addr,
slot,
storage[slot],
]);

const transaction = await testNetRPC!.waitForTransaction(txHash);
if (!transaction.status) {
console.log(`Transaction failed: ${txHash}`);
}
}
}
}
}

0 comments on commit a5cdf56

Please sign in to comment.