> ## Documentation Index
> Fetch the complete documentation index at: https://primev-24-update-validator-slashing.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Symbiotic Opt-in

> Opt into mev-commit by ERC20 restaking with the MevCommitMiddleware contract through Symbiotic.

# Context

### Why use this method?

Opting-in through Symbiotic is ideal for validators that wish to be secured by ERC20 collateral residing from a Symbiotic vault.

Symbiotic is capital efficient in that vault collateral can be restaked towards other protocols. Further, Symbiotic offers a large degree of restaking configurability.

### Prerequisites

Prior to opt-in through Symbiotic, it's worth familiarizing yourself with their [documentation](https://docs.symbiotic.fi/) on Networks, Vaults, and Operators. This method of validator opt-in requires competency in vault and operator curation.

### Who is this for?

Mev-commit is flexible in the type of entities that use Symbiotic to restake, and secure validators with our protocol. Any combination of Operator and Vault entities can be used, whether each are from the same organization or not.

Most importantly, For L1 validators to be opted-in to mev-commit, some collateral stake must be slashable for each validator, in case that validator acts against its protocol commitments. In the context of Symbiotic, Vaults allocate slashable ERC20 collateral to Operators that are registered with the mev-commit network. This collateral may be slashable by other Symbiotic networks, hence it is restaked.

Operators for the mev-commit network are responsible for bulk registering groups of L1 validator pubkeys to an associated vault. Every registered validator is represented by restaked collateral from a single Vault and Operator. Each Vault’s total collateral can be split up to secure/represent many validators in groups.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/primev-24-update-validator-slashing/v0.8.0/images/symbiotic.png" alt="Diagram showing the relationship between Vaults, Operators, Network Middleware, and the mev-commit Oracle" />
</Frame>

### Rewards

The primary reward that a validator earns in opting-in to mev-commit is increased yield, generated by providers being able to place higher bids in the mev-boost auction. See [Why Participate](/v0.8.0/get-started/validators/validator-guide#why-participate?) for more details.

All vault/operator pairs must agree on how validator yield will be split or otherwise distributed.

We plan to introduce a points system that will be applied to all opted-in validators. In the context of using Symbiotic, each vault will earn points commensurate to the number of validators opted-in through that vault.

# Setup

The following setup steps will reference various Symbiotic core contracts. Refer to their [deployments page](https://docs.symbiotic.fi/category/deployments) and [core source code](https://github.com/symbioticfi/core).

<Info>
  The Symbiotic CLI can assist in many of these steps. Refer to their [docs](https://docs.symbiotic.fi/guides/cli/).
</Info>

<Steps>
  <Step title="Initial Network Setup">
    The Network in this context is mev-commit. Our network is represented by a network address, and a middleware contract. Both of which can be found on the [testnet](/v0.8.0/developers/testnet#validator-registry-contract-addresses-holesky) page. Mainnet support is coming soon.

    Initially, the network address calls `NetworkRegistry.registerNetwork` to register with Symbiotic. Then `NetworkMiddlewareService.setMiddleware` to configure our middleware contract. This stage is completed by the mev-commit team (Primev).
  </Step>

  <Step title="Vault Configuration">
    A vault contract must be deployed and configured with slashable ERC20 `collateral`. Mev-commit will accept most forms of ERC20 collateral, unless they present significant risk of losing value. For non ETH denominated assets, overcollateralization may be required compared to their ETH denominated counterparts.

    In general vault configuration is immutable, and thus important to get right. See [Symbiotic's vault configuration docs](https://docs.symbiotic.fi/handbooks/vaults-handbook#vault-configuration).

    Mev-commit enforces vault configuration from the following dropdowns:

    <Accordion title="Configure Burner Router">
      The `IVaultStorage.burner` address must be set to a `BurnerRouter` contract, deployed via `IBurnerRouterFactory.create()`. See [here](https://docs.symbiotic.fi/deployments/current#burners) to find the `BurnerRouterFactory` address from the current deployment. Find more details about burner routers [here](https://docs.symbiotic.fi/modules/extensions/burners#burner-router).

      The deployed burner router must be configured as follows:

      * `IBurnerRouter.networkReceiver()` must be set to `MevCommitMiddleware.slashReceiver`.
      * `IBurnerRouter.operatorNetworkReceiver()` must be disable by setting to `address(0)`, or set to `MevCommitMiddleware.slashReceiver`. Essentially this value must not override a valid network receiver.
      * `IBurnerRouter.delay()` must be greater than `MevCommitMiddleware.minBurnerRouterDelay`, currently set to `2 days`.

      <Info>
        If you're deploying a burner router for the first time, we highly recommend setting these parameters upon burner router initialization. Otherwise if a delay is set for an already deployed BurnerRouter, that delay period must elapse before `acceptNetworkReceiver` can be called, to properly set the network receiver.
      </Info>

      On-chain values relevant to the middleware contract can be obtained by an applicable eth client, or by using etherscan to query against the verified contract. For example, the `MevCommitMiddleware.slashReceiver` for our current holesky deployment can be found from [this link](https://holesky.etherscan.io/address/0x79FeCD427e5A3e5f1a40895A0AC20A6a50C95393#readProxyContract#F24). The `slashReceiver` row should display `0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1 address`.

      Upon vault registration, and validator registration, all burner router configuration is validated on-chain. If later on this validation fails, all validators associated to a vault will no longer be opted-in, as enforced in `_isValidatorOptedIn`.
    </Accordion>

    <Accordion title="Configure Delegator Module">
      The delegator module for the vault must be the `NetworkRestakeDelegator` or `OperatorSpecificDelegator` type. `FullRestakeDelegator` is not supported.
    </Accordion>

    <Accordion title="Configure Slasher Module">
      The slasher module must be set, and can be either a `Slasher` or `VetoSlasher` type.

      Vaults with an instant `Slasher` must have an `epochDuration` greater than `slashPeriodSeconds` to register with our middleware contract, ensuring collateral is slashable during the full slashing period.

      Vaults with veto slashers:

      * must have an `epochDuration` greater than `slashPeriodSeconds` + `vetoDuration`, where `vetoDuration` is specified by the slasher.
      * require the resolver to be disabled via `address(0)`, since a permissioned oracle account invokes slashing, requiring only the most basic slashing interface.
    </Accordion>
  </Step>

  <Step title="Operator Actions">
    Next, a Symbiotic operator can be setup as an EOA or a contract. The Operator must be registered with Symbiotic via `OperatorRegistry.registerOperator()`.

    The operator must then opt-in to the any vault which will secure validators via `VaultOptInService.optIn(vaultAddress)`.

    The operator then opts-in to the mev-commit network via `NetworkOptInService.optIn(networkAddress)`. Do not confuse the mev-commit network address with the middleware contract address.
  </Step>

  <Step title="Coordinate with our Team">
    At this point you've setup a vault and operator pair that can be used to opt-in a group of validator pubkeys. Next you'll need communicate the following details to our team:

    * The vault address and operator address setup in previous steps.
    * The type of ERC20 collateral that will be used to secure the validator pubkeys.
    * The decimal precision of the ERC20 collateral (not all ERC20s have 18 decimal precision).
    * The max amount of collateral your vault plans to allocate toward securing the mev-commit network. This value should be equal to or less than the total collateral in the vault.

    <Accordion title="Example">
      Hey Primev team, here are the required details for step 4 of the Symbiotic opt-in process.

      * Vault Address: `0xa0Fc5e70aad58028020A13ACd2e5B1f2431C912f`
      * Operator Address: `0x7c096554FCb894DE83aEf8e5F31CC6B04cD9570d`
      * Collateral Type: `stETH`, contract address: `0x3f1c547b21f65e10480de3ad8e19faac46c95034`
      * Collateral Precision: `18`
      * Amount of collateral available to allocate: `1000000.0 stETH`
    </Accordion>

    <Warning>
      Please provide these values to our team in the exact format described, and let us know if you have any questions.
    </Warning>

    From here our team will assign a `slashAmount` appropriate for the collateral type. `slashAmount` of collateral is required to define a single validator as being slashable, and therefore opted-in to mev-commit. The vault/operator pair is able to opt-in `totalCollateral / slashAmount` number of validators.

    The network address (represented by Primev) will then set a max network limit for the vault's delegator module, `IBaseDelegator.setMaxNetworkLimit(uint96 identifier, uint256 amount)`. This is the maximum amount of collateral that will be accepted by the network from the vault.

    The network address will also call:

    * `MevCommitMiddleware.registerOperators` to register the operator with the middleware contract.
    * `MevCommitMiddleware.registerVaults` to register the vault with the middleware contract, associated to a `slashAmount`.
  </Step>

  <Step title="Vault Actions">
    Finally the vault curator address must make some calls. `setNetworkLimit(bytes32 subnetwork, uint256 amount)` should be called on the delegator module of the vault. This sets the total amount of collateral the vault would like to restake to the mev-commit network.

    <Info>
      For the mev-commit network, the subnetwork id is always `1`, and the `subnetwork` argument can be computed using Symbiotic's [Subnetwork library](https://github.com/symbioticfi/core/blob/main/src/contracts/libraries/Subnetwork.sol), by concatenating the network address with the subnetwork ID. On Holesky for example, the subnetwork bytes value is `0x4535bd6ff24860b5fd2889857651a85fb3d3c6b1000000000000000000000001`.
    </Info>

    If using a `NetworkRestakeDelegator`, the vault curator must then call `INetworkRestakeDelegator.setOperatorNetworkShares(bytes32 subnetwork, address operator, uint256 shares)`. This sets what portion of the mev-commit allocated stake the vault curator is allocating to a particular operator.

    If using an `OperatorSpecificDelegator`, calling `setOperatorNetworkShares` is not required, as this type of delegator automatically allocates 100% of the "shares" to a single operator.
  </Step>

  <Step title="Setup Complete - Register Validators">
    Now that setup is complete, the operator can register validators to the vault, so long as enough slashable collateral is allocated to the operator from previous steps.

    This is done through the [holesky validator dashboard](https://holesky.validators.mev-commit.xyz/).

    Validator deregistration is also done through this dashboard, and requires waiting a deregistration period.
  </Step>
</Steps>

# How to Maintain Validators Stay Opted-In

It's an operator's responsibility to monitor vault collateral, and make sure all registered validators are also slashable. This means if vault collateral is reduced to a value that does not define all validators as slashable (considering `slashAmount`), the operator must deregister validators of its choice, or implicitly accept that some quasi-random validators will no longer be "opted-in".
