---
# System prepended metadata

title: Exit Bus tests on Goerli

---

# Exit Bus tests on Goerli

## Preparation

- Install [Testnet CLI](https://github.com/lidofinance/testnet-cli#installation)
- Fill `.env` file with envs from 1password vault. It contains private key for EOA that has a role that allows you to change some states of the staking modules. Use it carefully and do not share the private key with anyone 🙏
- Check that eveything works correctly and your address has some stETH
    ```bash
    ./testnet.sh lido balance
    ```
- Approve withdrawal queue contract to spend your stETH
    ```bash
    ./testnet.sh lido approve 0xCF117961421cA9e546cD7f50bC73abCdB3039533
    ```
- Check that the transaction was successful and WQ contract has allowance for all your stETH
    ```bash
    ./testnet.sh lido allowance 0xCF117961421cA9e546cD7f50bC73abCdB3039533
    ```

## Test a validator ejection with a NO

- Get modules digests
    ```bash
    ./testnet.sh staking-router digests
    ```
- Check number of `active` keys for the NO
- Be sure that `target` is null for the NO
- Check the buffer. There may be external or ours test submission or collected ETH from vaults
    ```bash
    ./testnet.sh lido buffered-ether
    ```
- Check the demand in withdrawal queue. `unfinalized-steth` will be zeroed periodically when requests are finalized
    ```bash
    ./testnet.sh withdrawal-request unfinalized-steth
    ```
- Create a withdrawal request 
    ```bash
    ./testnet.sh withdrawal-request request 100  
    ```
- Set target limit for the NO as `active-keys - 1`
    ```bash
    # 1 - module id
    # 2 - node operator id
    # 9 - target limit
    ./testnet.sh staking-router set-validators-limit 1 2 9
    ```
- Wait for the [Exit Bus Oracle](https://goerli.etherscan.io/address/0xb75A55EFab5A8f5224Ae93B34B25741EDd3da98b) to report
- Check if validators [requsted to exit](#Exit-Bus-Oracle)
- Unset the limit for the NO
    ```bash
    # 1 - module id
    # 2 - node operator id
    ./testnet.sh staking-router unset-validators-limit 1 2
    ```

## Request amount

The hardest part is figuring out how many stETH we need to queue to exit a validator. For this we need to understand how many stETH in the queue will be covered from the buffer, how many validators are exiting or were requested to exit and not delayed. Every 40 epochs we receive ~100 eth from the EL vault with an oracle report and this is the thickest part of income. It has to be empty at some time, so check it periodically.

Validator exiting takes a while (~1 day if queue is empty + a few days of sweep), so I think we can start with a 300-500 stETH request and then add more to compensate the incoming inflow and see if the oracle send some validators to exit.

- EL Vault: [`0x94750381bE1AbA0504C666ee1DB118F68f0780D4`](https://goerli.etherscan.io/address/0x94750381bE1AbA0504C666ee1DB118F68f0780D4)
- Exit Bus Oracle: [`0xb75A55EFab5A8f5224Ae93B34B25741EDd3da98b`](https://goerli.etherscan.io/address/0xb75A55EFab5A8f5224Ae93B34B25741EDd3da98b)

### Claim finalized requests

- To claim one request
    ```bash
    # 1 - request id
    ./testnet.sh withdrawal-request claim 1
    ```
- To see a list of claimable requests
    ```bash
    ./testnet.sh withdrawal-request claimable
    ```
- To claim a batch of requests
    ```bash
    # 1,2,3 - requests ids separated by comma
    ./testnet.sh withdrawal-request claim-batch 1,2,3
    ```

### Exit Bus Oracle

- To see the index of the last requested validator to exit, use the command:
    ```bash
    ./testnet.sh exit-bus-oracle last-requested-validator-indices
    ```
- To see the events themselves generated by the oracle, use:
    ```bash
    ./testnet.sh exit-bus-oracle exit-requests-detail -b 50000
    ```
    Where `-b` is amount of the latest blocks to fetch
    
## Reimbursement of an unrecoverable validator
In certain cases (e.g. loss of keys), validators may be unrecoverable (i.e. potentially forever inactive and/or un-exitable). In this case, NOs should reimburse the protocol with 32 ETH for any such validator, and the protocol should increase the `refunded validators count` for that operator the corresponding quantity of validators. The below should be executed only after refunding has been performed and confirmed

* To set the `refundedValidatorsCount` for an NO, use
```bash
# args (moduleId)
# opts -o <operator id> -v <refunded validators count to set>
# 1 - moduleId
# 5 - operator id
# 2 - validators count
./testnet.sh staking-router update-refunded-validators 1 -o 5 -v 2
```

## Afterword

After all the tests are done

- Make sure that all NOs have the target limit turned off
    ```bash
    ./testnet.sh staking-router digests
    ```
- Send the rest of the stETH and ETH to the [dev wallet](https://goerli.etherscan.io/address/0xa5f1d7d49f581136cf6e58b32cbe9a2039c48ba1). The last argument of the command is amount of stETH (in stETH, not gwei)
    ```bash
    ./testnet.sh lido balance
    ./testnet.sh lido transfer 0xa5F1d7D49F581136Cf6e58B32cBE9a2039C48bA1 1.23
    ```
- Ask dev team to revoke the role from this EOA