Skip to content

Commit 4a844a8

Browse files
committed
feat(host-contracts): fix mocked relayer edge case
1 parent 0993dc1 commit 4a844a8

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

host-contracts/test/asyncDecrypt.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ const fulfillAllPastRequestsIds = async (mocked: boolean) => {
106106
if (!event) {
107107
throw new Error('Event is null');
108108
}
109+
const counter = event.args[0];
109110
const requestID = event.args[1];
110111
const handles = event.args[2];
111112
const contractCaller = event.args[3];
112113
const callbackSelector = event.args[4];
113114

114115
// if request is not already fulfilled
115-
if (mocked && !toSkip.includes(requestID)) {
116+
if (mocked && !toSkip.includes(counter)) {
116117
// in mocked mode, we trigger the decryption fulfillment manually
117118
await awaitCoprocessor();
118119

@@ -186,7 +187,7 @@ const fulfillAllPastRequestsIds = async (mocked: boolean) => {
186187
} else {
187188
console.log('Gateway fulfillment tx failed with an unknown error');
188189
}
189-
toSkip.push(requestID);
190+
toSkip.push(counter);
190191
throw error;
191192
}
192193
}

host-contracts/test/gatewayDecrypt/testAsyncDecryptMulti.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ describe.only('TestAsyncDecryptMultiContracts', function () {
3737
const y = await this.contractA.yUint64();
3838
const y2 = await this.contractB.yUint64();
3939
expect(y).to.equal(0); // because first decryption callback reverted
40-
expect(y2).to.equal(373737); // this second decryption, on the other hand, should succeed, but currently it is not fulfilled by mocked mode due to a logic bug in mocked relayer
40+
expect(y2).to.equal(373737); // this second decryption, on the other hand, should succeed
4141
});
4242
});

0 commit comments

Comments
 (0)