8000 LidoOracle: new interface and pushing principles · Issue #129 · lidofinance/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

LidoOracle: new interface and pushing principles #129

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

Closed
ongrid opened this issue Nov 11, 2020 · 1 comment · Fixed by #153
Closed

LidoOracle: new interface and pushing principles #129

ongrid opened this issue Nov 11, 2020 · 1 comment · Fixed by #153
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ongrid
Copy link
Contributor
ongrid commented Nov 11, 2020

Base branch: lip_3_oracle

  • ReportInterval will be replaced to just epochIds (the same IDs as beacon chain states have for clarity). Method setReportIntervalDuration and event ReportIntervalDurationChanged, REPORT_INTERVAL_DURATION are deprecated and to be removed.
  • The last state pushed to lido now called lastPushedEpochId instead of lastFinalizedReportInterval
  • The accept reportBeacon transactions from oracles if lastPushedEpochId < _epochId <= getCurrentReportableEpochID(), revert if not.
  • To gather reports for different epochs they should be stored in the map instead of currentlyAggregatedReportInterval flat variables.
    map gatheredReports[_epochId] = { Report, contrinutionBitmask }
  • To save gas, reports are tightly packed in the Report struct
struct Report {
        uint128 beaconValidators;
        uint128 beaconBalance;
    }
  • remove getLatestData since it doesn't make any sense.

  • Implement beaconSpec struct (oracle daemons take configuration from it). Implemented as public variable and its setter

    // timing parameters of Beacon Chain specification (may be overriden by corresponding setter)
    // See https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/beacon-chain.md
    struct BeaconSpec {
        uint64 slotsPerEpoch = 32; // SLOTS_PER_EPOCH
        uint64 secondsPerSlot = 12 // SECONDS_PER_SLOT
        // The genesis expected to happen on Dec 1, 2020, 12pm UTC
        // But the exact time depends on actual staking and will be known post factum
        uint64 genesisTime = 1606824000 
    }
    BeaconSpec public beaconSpec;
    
    function setBeaconSpec(uint64 slotsPerEpoch, uint64 secondsPerSlot, uint64 genesisTime) public {
        // Some require for sanity checks here
        beaconSpec.slotsPerEpoch = slotsPerEpoch;
        beaconSpec.secondsPerSlot = secondsPerSlot;
        beaconSpec.genesisTime = genesisTime;
    }
  • Implement public/external getters for oracle daemons: getCurrentReportableEpoch (define public vs external) and getCurrentReportableEpochID() (define external vs internal)
    // Returns the current reportable epoch object with its timestamp boundaries.
    // Used by oracle daemons
    function getCurrentReportableEpoch() public {
        epochId = getCurrentEpochID();
        // Use SafeMath here
        startTimestamp = epochId * beaconSpec.secondsPerSlot * beaconSpec.slotsPerEpoch
        endTimestamp = (epochId + 1) * beaconSpec.secondsPerSlot * beaconSpec.slotsPerEpoch - 1
    }
    
    // Returns the current epochId
    function getCurrentReportableEpochID() internal {
        // Switch to safeMath
        return(block.timestamp / beaconSpec.secondsPerSlot / beaconSpec.slotsPerEpoch);
    }
  • Cosmetic: more clear naming on quorum-related methods, see list of cosmetic issues below
  • Cosmetic: _tryFinalize is a bad name for new implementation since it doesn't require finalisation. The quorum-related logic should be renamed to _isQuorumReached(uint256 _epochId). pushBeacon and updating lastPushedEpochId can be called on the same level.
  • Cosmetic: all the introduced and refactored entities should have doxygens
  • Unit tests (integration tests will probably conflict with Lido pushBeacon with _beaconValidators amount for proper reward calculation #128)
  • Update Aragon's UI spec, deploy and check it by eyes. Suldin will help if needed.

Reference: Lido's interface:

contract Lido {
    // called by the oracle contract
    function pushBeacon(uint128 _beaconValidators, uint256 _beaconBalance) external {
        
    }
}

Solves: #110, Related: #4, Cosmetic: #71, #87, #119

@ongrid ongrid added the 8000 enhancement New feature or request label Nov 11, 2020
@ongrid ongrid added this to the RC2 milestone Nov 11, 2020
@skozin
Copy link
Member
skozin commented Nov 11, 2020

Have you already decided on how you're going to implement mode calc for the structured data?

lxzrv pushed a commit that referenced this issue Nov 16, 2020
lxzrv pushed a commit that referenced this issue Nov 16, 2020
lxzrv pushed a commit that referenced this issue Nov 17, 2020
lxzrv pushed a commit that referenced this issue Nov 17, 2020
lxzrv pushed a commit that referenced this issue Nov 17, 2020
lxzrv pushed a commit that referenced this issue Nov 17, 2020
lxzrv pushed a commit that referenced this issue Nov 17, 2020
lxzrv pushed a commit that referenced this issue Nov 17, 2020
ongrid pushed a commit that referenced this issue Nov 22, 2020
ongrid pushed a commit that referenced this issue Nov 22, 2020
ongrid pushed a commit that referenced this issue Nov 22, 2020
ongrid pushed a commit that referenced this issue Nov 22, 2020
ongrid pushed a commit that referenced this issue Nov 22, 2020
ongrid pushed a commit that referenced this issue Nov 22, 2020
skozin pushed a commit that referenced this issue Nov 22, 2020
skozin pushed a commit that referenced this issue Nov 22, 2020
skozin pushed a commit that referenced this issue Nov 22, 2020
krogla pushed a commit that referenced this issue Jan 26, 2021
krogla pushed a commit that referenced this issue Jan 26, 2021
krogla pushed a commit that referenced this issue Jan 26, 2021
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
tamtamchik pushed a commit that referenced this issue Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0