@@ -90,7 +90,11 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
90
90
bls_to_execution_changes: block_request . bls_to_execution_changes ,
91
91
blob_kzg_commitments: block_request . blob_kzg_commitments ,
92
92
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
+ ) ,
94
98
execution_payload: execution_payload
95
99
}
96
100
} }
@@ -205,12 +209,15 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
205
209
signature
206
210
end
207
211
208
- defp get_sync_aggregate ( contributions , slot ) do
212
+ defp get_sync_aggregate ( contributions , slot , parent_root ) do
209
213
# We group by the contributions by subcommittee index, get only the ones related to the previous slot
210
214
# and pick the one with the most amount of set bits in the aggregation bits.
211
215
contributions =
212
216
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
+ )
214
221
|> Enum . group_by ( & & 1 . message . contribution . subcommittee_index )
215
222
|> Enum . map ( fn { _ , contributions } ->
216
223
Enum . max_by (
@@ -221,7 +228,8 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
221
228
222
229
Logger . debug (
223
230
"[BlockBuilder] Contributions to aggregate: #{ inspect ( contributions , pretty: true ) } " ,
224
- slot: slot
231
+ slot: slot ,
232
+ root: parent_root
225
233
)
226
234
227
235
aggregate_data = % {
@@ -257,7 +265,8 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do
257
265
Logger . debug (
258
266
"[BlockBuilder] SyncAggregate to construct: #{ inspect ( aggregate_data . signatures , pretty: true ) } " ,
259
267
bits: aggregate_data . aggregation_bits ,
260
- slot: slot
268
+ slot: slot ,
269
+ root: parent_root
261
270
)
262
271
263
272
% Types.SyncAggregate {
0 commit comments