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

No new epoch_info data right after the epoch boundary #232

Closed
xray-robot opened this issue Sep 4, 2023 · 4 comments · Fixed by #238
Closed

No new epoch_info data right after the epoch boundary #232

xray-robot opened this issue Sep 4, 2023 · 4 comments · Fixed by #238
Milestone

Comments

@xray-robot
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Since cron is triggered every 15 minutes on epoch-info-cache-update, right after the epoch boundary the new epoch data is not available (in our case we lose epoch end_time information).

And in general many cached tables are not available at this time (15-30-45 minutes time span after the epoch boundary), perhaps we should invent some system of (db level?) triggers to either remove this waiting time or reduce it to acceptable values.

Describe the solution you'd like

  1. Create some more precise triggers for caching functions
  2. Add epoch_start_time, epoch_end_time to the tip endpoint (?)

The task is not urgent, but worthy of attention ☺️

@rdlrt
Copy link
Contributor

rdlrt commented Sep 6, 2023

Since cron is triggered every 15 minutes on epoch-info-cache-update, right after the epoch boundary the new epoch data is not available (in our case we lose epoch end_time information).

I think instead of changing the epoch-info-cache-update interval, we would like to move away from needing a cache table beyond block/tx indexes at start/end time of a particular epoch. This would mean epoch-info-cache is much slimmer, as fetching epoch_params/cost models could be done against live tables (while last tx could end up as empty until cache has finished), do you agree?

in general many cached tables are not available at this time

I think while the intervals can be adapted for epoch table, the cache information for most (account/pool/etc) is delayed on node and DB level, and only becomes available after calculation and insert is finished - for the cache to be able to trigger. For instance, in #195 - you'd see that we end up having to read the logs and wait for epoch stake to finish populating to be able to start preparing data for stake cache, which in turn is used for pool stake and so on. Also, from chain pov, the new epoch does not really start until there is a new block available, and while that block might be available - the associated info like treasury/reward/MIRs/etc for next epoch are populated few stability windows later within an epoch.

@rdlrt rdlrt mentioned this issue Sep 7, 2023
@rdlrt rdlrt moved this to Testing in Koios Project Sep 7, 2023
@rdlrt rdlrt added this to the Koios vNext milestone Sep 7, 2023
@rdlrt
Copy link
Contributor

rdlrt commented Sep 7, 2023

Closed in linked PR

@rdlrt rdlrt closed this as completed Sep 7, 2023
@xray-robot
Copy link
Contributor Author

xray-robot commented Sep 7, 2023

I think instead of changing the epoch-info-cache-update interval, we would like to move away from needing a cache table beyond block/tx indexes at start/end time of a particular epoch. This would mean epoch-info-cache is much slimmer, as fetching epoch_params/cost models could be done against live tables (while last tx could end up as empty until cache has finished), do you agree?

It looks logical if the fetching can happen on live tables.

I think while the intervals can be adapted for epoch table, the cache information for most (account/pool/etc) is delayed on node and DB level, and only becomes available after calculation and insert is finished - for the cache to be able to trigger. For instance, in #195 - you'd see that we end up having to read the logs and wait for epoch stake to finish populating to be able to start preparing data for stake cache, which in turn is used for pool stake and so on. Also, from chain pov, the new epoch does not really start until there is a new block available, and while that block might be available - the associated info like treasury/reward/MIRs/etc for next epoch are populated few stability windows later within an epoch.

Yes, this all sounds logical, but maybe there should be some new endpoint that doesn't depend on inserting a stake, but indicates that an epoch has started (perhaps the data should be taken from live tables). For now, it's more of an indication that epoch_info has a gap with the network state in the half hour that db-sync stake processing takes.

Edited: I mean the current epoch_info is more related to txs/stake statistics data. Perhaps there should be an additional endpoint that shows more data about the epoch itself.

@xray-robot
Copy link
Contributor Author

Whoops, sorry. I mixed tip and epoch_info in my head. Don't mind my ticket. 😅

@rdlrt rdlrt mentioned this issue Oct 6, 2023
59 tasks
rdlrt added a commit that referenced this issue Oct 13, 2023
## Description
<!--- Describe your changes -->
[Re-created from #227 post renaming base-branch]

- [x] pool_list: Return all fields from pool_info_cache (latest pool entry)
- [x] Remove filter for returning only 'registered' pools from pool_list, pool_relays and pool_metadata endpoints
- [x] Few more linting polishing (remove trailing spaces, move single column/table references onto same line)
- [x] Update pool_info to return same metadata as pool_list and pool_metadata (latest w/o fallback)
- [x] Update all tx_in joins to use the new tx_out.consumed_by_tx_in_id
- [x] Dont include epoch_params in epoch_info_cache, update references accordingly
- [x] Update `*_txs` as per #186 (point 4)
- [x] Update `*_utxos` as per #186 (point 3)
  - [x] credential_utxos
  - [x] address_utxos
  - [x] account_utxos
  - [x] utxo_info
  - [x] asset_utxos
  - [x] script_utxos
- [x] Add script_info and align all endpoints for scripts
- [x] Add temporary cron for fixing epoch count mismatch
- [x] Add pool_registrations/pool_deregistrations endpoint
- [x] Add retired txs to `pool_updates` (other fields for such transactions will return `null`)
- [x] Add reward_withdrawals/treasury_withdrawals endpoint
- [x] Simplify address_assets and account_assets heirarchy to return flat table (helps do horizontal filtering as desired)
- [x] API Spec updates:
  - [x] Add section for Authentication
  - [x] Bump Koios version
  - [x] pool_list
  - [x] pool_metadata
  - [x] pool_relay
  - [x] `*_txs`
  - [x] `*_utxos`
  - [x] `address_assets`
  - [x] `account_assets`
  - [x] `epoch_params`
  - [x] `pool_registrations`/`pool_deregistrations`
  - [x] `reward_withdrawals`/`treasury_withdrawals`
  - [x] All script-related endpoints
  - [x] Update examples
  - [x] Check re-usability
  - [x] Check schemathesis
    - [x] guild
    - [x] preview
    - [x] preprod
    - [x] mainnet
- [x] Add v0 vs v1 to monitoring
  - [x] guild
  - [ ] preview (post merge)
  - [ ] preprod (post merge)
  - [ ] mainnet (post 1.1.0 - instead of 1.1.0rc) release

- [x] Ogmios
  - [x] Add integration for tx Evaluation and submission using ogmios path
  - [x] Add health check based on /health (`version` and `networkSynchronization`)
- [x] Update CHANGELOG
- [x] Bump final specs version number to v1 

## Which issue it fixes?
<!--- Link to issue: Closes #issue-number -->
- [x] Closes #208
- [x] Closes #218
- [x] Closes #186 
- [x] Closes #221
- [x] Closes #224
- [x] Closes #191
- [x] Closes #232
- [x] Closes #240 #241

---------

Co-authored-by: KoT_B_KocMoce <[email protected]>
Co-authored-by: Ola [AHLNET] <[email protected]>
@rdlrt rdlrt moved this from Testing to Completed in Koios Project Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

2 participants