Skip to content

Commit

Permalink
return empty list when solana blocks too old
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters committed Nov 29, 2023
1 parent 080b585 commit 3af0697
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion cloud_functions/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,4 @@ gcloud functions deploy update-token-metadata --entry-point updateTokenMetadata
gcloud functions deploy reobserve-vaas --entry-point getReobserveVaas --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars FIRESTORE_ALARM_MISSING_VAAS_COLLECTION=$FIRESTORE_ALARM_MISSING_VAAS_COLLECTION --set-secrets 'REOBSERVE_VAA_API_KEY=Reobs_VAA_API_key_xLabs:1'
gcloud functions deploy wormchain-monitor --entry-point wormchainMonitor --runtime nodejs16 --trigger-http --no-allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars WORMCHAIN_SLACK_CHANNEL_ID=$WORMCHAIN_SLACK_CHANNEL_ID,WORMCHAIN_SLACK_POST_URL=$WORMCHAIN_SLACK_POST_URL,WORMCHAIN_SLACK_BOT_TOKEN=$WORMCHAIN_SLACK_BOT_TOKEN,WORMCHAIN_PAGERDUTY_ROUTING_KEY=$WORMCHAIN_PAGERDUTY_ROUTING_KEY,WORMCHAIN_PAGERDUTY_URL=$WORMCHAIN_PAGERDUTY_URL
gcloud functions deploy get-solana-events --entry-point getSolanaEvents --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars SOLANA_RPC=$SOLANA_RPC
gcloud functions deploy get-solana-events --entry-point getSolanaEvents --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars SOLANA_RPC=$SOLANA_RPC
gcloud functions deploy get-sui-events --entry-point getSuiEvents --runtime nodejs18 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3
3 changes: 2 additions & 1 deletion cloud_functions/src/getSolanaEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export async function getSolanaEvents(req: any, res: any) {
const fromSlot = Number(req.query.fromSlot);
const toSlot = Number(req.query.toSlot);
console.log(`fetching events from ${fromSlot} to ${toSlot}`);
const events = await _getSolanaEvents(fromSlot, toSlot);
// the RPC doesn't store blocks that are too old
const events = fromSlot < 232090284 ? [] : await _getSolanaEvents(fromSlot, toSlot);
console.log(`fetched ${events.length} events`);
res.json(events);
} catch (e) {
Expand Down

0 comments on commit 3af0697

Please sign in to comment.