Skip to content

Fix: Update isCurrentRound for previous round on appeal #2007

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 4 commits into from
May 28, 2025
Merged
Changes from 3 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
13 changes: 11 additions & 2 deletions subgraph/core/src/KlerosCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,19 @@ export function handleAppealDecision(event: AppealDecision): void {
const disputeID = event.params._disputeID;
const dispute = Dispute.load(disputeID.toString());
if (!dispute) return;

// Load the current (previous) round
const previousRoundID = dispute.currentRound;
const previousRound = Round.load(previousRoundID);
if (previousRound) {
previousRound.isCurrentRound = false;
previousRound.save();
}

const newRoundIndex = dispute.currentRoundIndex.plus(ONE);
const roundID = `${disputeID}-${newRoundIndex.toString()}`;
const newRoundID = `${disputeID}-${newRoundIndex.toString()}`;
dispute.currentRoundIndex = newRoundIndex;
dispute.currentRound = roundID;
dispute.currentRound = newRoundID;
dispute.save();
const roundInfo = contract.getRoundInfo(disputeID, newRoundIndex);

Expand Down
Loading