fix: address review feedback on fetch-events.ts (#315)

- Replace hardcoded Infura API key with INFURA_API_KEY env var; fail fast
  with a helpful message if unset and no --rpc-url is given
- Add onchain/script/backtesting/.gitignore (cache/) instead of relying on
  the opaque root pattern; remove force-tracked cache/.gitkeep (mkdirSync
  creates the directory at runtime)
- Document resume constraint: reliable only when both --start-block and
  --end-block are explicit, or --output is set
- Fix batch-number display: derive batchNum inside the loop from the actual
  `from` block so it stays correct when resumeFromBlock isn't BATCH_SIZE-aligned
- Guard log.logIndex === null consistently with blockNumber/transactionHash
- console.warn on decode errors instead of silently discarding them

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-02-26 22:45:40 +00:00
parent df89b8c2da
commit c33bdbaad5
3 changed files with 34 additions and 11 deletions

2
onchain/script/backtesting/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Cache files generated by fetch-events.ts at runtime — do not commit
cache/