lighthouse/common
kevinbogner 4d07e40501 Implement attestation_rewards API (per-validator reward) (#3822)
## Issue Addressed

#3661 

## Proposed Changes
`/eth/v1/beacon/rewards/attestations/{epoch}`

```json
{
  "execution_optimistic": false,
  "finalized": false,
  "data": [
    {
      "ideal_rewards": [
        {
          "effective_balance": "1000000000",
          "head": "2500",
          "target": "5000",
          "source": "5000"
        }
      ],
      "total_rewards": [
        {
          "validator_index": "0",
          "head": "2000",
          "target": "2000",
          "source": "4000",
          "inclusion_delay": "2000"
        }
      ]
    }
  ]
}
```

The issue contains the implementation of three per-validator reward APIs:
- [`sync_committee_rewards`](https://github.com/sigp/lighthouse/pull/3790)
- `attestation_rewards`
- `block_rewards`.

This PR *only* implements the `attestation_rewards`.

The endpoints can be viewed in the Ethereum Beacon nodes API browser: https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Rewards

## Additional Info
The implementation of [consensus client reward APIs](https://github.com/eth-protocol-fellows/cohort-three/blob/master/projects/project-ideas.md#consensus-client-reward-apis) is part of the [EPF](https://github.com/eth-protocol-fellows/cohort-three).

---
- [x] `get_state`
- [x] Calculate *ideal rewards* with some logic from  `get_flag_index_deltas`
- [x] Calculate *actual rewards*  with some logic from `get_flag_index_deltas`
- [x] Code cleanup
- [x] Testing
2023-02-07 00:00:19 +00:00
..
account_utils Clippy lints for rust 1.66 (#3810) 2022-12-16 04:04:00 +00:00
clap_utils Verify execution block hashes during finalized sync (#3794) 2023-01-09 03:11:59 +00:00
compare_fields Clippy 1.67 (#3916) 2023-01-27 09:48:42 +00:00
compare_fields_derive Clippy 1.67 (#3916) 2023-01-27 09:48:42 +00:00
deposit_contract Update discv5 (#3171) 2022-10-28 05:40:06 +00:00
directory Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
eth2 Implement attestation_rewards API (per-validator reward) (#3822) 2023-02-07 00:00:19 +00:00
eth2_config Add Goerli --network flag as duplicate of Prater: Option A (#3346) 2022-07-20 23:16:56 +00:00
eth2_interop_keypairs Update and consolidate dependencies (#3136) 2022-04-04 00:26:16 +00:00
eth2_network_config Add more Gnosis bootnodes (#3855) 2023-01-09 05:12:31 +00:00
eth2_wallet_manager Replace OpenOptions::new with File::options to be readable (#3059) 2022-03-07 06:30:18 +00:00
filesystem Fix rust 1.65 lints (#3682) 2022-11-04 07:43:43 +00:00
lighthouse_metrics Support histogram buckets (#3391) 2022-09-13 01:57:44 +00:00
lighthouse_version Release v3.4.0 (#3862) 2023-01-11 03:27:08 +00:00
lockfile Replace OpenOptions::new with File::options to be readable (#3059) 2022-03-07 06:30:18 +00:00
logging Add log debounce to work processor (#3045) 2022-03-07 06:30:17 +00:00
lru_cache keep failed finalized chains to avoid retries (#3142) 2022-04-13 01:10:55 +00:00
malloc_utils Switch allocator to jemalloc (#3697) 2023-01-20 04:19:29 +00:00
monitoring_api Remove fallback support from eth1 service (#3594) 2022-10-04 08:33:39 +00:00
oneshot_broadcast Fix concurrency issue with oneshot_broadcast (#3596) 2022-09-21 10:52:14 +00:00
sensitive_url Fix lints for Rust 1.63 (#3459) 2022-08-12 00:56:39 +00:00
slot_clock Update and consolidate dependencies (#3136) 2022-04-04 00:26:16 +00:00
system_health Health Endpoints for UI (#3668) 2022-11-15 05:21:26 +00:00
target_check Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
task_executor Enable proposer boost re-orging (#2860) 2022-12-13 09:57:26 +00:00
test_random_derive Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
unused_port Engine API v1.0.0.alpha.6 + interop tests (#3024) 2022-02-17 21:47:06 +00:00
validator_dir Clippy lints for rust 1.66 (#3810) 2022-12-16 04:04:00 +00:00
warp_utils Implement feerecipient API for keymanager (#3213) 2022-07-06 03:51:08 +00:00
README.md Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00

eth2

Common crates containing eth2-specific logic.