Skip to content

Commit

Permalink
fix: use evm_mine_detailed
Browse files Browse the repository at this point in the history
  • Loading branch information
doomsower committed Jul 23, 2024
1 parent 5b38f6a commit ff55320
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/services/RedstoneServiceV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
encodeFunctionData,
parseAbiParameters,
toBytes,
toHex,
} from "viem";

import type { Config } from "../config/index.js";
Expand Down Expand Up @@ -177,12 +178,15 @@ export class RedstoneServiceV3 {
{ tag: "timing" },
`warp, because block ts ${formatTs(block)} < ${formatTs(redstoneTs)} redstone ts (${Math.ceil(-delta / 60)} min)`,
);
await this.client.anvil.setNextBlockTimestamp({
timestamp: BigInt(redstoneTs),
});
await this.client.anvil.mine({ blocks: 1 });
const mineDetailed = await this.client.anvil.request({
method: "evm_mine_detailed",
params: [toHex(redstoneTs)],
} as any);
block = await this.client.pub.getBlock({ blockTag: "latest" });
logger.debug({ tag: "timing" }, `new block ts: ${formatTs(block)}`);
logger.debug(
{ tag: "timing", mineDetailed },
`new block ts: ${formatTs(block)}`,
);
}
}

Expand Down

0 comments on commit ff55320

Please sign in to comment.