Skip to content

Commit

Permalink
🐛 Fix methods, only use envio for indexer, and alchemy + pimlico for …
Browse files Browse the repository at this point in the history
…nexus
  • Loading branch information
KONFeature committed Aug 22, 2024
1 parent cf5d0a5 commit 0ed84b9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 53 deletions.
2 changes: 1 addition & 1 deletion iac/Indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
37 changes: 8 additions & 29 deletions packages/erpc/erpc-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,12 @@ const pimlicoSpecificMethods: RpcMethodWithRegex<EIP1474Methods>[] = [
];

// 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,
Expand All @@ -135,7 +114,7 @@ const pimlicoUpstream = buildPimlicoUpstream({
const ponderProject: ProjectConfig = buildProject({
id: "ponder-rpc",
networks,
upstreams,
upstreams: [envioUpstream, alchemyUpstream],
auth: {
strategies: [
buildSecretAuthStrategy({
Expand All @@ -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",
Expand Down
27 changes: 6 additions & 21 deletions packages/erpc/erpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -134,15 +120,14 @@ projects:
networks: *var3
upstreams:
- *var4
- *var5
- id: pimlico
endpoint: evm+pimlico://${PIMLICO_API_KEY}
rateLimitBudget: pimlico-rate-limit
type: evm+pimlico
vendorName: Pimlico
ignoreMethods:
- "*"
allowMethods: *var6
allowMethods: *var5
autoIgnoreUnsupportedMethods: true
cors:
allowedOrigins:
Expand Down
3 changes: 1 addition & 2 deletions packages/ponder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 . .
Expand All @@ -40,4 +39,4 @@ COPY --from=install /temp/prod/node_modules node_modules

# run the app
EXPOSE 42069/tcp
ENTRYPOINT [ "pnpm", "run", "start"]
ENTRYPOINT [ "pnpm", "ponder", "--log-format", "json", "--log-level", "debug", "start"]

0 comments on commit 0ed84b9

Please sign in to comment.