# Dev Update #11 Hey :wave: In my [last update](https://hackmd.io/@kevinbogner/dev-update-10), I explained the structure of the [`attestation_rewards`](https://github.com/sigp/lighthouse/pull/3822) API. The design can be divided into *three* parts: 1. Selecting the [correct state](https://hackmd.io/@kevinbogner/dev-update-10#Correct-state), 2. calculating [`ideal_rewards`](https://hackmd.io/@kevinbogner/dev-update-10#Ideal-rewards), and 3. calculating [`actual_rewards`](https://hackmd.io/@kevinbogner/dev-update-10#Actual-rewards). Selecting the correct state is already implemented and can be found [here](https://github.com/naviechan/lighthouse/blob/attestation_rewards/beacon_node/http_api/src/attestation_rewards.rs#L19-L39). Therefore, I want to take a closer at the `ideal_rewards` because they have been the focus of this week. There are *two* relevant components for calculating the `ideal_rewards`: `flag` and `effective_balance`. In the following, I want to discuss those two elements. ## `flag` For attestations, `flag` consists of `head`, `target`, `source`, or its integer representation. Each value calculation uses the participation flag indices defined in the [spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/beacon-chain.md#participation-flag-indices). Lighthouse's implementation can be found [here](https://github.com/sigp/lighthouse/blob/stable/consensus/types/src/consts.rs#L2-L4). ```python TIMELY_SOURCE_FLAG_INDEX = 0 TIMELY_TARGET_FLAG_INDEX = 1 TIMELY_HEAD_FLAG_INDEX = 2 ``` Those *three* constants are mandatory for the calculation of `ideal_rewards`. The rewards need to be computed for every `effective_balance`. ## `effective_balance` In our context, the `effective_balance` of an account refers to the amount of Ether deposited by a validator in the [staking contract](https://ethereum.org/en/staking/deposit-contract/). These amounts are defined in the [spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#gwei-values) (*simplified*). ```python MAX_EFFECTIVE_BALANCE = 32 EFFECTIVE_BALANCE_INCREMENT = 1 ``` Due to this, we need to calculate the `ideal_rewards` for `33` values from `0` to `32`. ## Conclusion Of course, some other aspects are relevant for the `ideal_rewards` as well, but `flag` and `effective_balance` are the main ingredients. Hopefully, I will be finished with the implementation of `attestation_rewards` by the next dev update, and I can discuss the details there.