Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1357620

Browse files
committedNov 25, 2024·
feat(validtor-bot): review fixes
1 parent b233445 commit 1357620

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed
 

‎validator-cli/src/ArbToEth/watcherArbToGnosis.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,15 @@ const watch = async () => {
212212

213213
const veaEpochOutboxClaimableNowOld = veaEpochOutboxClaimableNow;
214214
veaEpochOutboxClaimableNow = Math.floor(timeGnosis / epochPeriod) - 1;
215-
// TODO: sometimes veaEpochOutboxClaimableNow is 1 epoch behind veaEpochOutboxClaimableNowOld
216-
const veaEpochsOutboxClaimableNew: number[] = new Array(veaEpochOutboxClaimableNow - veaEpochOutboxClaimableNowOld)
217-
.fill(veaEpochOutboxClaimableNowOld + 1)
218-
.map((el, i) => el + i);
219215

220-
veaEpochOutboxCheckClaimsRangeArray.concat(veaEpochsOutboxClaimableNew);
216+
if (veaEpochOutboxClaimableNow > veaEpochOutboxClaimableNowOld) {
217+
const veaEpochsOutboxClaimableNew: number[] = new Array(
218+
veaEpochOutboxClaimableNow - veaEpochOutboxClaimableNowOld
219+
)
220+
.fill(veaEpochOutboxClaimableNowOld + 1)
221+
.map((el, i) => el + i);
222+
veaEpochOutboxCheckClaimsRangeArray.push(...veaEpochsOutboxClaimableNew);
223+
}
221224

222225
if (veaEpochOutboxCheckClaimsRangeArray.length == 0) {
223226
console.log("no claims to check");
@@ -248,7 +251,7 @@ const watch = async () => {
248251
);
249252
veaEpochOutboxCheckClaimsRangeArray.splice(index, 1);
250253
index--;
251-
if (challenges.has(index)) challenges.delete(index);
254+
if (challenges.has(veaEpochOutboxCheck)) challenges.delete(veaEpochOutboxCheck);
252255
continue;
253256
} else {
254257
console.log(
@@ -320,7 +323,7 @@ const watch = async () => {
320323
continue;
321324
}
322325
console.log(veaEpochOutboxCheck, "claim found ", { claim });
323-
const previousProgress = challenges.get(index) || ({} as any);
326+
const previousProgress = challenges.get(veaEpochOutboxCheck) || ({} as any);
324327
let challengeProgress = await reconstructChallengeProgress(
325328
veaEpochOutboxCheck,
326329
veaOutbox,
@@ -333,7 +336,7 @@ const watch = async () => {
333336
amb,
334337
previousProgress
335338
);
336-
challenges.set(index, challengeProgress);
339+
challenges.set(veaEpochOutboxCheck, challengeProgress);
337340
console.log(
338341
"challenge progess for epoch " + veaEpochOutboxCheck + " is " + JSON.stringify(challengeProgress)
339342
);
@@ -389,7 +392,7 @@ const watch = async () => {
389392
finalized: false,
390393
};
391394
challengeProgress.status = "WithdrawalPending";
392-
challenges.set(index, challengeProgress);
395+
challenges.set(veaEpochOutboxCheck, challengeProgress);
393396
}
394397
}
395398
}

0 commit comments

Comments
 (0)
Please sign in to comment.