Skip to content

Commit

Permalink
⚡️ Add rate limit for ponder dev
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Jan 7, 2025
1 parent 3ad1521 commit de37018
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/erpc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
envioRateRules,
llamaFreeRateRules,
pimlicoRateRules,
ponderDevRateRules,
tenderlyFreeRateRules,
} from "./rateLimits";
import { cacheConfig } from "./storage";
Expand Down Expand Up @@ -43,6 +44,7 @@ export default initErpcConfig({
drpc: drpcRateRules,
llamaFree: llamaFreeRateRules,
tenderlyFree: tenderlyFreeRateRules,
ponderDev: ponderDevRateRules,
})
// Add networks to the config
.decorate("networks", {
Expand Down Expand Up @@ -89,6 +91,7 @@ export default initErpcConfig({
upstreams.drpc,
upstreams.tenderlyFreeArbSepolia,
],
rateLimitBudget: "ponderDev",
auth: {
strategies: [
{
Expand Down
16 changes: 16 additions & 0 deletions packages/erpc/src/rateLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@ export const drpcRateRules: RuleExport = [genericRateLimitsRules(100)];

export const llamaFreeRateRules: RuleExport = [genericRateLimitsRules(30)];
export const tenderlyFreeRateRules: RuleExport = [genericRateLimitsRules(10)];

export const ponderDevRateRules: RuleExport = [
genericRateLimitsRules(200),
{
method: "eth_getLogs",
maxCount: 30,
period: "1s",
waitTime: "1s",
},
{
method: "eth_getBlockByNumber",
maxCount: 10,
period: "1s",
waitTime: "1s",
},
];

0 comments on commit de37018

Please sign in to comment.