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
..
2023-02-07 00:00:19 +00:00
2023-01-09 03:11:59 +00:00
2023-01-09 08:18:55 +00:00
2022-12-16 04:04:00 +00:00
2023-01-09 03:11:59 +00:00
2022-11-21 03:15:54 +00:00
2023-02-07 00:00:19 +00:00
2022-03-24 00:04:49 +00:00
2023-01-06 15:59:33 +00:00
2023-01-24 22:17:50 +00:00
2022-12-16 04:04:00 +00:00
2023-01-09 08:18:55 +00:00
2022-12-16 04:04:00 +00:00
2021-07-09 06:15:32 +00:00
2022-07-03 05:36:50 +00:00
2023-01-11 03:27:08 +00:00