-
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.
test: e2e scenario 1 with NewEpoch event validation (#69)
# 🤖 Linear Closes GRT-191 ## Description * ProphetCoded ABI types following format needed for structs * Fix events being potentially fetched twice if they were present in the last finalized block during a sync cycle * Skip enqueuing events that were fetched but emitted before the currently last processed event. This should not be too relevant during normal operation but it adds to the reliability of the whole system (and also allows the e2e test to be quickly run) * Catch revert errors for trying to create already created requests * Validates `NewEpoch` event being emitted at the end of the flow
- Loading branch information
Showing
7 changed files
with
336 additions
and
98 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
61 changes: 61 additions & 0 deletions
61
apps/agent/test/e2e/utils/prophet-e2e-scaffold/epochManager.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,61 @@ | ||
import { epochManagerAbi } from "@ebo-agent/automated-dispute"; | ||
import { Address, Chain, HttpTransport } from "viem"; | ||
|
||
import { AnvilClient } from "./anvil"; | ||
|
||
type SetEpochLengthInput = { | ||
client: AnvilClient<HttpTransport, Chain>; | ||
governorAddress: Address; | ||
epochManagerAddress: Address; | ||
length: bigint; | ||
}; | ||
|
||
export const setEpochLength = async (params: SetEpochLengthInput) => { | ||
const { client, governorAddress, epochManagerAddress, length } = params; | ||
|
||
client.impersonateAccount({ | ||
address: governorAddress, | ||
}); | ||
|
||
const tx = await client.writeContract({ | ||
address: epochManagerAddress, | ||
account: governorAddress, | ||
abi: epochManagerAbi, | ||
functionName: "setEpochLength", | ||
args: [length], | ||
}); | ||
|
||
await client.waitForTransactionReceipt({ hash: tx }); | ||
|
||
client.stopImpersonatingAccount({ | ||
address: governorAddress, | ||
}); | ||
}; | ||
|
||
type GetEpochLengthInput = Omit<SetEpochLengthInput, "length">; | ||
|
||
export const getEpochLength = async (params: GetEpochLengthInput) => { | ||
const { client, governorAddress, epochManagerAddress } = params; | ||
|
||
return await client.readContract({ | ||
address: epochManagerAddress, | ||
account: governorAddress, | ||
abi: epochManagerAbi, | ||
functionName: "epochLength", | ||
}); | ||
}; | ||
|
||
type GetCurrentEpochInput = { | ||
client: AnvilClient<HttpTransport, Chain>; | ||
epochManagerAddress: Address; | ||
}; | ||
|
||
export const getCurrentEpoch = async (params: GetCurrentEpochInput) => { | ||
const { client, epochManagerAddress } = params; | ||
|
||
return await client.readContract({ | ||
address: epochManagerAddress, | ||
abi: epochManagerAbi, | ||
functionName: "currentEpoch", | ||
}); | ||
}; |
Oops, something went wrong.