From 3bffc6f0df6968adf4ae3966ab5f0ad6e8259eac Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 27 Jun 2024 21:59:20 +0100 Subject: [PATCH] remove paymaster validUntil limit --- mock-verifying-paymaster/src/index.ts | 102 +++++++++++++------------- mock-verifying-paymaster/src/relay.ts | 4 +- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/mock-verifying-paymaster/src/index.ts b/mock-verifying-paymaster/src/index.ts index de16703..954d79a 100644 --- a/mock-verifying-paymaster/src/index.ts +++ b/mock-verifying-paymaster/src/index.ts @@ -1,54 +1,54 @@ -import cors from "@fastify/cors" -import Fastify from "fastify" -import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "permissionless" -import { createPimlicoBundlerClient } from "permissionless/clients/pimlico" -import { http } from "viem" -import { foundry } from "viem/chains" -import { getAnvilWalletClient } from "./helpers/utils" +import cors from "@fastify/cors"; +import Fastify from "fastify"; +import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "permissionless"; +import { createPimlicoBundlerClient } from "permissionless/clients/pimlico"; +import { http } from "viem"; +import { foundry } from "viem/chains"; +import { getAnvilWalletClient } from "./helpers/utils"; import { - setupVerifyingPaymasterV06, - setupVerifyingPaymasterV07 -} from "./helpers/verifyingPaymasters" -import { createRpcHandler } from "./relay" + setupVerifyingPaymasterV06, + setupVerifyingPaymasterV07, +} from "./helpers/verifyingPaymasters"; +import { createRpcHandler } from "./relay"; const main = async () => { - const walletClient = getAnvilWalletClient() - const verifyingPaymasterV07 = await setupVerifyingPaymasterV07(walletClient) - const verifyingPaymasterV06 = await setupVerifyingPaymasterV06(walletClient) - - const altoBundlerV07 = createPimlicoBundlerClient({ - chain: foundry, - transport: http(process.env.ALTO_RPC), - entryPoint: ENTRYPOINT_ADDRESS_V07 - }) - - const altoBundlerV06 = createPimlicoBundlerClient({ - chain: foundry, - transport: http(process.env.ALTO_RPC), - entryPoint: ENTRYPOINT_ADDRESS_V06 - }) - - const app = Fastify({}) - - app.register(cors, { - origin: "*", - methods: ["POST", "GET", "OPTIONS"] - }) - - const rpcHandler = createRpcHandler( - altoBundlerV07, - altoBundlerV06, - verifyingPaymasterV07, - verifyingPaymasterV06, - walletClient - ) - app.post("/", {}, rpcHandler) - - app.get("/ping", async (_request, reply) => { - return reply.code(200).send({ message: "pong" }) - }) - - await app.listen({ host: "0.0.0.0", port: 3000 }) -} - -main() + const walletClient = getAnvilWalletClient(); + const verifyingPaymasterV07 = await setupVerifyingPaymasterV07(walletClient); + const verifyingPaymasterV06 = await setupVerifyingPaymasterV06(walletClient); + + const altoBundlerV07 = createPimlicoBundlerClient({ + chain: foundry, + transport: http(process.env.ALTO_RPC), + entryPoint: ENTRYPOINT_ADDRESS_V07, + }); + + const altoBundlerV06 = createPimlicoBundlerClient({ + chain: foundry, + transport: http(process.env.ALTO_RPC), + entryPoint: ENTRYPOINT_ADDRESS_V06, + }); + + const app = Fastify({}); + + app.register(cors, { + origin: "*", + methods: ["POST", "GET", "OPTIONS"], + }); + + const rpcHandler = createRpcHandler( + altoBundlerV07, + altoBundlerV06, + verifyingPaymasterV07, + verifyingPaymasterV06, + walletClient, + ); + app.post("/", {}, rpcHandler); + + app.get("/ping", async (_request, reply) => { + return reply.code(200).send({ message: "pong" }); + }); + + await app.listen({ host: "0.0.0.0", port: 3000 }); +}; + +main(); diff --git a/mock-verifying-paymaster/src/relay.ts b/mock-verifying-paymaster/src/relay.ts index f3ed6e9..fb3d9c1 100644 --- a/mock-verifying-paymaster/src/relay.ts +++ b/mock-verifying-paymaster/src/relay.ts @@ -105,7 +105,7 @@ const handleMethodV06 = async ( } const validAfter = 0; - const validUntil = Math.floor(Date.now() / 1000) + 6000; + const validUntil = 0; op.paymasterAndData = concat([ verifyingPaymasterV06.address, encodeAbiParameters( @@ -208,7 +208,7 @@ const handleMethodV07 = async ( } const validAfter = 0; - const validUntil = Math.floor(Date.now() / 1000) + 6000; + const validUntil = 0; op.paymasterData = concat([ encodeAbiParameters( [