livepeer / protocol

Livepeer protocol
MIT License
152 stars 45 forks source link

spike: Snapshot-based TreasuryGovernor #611

Closed victorges closed 1 year ago

victorges commented 1 year ago

What does this pull request do? Explain your changes. (required) This is to demonstrate the implementation described in this document regarding a stake snapshot-based voting power system for an on-chain treasury fueled by inflationary rewards.

Specific updates (required)

There are some obvious missing pieces there like integrating this with our Controller abstractions (and whether we should use our proxy or OZ's).

How did you test each of these updates (required) This is all currently untested, which is what I'll be working on now.

Accept tips on how to test from an existing state like mainnet right now snapshotted to a test env 🤔

Does this pull request close any open issues? Δ

Checklist:

victorges commented 1 year ago

FTR I've moved the code around a bit to resemble what their final organization might look like. 3 new contracts now:

Also added some other comments to the code as I went through it with more info or TODO reminders (feel free to make comments on them in the PR as well)

yondonfu commented 1 year ago

I don't recall if this was explicitly covered elsewhere, but it is also important to define whether the snapshot of voting power is taken at the start or end of a round.

IIUC:

If the snapshot of voting power is taken at the start of a round N (i.e. the first block of the round) then we should fetch the delegator's stake as of the end of round N - 1. This implies fetching the most recent delegator checkpoint before round N and setting the end round for the cumulative earnings calculation to round N - 1.

If the snapshot of voting power is taken at the end of a round N then we should fetch the delegator's stake as of the end of round N. This implies fetching the most recent delegator checkpoint before or equal to round N and setting the end round for the cumulative earnings calculation to round N.

victorges commented 1 year ago

We are done with this phase!