Some of the inputs to some functions in the Altair validator guide
were required in earlier iterations of the aggregation scheme but are
no longer required in the current version. This commit cleans up these
functions.
Fix two bugs:
1) The participant reward (previously known as "inclusion reward") should not be proportional to `effective_balance` because a sync committee member is already chosen with probability proportional to the effective balance. Credit to @vbuterin.
2) The participant reward (previously known as "inclusion reward") was too large by a factor of `len(participant_indices)`, not taking into account the `for` loop.
Fixing these two bugs actually makes the code significantly simpler and cleaner :)
@barnabemonnot: Could you check the logic? :) If confirmed happy to update the tests.
Validate the `selection_proof` selects the incoming validator as an
aggregator before doing other checks like committee inclusion and
(relatively) expensive signature checks.
The sub-index calculation was incorrect when demonstrating how to map a validator in the sync committee to a particular bit in the `aggregation_bits` in the sync committee aggregation scheme. The correct index is given in this commit.
The field name `aggregation_bits` was changed from `aggregate_bits` to reflect the same usage under the attestation scheme. This PR cleans up left-over references to the old field name in the section header and TOC.
* Typing problem fixed: `process_block_header` passes `Bytes32()` to `state_root` of `BeaconBlockHeader`, which type is `Root`
* Typing problem fixed in `initialize_beacon_state_from_eth1`: `len` returns an `int` value, while `deposit_count=uint64` of `Eth1Data` has type `uint64`
* Typing problem fixed in `process_rewards_and_penalties`: `numerator` of type `int` passed to `weight` parameter of `get_flag_index_deltas`, which has type `uint64`
* Typing problem fixed in `process_attestation`; `False` passes as `crosslink_success` parameter of `PendingAttestation`, which has type `boolean`. `False` is an instance of `(python.)bool` and is not an instance of `(ssz.)boolean`
* Typing problem fixed: `shard_data_roots` of `ShardTransition` has type `List[Bytes32]`, but its elements are used as if they were `Root` values, e.g. in `process_chunk_challenge` method: passed to `data_root` of `CustodyChunkChallengeRecord` which has type `Root`
* Typing problem fixed in `process_custody_final_updates`: `index` has type `int`, while `validator_indices_in_records` has type `Set[ValidatorIndex]`, so tesing whether `index in validator_indices_in_records` can be risky, depending on implementation details. `ValidatorIndex(index) in validator_indices_in_records` is a safer variant.
* Typing problem fixed: `slashed` parameter of `pack_compact_validator` has type `(python.)bool`, however in `committee_to_compact_committee` a value of `(ssz.)boolean` is passed as a value of the parameter
* Typing problem fixed: `inactivity_scores` is a `List[uint64,...]`, while it is intialized/appended with values of `(python.)int` type
* fixed according to @protolambda suggestions
* changed types of _WEIGHT constants and appropriate variables/parameters, according to @protolambda suggestions
* revert code formatting back
* Introduced ZERO_ROOT according to @protolambda 's suggestion
* Reverted back to , according to @protolambda comments