From 991a13f5895f4350acb0df2ba175f4899557128b Mon Sep 17 00:00:00 2001 From: doomsower <12031673+doomsower@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:07:23 -0400 Subject: [PATCH] fix: snapshot for each batch in optimistic --- src/services/liquidate/BatchLiquidator.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/liquidate/BatchLiquidator.ts b/src/services/liquidate/BatchLiquidator.ts index 4b0a47b..7d68711 100644 --- a/src/services/liquidate/BatchLiquidator.ts +++ b/src/services/liquidate/BatchLiquidator.ts @@ -83,6 +83,7 @@ export default class BatchLiquidator this.logger.debug( `processing batch of ${batch.length} for ${batch[0]?.cmName}: ${batch.map(ca => ca.addr)}`, ); + const snapshotId = await this.client.anvil.snapshot(); const { results, receipt } = await this.#liquidateBatch( batch, cms, @@ -99,6 +100,7 @@ export default class BatchLiquidator for (const r of results) { this.optimistic.push({ ...r, traceFile: traceId }); } + await this.client.anvil.revert({ id: snapshotId }); } const success = this.optimistic.get().filter(r => !r.isError).length; this.logger.info(