@@ -9,44 +9,43 @@ import chainsData from "./chains.json";
99//
1010// Historical backfill is ALWAYS the Portal. The realtime source is a config choice:
1111// • bench mode (default): bounded [deploy, head] — a clean fixed-range benchmark; RPC only for setup.
12- // • EULER_REALTIME=true: unbounded → live, realtime served by the Portal-backed RPC — the service
13- // offered to clients (Portal-backed under the hood, designed for the recent tip) .
12+ // • EULER_REALTIME=true: unbounded → live, realtime served by an authenticated RPC (URL + x-api-key
13+ // from env). Ponder owns reorg handling and is agnostic to what the RPC is or how it's implemented .
1414//
1515// Portal base URLs are deployment config (from env); relative to a base the documented Portal API paths
1616// apply — /datasets/<>, /metadata, … (see docs.sqd.dev). Public examples default to the public Portal.
17- // PORTAL_URL = Portal base (default https://portal.sqd.dev — the public, rate-limited Portal)
18- // PORTAL_RPC_URL = Portal-backed RPC base (from env; provisioned per client)
19- // One config serves any client by swapping env. `rpc.subsquid.io` is a generic proxied RPC (like Alchemy)
20- // — NOT the Portal-backed product — and is deliberately not used; keyless public RPCs (chains.json
21- // `freeRpcs`) are only for setup / finality tail.
17+ // PORTAL_URL = Portal base (default https://portal.sqd.dev — the public, rate-limited Portal)
18+ // REALTIME_RPC_URL = authenticated realtime RPC base (with REALTIME_RPC_KEY, from env)
19+ // One config serves any deployment by swapping env. Keyless public RPCs (chains.json `freeRpcs`) are only
20+ // for setup / finality tail — excluded from the realtime path (403/timeout cascades stall it).
2221//
23- // No secrets/tenancy in the repo: PORTAL_API_KEY, PORTAL_URL, PORTAL_RPC_KEY, PORTAL_RPC_URL come from env.
22+ // No secrets/tenancy in the repo: PORTAL_API_KEY, PORTAL_URL, REALTIME_RPC_KEY, REALTIME_RPC_URL come from env.
2423const proxyCreated = parseAbiItem (
2524 "event ProxyCreated(address indexed proxy, bool upgradeable, address implementation, bytes trailingData)" ,
2625) ;
2726
2827type ChainRow = { id : number ; name : string ; ds : string ; factory : string ; head : number ; deploy : number ; sqdSlug : string | null ; freeRpcs : string [ ] } ;
2928const rows = chainsData as ChainRow [ ] ;
3029const PORTAL_URL = process . env . PORTAL_URL ?? "https://portal.sqd.dev" ;
31- const PORTAL_RPC_KEY = process . env . PORTAL_RPC_KEY ;
32- const PORTAL_RPC_URL = process . env . PORTAL_RPC_URL ; // Portal-backed RPC base (from env; provisioned per client)
30+ const REALTIME_RPC_KEY = process . env . REALTIME_RPC_KEY ;
31+ const REALTIME_RPC_URL = process . env . REALTIME_RPC_URL ; // realtime RPC base (from env; provisioned per client)
3332const REALTIME = process . env . EULER_REALTIME === "true" ;
3433
35- // Chains served by the Portal-backed RPC. Realtime uses it (alone) on these.
36- const PORTAL_RPC_CHAINS = new Set ( [ 1 , 42161 , 8453 , 43114 , 137 , 56 , 9745 , 143 ] ) ;
37- const portalRpc = ( chainId : number ) =>
38- http ( `${ PORTAL_RPC_URL } /${ chainId } ` , { fetchOptions : { headers : { "x-api-key" : PORTAL_RPC_KEY ?? "" } } } ) ;
34+ // Chains served by the realtime RPC. Realtime uses it (alone) on these.
35+ const REALTIME_CHAINS = new Set ( [ 1 , 42161 , 8453 , 43114 , 137 , 56 , 9745 , 143 ] ) ;
36+ const realtimeRpc = ( chainId : number ) =>
37+ http ( `${ REALTIME_RPC_URL } /${ chainId } ` , { fetchOptions : { headers : { "x-api-key" : REALTIME_RPC_KEY ?? "" } } } ) ;
3938
40- // realtime → the Portal-backed RPC ALONE (the endpoint under evaluation): no generic proxy, no flaky
39+ // realtime → the realtime RPC ALONE (the endpoint under evaluation): no generic proxy, no flaky
4140// keyless public fallback (their 403/timeout cascades stall the single-thread). bench → public RPCs only.
4241const rpcFor = ( c : ChainRow ) =>
43- REALTIME && PORTAL_RPC_KEY && PORTAL_RPC_URL && PORTAL_RPC_CHAINS . has ( c . id ) ? portalRpc ( c . id ) : c . freeRpcs ;
42+ REALTIME && REALTIME_RPC_KEY && REALTIME_RPC_URL && REALTIME_CHAINS . has ( c . id ) ? realtimeRpc ( c . id ) : c . freeRpcs ;
4443
4544// optional subset: EULER_CHAINS=ethereum,base limits the run. In realtime mode with no explicit subset,
46- // default to the Portal-backed -RPC chains (the 8 that have a realtime source).
45+ // default to the realtime -RPC chains (the 8 that have a realtime source).
4746const only = ( process . env . EULER_CHAINS ?? "" ) . split ( "," ) . map ( ( s ) => s . trim ( ) ) . filter ( Boolean ) ;
4847let active = only . length ? rows . filter ( ( c ) => only . includes ( c . name ) ) : rows ;
49- if ( REALTIME && ! only . length ) active = rows . filter ( ( c ) => PORTAL_RPC_CHAINS . has ( c . id ) ) ;
48+ if ( REALTIME && ! only . length ) active = rows . filter ( ( c ) => REALTIME_CHAINS . has ( c . id ) ) ;
5049
5150export default createConfig ( {
5251 // Postgres (production shape, separate process → own memory) when DATABASE_URL is set; else pglite.
@@ -61,7 +60,7 @@ export default createConfig({
6160 chain : Object . fromEntries (
6261 active . map ( ( c ) => [
6362 c . name ,
64- // realtime: no endBlock → backfill to finalized head, then go live on the Portal-backed RPC.
63+ // realtime: no endBlock → backfill to finalized head, then go live on the realtime RPC.
6564 { address : factory ( { address : c . factory as `0x${string } `, event : proxyCreated , parameter : "proxy" } ) , startBlock : c . deploy , ...( REALTIME ? { } : { endBlock : c . head } ) } ,
6665 ] ) ,
6766 ) ,
0 commit comments