Skip to content

Commit 0b95012

Browse files
committed
Separate type for unaggregated network attestations
As a complement to ethereum#3787, this PR introduces a `SingleAttestation` type used for network propagation only. In Electra, the on-chain attestation format introduced in [EIP-7549](ethereum#3559) presents several difficulties - not only are the new fields to be interpreted differently during network processing and onchain which adds complexity in clients, they also introduce inefficiency both in hash computation and bandwidth. The new type puts the validator and committee indices directly in the attestation type, this simplifying processing and increasing security. * placing the validator index directly in the attestation allows verifying the signature without computing a shuffling - this closes a loophole where clients either must drop attestations or risk being overwhelmed by shuffling computations during attestation verification * the simpler "structure" of the attestation saves several hash calls during processing (a single-item List has significant hashing overhead compared to a field) * we save a few bytes here and there - we can also put stricter bounds on message size on the attestation topic because `SingleAttestation` is now fixed-size * the ambiguity of interpreting the `attestation_bits` list indices which became contextual under EIP-7549 is removed Because this change only affects the network encoding (and not block contents), the implementation impact on clients should be minimal.
1 parent ca04b1e commit 0b95012

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

specs/electra/beacon-chain.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [`WithdrawalRequest`](#withdrawalrequest)
3131
- [`ConsolidationRequest`](#consolidationrequest)
3232
- [`PendingConsolidation`](#pendingconsolidation)
33+
- [`SingleAttestation`](#singleattestation)
3334
- [Modified Containers](#modified-containers)
3435
- [`AttesterSlashing`](#attesterslashing)
3536
- [Extended Containers](#extended-containers)
@@ -258,6 +259,17 @@ class PendingConsolidation(Container):
258259
target_index: ValidatorIndex
259260
```
260261

262+
263+
#### `SingleAttestation`
264+
265+
```python
266+
class SingleAttestation(Container):
267+
committee_index: CommitteeIndex
268+
attester_index: ValidatorIndex
269+
data: AttestationData
270+
signature: BLSSignature
271+
```
272+
261273
### Modified Containers
262274

263275
#### `AttesterSlashing`
@@ -875,7 +887,7 @@ def process_pending_balance_deposits(state: BeaconState) -> None:
875887
if processed_amount + deposit.amount > available_for_processing:
876888
break
877889
# Deposit fits in the churn, process it. Increase balance and consume churn.
878-
else:
890+
else:
879891
increase_balance(state, deposit.index, deposit.amount)
880892
processed_amount += deposit.amount
881893
# Regardless of how the deposit was handled, we move on in the queue.

specs/electra/p2p-interface.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ The following validations are added:
5454

5555
##### `beacon_attestation_{subnet_id}`
5656

57+
The topic is updated to propagate `SingleAttestation` objects.
58+
5759
The following convenience variables are re-defined
58-
- `index = get_committee_indices(attestation.committee_bits)[0]`
60+
- `index = attestation.committee_index`
5961

6062
The following validations are added:
61-
* [REJECT] `len(committee_indices) == 1`, where `committee_indices = get_committee_indices(attestation)`.
6263
* [REJECT] `attestation.data.index == 0`

0 commit comments

Comments
 (0)