ensure consistency about sync committees vs aggregates in naming throughout

This commit is contained in:
Danny Ryan 2021-06-07 16:15:53 -06:00
parent b97972c091
commit 09b6fb0e64
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
4 changed files with 9 additions and 9 deletions

View File

@ -446,7 +446,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_randao(state, block.body)
process_eth1_data(state, block.body)
process_operations(state, block.body) # [Modified in Altair]
process_sync_committee(state, block.body.sync_aggregate) # [New in Altair]
process_sync_aggregate(state, block.body.sync_aggregate) # [New in Altair]
```
#### Modified `process_attestation`
@ -532,19 +532,19 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
increase_balance(state, index, amount)
```
#### Sync committee processing
#### Sync aggregate processing
*Note*: The function `process_sync_committee` is new.
*Note*: The function `process_sync_aggregate` is new.
```python
def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None:
def process_sync_aggregate(state: BeaconState, sync_aggregate: SyncAggregate) -> None:
# Verify sync committee aggregate signature signing over the previous slot block root
committee_pubkeys = state.current_sync_committee.pubkeys
participant_pubkeys = [pubkey for pubkey, bit in zip(committee_pubkeys, aggregate.sync_committee_bits) if bit]
participant_pubkeys = [pubkey for pubkey, bit in zip(committee_pubkeys, sync_aggregate.sync_committee_bits) if bit]
previous_slot = max(state.slot, Slot(1)) - Slot(1)
domain = get_domain(state, DOMAIN_SYNC_COMMITTEE, compute_epoch_at_slot(previous_slot))
signing_root = compute_signing_root(get_block_root_at_slot(state, previous_slot), domain)
assert eth2_fast_aggregate_verify(participant_pubkeys, signing_root, aggregate.sync_committee_signature)
assert eth2_fast_aggregate_verify(participant_pubkeys, signing_root, sync_aggregate.sync_committee_signature)
# Compute participant and proposer rewards
total_active_increments = get_total_active_balance(state) // EFFECTIVE_BALANCE_INCREMENT
@ -556,7 +556,7 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None
# Apply participant and proposer rewards
all_pubkeys = [v.pubkey for v in state.validators]
committee_indices = [ValidatorIndex(all_pubkeys.index(pubkey)) for pubkey in state.current_sync_committee.pubkeys]
for participant_index, participation_bit in zip(committee_indices, aggregate.sync_committee_bits):
for participant_index, participation_bit in zip(committee_indices, sync_aggregate.sync_committee_bits):
if participation_bit:
increase_balance(state, participant_index, participant_reward)
increase_balance(state, get_beacon_proposer_index(state), proposer_reward)

View File

@ -41,7 +41,7 @@ Operations:
| `deposit` | `Deposit` | `deposit` | `process_deposit(state, deposit)` |
| `proposer_slashing` | `ProposerSlashing` | `proposer_slashing` | `process_proposer_slashing(state, proposer_slashing)` |
| `voluntary_exit` | `SignedVoluntaryExit` | `voluntary_exit` | `process_voluntary_exit(state, voluntary_exit)` |
| `sync_aggregate` | `SyncAggregate` | `sync_aggregate` | `process_sync_committee(state, sync_aggregate)` (new in Altair) |
| `sync_aggregate` | `SyncAggregate` | `sync_aggregate` | `process_sync_aggregate(state, sync_aggregate)` (new in Altair) |
| `execution_payload` | `ExecutionPayload` | `execution_payload` | `process_execution_payload(state, execution_payload)` (new in Merge) |
Note that `block_header` is not strictly an operation (and is a full `Block`), but processed in the same manner, and hence included here.

View File

@ -13,7 +13,7 @@ if __name__ == "__main__":
]}
altair_mods = {
**{key: 'eth2spec.test.altair.block_processing.test_process_' + key for key in [
'sync_committee',
'sync_aggregate',
]},
**phase_0_mods,
} # also run the previous phase 0 tests