-
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-57 ## Description * Scaffolds the base of `EboProcessor` class * Adds unit tests as specs for this class * Creates a much needed `type RequestId`
- Loading branch information
Showing
9 changed files
with
66 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export * from "./invalidActorState.exception.js"; | ||
export * from "./invalidDisputeStatus.exception.js"; | ||
export * from "./requestAlreadyHandled.exception.js"; | ||
export * from "./requestMismatch.js"; | ||
export * from "./responseAlreadyProposed.js"; | ||
export * from "./requestMismatch.exception.js"; | ||
export * from "./responseAlreadyProposed.exception.js"; | ||
export * from "./rpcUrlsEmpty.exception.js"; |
File renamed without changes.
File renamed without changes.
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,40 @@ | ||
import { ILogger } from "@ebo-agent/shared"; | ||
|
||
import { EboActor } from "../eboActor.js"; | ||
import { EboActorsManager } from "../eboActorsManager.js"; | ||
import { ProtocolProvider } from "../protocolProvider.js"; | ||
|
||
const DEFAULT_MS_BETWEEN_CHECKS = 10 * 60 * 1000; // 10 minutes | ||
|
||
export class EboProcessor { | ||
private eventsInterval?: NodeJS.Timeout; | ||
private lastCheckedBlock?: bigint; | ||
|
||
constructor( | ||
private readonly protocolProvider: ProtocolProvider, | ||
private readonly actorsManager: EboActorsManager, | ||
private readonly logger: ILogger, | ||
) {} | ||
|
||
public async start(msBetweenChecks: number = DEFAULT_MS_BETWEEN_CHECKS) { | ||
this.bootstrap(); // Bootstrapping | ||
|
||
this.eventsInterval = setInterval(this.eventLoop, msBetweenChecks); | ||
} | ||
|
||
private async bootstrap() { | ||
// TODO | ||
} | ||
|
||
private async eventLoop() { | ||
// TODO | ||
} | ||
|
||
private async onActorError(_actor: EboActor, _error: Error) { | ||
// TODO | ||
} | ||
|
||
private async notifyError(_error: Error) { | ||
// TODO | ||
} | ||
} |
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 @@ | ||
export * from "./eboProcessor.js"; |
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
13 changes: 13 additions & 0 deletions
13
packages/automated-dispute/tests/services/eboProcessor.spec.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,13 @@ | ||
import { describe, it } from "vitest"; | ||
|
||
describe("EboProcessor", () => { | ||
describe.skip("start", () => { | ||
it.skip("bootstraps actors with onchain active requests when starting"); | ||
it.skip("fetches events since epoch start when starting"); | ||
it.skip("fetches events since last block checked after first events fetch"); | ||
it.skip("registers new actor when a new request id is detected on events"); | ||
it.skip("forwards events to corresponding actors"); | ||
it.skip("notifies if an actor throws while handling events"); | ||
it.skip("removes the actor when processing onFinalizeRequest event"); | ||
}); | ||
}); |