BalancerMaxis / multisig-ops

17 stars 27 forks source link

Gauge Offboarding Automation #832

Open Xeonus opened 7 months ago

Xeonus commented 7 months ago

Gauge Offboarding Automation a.k.a. identifying stale gauges to kill

Motivation

Given the insights gathered in the Gauge Framework Status Report we want to develop a job or routine that frequently checks all gauges and identifies candidates that did not receive veBAL votes for a longer time period (tbd)

Technical Specification

An ideal solution consists of a cron job that triggers a report in the multi-sig or other repo to evaluate all currently active gauges on all networks and returns a report incl. a payload that can be prepared for governance. The requirements are:

Components

Implementation Details

  1. Obtain global gauge list, incl. already killed ones from api-v3 with this query:
    query VeBalGetVotingGauges {
    veBalGetVotingList
    {
        id
        address
        chain
        type
        symbol
        gauge {
            address
            isKilled
            relativeWeightCap
            addedTimestamp
        }
        tokens {
            address
            logoURI
            symbol
            weight
        }
    }
    }
  2. Obtain the currently active set where isKilled flag is false
  3. For each non-killed gauge, obtain the voting history from on-chain events or another source (see additional information)
  4. For a given threshold (tbd, e.g. 3 months) obtain the set of gauges to be killed
  5. Make sure that newly added gauges are not picked up -> check addedTimestamp (alternatively on-chain events from gauge adder v4)?
  6. generate output table
  7. generate paylaod
  8. generate PR Make sure to handle cases where no gauge has been identified

Additional information

It is important to note that the balancer-gauges subgraph does not contain any information about historical votes. Therefore, we need to develop an on-chain solution or use available infrastructure from Dune to obtain that data.

Governance process

Xeonus commented 7 months ago

As per Fabio following approaches can be taken to obtain historical voting weights:

on Dune we have this view balancer_ethereum.vebal_votes whose schema is: round, provider, gauge, votes. Then if you aggregate it you find historical votes by gauges. I'm not sure if you're fine querying that data from somewhere or you want to re-build it in Python. if (1) you could use [Dune API and their Python SDK](https://docs.dune.com/api-reference/overview/sdks) and if (2) you'd need to get all gauges from API or Subgraph, get all end-of-round timestamps, call gauge relative weight(gauge, ts) for each gauge and round from Controller contract - quite RPC intensive but you don't have to re-implement logic in Python