Skip to content

Commit

Permalink
docs: finalize request docs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyaco committed Oct 25, 2024
1 parent d3ba273 commit 913649c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions packages/automated-dispute/src/services/eboActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ export class EboActor {
await Promise.all(settledDisputes);
}

/**
* Get the first response to be used to finalize a request.
*
* @param request request to search responses for
* @param atTimestamp timestamp to validate Prophet's time windows
* @returns a `Response` if can be used to finalize `request. Otherwise undefined.
*/
private getFinalizableResponse(request: Request, atTimestamp: UnixTimestamp) {
this.logger.info("Getting finalizable requests...");

Expand All @@ -350,6 +357,12 @@ export class EboActor {
return this.getAcceptedResponse(atTimestamp);
}

/**
* Finalize `request` with `response`.
*
* @param request a `Request`
* @param response a `Response`
*/
private async finalizeRequest(request: Request, response: Response) {
this.logger.info(`Finalizing request.`);
this.logger.debug(stringify({ request: request, response: response }));
Expand All @@ -358,6 +371,9 @@ export class EboActor {
await this.protocolProvider.finalize(request.prophetData, response.prophetData);
} catch (err) {
if (err instanceof CustomContractError) {
this.logger.warn(`Finalizing request reverted: ${err.name}`);
this.logger.debug(stringify({ request, error: err }));

err.setContext({
request,
response,
Expand Down
2 changes: 1 addition & 1 deletion packages/automated-dispute/src/services/eboProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class EboProcessor {
const lastBlock = await this.getLastFinalizedBlock();

// Events will sync starting from the block after the last checked one,
// making the block interval exclusive on its lower bound:
// making the block interval exclusive of its lower bound:
// (last checked block, last block]
const events = await this.getEvents(this.lastCheckedBlock + 1n, lastBlock.number);

Expand Down

0 comments on commit 913649c

Please sign in to comment.