From 5534e7e89e37749444aca60f9680fb25cd536cfd Mon Sep 17 00:00:00 2001 From: doomsower <12031673+doomsower@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:51:41 -0500 Subject: [PATCH] fix: increase redstone rounding --- src/services/RedstoneServiceV3.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/RedstoneServiceV3.ts b/src/services/RedstoneServiceV3.ts index 02b63ae..cea9ca9 100644 --- a/src/services/RedstoneServiceV3.ts +++ b/src/services/RedstoneServiceV3.ts @@ -84,8 +84,12 @@ export class RedstoneServiceV3 { // Also, when forking anvil->anvil (when running on testnets) block.timestamp can be in future because min ts for block is 1 seconds, // and scripts can take dozens of blocks (hundreds for faucet). So we take min value; const nowMs = new Date().getTime(); - const anvilTsS = 10 * Math.floor(Number(block.timestamp) / 10); - const fromNowTsS = 10 * Math.floor(nowMs / 10_000 - 1); + const redstoneIntervalS = 60; + const anvilTsS = + redstoneIntervalS * + Math.floor(Number(block.timestamp) / redstoneIntervalS); + const fromNowTsS = + redstoneIntervalS * Math.floor(nowMs / (redstoneIntervalS * 1000) - 1); this.#optimisticTimestamp = Math.min(anvilTsS, fromNowTsS); const deltaS = Math.floor(nowMs / 1000) - this.#optimisticTimestamp; this.logger.info(