-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# 🤖 Linear Closes GRT-81 ## Description * Standardizes timestamps used through our providers to `BigInt` type, to be consistent with viem `Block.timestamp` type * Set up `EboActor.onRequestCreated` handler
- Loading branch information
Showing
20 changed files
with
480 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { EboRegistry } from "./interfaces/eboRegistry.js"; | ||
import { Dispute, Request, Response } from "./types/prophet.js"; | ||
|
||
export class EboMemoryRegistry implements EboRegistry { | ||
constructor( | ||
private requests: Map<string, Request> = new Map(), | ||
private responses: Map<string, Response> = new Map(), | ||
private dispute: Map<string, Dispute> = new Map(), | ||
) {} | ||
|
||
/** @inheritdoc */ | ||
public addRequest(requestId: string, request: Request) { | ||
this.requests.set(requestId, request); | ||
} | ||
|
||
/** @inheritdoc */ | ||
public getRequest(requestId: string) { | ||
return this.requests.get(requestId); | ||
} | ||
|
||
/** @inheritdoc */ | ||
public getResponses() { | ||
return this.responses; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./rpcUrlsEmpty.exception.js"; | ||
export * from "./invalidActorState.exception.js"; |
8 changes: 8 additions & 0 deletions
8
packages/automated-dispute/src/exceptions/invalidActorState.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export class InvalidActorState extends Error { | ||
constructor() { | ||
// TODO: we'll want to dump the Actor state into stderr at this point | ||
super("The actor is in an invalid state."); | ||
|
||
this.name = "InvalidActorState"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export class RequestMismatch extends Error { | ||
constructor(requestId: string, eventRequestId: string) { | ||
super(`Actor handling request ${requestId} received a request ${eventRequestId} event.`); | ||
this.name = "RequestMismatch"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Request, Response } from "../types/prophet.js"; | ||
|
||
/** Registry that stores Prophet entities (ie. requests, responses and disputes) */ | ||
export interface EboRegistry { | ||
/** | ||
* Add a `Request` by ID. | ||
* | ||
* @param requestId the ID of the `Request` | ||
* @param request the `Request` | ||
*/ | ||
addRequest(requestId: string, request: Request): void; | ||
|
||
/** | ||
* Get a `Request` by ID. | ||
* | ||
* @param requestId request ID | ||
* @returns the request if already added into registry, `undefined` otherwise | ||
*/ | ||
getRequest(requestId: string): Request | undefined; | ||
|
||
/** | ||
* Return all responses | ||
* | ||
* @returns responses map | ||
*/ | ||
getResponses(): Map<string, Response>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.