Skip to content

fix(subgraph): handle-batched-disputes-request-events #2010

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

Merged
merged 1 commit into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions subgraph/core/src/entities/Dispute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,36 @@ export const updateDisputeRequestData = (event: DisputeCreation): void => {
if (!receipt) return;

const logs = receipt.logs;
const coreDisputeId = event.params._disputeID;

// note that the topic at 0th index is always the event signature
const disputeRequestEventIndex = logs.findIndex((log) => log.topics[0] == DisputeRequestSignature);
const crossChainDisputeEventIndex = logs.findIndex((log) => log.topics[0] == CrossChainDisputeIncomingSignature);
// For DisputeRequestSignature
let disputeRequestEventIndex = -1;
for (let i = 0; i < logs.length; i++) {
let log = logs[i];
if (log.topics.length > 2 && log.topics[0] == DisputeRequestSignature) {
// 3rd indexed argument in event is _arbitratorDisputeId
let decodedId = ethereum.decode("uint256", log.topics[2]);
if (decodedId != null && coreDisputeId.equals(decodedId.toBigInt())) {
disputeRequestEventIndex = i;
break;
}
}
}

// For CrossChainDisputeIncomingSignature
let crossChainDisputeEventIndex = -1;
for (let i = 0; i < logs.length; i++) {
let log = logs[i];
if (log.topics.length > 3 && log.topics[0] == CrossChainDisputeIncomingSignature) {
// 4th indexed argument in event is _arbitratorDisputeId
let decodedId = ethereum.decode("uint256", log.topics[3]);
if (decodedId != null && coreDisputeId.equals(decodedId.toBigInt())) {
crossChainDisputeEventIndex = i;
break;
}
}
}

if (crossChainDisputeEventIndex !== -1) {
const crossChainDisputeEvent = logs[crossChainDisputeEventIndex];
Expand Down
2 changes: 1 addition & 1 deletion subgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/kleros-v2-subgraph",
"version": "0.15.2",
"version": "0.15.3",
"drtVersion": "0.12.0",
"license": "MIT",
"scripts": {
Expand Down
Loading