From f6a7ca5050b65ded1e5ce1dd338eb4cf316282c3 Mon Sep 17 00:00:00 2001 From: KONFeature Date: Fri, 18 Oct 2024 18:06:59 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Reput=20envio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/erpc/erpc-config.ts | 32 ++++++++++++++++++++----------- packages/erpc/erpc.yaml | 37 +++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/packages/erpc/erpc-config.ts b/packages/erpc/erpc-config.ts index fdd2e99..fa38168 100644 --- a/packages/erpc/erpc-config.ts +++ b/packages/erpc/erpc-config.ts @@ -31,12 +31,22 @@ import { /* -------------------------------------------------------------------------- */ // Build every rate limits +const envioRateLimits = buildRateLimit({ + id: "envion-rate-limit", + rules: [ + { + method: "*", + maxCount: 600, + period: "1s", + }, + ], +}); const alchemyRateLimits = buildRateLimit({ id: "alchemy-rate-limit", rules: [ { method: "*", - maxCount: 400, + maxCount: 250, period: "1s", }, ], @@ -46,7 +56,7 @@ const blockPiRateLimits = buildRateLimit({ rules: [ { method: "*", - maxCount: 400, + maxCount: 250, period: "1s", }, ], @@ -56,7 +66,7 @@ const pimlicoRateLimits = buildRateLimit({ rules: [ { method: "*", - maxCount: 500, + maxCount: 400, period: "1s", }, ], @@ -111,6 +121,7 @@ const pimlicoSpecificMethods: RpcMethodWithRegex[] = [ // Build each upstream we will use const envioUpstream = buildEnvioUpstream({ + rateLimitBudget: envioRateLimits.id, ignoreMethods: ["*"], // todo: simple port of the vendors/evio.go stuff hereh // since ts sdk doesn't support null value if ts definition doesn't give optional stuff @@ -125,10 +136,6 @@ const envioUpstream = buildEnvioUpstream({ "eth_getTransactionReceipt", "eth_getBlockReceipts", "eth_getLogs", - "eth_getFilterLogs", - "eth_getFilterChanges", - "eth_uninstallFilter", - "eth_newFilter", ], }); const alchemyUpstream = buildAlchemyUpstream({ @@ -139,14 +146,12 @@ const alchemyUpstream = buildAlchemyUpstream({ const blockpiArbSepoliaUpstream = buildEvmUpstream({ id: "blockpi-arbSepolia", endpoint: `https://arbitrum-sepolia.blockpi.network/v1/rpc/${envVariable("BLOCKPI_API_KEY_ARB_SEPOLIA")}`, - allowMethods: ["*"], rateLimitBudget: blockPiRateLimits.id, ignoreMethods: pimlicoSpecificMethods, }); const blockpiArbUpstream = buildEvmUpstream({ id: "blockpi-arb", endpoint: `https://arbitrum.blockpi.network/v1/rpc/${envVariable("BLOCKPI_API_KEY_ARB")}`, - allowMethods: ["*"], rateLimitBudget: blockPiRateLimits.id, ignoreMethods: pimlicoSpecificMethods, }); @@ -161,7 +166,7 @@ const pimlicoUpstream = buildPimlicoUpstream({ const ponderProject: ProjectConfig = buildProject({ id: "ponder-rpc", networks, - upstreams: [alchemyUpstream, blockpiArbUpstream], + upstreams: [envioUpstream, alchemyUpstream, blockpiArbUpstream], auth: { strategies: [ buildSecretAuthStrategy({ @@ -234,7 +239,12 @@ export default buildErpcConfig({ }, projects: [ponderProject, nexusProject], rateLimiters: { - budgets: [alchemyRateLimits, pimlicoRateLimits, blockPiRateLimits], + budgets: [ + envioRateLimits, + alchemyRateLimits, + pimlicoRateLimits, + blockPiRateLimits, + ], }, }, }); diff --git a/packages/erpc/erpc.yaml b/packages/erpc/erpc.yaml index 1ee29ed..61d166a 100644 --- a/packages/erpc/erpc.yaml +++ b/packages/erpc/erpc.yaml @@ -88,6 +88,25 @@ projects: architecture: evm rateLimitBudget: "" upstreams: + - id: envio + endpoint: evm+envio://rpc.hypersync.xyz + rateLimitBudget: envion-rate-limit + type: evm+envio + vendorName: Envio + ignoreMethods: + - "*" + allowMethods: + - eth_chainId + - eth_blockNumber + - eth_getBlockByNumber + - eth_getBlockByHash + - eth_getTransactionByHash + - eth_getTransactionByBlockHashAndIndex + - eth_getTransactionByBlockNumberAndIndex + - eth_getTransactionReceipt + - eth_getBlockReceipts + - eth_getLogs + autoIgnoreUnsupportedMethods: true - &var5 id: alchemy endpoint: evm+alchemy://${ALCHEMY_API_KEY} @@ -111,8 +130,7 @@ projects: type: evm vendorName: Generic Evm ignoreMethods: *var3 - allowMethods: - - "*" + allowMethods: [] autoIgnoreUnsupportedMethods: true auth: strategies: @@ -143,8 +161,7 @@ projects: type: evm vendorName: Generic Evm ignoreMethods: *var3 - allowMethods: - - "*" + allowMethods: [] autoIgnoreUnsupportedMethods: true - *var6 cors: @@ -177,21 +194,27 @@ projects: value: ${NEXUS_RPC_SECRET} rateLimiters: budgets: + - id: envion-rate-limit + rules: + - method: "*" + maxCount: 600 + period: 1s + waitTime: "" - id: alchemy-rate-limit rules: - method: "*" - maxCount: 400 + maxCount: 250 period: 1s waitTime: "" - id: pimlico-rate-limit rules: - method: "*" - maxCount: 500 + maxCount: 400 period: 1s waitTime: "" - id: block-pi-rate-limit rules: - method: "*" - maxCount: 400 + maxCount: 250 period: 1s waitTime: ""