Skip to content

Commit 0486927

Browse files
authored
fix: sporadic test failure in CI (#5117)
1 parent 219f457 commit 0486927

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/hardhat-core/test/internal/hardhat-network/provider/modules/eth/methods/getTransactionReceipt.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,18 @@ describe("Eth module", function () {
9898
)
9999
);
100100

101+
// Promises could have executed in any order, so we sort the results
102+
const sortedReceipts = receipts.sort((lhs, rhs) => {
103+
return (
104+
rpcQuantityToNumber(lhs.transactionIndex) -
105+
rpcQuantityToNumber(rhs.transactionIndex)
106+
);
107+
});
108+
101109
let logIndex = 0;
102110
let cumGasUsed = 0;
103111

104-
for (const receipt of receipts) {
112+
for (const receipt of sortedReceipts) {
105113
cumGasUsed += rpcQuantityToNumber(receipt.gasUsed);
106114
assert.equal(
107115
cumGasUsed,

0 commit comments

Comments
 (0)