---
# System prepended metadata

title: Oracle review
tags: [Oracle]

---

---
title: Oracle review
tags: Oracle
status: Draft
---
# Oracle review

## Things to research

- Gas estimation.
    - Gas amount depends on previous reports (contract state)?
    - Report structure
        - Static array length
        - Dynamic array length depends on gas amount
- How extra data quorum works.
    - What if there are several parts of extra data with same type.
- Separate modules into processes.
- Версия Оракула прибита к версии контракта. Для апдейта - нужно выкатить мажорную верию и попросить Oracle Holders параллельно поднять её.

## Entrypoint same for all modules

Responsobility:
- Variables sainity checks.
- Infinity cycle
- All healthchecks

## Accounting

Cycle:
- Check contract and consensus version
    - Oracle state:
        - Ready for hash report
            - Build report.
            - Send hash to Contract
        - Ready for data to be reported
            - Build report.
            - Check hash with Oracle's contract if changed send new hash.
            - If consensus hash == oracle's hash - send report data
        - Ready for list of validators to be reported (WIP)
        - Oracle finalized and all data delivered. Wait for next epoch.

### Calculations

- Bunker mode.
    - How to associate lido slashed validators to withdrawal requests, beacuse slashed epoch can't be calculated
    `withdraw = max(validator.withdrawable_epoch, Epoch(epoch + EPOCHS_PER_SLASHINGS_VECTOR))`
        
## Ejectior

Cycle:
- Check contract and consensus version
    - Oracle state:
        - Ready for hash report
            - Build report.
            - Send hash to Contract
        - Ready for data to be reported
            - Build report.
            - Check hash with Oracle's contract if changed send new hash.
            - If consensus hash == oracle's hash - send report data
        - Oracle finalized and all data delivered. Wait for next epoch.



## Price balancer

Move to separate daemon.

- Согласовать с протокольной командой
- Write bot
- Test bot
    - Deploy smart contracts on testnet
- Deploy testnet
    - Ask devops for capacity
- Deploy prod
- Build dashboard and alerts
    
Source: https://github.com/lidofinance/lido-oracle/blob/ae034e3dfe8c98c66d9fbfa88a097c6fe1a75b99/src/modules/steth_price_balancer.py