Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate type for unaggregated network attestations #3900

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [`WithdrawalRequest`](#withdrawalrequest)
- [`ConsolidationRequest`](#consolidationrequest)
- [`PendingConsolidation`](#pendingconsolidation)
- [`SingleAttestation`](#singleattestation)
- [`ExecutionRequests`](#executionrequests)
- [Modified Containers](#modified-containers)
- [`AttesterSlashing`](#attesterslashing)
Expand Down Expand Up @@ -257,6 +258,16 @@ class PendingConsolidation(Container):
target_index: ValidatorIndex
```

#### `SingleAttestation`

```python
class SingleAttestation(Container):
committee_index: CommitteeIndex
attester_index: ValidatorIndex
data: AttestationData
signature: BLSSignature
jtraglia marked this conversation as resolved.
Show resolved Hide resolved
```

#### `ExecutionRequests`

*Note*: This container holds requests from the execution layer that are received in [
Expand Down Expand Up @@ -945,7 +956,7 @@ def notify_new_payload(self: ExecutionEngine,
execution_requests: ExecutionRequests,
parent_beacon_block_root: Root) -> bool:
"""
Return ``True`` if and only if ``execution_payload`` and ``execution_requests``
Return ``True`` if and only if ``execution_payload`` and ``execution_requests``
are valid with respect to ``self.execution_state``.
"""
...
Expand Down Expand Up @@ -974,8 +985,8 @@ def verify_and_notify_new_payload(self: ExecutionEngine,

# [Modified in Electra]
if not self.notify_new_payload(
execution_payload,
execution_requests,
execution_payload,
execution_requests,
parent_beacon_block_root):
return False

Expand Down
17 changes: 13 additions & 4 deletions specs/electra/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@ The following validations are added:

##### `beacon_attestation_{subnet_id}`

The following convenience variables are re-defined
- `index = get_committee_indices(attestation.committee_bits)[0]`
The topic is updated to propagate `SingleAttestation` objects.

The following convenience variables are re-defined:
- `index = attestation.committee_index`

The following validations are added:
* [REJECT] `len(committee_indices) == 1`, where `committee_indices = get_committee_indices(attestation)`.
* [REJECT] `attestation.data.index == 0`
- _[REJECT]_ `attestation.data.index == 0`
- _[REJECT]_ The attester is a member of the committee -- i.e.
`atestation.attester_index in get_beacon_committee(state, attestation.data.slot, index)`.

The following validations are removed:
- _[REJECT]_ The attestation is unaggregated --
that is, it has exactly one participating validator (`len([bit for bit in aggregation_bits if bit]) == 1`, i.e. exactly 1 bit is set).
- _[REJECT]_ The number of aggregation bits matches the committee size -- i.e.
`len(aggregation_bits) == len(get_beacon_committee(state, attestation.data.slot, index))`.
11 changes: 6 additions & 5 deletions specs/electra/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,17 @@ def prepare_execution_payload(state: BeaconState,

### Construct attestation

- Set `attestation_data.index = 0`.
- Let `attestation.aggregation_bits` be a `Bitlist[MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT]` of length `len(committee)`, where the bit of the index of the validator in the `committee` is set to `0b1`.
- Let `attestation.committee_bits` be a `Bitvector[MAX_COMMITTEES_PER_SLOT]`, where the bit at the index associated with the validator's committee is set to `0b1`.
The validator creates `attestation` as a `SingleAttestation` container
with updated field assignments:

*Note*: Calling `get_attesting_indices(state, attestation)` should return a list of length equal to 1, containing `validator_index`.
- Set `attestation_data.index = 0`.
- Set `attestation.committee_index` to the index associated with the validator's committee.
- Set `attestation.attester_index` to the index of the validator.

## Attestation aggregation

### Construct aggregate

- Set `attestation_data.index = 0`.
- Let `aggregation_bits` be a `Bitlist[MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT]` of length `len(committee)`, where each bit set from each individual attestation is set to `0b1`.
- Set `attestation.committee_bits = committee_bits`, where `committee_bits` has the same value as in each individual attestation.
- Set `attestation.committee_bits = committee_bits`, where `committee_bits` has the bit set corresponding to `committee_index` in each individual attestation.