From 0ed84b905a959fb276120a75560ea535d82738c0 Mon Sep 17 00:00:00 2001 From: KONFeature Date: Thu, 22 Aug 2024 17:22:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20methods,=20only=20use=20en?= =?UTF-8?q?vio=20for=20indexer,=20and=20alchemy=20+=20pimlico=20for=20nexu?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iac/Indexer.ts | 2 +- packages/erpc/erpc-config.ts | 37 ++++++++---------------------------- packages/erpc/erpc.yaml | 27 ++++++-------------------- packages/ponder/Dockerfile | 3 +-- 4 files changed, 16 insertions(+), 53 deletions(-) diff --git a/iac/Indexer.ts b/iac/Indexer.ts index 7c5e567..e24e30f 100644 --- a/iac/Indexer.ts +++ b/iac/Indexer.ts @@ -368,7 +368,7 @@ function addIndexerService({ // Set the right environment variables environment: { // Ponder related stuff - PONDER_LOG_LEVEL: "trace", + PONDER_LOG_LEVEL: "debug", // Erpc external endpoint ERPC_EXTERNAL_URL: "https://indexer.frak.id/ponder-rpc/evm", }, diff --git a/packages/erpc/erpc-config.ts b/packages/erpc/erpc-config.ts index 3bc387f..bd29d6b 100644 --- a/packages/erpc/erpc-config.ts +++ b/packages/erpc/erpc-config.ts @@ -97,33 +97,12 @@ const pimlicoSpecificMethods: RpcMethodWithRegex[] = [ ]; // Build each upstream we will use -const upstreams = [ - buildEnvioUpstream({ - ignoreMethods: ["*"], - allowMethods: [ - // Explicitly set allowed method for envio to remove `eth_getBlockByHash` and `eth_getBlockByNumber` - // since they are not returning `baseFeePerGas` attribute required for frontend use - // and since eRPC is overing the allowed method if not defined here: https://github.com/erpc/erpc/blob/cafe32b9d231012de5d329e7825589096f5af4b0/vendors/envio.go#L22 - "eth_chainId", - "eth_blockNumber", - "eth_getTransactionByHash", - "eth_getTransactionByBlockHashAndIndex", - "eth_getTransactionByBlockNumberAndIndex", - "eth_getTransactionReceipt", - "eth_getBlockReceipts", - "eth_getLogs", - "eth_getFilterLogs", - "eth_getFilterChanges", - "eth_uninstallFilter", - "eth_newFilter", - ], - }), - buildAlchemyUpstream({ - apiKey: envVariable("ALCHEMY_API_KEY"), - rateLimitBudget: alchemyRateLimits.id, - ignoreMethods: pimlicoSpecificMethods, - }), -]; +const envioUpstream = buildEnvioUpstream(); +const alchemyUpstream = buildAlchemyUpstream({ + apiKey: envVariable("ALCHEMY_API_KEY"), + rateLimitBudget: alchemyRateLimits.id, + ignoreMethods: pimlicoSpecificMethods, +}); const pimlicoUpstream = buildPimlicoUpstream({ apiKey: envVariable("PIMLICO_API_KEY"), rateLimitBudget: pimlicoRateLimits.id, @@ -135,7 +114,7 @@ const pimlicoUpstream = buildPimlicoUpstream({ const ponderProject: ProjectConfig = buildProject({ id: "ponder-rpc", networks, - upstreams, + upstreams: [envioUpstream, alchemyUpstream], auth: { strategies: [ buildSecretAuthStrategy({ @@ -152,7 +131,7 @@ const ponderProject: ProjectConfig = buildProject({ const nexusProject: ProjectConfig = buildProject({ id: "nexus-rpc", networks, - upstreams: [...upstreams, pimlicoUpstream], + upstreams: [alchemyUpstream, pimlicoUpstream], cors: { allowedOrigins: [ "https://nexus.frak.id", diff --git a/packages/erpc/erpc.yaml b/packages/erpc/erpc.yaml index ecf7ebe..b580dd6 100644 --- a/packages/erpc/erpc.yaml +++ b/packages/erpc/erpc.yaml @@ -82,35 +82,21 @@ projects: architecture: evm rateLimitBudget: "" upstreams: - - &var4 - id: envio + - id: envio endpoint: evm+envio://rpc.hypersync.xyz rateLimitBudget: "" type: evm+envio vendorName: Envio - ignoreMethods: - - "*" - allowMethods: - - eth_chainId - - eth_blockNumber - - eth_getTransactionByHash - - eth_getTransactionByBlockHashAndIndex - - eth_getTransactionByBlockNumberAndIndex - - eth_getTransactionReceipt - - eth_getBlockReceipts - - eth_getLogs - - eth_getFilterLogs - - eth_getFilterChanges - - eth_uninstallFilter - - eth_newFilter + ignoreMethods: [] + allowMethods: [] autoIgnoreUnsupportedMethods: true - - &var5 + - &var4 id: alchemy endpoint: evm+alchemy://${ALCHEMY_API_KEY} type: evm+alchemy rateLimitBudget: alchemy-rate-limit vendorName: Alchemy - ignoreMethods: &var6 + ignoreMethods: &var5 - eth_estimateUserOperationGas - eth_getUserOperationByHash - eth_getUserOperationReceipt @@ -134,7 +120,6 @@ projects: networks: *var3 upstreams: - *var4 - - *var5 - id: pimlico endpoint: evm+pimlico://${PIMLICO_API_KEY} rateLimitBudget: pimlico-rate-limit @@ -142,7 +127,7 @@ projects: vendorName: Pimlico ignoreMethods: - "*" - allowMethods: *var6 + allowMethods: *var5 autoIgnoreUnsupportedMethods: true cors: allowedOrigins: diff --git a/packages/ponder/Dockerfile b/packages/ponder/Dockerfile index e34aabf..b5a59b6 100644 --- a/packages/ponder/Dockerfile +++ b/packages/ponder/Dockerfile @@ -28,7 +28,6 @@ FROM base AS release # Set env to production ENV NODE_ENV=production -ENV PONDER_LOG_LEVEL=trace # copy production dependencies and source code into final image COPY . . @@ -40,4 +39,4 @@ COPY --from=install /temp/prod/node_modules node_modules # run the app EXPOSE 42069/tcp -ENTRYPOINT [ "pnpm", "run", "start"] \ No newline at end of file +ENTRYPOINT [ "pnpm", "ponder", "--log-format", "json", "--log-level", "debug", "start"] \ No newline at end of file