# Fraud Proof Scrubs
Instead of the current challenge period that relies on trusted oracles to scrub, this design allows fraud proofs during a challenge period to prevent the withdrawal credential exploit described in [SCRUB CHECK -WITH CRED] in a trustless manner.
### Design
The general flow is similar to what we have now:
1. The node operator initiates a first deposit of 1 ETH to the beacon chain.
2. During a scrub period, a fraud proof can be submitted.
3. a) If no fraud proof is submitted, the remaining 31 ETH can be deposited.
b) If a valid fraud proof is submitted, the minipool is scrubbed: ETH is returned to liquid stakers and RPL is slashed and awarded to the person providing the proof.
The crucial difference in Step 2 is that fraud (frontrunning the deposit to set different withdrawall credentials) is verified on-chain and does not rely on trusted oracles. Instead, a verifiable proof can be submitted by anyone. To achieve this, we use the Deposit Root of the Incremental Merkle Tree maintained by the [Solidity Deposit Contract](https://github.com/ethereum/consensus-specs/blob/v1.2.0/solidity_deposit_contract/deposit_contract.sol) as a source of truth for all deposits that happened before, by storing it in Step 1.
Each deposit to the deposit contract adds a `DepositData` object to a incremental Merkel Tree that contains:
- `pubkey` of the validator the deposit is for
- `withdrawal_credentials` of the validator
- deposit `amount`
- BLS12-381 `signature` of the validator
However this signature [is not verified by the deposit contract](https://github.com/ethereum/consensus-specs/blob/v1.2.0/specs/phase0/deposit-contract.md#depositevent-log).
If someone is attempting the withdrawal credential exploit, then the Deposit Root at time of first deposit must contain a leaf with the same pubkey as the minipool and a valid signature. Conversely, if it is not possible to proof existence of such a leave, then the deposit executed by the Rocket Pool smart contracts is guaranteed to be the first valid deposit for this pubkey and the withdrawal credentials will be set correctly.
Verifying the signature as part of the fraud proof is necessary to prevent griefing of node operators: Anyone can deposit 1 ETH for a given pubkey together with a made up signature. Such a deposit would be rejected by the beacon chain because of the invalid signature, but it would be part of the deposit data merkle tree. So in a fraud proof system without signature verification, an attacker could frontrun a deposit with an invalid signature and scrub a legitimate minipool.
### Implementation Complexity
Ideally, there would be multiple implementations of a "watchtower" software that allows anyone to run scrub checks and submit fraud proofs.
The smartnode already implements a check of the Deposit Merkle Tree including signature verification as part of the oDAO scrub duty. Generating the merkle tree proof is comparable to the process for claiming rewards under the merkle rewards system.
As explained above, the smart contracts have to implement signature verification. [EIP 2537](https://eips.ethereum.org/EIPS/eip-2537) is [considered for inclusion for Cancun](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md#eips-considered-for-inclusion) and would introduce new opcodes that make that straight forward, see for example this [Deposit Verifier](https://github.com/ralexstokes/deposit-verifier/blob/master/deposit_verifier.sol).
Even without EIP 2537, it should be possible to implement the necessary operations ([Map to Field](https://hackmd.io/@benjaminion/bls12-381#Hashing-to-the-curve) and the [Pairing](https://hackmd.io/@benjaminion/bls12-381#Final-exponentiation)). This would add significant implementation complexity and result in higher gas cost of signature verification. But it would only be necessary when a fraud proof is submitted and the gas cost would be covered by the penalty taken from the scrubbed minipool.
### Security Considerations
Just like [Verifiable Off-Chain Calculations], this is a form of optimistic fraud proofs and requires at least one honest participant. The risks outlined in [Optimistic Fraud Proofs - Security] apply and the RPL award for the proof provider serves as protection.
It is worth pointing out that the current oDAO scrub system has similar weaknesses: It requires not only one but at least 51% honest participants and censorship and DoS during the 12 hour period are a risk.