-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: e2e dispute #72
Conversation
4a6d0da
to
c8b7399
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a couple comments 👍🏻
* When: | ||
* - A1 detects RESP1 is wrong | ||
* | ||
* Then: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice explanation
* - `EBOFinalityModule.newEpoch(E1, CHAIN1, RESP2.response)` | ||
* - `OracleRequestFinalized(REQ1.id, RESP2.id, A1.address)` | ||
*/ | ||
test.skip("dispute response and propose a new one", { timeout: E2E_TEST_TIMEOUT }, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will the test be enabled later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the idea is to enable every test to be run sequentially later
* @param status - The uint8 value representing the dispute status. | ||
* @returns The DisputeStatus string corresponding to the input value. | ||
*/ | ||
private mapDisputeStatus(status: number): DisputeStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@@ -343,6 +333,44 @@ export class EboActor { | |||
await Promise.all(settledDisputes); | |||
} | |||
|
|||
private getFinalizableResponse(request: Request, atTimestamp: UnixTimestamp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe docs here?
return this.getAcceptedResponse(atTimestamp); | ||
} | ||
|
||
private async finalizeRequest(request: Request, response: Response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe docs here?
await this.protocolProvider.finalize(request.prophetData, response.prophetData); | ||
} catch (err) { | ||
if (err instanceof CustomContractError) { | ||
err.setContext({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed in getActiveDisputes you have a this.logger.warn in the catch but not here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a warn here too!
const events = await this.getEvents(this.lastCheckedBlock, lastBlock.number); | ||
|
||
// Events will sync starting from the block after the last checked one, | ||
// making the block interval exclusive on its lower bound: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclusive of*
exclusive on means it's included
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonderful, few comments but nothing critical. after addressing beebs comments is good to go to me
Q: HexUtils.normalize is removed in many places, this is no longer required?
responseId: HexUtils.normalize(event.metadata.responseId) as ResponseId, | ||
responseId: event.metadata.responseId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just double check that normalizing is no longer required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thing to ask! The main idea of this change is to apply HexUtils.normalize
only during functions that fetch events. Starting from that point, the app will always work with already normalized ids.
I've actually grep'd any as (RequestId |ResponseId |DisputeId)
to remove any forced casting, keeping only the ones in methods used within ProtocolProvider.getEvent
const operations = await Promise.allSettled([ | ||
this.pledgeFor(request, dispute), | ||
(async () => { | ||
try { | ||
const { chainId } = request.decodedData.requestModuleData; | ||
|
||
await this.proposeResponse(chainId); | ||
} catch (err) { | ||
if (err instanceof ResponseAlreadyProposed) { | ||
this.logger.warn(err.message); | ||
} else { | ||
this.logger.error( | ||
`Could not propose a new response after response ${proposedResponse.id} disputal.`, | ||
); | ||
|
||
throw err; | ||
} | ||
} | ||
})(), | ||
]); | ||
|
||
operations.forEach((element) => { | ||
if (element.status === "rejected") throw element.reason; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're throwing on 'rejected', there's no benefit on doing Promise.allSettled
unless we require that Promises are all fulfilled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random fact: Viem has this stringify implemented
🤖 Linear
Closes GRT-192, GRT-216
Description
Miscelanous fixes:
waitForEvent
E2E testing util to return the found eventProphetCodec
class