Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(epoch): use epochZeroStartTimestamp to determine if you should tr… #60

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

dtfiedler
Copy link
Collaborator

…y and submit a report

The current error:

info: Listening on port 5050 {"timestamp":"2025-02-20T07:07:12.583Z"}
info: Generating report... {"timestamp":"2025-02-20T07:07:13.237Z"}
error: Error generating report Cannot destructure property 'startTimestamp' of '(intermediate value)' as it is undefined. {"stack":"TypeError: Cannot destructure property 'startTimestamp' of '(intermediate value)' as it is undefined.\n    at ContractEpochSource.getEpochParams (file:///Users/dylanfiedler/Documents/ario/ar-io/ar-io-observer/src/epochs/contract-epoch-source.ts:49:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Observer.generateReport (file:///Users/dylanfiedler/Documents/ario/ar-io/ar-io-observer/src/observer.ts:279:37)\n    at async updateAndSaveCurrentReport (file:///Users/dylanfiedler/Documents/ario/ar-io/ar-io-observer/src/system.ts:259:24)","timestamp":"2025-02-20T07:07:13.941Z"}

This happens because we expect epoch to be defined in the ContractSource. If we have not created any epochs, the destructing of the empty epoch throws the error.

Checking the epochZeroStartTimestamp is a better way to indicate if/when epochs should be created.

With the fix:

info: Using wallet 1H7WZIWhzwTH9FIcnuMqYkTsoyv1OTfGa_amvuYwrgo {"timestamp":"2025-02-20T07:07:47.527Z"}
info: Loading key file... {"keyFile":"wallets/1H7WZIWhzwTH9FIcnuMqYkTsoyv1OTfGa_amvuYwrgo.json","timestamp":"2025-02-20T07:07:47.530Z"}
info: Key file loaded {"keyFile":"wallets/1H7WZIWhzwTH9FIcnuMqYkTsoyv1OTfGa_amvuYwrgo.json","timestamp":"2025-02-20T07:07:47.530Z"}
info: Using process PklI5-ORsL310QNAwh-LMcFycFxPkJ67MmoriUCaL3I to fetch contract information {"processId":"PklI5-ORsL310QNAwh-LMcFycFxPkJ67MmoriUCaL3I","timestamp":"2025-02-20T07:07:47.543Z"}
info: SUBMIT_CONTRACT_INTERACTIONS is false - contract interactions will not be saved {"timestamp":"2025-02-20T07:07:47.552Z"}
info: Listening on port 5050 {"timestamp":"2025-02-20T07:07:47.604Z"}
info: First epoch has not started yet. Not generating report. {"timestamp":"2025-02-20T07:07:48.261Z"}

dtfiedler added 2 commits February 20, 2025 01:11
…y and submit a report

The current error:
```
error: Error generating report Cannot destructure property "startTimestamp" of "(intermediate value)" as it is undefined.
```

happens because we expect epoch to be defined in the ContractSource. If we have not created any epochs, this destructing results in undefined values. By checking the epochZeroStartTimestamp beofre attempting to fetch an epoch, we clean up the error.
We should look to make this interface handle the epochZeroStartTimstamp being a future date as well, but not necessary to fix the immediate bug
@djwhitt djwhitt merged commit 4b22b6e into develop Feb 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants