From ec633e8871b3d3fad17413ed85c8444f8b651ad2 Mon Sep 17 00:00:00 2001 From: Mehdi AOUADI Date: Wed, 20 Mar 2024 16:31:46 +0100 Subject: [PATCH 1/2] clarify network aggregation vs onchain aggregation --- specs/_features/eip7549/validator.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/specs/_features/eip7549/validator.md b/specs/_features/eip7549/validator.md index 6ae84aca6..1e260deec 100644 --- a/specs/_features/eip7549/validator.md +++ b/specs/_features/eip7549/validator.md @@ -26,7 +26,28 @@ ##### Attestations -Attestations received from aggregators with disjoint `committee_bits` sets and equal `AttestationData` SHOULD be consolidated into a single `Attestation` object. +The network attestation aggregates contain only the assigned committee attestations. +Attestation aggregates received by the block proposer from the committee aggregators with disjoint `committee_bits` sets and equal `AttestationData` SHOULD be consolidated into a single `Attestation` object. +The proposer should run the following function to construct an on chain final aggregate form a list of network aggregates with equal `AttestationData`: + +```python +def compute_on_chain_aggregate(network_aggregates: List[Attestation]) -> Attestation: + + aggregates = sorted(network_aggregates, key=lambda a: get_committee_indices(a.committee_bits)[0]) + + data = aggregates[0].data + aggregation_bits = [a.aggregation_bits[0] for a in aggregates] + signature = bls.Aggregate([a.signature for a in aggregates]) + + committee_indices = [get_committee_indices(a.committee_bits)[0] for a in aggregates] + committee_flags = [(index in committee_indices) for index in range(0, MAX_COMMITTEES_PER_SLOT)] + committee_bits = Bitvector[MAX_COMMITTEES_PER_SLOT](committee_flags) + + return Attestation(aggregation_bits=aggregation_bits, + data=data, + committee_bits=committee_bits, + signature=signature) +``` ### Attesting From 2014edbbaa3aa9e8c5b16b897e04b2fffc2679e8 Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Fri, 22 Mar 2024 13:25:03 +0900 Subject: [PATCH 2/2] Update validator.md --- specs/_features/eip7549/validator.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/specs/_features/eip7549/validator.md b/specs/_features/eip7549/validator.md index 1e260deec..7278a1ebf 100644 --- a/specs/_features/eip7549/validator.md +++ b/specs/_features/eip7549/validator.md @@ -32,21 +32,17 @@ The proposer should run the following function to construct an on chain final ag ```python def compute_on_chain_aggregate(network_aggregates: List[Attestation]) -> Attestation: - aggregates = sorted(network_aggregates, key=lambda a: get_committee_indices(a.committee_bits)[0]) - + data = aggregates[0].data aggregation_bits = [a.aggregation_bits[0] for a in aggregates] signature = bls.Aggregate([a.signature for a in aggregates]) - + committee_indices = [get_committee_indices(a.committee_bits)[0] for a in aggregates] committee_flags = [(index in committee_indices) for index in range(0, MAX_COMMITTEES_PER_SLOT)] committee_bits = Bitvector[MAX_COMMITTEES_PER_SLOT](committee_flags) - return Attestation(aggregation_bits=aggregation_bits, - data=data, - committee_bits=committee_bits, - signature=signature) + return Attestation(aggregation_bits, data, committee_bits, signature) ``` ### Attesting