195 lines
5.6 KiB
Markdown
195 lines
5.6 KiB
Markdown
|
|
# Challenger Operations Guide
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
|
||
|
|
This guide explains how to become a challenger and detect fraudulent claims in the trustless bridge system. Challengers monitor claims and submit fraud proofs to earn rewards.
|
||
|
|
|
||
|
|
## Becoming a Challenger
|
||
|
|
|
||
|
|
### Requirements
|
||
|
|
|
||
|
|
1. **Ethereum Wallet**: Wallet with ETH for gas fees
|
||
|
|
2. **Monitoring Infrastructure**: Ability to monitor both ChainID 138 and Ethereum Mainnet
|
||
|
|
3. **Technical Knowledge**: Understanding of fraud proofs, Merkle proofs, and bridge mechanics
|
||
|
|
4. **Capital**: ETH for gas fees (rewards cover costs if successful)
|
||
|
|
|
||
|
|
### Setup Steps
|
||
|
|
|
||
|
|
1. **Deploy Monitoring Service**:
|
||
|
|
- Monitor `Deposit` events on ChainID 138
|
||
|
|
- Monitor `ClaimSubmitted` events on Ethereum Mainnet
|
||
|
|
- Compare claims against source chain state
|
||
|
|
|
||
|
|
2. **Prepare Fraud Proof Generation**:
|
||
|
|
- Set up Merkle proof generation
|
||
|
|
- Implement fraud proof encoding
|
||
|
|
- Test fraud proof verification
|
||
|
|
|
||
|
|
3. **Test on Testnet**:
|
||
|
|
- Test challenge submission
|
||
|
|
- Verify fraud proof format
|
||
|
|
- Practice fraud detection
|
||
|
|
|
||
|
|
## Challenger Operations
|
||
|
|
|
||
|
|
### Monitoring for Fraud
|
||
|
|
|
||
|
|
**What to Monitor**:
|
||
|
|
1. **Claims on Ethereum**: All `ClaimSubmitted` events
|
||
|
|
2. **Deposits on ChainID 138**: All `Deposit` events
|
||
|
|
3. **Compare**: Verify claims match deposits
|
||
|
|
|
||
|
|
**Fraud Detection**:
|
||
|
|
- **Non-Existent Deposit**: Claim for deposit that doesn't exist
|
||
|
|
- **Incorrect Amount**: Claim amount differs from actual deposit
|
||
|
|
- **Incorrect Recipient**: Claim recipient differs from actual deposit
|
||
|
|
- **Double Spend**: Same deposit claimed twice
|
||
|
|
|
||
|
|
### Submitting Challenges
|
||
|
|
|
||
|
|
**Function**: `ChallengeManager.challengeClaim()`
|
||
|
|
|
||
|
|
**Parameters**:
|
||
|
|
- `depositId`: Deposit ID of the claim to challenge
|
||
|
|
- `proofType`: Type of fraud proof (NonExistentDeposit, IncorrectAmount, etc.)
|
||
|
|
- `proof`: Encoded fraud proof data
|
||
|
|
|
||
|
|
**Process**:
|
||
|
|
```solidity
|
||
|
|
// Generate fraud proof
|
||
|
|
bytes memory fraudProof = generateFraudProof(depositId, claim, proofType);
|
||
|
|
|
||
|
|
// Submit challenge
|
||
|
|
challengeManager.challengeClaim(
|
||
|
|
depositId,
|
||
|
|
proofType,
|
||
|
|
fraudProof
|
||
|
|
);
|
||
|
|
```
|
||
|
|
|
||
|
|
**Fraud Proof Types**:
|
||
|
|
1. **NonExistentDeposit**: Merkle proof showing deposit doesn't exist
|
||
|
|
2. **IncorrectAmount**: Merkle proof with actual deposit amount
|
||
|
|
3. **IncorrectRecipient**: Merkle proof with actual recipient
|
||
|
|
4. **DoubleSpend**: Proof of previous claim for same deposit
|
||
|
|
|
||
|
|
### Fraud Proof Generation
|
||
|
|
|
||
|
|
**Non-Existent Deposit Proof**:
|
||
|
|
1. Get state root from ChainID 138 block
|
||
|
|
2. Hash claimed deposit data
|
||
|
|
3. Generate Merkle proof showing non-existence
|
||
|
|
4. Encode proof according to `FraudProofTypes.NonExistentDepositProof`
|
||
|
|
|
||
|
|
**Incorrect Amount Proof**:
|
||
|
|
1. Get actual deposit from ChainID 138
|
||
|
|
2. Generate Merkle proof for actual deposit
|
||
|
|
3. Encode proof with actual amount
|
||
|
|
4. Submit challenge with proof
|
||
|
|
|
||
|
|
**See**: `docs/bridge/trustless/FRAUD_PROOFS.md` for detailed proof formats
|
||
|
|
|
||
|
|
## Economics
|
||
|
|
|
||
|
|
### Costs
|
||
|
|
|
||
|
|
- **Gas Fees**: For submitting challenges
|
||
|
|
- **Infrastructure**: Monitoring and proof generation costs
|
||
|
|
- **Time**: Time to monitor and generate proofs
|
||
|
|
|
||
|
|
### Revenue
|
||
|
|
|
||
|
|
- **Challenger Reward**: 50% of slashed bond
|
||
|
|
- **Example**: If bond is 1.1 ETH, challenger receives 0.55 ETH
|
||
|
|
|
||
|
|
### Profitability
|
||
|
|
|
||
|
|
- Calculate: Reward - Gas Costs - Infrastructure - Time
|
||
|
|
- Consider success rate, gas prices, bond amounts
|
||
|
|
- Monitor market conditions
|
||
|
|
|
||
|
|
## Best Practices
|
||
|
|
|
||
|
|
### 1. Detection
|
||
|
|
|
||
|
|
- **Fast Detection**: Detect fraud quickly (within challenge window)
|
||
|
|
- **Accurate Proofs**: Ensure fraud proofs are correct
|
||
|
|
- **Comprehensive Monitoring**: Monitor all claims and deposits
|
||
|
|
- **Pattern Recognition**: Identify patterns in fraudulent claims
|
||
|
|
|
||
|
|
### 2. Proof Generation
|
||
|
|
|
||
|
|
- **Correct Format**: Use proper fraud proof encoding
|
||
|
|
- **Valid Proofs**: Ensure proofs are verifiable
|
||
|
|
- **Complete Data**: Include all required proof elements
|
||
|
|
- **Testing**: Test proof generation thoroughly
|
||
|
|
|
||
|
|
### 3. Risk Management
|
||
|
|
|
||
|
|
- **Gas Costs**: Monitor gas prices
|
||
|
|
- **Success Rate**: Track challenge success rate
|
||
|
|
- **Competition**: Consider other challengers
|
||
|
|
- **Timing**: Submit challenges within challenge window
|
||
|
|
|
||
|
|
## Automation
|
||
|
|
|
||
|
|
### Automated Monitoring
|
||
|
|
|
||
|
|
- Set up event watchers for both chains
|
||
|
|
- Compare claims against deposits automatically
|
||
|
|
- Alert on potential fraud
|
||
|
|
- Generate fraud proofs automatically
|
||
|
|
|
||
|
|
### Automated Challenging
|
||
|
|
|
||
|
|
- Automatically submit challenges when fraud detected
|
||
|
|
- Optimize gas usage
|
||
|
|
- Monitor challenge success
|
||
|
|
- Track rewards
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Challenge Rejected
|
||
|
|
|
||
|
|
- **Check Proof**: Verify fraud proof is correct
|
||
|
|
- **Verify Format**: Ensure proof encoding is correct
|
||
|
|
- **Check Timing**: Ensure within challenge window
|
||
|
|
- **Review Errors**: Check error messages
|
||
|
|
|
||
|
|
### Invalid Fraud Proof
|
||
|
|
|
||
|
|
- **Verify Merkle Proof**: Ensure Merkle proof is valid
|
||
|
|
- **Check State Root**: Verify state root is correct
|
||
|
|
- **Review Encoding**: Check proof encoding format
|
||
|
|
- **Test Locally**: Test proof verification locally
|
||
|
|
|
||
|
|
### High Gas Costs
|
||
|
|
|
||
|
|
- **Wait**: Consider waiting for lower gas prices
|
||
|
|
- **Batch**: Batch multiple challenges if possible
|
||
|
|
- **Optimize**: Optimize proof generation
|
||
|
|
|
||
|
|
## Monitoring
|
||
|
|
|
||
|
|
### Key Metrics
|
||
|
|
|
||
|
|
- **Challenges Submitted**: Total challenges submitted
|
||
|
|
- **Success Rate**: Percentage of successful challenges
|
||
|
|
- **Rewards Earned**: Total rewards from successful challenges
|
||
|
|
- **Gas Costs**: Average gas costs per challenge
|
||
|
|
- **Detection Time**: Time to detect fraud
|
||
|
|
|
||
|
|
### Alerts
|
||
|
|
|
||
|
|
- **Fraud Detected**: Alert when fraud is detected
|
||
|
|
- **Challenge Success**: Alert on successful challenges
|
||
|
|
- **Gas Prices**: Alert on high gas prices
|
||
|
|
- **Patterns**: Alert on fraud patterns
|
||
|
|
|
||
|
|
## References
|
||
|
|
|
||
|
|
- Fraud Proofs: `docs/bridge/trustless/FRAUD_PROOFS.md`
|
||
|
|
- Challenge Manager: `contracts/bridge/trustless/ChallengeManager.sol`
|
||
|
|
- Architecture: `docs/bridge/trustless/ARCHITECTURE.md`
|
||
|
|
|