@lidofinance/api-rpc-proxy 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -2
- package/README.mdx +4 -0
- package/dist/index.cjs +558 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +524 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,sFAAsF;AACtF,2DAA2D;AAC3D,6BAA6B;AAC7B,iEAAiE;AACjE,sFAAsF;AACtF,qFAAqF;;;;;;;;;;;;;ACL9E,MAAM,4CAA4B;AAElC,MAAM,4CAAgC;AAEtC,MAAM,iDAAoB;AAAO;AAEjC,MAAM,kDAAgC;IAC3C,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;AAEO,MAAM,kDAAmC;IAC9C,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;AAEO,MAAM,kDAA4B;IACvC,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;AAEO,MAAM,kDAA0B;IACrC,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;;;;;;ACfA,kFAAkF;AAClF,iFAAiF;AACjF,6EAA6E;AAC7E,MAAM,+BAAS,OAAO;AAEf,MAAM,4CAA+B,CAC1C,cACA,WACA;IAEA,OAAO,CAAC;QACN,MAAM,aAAa,MAAM,QAAQ,IAAI,MAAM,WAAW,IAAI,MAAM,OAAO,CAAC,EAAE,GAAG,IAAI,MAAM;QAEvF,MAAM,UAAU,OAAO,cAAc;QAErC,IAAI,SAAS,CAAC,QAAQ,IAAI,MACxB,MAAM,IAAI,CAAA,GAAA,yCAAs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C3B;sBACA;kBACA;QACA,SAAS;YACP,mBAAmB,QAAQ;YAC3B,mBAAmB,QAAQ;QAC7B;oBACA;sBACA;IACF;IAEA,MAAM,eAAe,CAAA,GAAA,yCAAkB,EAAE;QACvC,KAAK,UAAU;QACf,WAAW,UAAU;QACrB,gBAAgB,UAAU;QAC1B,WAAW,IAAM,QAAQ,sBAAsB,IAAI;gBAAE,OAAO;YAAO;IACrE;IAMK,IAAI,SAAS,CAAC;QACjB,MAAM,QAAQ,cAAc;QAC5B,MAAM,KAAK,QAAQ;QACnB,OAAO,QAAQ;IACjB;AACF;;","sources":["packages/api/rpc-proxy/src/index.ts","packages/api/rpc-proxy/src/rpcFactory/rpcFactory.ts","packages/api/rpc-proxy/src/rpcFactory/errors.ts","packages/api/rpc-proxy/src/rpcFactory/validation.ts","packages/api/rpc-proxy/src/rpcFactory/types.ts","packages/api/rpc-proxy/src/rateLimit/rateLimit.ts","packages/api/rpc-proxy/src/rateLimit/constants.ts","packages/api/rpc-proxy/src/rateLimit/fixedWindowStore.ts","packages/api/rpc-proxy/src/rateLimit/getClientIp.ts","packages/api/rpc-proxy/src/health.ts","packages/api/rpc-proxy/src/metrics.ts","packages/api/rpc-proxy/src/routes.ts"],"sourcesContent":["export { rpcFactory } from './rpcFactory/rpcFactory'\nexport * from './rpcFactory/types'\nexport * from './rpcFactory/errors'\nexport {\n baseRequestValidationFactory,\n ethCallValidationFactory,\n ethGetLogsValidationFactory,\n rpcMethodsValidationFactory,\n shouldValidateRpcMethod,\n streamMaxSizeValidationFactory,\n} from './rpcFactory/validation'\n\nexport { createRateLimitHook } from './rateLimit/rateLimit'\nexport type { RateLimitOptions } from './rateLimit/rateLimit'\nexport { FixedWindowStore } from './rateLimit/fixedWindowStore'\nexport { getClientIp, normalizeIp } from './rateLimit/getClientIp'\nexport { RATE_LIMIT_ERROR_MESSAGE, RATE_LIMIT_HEADERS } from './rateLimit/constants'\n\nexport { probeChains } from './health'\nexport type { ChainProbeResult, ProbeChainsOptions } from './health'\n\nexport { createRpcProxyMetrics } from './metrics'\nexport type { CreateRpcProxyMetricsOptions, RpcProxyMetrics } from './metrics'\n\nexport { registerRpcProxyRoutes } from './routes'\nexport type { RegisterRpcProxyRoutesOptions } from './routes'\n","// RPC proxy factory adapted from the @lidofinance/next-api-wrapper rpcFactory pattern\n// (https://github.com/lidofinance/lido-frontend-template).\n// Changes from the original:\n// - Ported from Next.js API routes to Fastify request handlers\n// - Added per-chain contract-address allowlist (eth_call / eth_getLogs restriction)\n// - Integrated @lidofinance/api-rpc trackedFetchRpcFactory for prom-client metrics\nimport { Readable } from 'node:stream'\nimport { pipeline } from 'node:stream/promises'\nimport { ReadableStream } from 'node:stream/web'\nimport { iterateUrls } from '@lidofinance/rpc'\n\nimport { ClientError, DEFAULT_API_ERROR_MESSAGE, HEALTHY_RPC_SERVICES_ARE_OVER } from './errors'\n\nimport type { RPCFactoryParams } from './types'\nimport {\n baseRequestValidationFactory,\n ethCallValidationFactory,\n ethGetLogsValidationFactory,\n rpcMethodsValidationFactory,\n shouldValidateRpcMethod,\n streamMaxSizeValidationFactory,\n} from './validation'\nimport type { FetchRpcInitBody } from '@lidofinance/rpc'\nimport type { FastifyReply, FastifyRequest } from 'fastify'\n\ntype RpcQuery = { chainId?: string }\n\nexport const rpcFactory = ({\n providers,\n fetchRPC,\n defaultChain,\n validation,\n serverLogger = console,\n metrics,\n}: RPCFactoryParams) => {\n const {\n allowedRPCMethods,\n allowedCallAddresses,\n allowedLogsAddresses,\n maxResponseSize = 1_000_000,\n maxBatchCount = 20,\n currentBlockTTLms = 60_000,\n maxGetLogsRange = 20_000,\n blockEmptyAddressGetLogs = true,\n } = validation\n\n const rpcRequestBlocked = metrics?.rpcRequestBlocked ?? {\n inc: (_labels: { reason: string }) => {},\n }\n const rpcRequestMethods = metrics?.rpcRequestMethods\n\n const validateBaseRequest = baseRequestValidationFactory(defaultChain, providers, maxBatchCount)\n const validateRpcMethod = rpcMethodsValidationFactory(allowedRPCMethods)\n\n const validateEthCall =\n allowedCallAddresses && shouldValidateRpcMethod('eth_call', allowedRPCMethods)\n ? ethCallValidationFactory(allowedCallAddresses)\n : undefined\n\n const validateEthGetLogs =\n (allowedLogsAddresses || blockEmptyAddressGetLogs) && shouldValidateRpcMethod('eth_getLogs', allowedRPCMethods)\n ? ethGetLogsValidationFactory(allowedLogsAddresses, blockEmptyAddressGetLogs, maxGetLogsRange, currentBlockTTLms)\n : undefined\n\n const validateMaxSteamSize = streamMaxSizeValidationFactory(maxResponseSize)\n\n const requestRPC = (chainId: number, body: FetchRpcInitBody) =>\n iterateUrls(\n providers[chainId],\n (url: string) => fetchRPC(url, { body }, { chainId }),\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error)\n serverLogger.warn(`[rpcFactory] provider failed for chain ${chainId}: ${message}`)\n },\n )\n\n return async (request: FastifyRequest<{ Querystring: RpcQuery }>, reply: FastifyReply): Promise<void> => {\n const abortController = new AbortController()\n try {\n const { chainId, requests } = validateBaseRequest(request)\n\n const validationContext = { chainId, rpcRequestBlocked, requestRPC }\n\n for (const req of requests) {\n validateRpcMethod(req, validationContext)\n rpcRequestMethods?.inc({ method: req.method })\n\n if (req.method === 'eth_call' && validateEthCall) {\n validateEthCall(req, validationContext)\n }\n if (req.method === 'eth_getLogs' && validateEthGetLogs) {\n await validateEthGetLogs(req, validationContext)\n }\n }\n\n const proxiedRPC = await requestRPC(chainId, request.body as FetchRpcInitBody)\n\n void reply.header('content-type', proxiedRPC.headers.get('content-type') ?? 'application/json')\n\n if (!proxiedRPC.body) {\n throw new Error('There are problems with RPC provider')\n }\n\n await pipeline(\n Readable.fromWeb(proxiedRPC.body as ReadableStream),\n validateMaxSteamSize(validationContext),\n reply.raw,\n { signal: abortController.signal },\n )\n } catch (error) {\n if (error instanceof ClientError) {\n void reply.status(400).send(error.message ?? DEFAULT_API_ERROR_MESSAGE)\n } else if (error instanceof Error) {\n serverLogger.error('[rpcFactory] ' + (error.message ?? DEFAULT_API_ERROR_MESSAGE))\n if (!reply.sent) {\n void reply.status(500).send(DEFAULT_API_ERROR_MESSAGE)\n }\n } else {\n void reply.status(500).send(HEALTHY_RPC_SERVICES_ARE_OVER)\n }\n } finally {\n abortController.abort()\n }\n }\n}\n","export const DEFAULT_API_ERROR_MESSAGE = 'Something went wrong. Sorry, try again later :('\n\nexport const HEALTHY_RPC_SERVICES_ARE_OVER = 'Healthy RPC services are over!'\n\nexport class ClientError extends Error {}\n\nexport class UnsupportedChainIdError extends ClientError {\n constructor(message?: string) {\n super(message || 'Unsupported chainId')\n }\n}\n\nexport class UnsupportedHTTPMethodError extends ClientError {\n constructor(message?: string) {\n super(message || 'Unsupported HTTP method')\n }\n}\n\nexport class InvalidRequestError extends ClientError {\n constructor(message?: string) {\n super(message || 'Invalid Request')\n }\n}\n\nexport class SizeTooLargeError extends ClientError {\n constructor(message?: string) {\n super(message || 'Response size too large')\n }\n}\n","import { Transform } from 'node:stream'\n\nimport { Cache } from 'memory-cache'\n\nimport { ClientError, InvalidRequestError, SizeTooLargeError, UnsupportedChainIdError } from './errors'\n\nimport type { RpcRequest, ValidationContext } from './types'\n\ntype BaseRequest = {\n query: { chainId?: string | string[] }\n body: unknown\n}\n\n// BigInt(0), not a 0n literal — this file is type-checked under the repo's shared\n// root tsconfig (target es5) whenever a sibling package without its own tsconfig\n// runs `tsc`, and BigInt literal syntax requires an ES2020+ target to parse.\nconst zeroBN = BigInt(0)\n\nexport const baseRequestValidationFactory = (\n defaultChain: number | string,\n providers: Record<string, unknown>,\n maxBatchSize?: number,\n) => {\n return (req: BaseRequest) => {\n const rawChainId = Array.isArray(req.query.chainId) ? req.query.chainId[0] : req.query.chainId\n\n const chainId = Number(rawChainId || defaultChain)\n\n if (providers[chainId] == null) {\n throw new UnsupportedChainIdError()\n }\n\n const requests = Array.isArray(req.body) ? req.body : [req.body]\n\n if (typeof maxBatchSize === 'number' && requests.length > maxBatchSize) {\n throw new InvalidRequestError(`Too many batched requests`)\n }\n return { chainId, requests }\n }\n}\n\nexport const rpcMethodsValidationFactory = (allowedMethods?: string[]) => {\n const methodsMap = new Set(allowedMethods ?? [])\n\n return (request: RpcRequest, context: ValidationContext) => {\n const method = request.method\n if (typeof method !== 'string') {\n throw new InvalidRequestError(`RPC method isn't string`)\n }\n if (allowedMethods && !methodsMap.has(request.method)) {\n context.rpcRequestBlocked.inc({ reason: 'method not allowed' })\n throw new InvalidRequestError(`RPC method ${method} not allowed`)\n }\n }\n}\n\nexport const ethCallValidationFactory = (allowedAddress: Record<number, string[]>) => {\n const allowedCallAddressMap = createAllowedAddressMap(allowedAddress)\n\n return (request: RpcRequest, { chainId, rpcRequestBlocked }: ValidationContext) => {\n const { params } = request\n\n // Explicitly reject any request whose first param is not a well-formed tx object.\n // Using an early-return guard keeps the \"address allowed?\" check unconditionally\n // reachable and prevents future edits to the condition from accidentally creating\n // a path that forwards an unvalidated eth_call.\n const txObject = Array.isArray(params) ? params[0] : undefined\n\n if (\n txObject == null ||\n typeof txObject !== 'object' ||\n !('to' in txObject) ||\n typeof (txObject as Record<string, unknown>).to !== 'string'\n ) {\n throw new InvalidRequestError(`RPC method eth_call is invalid`)\n }\n\n const toAddress = (txObject as { to: string }).to\n\n if (!allowedCallAddressMap[chainId]?.has(toAddress.toLowerCase())) {\n rpcRequestBlocked.inc({ reason: 'address not allowed for eth_call' })\n throw new InvalidRequestError(`Address not allowed for eth_call`)\n }\n }\n}\n\nexport const ethGetLogsValidationFactory = (\n allowedAddress: Record<number, string[]> | undefined,\n blockEmptyAddressGetLogs: boolean | undefined,\n maxBlockRange: number | undefined,\n currentBlockTTL = 60_000,\n) => {\n const allowedAddressMap = createAllowedAddressMap(allowedAddress ?? {})\n const maxBlockRangeBN = maxBlockRange ? BigInt(maxBlockRange) : zeroBN\n const currentBlock = new Cache<number, bigint>()\n\n return async (request: RpcRequest, { chainId, rpcRequestBlocked, requestRPC }: ValidationContext) => {\n try {\n const params = request.params[0] as any\n const fromBlock: string = params.fromBlock\n const toBlock: string = params.toBlock ?? 'latest'\n\n if (blockEmptyAddressGetLogs || allowedAddress) {\n const address: string | string[] = params.address\n\n if (blockEmptyAddressGetLogs && !address)\n throw new InvalidRequestError(`RPC method eth_getLogs address is invalid`)\n\n const addresses = Array.isArray(address) ? address : [address]\n\n if (blockEmptyAddressGetLogs && addresses.length === 0) {\n throw new InvalidRequestError(`RPC method eth_getLogs address is invalid`)\n }\n if (\n allowedAddress &&\n addresses.some(\n (eventAddress) =>\n typeof eventAddress !== 'string' || !allowedAddressMap[chainId]?.has(eventAddress.toLowerCase()),\n )\n ) {\n rpcRequestBlocked.inc({ reason: 'address not allowed for eth_getLogs' })\n throw new InvalidRequestError(`Address not allowed for eth_getLogs`)\n }\n }\n\n if (maxBlockRange) {\n if (fromBlock === 'earliest') throw new InvalidRequestError(`RPC method eth_getLogs fromBlock is invalid`)\n\n if (fromBlock.startsWith('0x')) {\n const normalizedFromBlock = BigInt(fromBlock)\n let normalizedToBlock: bigint\n\n if (toBlock.startsWith('0x')) {\n normalizedToBlock = BigInt(toBlock)\n } else {\n const cached = currentBlock.get(chainId)\n if (cached) {\n normalizedToBlock = cached\n } else {\n normalizedToBlock = await requestRPC(chainId, {\n id: 1,\n jsonrpc: '2.0',\n method: 'eth_blockNumber',\n })\n .then((res) => res.json() as Promise<{ result: string }>)\n .then((res) => BigInt(res.result))\n currentBlock.put(chainId, normalizedToBlock, currentBlockTTL)\n }\n }\n\n const range = normalizedToBlock - normalizedFromBlock\n if (range < zeroBN || range > maxBlockRangeBN) {\n rpcRequestBlocked.inc({ reason: 'eth_getLogs range is invalid' })\n throw new InvalidRequestError(`RPC method eth_getLogs range is invalid`)\n }\n }\n }\n } catch (error) {\n if (error instanceof ClientError) throw error\n throw new InvalidRequestError(`RPC method eth_getLogs is invalid`)\n }\n }\n}\n\nexport const streamMaxSizeValidationFactory = (MAX_SIZE: number) => (context: ValidationContext) => {\n let bytesWritten = 0\n return new Transform({\n transform(chunk, _encoding, callback) {\n bytesWritten += chunk.length\n if (bytesWritten > MAX_SIZE) {\n context.rpcRequestBlocked.inc({ reason: 'response too large' })\n return callback(new SizeTooLargeError(`Stream size exceeds the maximum limit of ${MAX_SIZE} bytes`))\n }\n return callback(null, chunk)\n },\n flush(callback) {\n callback()\n },\n })\n}\n\n// utils\n\nexport const shouldValidateRpcMethod = (method: string, allowedRPCMethods?: string[]) =>\n !allowedRPCMethods || allowedRPCMethods.includes(method)\n\nconst createAllowedAddressMap = (allowedAddress: Record<number, string[]>) =>\n Object.entries(allowedAddress).reduce((acc, [chainId, addresses]) => {\n acc[chainId] = new Set(addresses.map((a) => a.toLowerCase()))\n return acc\n }, {} as Record<string, Set<string>>)\n","import type { FetchRpcInit, FetchRpcInitBody } from '@lidofinance/rpc'\n\nexport type RpcProviders = Record<string | number, [string, ...string[]]>\n\nexport type RPCFactoryValidationParams = {\n maxBatchCount?: number\n maxResponseSize?: number\n allowedRPCMethods?: string[]\n allowedCallAddresses?: Record<number, string[]>\n allowedLogsAddresses?: Record<number, string[]>\n blockEmptyAddressGetLogs?: boolean\n maxGetLogsRange?: number\n currentBlockTTLms?: number\n}\n\nexport type FetchRPC = (url: string, init: FetchRpcInit, meta: { chainId: number | string }) => Promise<Response>\n\nexport type RPCFactoryMetrics = {\n rpcRequestBlocked: RpcRequestBlockedCounter\n rpcRequestMethods?: { inc(labels: { method: string }): void }\n}\n\nexport type RPCFactoryParams = {\n providers: RpcProviders\n fetchRPC: FetchRPC\n defaultChain: string | number\n validation: RPCFactoryValidationParams\n serverLogger?: Pick<Console, 'warn' | 'error'>\n metrics?: RPCFactoryMetrics\n}\n\nexport type RpcRequest = {\n method: string\n params: unknown[]\n}\n\nexport type RpcRequestBlockedCounter = {\n inc(labels: { reason: string }): void\n}\n\nexport type ValidationContext = {\n chainId: number\n rpcRequestBlocked: RpcRequestBlockedCounter\n requestRPC: (chainId: number, body: FetchRpcInitBody) => Promise<Response>\n}\n","import { RATE_LIMIT_ERROR_MESSAGE, RATE_LIMIT_HEADERS } from './constants'\nimport { FixedWindowStore } from './fixedWindowStore'\nimport { getClientIp } from './getClientIp'\nimport type { FastifyReply, FastifyRequest } from 'fastify'\n\nexport type RateLimitOptions = {\n max: number\n windowSec: number\n customIpHeader?: string\n onBlocked?: (ip: string) => void\n}\n\n// Fixed-window per-IP limiter, adapted as a Fastify preHandler from\n// https://github.com/lidofinance/warehouse/blob/main/packages/next/ip-rate-limit\n// (a Next.js API-route wrapper — this repo has no Next.js, so the counting\n// and IP-extraction ideas are ported by hand rather than installed).\n// One store instance per createRateLimitHook call — call it once per route so\n// separate routes (e.g. /rpc and /api/csp-report) don't share a budget.\nexport const createRateLimitHook = ({ max, windowSec, customIpHeader, onBlocked }: RateLimitOptions) => {\n const store = new FixedWindowStore()\n\n return async (req: FastifyRequest, reply: FastifyReply): Promise<void> => {\n const ip = getClientIp(req, customIpHeader)\n const now = Date.now() / 1000\n const window = Math.floor(now / windowSec)\n const key = `${ip}:${window}`\n\n const count = store.increment(key, windowSec)\n const remaining = max - count\n const reset = (window + 1) * windowSec\n\n void reply.header(RATE_LIMIT_HEADERS.limit, String(max))\n void reply.header(RATE_LIMIT_HEADERS.remaining, String(Math.max(remaining, 0)))\n void reply.header(RATE_LIMIT_HEADERS.reset, String(reset))\n\n if (remaining < 0) {\n const retryAfter = Math.max(Math.ceil(reset - now), 0)\n void reply.header('Retry-After', String(retryAfter))\n onBlocked?.(ip)\n void reply.status(429).send(`${RATE_LIMIT_ERROR_MESSAGE} for ip:${ip}`)\n }\n }\n}\n","export const RATE_LIMIT_HEADERS = {\n limit: 'X-RateLimit-Limit',\n remaining: 'X-RateLimit-Remaining',\n reset: 'X-RateLimit-Reset',\n} as const\n\nexport const RATE_LIMIT_ERROR_MESSAGE = 'Rate limit exceeded'\n","type StoreEntry = { value: number; timeoutId: NodeJS.Timeout }\n\n// Fixed-window counter: each key auto-expires durationSec after it was last\n// touched, so no separate sweep/cron is needed to bound memory. Adapted from\n// https://github.com/lidofinance/warehouse/blob/main/packages/next/ip-rate-limit/src/storage.ts,\n// itself based on nestjs/throttler's setTimeout-per-key approach.\nexport class FixedWindowStore {\n private store = new Map<string, StoreEntry>()\n\n private set(key: string, value: number, durationSec: number) {\n clearTimeout(this.store.get(key)?.timeoutId)\n\n const timeoutId = setTimeout(() => this.store.delete(key), durationSec * 1000)\n // This is a cache-eviction timer, not pending work — it must not keep the\n // process alive on its own (matters for a long-running server, unlike the\n // serverless functions the ported design originally ran in).\n timeoutId.unref()\n\n this.store.set(key, { value, timeoutId })\n }\n\n get(key: string): number | undefined {\n return this.store.get(key)?.value\n }\n\n increment(key: string, durationSec: number): number {\n const next = (this.get(key) ?? 0) + 1\n this.set(key, next, durationSec)\n return next\n }\n}\n","import { isIP } from 'node:net'\nimport type { FastifyRequest } from 'fastify'\n\nexport const normalizeIp = (ip: string): string => ip.trim().replace(/^::ffff:/i, '')\n\nconst firstValidIp = (value: string | string[] | undefined): string | undefined => {\n const raw = Array.isArray(value) ? value[0] : value\n if (!raw) return undefined\n const candidate = normalizeIp(raw.split(',')[0] ?? '')\n return candidate && isIP(candidate) ? candidate : undefined\n}\n\n// req.ip is already the right answer for X-Forwarded-For: Fastify's trustProxy\n// option (see server/index.ts, set to TRUSTED_PROXY_HOPS) walks exactly that\n// many hops back through the header via @fastify/proxy-addr, which is the\n// correct way to find the real client through this app's one nginx hop. X-\n// Forwarded-For is never read directly here — a client can set that header to\n// anything, and only Fastify's hop-counted view of it is trustworthy.\n//\n// customIpHeader is for an edge/CDN in front of nginx (e.g. Cloudflare's\n// cf-connecting-ip) that knows the client's IP authoritatively, independent of\n// hop counting. It's validated with isIP so a spoofed or garbage value falls\n// through to req.ip instead of being trusted blindly — ported from\n// https://github.com/lidofinance/warehouse/blob/main/packages/next/ip-rate-limit/src/utils.ts,\n// adapted from Next's per-request customIpHeader to Fastify + trustProxy.\nexport const getClientIp = (req: FastifyRequest, customIpHeader?: string): string => {\n const customIp = customIpHeader ? firstValidIp(req.headers[customIpHeader.toLowerCase()]) : undefined\n\n return customIp ?? normalizeIp(req.ip || '0.0.0.0')\n}\n","import type { FetchRPC, RpcProviders } from './rpcFactory/types'\n\nexport type ChainProbeResult = { chainId: string; ok: boolean }\n\nexport type ProbeChainsOptions = {\n fetchRPC: FetchRPC\n timeoutMs?: number\n onResult?: (result: ChainProbeResult) => void\n logger?: Pick<Console, 'warn'>\n}\n\nconst DEFAULT_HEALTH_TIMEOUT_MS = 5_000\n\n// Probes every configured URL per chain in parallel — matching the runtime fallback\n// semantics of iterateUrls in rpcFactory. A chain is healthy when at least one URL\n// responds, so a single-provider outage doesn't fail a proxy that has working fallbacks.\nexport const probeChains = async (\n providers: RpcProviders,\n { fetchRPC, timeoutMs = DEFAULT_HEALTH_TIMEOUT_MS, onResult, logger = console }: ProbeChainsOptions,\n): Promise<ChainProbeResult[]> => {\n const results = await Promise.all(\n Object.entries(providers).map(async ([chainId, urls]) => {\n const urlResults = await Promise.all(\n urls.map(async (url) => {\n try {\n const response = await fetchRPC(\n url,\n {\n body: { id: 1, jsonrpc: '2.0', method: 'eth_blockNumber', params: [] },\n signal: AbortSignal.timeout(timeoutMs),\n },\n { chainId },\n )\n const { result } = (await response.json()) as { result?: unknown }\n return response.ok && result != null\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n logger.warn(`[health] probe failed for chain ${chainId} url ${url}: ${reason}`)\n return false\n }\n }),\n )\n const ok = urlResults.some(Boolean)\n return { chainId, ok }\n }),\n )\n for (const result of results) {\n onResult?.(result)\n }\n return results\n}\n","import { trackedFetchRpcFactory } from '@lidofinance/api-rpc'\nimport { Counter, Gauge, Histogram, Registry, collectDefaultMetrics } from 'prom-client'\n\nimport type { FetchRPC } from './rpcFactory/types'\n\nexport type RpcProxyMetrics = {\n registry: Registry\n fetchRPC: FetchRPC\n rpcRequestBlocked: Counter<'reason'>\n rpcRequestMethods: Counter<'method'>\n rateLimitBlockedCount: Counter<'route'>\n apiResponse: Histogram<'method' | 'route' | 'status'>\n rpcChainReachable: Gauge<'chainId'>\n}\n\nexport type CreateRpcProxyMetricsOptions = {\n // Prefix applied to every metric name registered by this factory, including the\n // request/response counters trackedFetchRpcFactory registers into `registry`.\n prefix: string\n registry?: Registry\n // Set false when the consuming app already calls prom-client's collectDefaultMetrics\n // itself (e.g. to combine it with its own startup metrics) — avoids double-registering.\n collectDefault?: boolean\n}\n\n// Prom-client metrics for a Fastify RPC proxy: blocked/allowed request counts,\n// per-IP rate-limit blocks, HTTP response timings and per-chain reachability —\n// plus a metrics-tracked fetchRPC (via @lidofinance/api-rpc) to pass into rpcFactory.\nexport const createRpcProxyMetrics = ({\n prefix,\n registry = new Registry(),\n collectDefault = true,\n}: CreateRpcProxyMetricsOptions): RpcProxyMetrics => {\n const rpcRequestBlocked = new Counter({\n name: `${prefix}rpc_request_blocked_total`,\n help: 'Number of blocked RPC requests by reason',\n labelNames: ['reason'] as const,\n registers: [registry],\n })\n\n // Client-requested RPC methods, counted at validation time — before a request is\n // blocked or forwarded. Distinct from fetchRPC's own request-methods counter (from\n // @lidofinance/api-rpc), which only counts methods that actually reached a provider.\n const rpcRequestMethods = new Counter({\n name: `${prefix}rpc_request_methods`,\n help: 'RPC methods requested by clients, by method',\n labelNames: ['method'] as const,\n registers: [registry],\n })\n\n const rateLimitBlockedCount = new Counter({\n name: `${prefix}rate_limit_blocked_total`,\n help: 'Number of requests rejected by the in-process per-IP rate limiter, by route',\n labelNames: ['route'] as const,\n registers: [registry],\n })\n\n const apiResponse = new Histogram({\n name: `${prefix}api_response_seconds`,\n help: 'API response time',\n buckets: [0.1, 0.2, 0.3, 0.6, 1, 1.5, 2, 5],\n labelNames: ['method', 'route', 'status'] as const,\n registers: [registry],\n })\n\n const rpcChainReachable = new Gauge({\n name: `${prefix}rpc_chain_reachable`,\n help: '1 if the RPC endpoint for the chain is reachable, 0 otherwise',\n labelNames: ['chainId'] as const,\n registers: [registry],\n })\n\n // Registers its own request/response/methods/result counters into `registry`.\n const fetchRPC = trackedFetchRpcFactory({ prefix, registry })\n\n if (collectDefault) {\n collectDefaultMetrics({ register: registry, prefix })\n }\n\n return {\n registry,\n fetchRPC,\n rpcRequestBlocked,\n rpcRequestMethods,\n rateLimitBlockedCount,\n apiResponse,\n rpcChainReachable,\n }\n}\n","import { getStatusLabel } from '@lidofinance/api-metrics'\n\nimport { probeChains } from './health'\nimport { createRateLimitHook } from './rateLimit/rateLimit'\nimport { rpcFactory } from './rpcFactory/rpcFactory'\n\nimport type { RpcProxyMetrics } from './metrics'\nimport type { RPCFactoryValidationParams, FetchRPC, RpcProviders } from './rpcFactory/types'\nimport type { FastifyInstance } from 'fastify'\n\nexport type RegisterRpcProxyRoutesOptions = {\n providers: RpcProviders\n defaultChain: string | number\n fetchRPC: FetchRPC\n metrics: RpcProxyMetrics\n validation: RPCFactoryValidationParams\n rateLimit: {\n max: number\n windowSec: number\n customIpHeader?: string\n }\n healthTimeoutMs?: number\n serverLogger?: Pick<Console, 'warn' | 'error'>\n}\n\n// Wires /health, /metrics and /rpc onto a Fastify instance. Anything app-specific —\n// CSP reporting, extra routes, the fastify() bootstrap itself — stays with the caller.\nexport const registerRpcProxyRoutes = (app: FastifyInstance, options: RegisterRpcProxyRoutesOptions) => {\n const { providers, defaultChain, fetchRPC, metrics, validation, rateLimit, healthTimeoutMs, serverLogger } = options\n\n // Route label uses the matched route template (e.g. \"/rpc\"), not request.url —\n // avoid request.url here because unmatched URLs (404s) can blow up label\n // cardinality, hence the 'unknown' fallback instead. status is the aggregated\n // 2xx/4xx/… class, not the exact code.\n app.addHook('onResponse', (request, reply, done) => {\n metrics.apiResponse.observe(\n {\n method: request.method,\n route: request.routeOptions.url ?? 'unknown',\n status: getStatusLabel(reply.statusCode),\n },\n reply.elapsedTime / 1000,\n )\n done()\n })\n\n app.get('/health', async (_req, reply) => {\n const checks = await probeChains(providers, {\n fetchRPC,\n timeoutMs: healthTimeoutMs,\n onResult: ({ chainId, ok }) => metrics.rpcChainReachable.set({ chainId }, ok ? 1 : 0),\n logger: serverLogger,\n })\n const healthy = checks.every((c) => c.ok)\n // Structured JSON (status code still carries the pass/fail signal for simple\n // probes like a Dockerfile's `wget --spider`) so infra/dashboards hitting this\n // directly can see which chain is unreachable, not just an aggregate.\n return reply.status(healthy ? 200 : 503).send({\n status: healthy ? 'ok' : 'degraded',\n chains: Object.fromEntries(checks.map((c) => [c.chainId, c.ok ? 'ok' : 'unreachable'])),\n })\n })\n\n app.get('/metrics', async (_req, reply) => {\n const content = await metrics.registry.metrics()\n void reply.status(200).header('Content-Type', metrics.registry.contentType).send(content)\n })\n\n const handleRpc = rpcFactory({\n providers,\n defaultChain,\n fetchRPC,\n metrics: {\n rpcRequestBlocked: metrics.rpcRequestBlocked,\n rpcRequestMethods: metrics.rpcRequestMethods,\n },\n validation,\n serverLogger,\n })\n\n const rpcRateLimit = createRateLimitHook({\n max: rateLimit.max,\n windowSec: rateLimit.windowSec,\n customIpHeader: rateLimit.customIpHeader,\n onBlocked: () => metrics.rateLimitBlockedCount.inc({ route: '/rpc' }),\n })\n\n // Encapsulated in its own plugin context (rather than passed via the route's\n // `preHandler` option) so the rate-limit hook's untyped FastifyRequest doesn't\n // get unified with handleRpc's typed `Querystring: RpcQuery` generic — that\n // unification otherwise collapses to `unknown` and fails to typecheck.\n void app.register((scope) => {\n scope.addHook('preHandler', rpcRateLimit)\n scope.post('/rpc', handleRpc)\n return Promise.resolve()\n })\n}\n"],"names":[],"version":3,"file":"index.cjs.map","sourceRoot":"../../../../"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { FetchRpcInit, FetchRpcInitBody } from "@lidofinance/rpc";
|
|
2
|
+
import { Transform } from "node:stream";
|
|
3
|
+
import { FastifyReply, FastifyRequest, FastifyInstance } from "fastify";
|
|
4
|
+
import { Counter, Gauge, Histogram, Registry } from "prom-client";
|
|
5
|
+
export const DEFAULT_API_ERROR_MESSAGE = "Something went wrong. Sorry, try again later :(";
|
|
6
|
+
export const HEALTHY_RPC_SERVICES_ARE_OVER = "Healthy RPC services are over!";
|
|
7
|
+
export class ClientError extends Error {
|
|
8
|
+
}
|
|
9
|
+
export class UnsupportedChainIdError extends ClientError {
|
|
10
|
+
constructor(message?: string);
|
|
11
|
+
}
|
|
12
|
+
export class UnsupportedHTTPMethodError extends ClientError {
|
|
13
|
+
constructor(message?: string);
|
|
14
|
+
}
|
|
15
|
+
export class InvalidRequestError extends ClientError {
|
|
16
|
+
constructor(message?: string);
|
|
17
|
+
}
|
|
18
|
+
export class SizeTooLargeError extends ClientError {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
export type RpcProviders = Record<string | number, [string, ...string[]]>;
|
|
22
|
+
export type RPCFactoryValidationParams = {
|
|
23
|
+
maxBatchCount?: number;
|
|
24
|
+
maxResponseSize?: number;
|
|
25
|
+
allowedRPCMethods?: string[];
|
|
26
|
+
allowedCallAddresses?: Record<number, string[]>;
|
|
27
|
+
allowedLogsAddresses?: Record<number, string[]>;
|
|
28
|
+
blockEmptyAddressGetLogs?: boolean;
|
|
29
|
+
maxGetLogsRange?: number;
|
|
30
|
+
currentBlockTTLms?: number;
|
|
31
|
+
};
|
|
32
|
+
export type FetchRPC = (url: string, init: FetchRpcInit, meta: {
|
|
33
|
+
chainId: number | string;
|
|
34
|
+
}) => Promise<Response>;
|
|
35
|
+
export type RPCFactoryMetrics = {
|
|
36
|
+
rpcRequestBlocked: RpcRequestBlockedCounter;
|
|
37
|
+
rpcRequestMethods?: {
|
|
38
|
+
inc(labels: {
|
|
39
|
+
method: string;
|
|
40
|
+
}): void;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type RPCFactoryParams = {
|
|
44
|
+
providers: RpcProviders;
|
|
45
|
+
fetchRPC: FetchRPC;
|
|
46
|
+
defaultChain: string | number;
|
|
47
|
+
validation: RPCFactoryValidationParams;
|
|
48
|
+
serverLogger?: Pick<Console, 'warn' | 'error'>;
|
|
49
|
+
metrics?: RPCFactoryMetrics;
|
|
50
|
+
};
|
|
51
|
+
export type RpcRequest = {
|
|
52
|
+
method: string;
|
|
53
|
+
params: unknown[];
|
|
54
|
+
};
|
|
55
|
+
export type RpcRequestBlockedCounter = {
|
|
56
|
+
inc(labels: {
|
|
57
|
+
reason: string;
|
|
58
|
+
}): void;
|
|
59
|
+
};
|
|
60
|
+
export type ValidationContext = {
|
|
61
|
+
chainId: number;
|
|
62
|
+
rpcRequestBlocked: RpcRequestBlockedCounter;
|
|
63
|
+
requestRPC: (chainId: number, body: FetchRpcInitBody) => Promise<Response>;
|
|
64
|
+
};
|
|
65
|
+
type BaseRequest = {
|
|
66
|
+
query: {
|
|
67
|
+
chainId?: string | string[];
|
|
68
|
+
};
|
|
69
|
+
body: unknown;
|
|
70
|
+
};
|
|
71
|
+
export const baseRequestValidationFactory: (defaultChain: number | string, providers: Record<string, unknown>, maxBatchSize?: number) => (req: BaseRequest) => {
|
|
72
|
+
chainId: number;
|
|
73
|
+
requests: any[];
|
|
74
|
+
};
|
|
75
|
+
export const rpcMethodsValidationFactory: (allowedMethods?: string[]) => (request: RpcRequest, context: ValidationContext) => void;
|
|
76
|
+
export const ethCallValidationFactory: (allowedAddress: Record<number, string[]>) => (request: RpcRequest, { chainId, rpcRequestBlocked }: ValidationContext) => void;
|
|
77
|
+
export const ethGetLogsValidationFactory: (allowedAddress: Record<number, string[]> | undefined, blockEmptyAddressGetLogs: boolean | undefined, maxBlockRange: number | undefined, currentBlockTTL?: number) => (request: RpcRequest, { chainId, rpcRequestBlocked, requestRPC }: ValidationContext) => Promise<void>;
|
|
78
|
+
export const streamMaxSizeValidationFactory: (MAX_SIZE: number) => (context: ValidationContext) => Transform;
|
|
79
|
+
export const shouldValidateRpcMethod: (method: string, allowedRPCMethods?: string[]) => boolean;
|
|
80
|
+
type RpcQuery = {
|
|
81
|
+
chainId?: string;
|
|
82
|
+
};
|
|
83
|
+
export const rpcFactory: ({ providers, fetchRPC, defaultChain, validation, serverLogger, metrics, }: RPCFactoryParams) => (request: FastifyRequest<{
|
|
84
|
+
Querystring: RpcQuery;
|
|
85
|
+
}>, reply: FastifyReply) => Promise<void>;
|
|
86
|
+
export const RATE_LIMIT_HEADERS: {
|
|
87
|
+
readonly limit: "X-RateLimit-Limit";
|
|
88
|
+
readonly remaining: "X-RateLimit-Remaining";
|
|
89
|
+
readonly reset: "X-RateLimit-Reset";
|
|
90
|
+
};
|
|
91
|
+
export const RATE_LIMIT_ERROR_MESSAGE = "Rate limit exceeded";
|
|
92
|
+
export class FixedWindowStore {
|
|
93
|
+
get(key: string): number | undefined;
|
|
94
|
+
increment(key: string, durationSec: number): number;
|
|
95
|
+
}
|
|
96
|
+
export const normalizeIp: (ip: string) => string;
|
|
97
|
+
export const getClientIp: (req: FastifyRequest, customIpHeader?: string) => string;
|
|
98
|
+
export type RateLimitOptions = {
|
|
99
|
+
max: number;
|
|
100
|
+
windowSec: number;
|
|
101
|
+
customIpHeader?: string;
|
|
102
|
+
onBlocked?: (ip: string) => void;
|
|
103
|
+
};
|
|
104
|
+
export const createRateLimitHook: ({ max, windowSec, customIpHeader, onBlocked }: RateLimitOptions) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
105
|
+
export type ChainProbeResult = {
|
|
106
|
+
chainId: string;
|
|
107
|
+
ok: boolean;
|
|
108
|
+
};
|
|
109
|
+
export type ProbeChainsOptions = {
|
|
110
|
+
fetchRPC: FetchRPC;
|
|
111
|
+
timeoutMs?: number;
|
|
112
|
+
onResult?: (result: ChainProbeResult) => void;
|
|
113
|
+
logger?: Pick<Console, 'warn'>;
|
|
114
|
+
};
|
|
115
|
+
export const probeChains: (providers: RpcProviders, { fetchRPC, timeoutMs, onResult, logger }: ProbeChainsOptions) => Promise<ChainProbeResult[]>;
|
|
116
|
+
export type RpcProxyMetrics = {
|
|
117
|
+
registry: Registry;
|
|
118
|
+
fetchRPC: FetchRPC;
|
|
119
|
+
rpcRequestBlocked: Counter<'reason'>;
|
|
120
|
+
rpcRequestMethods: Counter<'method'>;
|
|
121
|
+
rateLimitBlockedCount: Counter<'route'>;
|
|
122
|
+
apiResponse: Histogram<'method' | 'route' | 'status'>;
|
|
123
|
+
rpcChainReachable: Gauge<'chainId'>;
|
|
124
|
+
};
|
|
125
|
+
export type CreateRpcProxyMetricsOptions = {
|
|
126
|
+
prefix: string;
|
|
127
|
+
registry?: Registry;
|
|
128
|
+
collectDefault?: boolean;
|
|
129
|
+
};
|
|
130
|
+
export const createRpcProxyMetrics: ({ prefix, registry, collectDefault, }: CreateRpcProxyMetricsOptions) => RpcProxyMetrics;
|
|
131
|
+
export type RegisterRpcProxyRoutesOptions = {
|
|
132
|
+
providers: RpcProviders;
|
|
133
|
+
defaultChain: string | number;
|
|
134
|
+
fetchRPC: FetchRPC;
|
|
135
|
+
metrics: RpcProxyMetrics;
|
|
136
|
+
validation: RPCFactoryValidationParams;
|
|
137
|
+
rateLimit: {
|
|
138
|
+
max: number;
|
|
139
|
+
windowSec: number;
|
|
140
|
+
customIpHeader?: string;
|
|
141
|
+
};
|
|
142
|
+
healthTimeoutMs?: number;
|
|
143
|
+
serverLogger?: Pick<Console, 'warn' | 'error'>;
|
|
144
|
+
};
|
|
145
|
+
export const registerRpcProxyRoutes: (app: FastifyInstance, options: RegisterRpcProxyRoutesOptions) => void;
|
|
146
|
+
|
|
147
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA,OAAO,MAAM,6EAA6E,CAAA;AAE1F,OAAO,MAAM,gEAAgE,CAAA;AAE7E,wBAAyB,SAAQ,KAAK;CAAG;AAEzC,oCAAqC,SAAQ,WAAW;gBAC1C,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,uCAAwC,SAAQ,WAAW;gBAC7C,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,gCAAiC,SAAQ,WAAW;gBACtC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,8BAA+B,SAAQ,WAAW;gBACpC,OAAO,CAAC,EAAE,MAAM;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,CAAC,CAAA;IACpC,qBAAqB,EAAE,QAAQ,OAAO,CAAC,CAAA;IACvC,WAAW,EAAE,UAAU,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAA;IACrD,iBAAiB,EAAE,MAAM,SAAS,CAAC,CAAA;CACpC,CAAA;AAED,2CAA2C;IAGzC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAGnB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAKD,OAAO,MAAM,+DAIV,4BAA4B,KAAG,eAwDjC,CAAA;AC9ED,4CAA4C;IAC1C,SAAS,EAAE,YAAY,CAAA;IACvB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,0BAA0B,CAAA;IACtC,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAA;QACX,SAAS,EAAE,MAAM,CAAA;QACjB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;CAC/C,CAAA;AAID,OAAO,MAAM,8BAA+B,eAAe,WAAW,6BAA6B,SAqElG,CAAA","sources":["packages/api/rpc-proxy/src/src/rpcFactory/errors.ts","packages/api/rpc-proxy/src/src/rpcFactory/types.ts","packages/api/rpc-proxy/src/src/rpcFactory/validation.ts","packages/api/rpc-proxy/src/src/rpcFactory/rpcFactory.ts","packages/api/rpc-proxy/src/src/rateLimit/constants.ts","packages/api/rpc-proxy/src/src/rateLimit/fixedWindowStore.ts","packages/api/rpc-proxy/src/src/rateLimit/getClientIp.ts","packages/api/rpc-proxy/src/src/rateLimit/rateLimit.ts","packages/api/rpc-proxy/src/src/health.ts","packages/api/rpc-proxy/src/src/metrics.ts","packages/api/rpc-proxy/src/src/routes.ts","packages/api/rpc-proxy/src/src/index.ts","packages/api/rpc-proxy/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,"export { rpcFactory } from './rpcFactory/rpcFactory'\nexport * from './rpcFactory/types'\nexport * from './rpcFactory/errors'\nexport {\n baseRequestValidationFactory,\n ethCallValidationFactory,\n ethGetLogsValidationFactory,\n rpcMethodsValidationFactory,\n shouldValidateRpcMethod,\n streamMaxSizeValidationFactory,\n} from './rpcFactory/validation'\n\nexport { createRateLimitHook } from './rateLimit/rateLimit'\nexport type { RateLimitOptions } from './rateLimit/rateLimit'\nexport { FixedWindowStore } from './rateLimit/fixedWindowStore'\nexport { getClientIp, normalizeIp } from './rateLimit/getClientIp'\nexport { RATE_LIMIT_ERROR_MESSAGE, RATE_LIMIT_HEADERS } from './rateLimit/constants'\n\nexport { probeChains } from './health'\nexport type { ChainProbeResult, ProbeChainsOptions } from './health'\n\nexport { createRpcProxyMetrics } from './metrics'\nexport type { CreateRpcProxyMetricsOptions, RpcProxyMetrics } from './metrics'\n\nexport { registerRpcProxyRoutes } from './routes'\nexport type { RegisterRpcProxyRoutesOptions } from './routes'\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../../../../"}
|