@@ -25,19 +25,21 @@ import {
2525 isCronSecretConfigured ,
2626} from "../../_lib/middleware.js" ;
2727
28- // Consolidated from four separate files (accrue/health/rebalance/alert) to
29- // stay under Vercel's per-deployment Serverless Functions cap. URL paths are
30- // unchanged: /api/v1/keepers/accrue, /api/v1/keepers/health,
31- // /api/v1/keepers/rebalance, and /api/v1/keepers/alert all route here via
32- // the [action].ts dynamic segment, with req.query.action set accordingly.
28+ // Consolidated from the former per-keeper files to stay under Vercel's
29+ // per-deployment Serverless Functions cap. URL paths are unchanged:
30+ // /api/v1/keepers/accrue, /api/v1/keepers/health,
31+ // /api/v1/keepers/rebalance, /api/v1/keepers/alert, and
32+ // /api/v1/keepers/snapshot all route here via the [action].ts dynamic
33+ // segment, with req.query.action set accordingly.
3334//
34- // health is read-only and public, same as before; accrue/rebalance/alert
35- // still require the cron bearer token and are never CORS-gated. accrue and
36- // rebalance sign and submit real transactions off a funded/admin account;
37- // alert signs nothing but still costs an RPC round trip per known vault plus
38- // a webhook POST per unauthenticated probe, so it gets the same rate-limit
39- // backstop. That auth split is preserved exactly as it was when these were
40- // separate files.
35+ // health is read-only and public, same as before; accrue/rebalance/alert/
36+ // snapshot still require the cron bearer token and are never CORS-gated.
37+ // accrue and rebalance sign and submit real transactions off a funded/admin
38+ // account; alert signs nothing but still costs an RPC round trip per known
39+ // vault plus a webhook POST per unauthenticated probe; snapshot reads every
40+ // tracked wallet and writes the resulting series. They all keep the same
41+ // rate-limit backstop. That auth split is preserved exactly as it was when
42+ // these were separate files.
4143export default async function handler ( req : VercelRequest , res : VercelResponse ) {
4244 const { action } = req . query ;
4345
@@ -71,14 +73,14 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
7173 return res . status ( 405 ) . json ( { error : "Method not allowed" } ) ;
7274 }
7375
74- // No applyCors: cron-invoked, never browser-facing. But all three sign or
75- // submit real transactions, or read/post on their behalf, unlike simple
76- // reads, so they still get a rate-limit backstop. Checked before auth,
77- // deliberately, even though that costs a Redis round trip on an
76+ // No applyCors: cron-invoked, never browser-facing. But these actions sign
77+ // or submit real transactions, or read and write on their behalf, unlike
78+ // simple reads, so they still get a rate-limit backstop. Checked before
79+ // auth, deliberately, even though that costs a Redis round trip on an
7880 // unauthenticated probe: this is the volume-abuse backstop for *all*
79- // traffic, not just correctly authenticated traffic — if it only ran
80- // after a successful auth check, unauthenticated/ wrong-token spam would
81- // be entirely unbounded.
81+ // traffic, not just correctly authenticated traffic. If it only ran after
82+ // a successful auth check, unauthenticated or wrong-token spam would be
83+ // entirely unbounded.
8284 try {
8385 if ( ! ( await checkRateLimit ( req , res , { strict : true } ) ) ) return ;
8486 } catch ( err ) {
0 commit comments