@@ -90,7 +90,11 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
9090 bls_to_execution_changes: block_request . bls_to_execution_changes ,
9191 blob_kzg_commitments: block_request . blob_kzg_commitments ,
9292 sync_aggregate:
93- get_sync_aggregate ( block_request . sync_committee_contributions , block_request . slot ) ,
93+ get_sync_aggregate (
94+ block_request . sync_committee_contributions ,
95+ block_request . slot ,
96+ block_request . parent_root
97+ ) ,
9498 execution_payload: execution_payload
9599 }
96100 } }
@@ -205,12 +209,15 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
205209 signature
206210 end
207211
208- defp get_sync_aggregate ( contributions , slot ) do
212+ defp get_sync_aggregate ( contributions , slot , parent_root ) do
209213 # We group by the contributions by subcommittee index, get only the ones related to the previous slot
210214 # and pick the one with the most amount of set bits in the aggregation bits.
211215 contributions =
212216 contributions
213- |> Enum . filter ( & ( & 1 . message . contribution . slot == slot - 1 ) )
217+ |> Enum . filter (
218+ & ( & 1 . message . contribution . slot == slot - 1 &&
219+ & 1 . message . contribution . beacon_block_root == parent_root )
220+ )
214221 |> Enum . group_by ( & & 1 . message . contribution . subcommittee_index )
215222 |> Enum . map ( fn { _ , contributions } ->
216223 Enum . max_by (
@@ -221,7 +228,8 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
221228
222229 Logger . debug (
223230 "[BlockBuilder] Contributions to aggregate: #{ inspect ( contributions , pretty: true ) } " ,
224- slot: slot
231+ slot: slot ,
232+ root: parent_root
225233 )
226234
227235 aggregate_data = % {
@@ -257,7 +265,8 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
257265 Logger . debug (
258266 "[BlockBuilder] SyncAggregate to construct: #{ inspect ( aggregate_data . signatures , pretty: true ) } " ,
259267 bits: aggregate_data . aggregation_bits ,
260- slot: slot
268+ slot: slot ,
269+ root: parent_root
261270 )
262271
263272 % Types.SyncAggregate {
0 commit comments