datahaven/test/utils
Ahmad Kaouk 9be1acc97e
refactor: cleanup old rewards model (#383)
## Summary

This PR removes the old merkle root-based rewards model and completes
the migration to EigenLayer Rewards V2 distribution. The old model
required operators to claim rewards by providing merkle proofs, while
the new model uses `submitRewards` to send rewards directly to
EigenLayer's `RewardsCoordinator`.

### Key Changes

- **Smart Contracts**: Removed `RewardsRegistry`,
`RewardsRegistryStorage`, `IRewardsRegistry`, and `SortedMerkleProof`
contracts along with all merkle claim functions from
`ServiceManagerBase`
- **Substrate Pallets**: Removed merkle proof generation from
`external-validators-rewards` pallet and deleted the entire
`runtime-api` crate (no longer needed)
- **Test Framework**: Removed all RewardsRegistry-related code from
deployment scripts, CLI handlers, and TypeScript bindings
- **Runtimes**: Cleaned up all three runtimes (testnet, stagenet,
mainnet) to remove runtime API implementations and unused imports

### Files Removed

**Contracts:**
- `contracts/src/middleware/RewardsRegistry.sol`
- `contracts/src/middleware/RewardsRegistryStorage.sol`
- `contracts/src/interfaces/IRewardsRegistry.sol`
- `contracts/src/libraries/SortedMerkleProof.sol`
- `contracts/test/RewardsRegistry.t.sol`
- `contracts/test/ServiceManagerRewardsRegistry.t.sol`

**Substrate:**
- `operator/pallets/external-validators-rewards/runtime-api/` (entire
crate)

**Test Framework:**
- `test/suites/rewards-message.test.ts`

### Files Modified

**Contracts:**
- `ServiceManagerBase.sol` - Removed merkle claim functions
- `ServiceManagerBaseStorage.sol` - Removed
`operatorSetToRewardsRegistry` mapping
- `IServiceManager.sol` - Removed interface members

**Substrate:**
- `external-validators-rewards` pallet - Removed merkle proof
generation, simplified `EraRewardsUtils` struct
- All runtime configs - Removed `ExternalValidatorsRewardsApi`
implementations

**Test Framework:**
- Updated deployment scripts, CLI handlers, relayer configs, and
TypeScript bindings

### Stats

```
50 files changed, 966 insertions(+), 4453 deletions(-)
```

## Test plan

- [x] All Rust tests pass (`cargo test`)
- [x] All contract tests pass (`forge test`)
- [x] TypeScript type checking passes (`bun typecheck`)
- [x] Contracts build successfully (`forge build`)
- [x] Operator builds successfully (`cargo build --release --features
fast-runtime`)
- [ ] E2E tests pass (`bun test:e2e`)
2026-01-09 15:25:49 +01:00
..
blockscout.ts test: Add E2E Tests (#36) 2025-04-14 16:22:43 -03:00
constants.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
contracts.ts refactor: cleanup old rewards model (#383) 2026-01-09 15:25:49 +01:00
docker.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
events.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
index.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
input.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
kurtosis.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
logger.ts feat: Add Polkadot API support to CLI and e2e testing infra (#68) 2025-05-13 03:03:21 +00:00
papi.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
parameters.ts perf: Batch runtime parameter updates to speed up E2E setup (#368) 2025-12-22 15:57:32 +01:00
parser.ts fix: 🔨 Fix Kurtosis & Snowbridge relay configs for Fulu fork (#356) 2025-12-18 15:50:09 +01:00
rpc.ts test: Add E2E Tests (#36) 2025-04-14 16:22:43 -03:00
service-mappings.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
shell.ts Fix: command cli deploy contracts (#319) 2025-11-27 15:06:04 +01:00
types.ts feat: Implement EigenLayer Rewards V2 distribution (#351) 2026-01-06 23:53:03 +00:00
validators.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
viem.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
waits.ts feat: 🚀 Add deploy command to CLI (#87) 2025-06-12 10:24:03 +02:00