@@ -223,72 +223,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockBodyRef<'a, E,
223
223
proof. append ( & mut proof_body) ;
224
224
debug_assert_eq ! ( proof. len( ) , E :: kzg_proof_inclusion_proof_depth( ) ) ;
225
225
226
- debug_assert_eq ! ( proof. len( ) , E :: kzg_proof_inclusion_proof_depth( ) ) ;
227
- Ok ( proof. into ( ) )
228
- }
229
- // TODO(electra): De-duplicate proof computation.
230
- Self :: Electra ( body) => {
231
- // We compute the branches by generating 2 merkle trees:
232
- // 1. Merkle tree for the `blob_kzg_commitments` List object
233
- // 2. Merkle tree for the `BeaconBlockBody` container
234
- // We then merge the branches for both the trees all the way up to the root.
235
-
236
- // Part1 (Branches for the subtree rooted at `blob_kzg_commitments`)
237
- //
238
- // Branches for `blob_kzg_commitments` without length mix-in
239
- let depth = E :: max_blob_commitments_per_block ( )
240
- . next_power_of_two ( )
241
- . ilog2 ( ) ;
242
- let leaves: Vec < _ > = body
243
- . blob_kzg_commitments
244
- . iter ( )
245
- . map ( |commitment| commitment. tree_hash_root ( ) )
246
- . collect ( ) ;
247
- let tree = MerkleTree :: create ( & leaves, depth as usize ) ;
248
- let ( _, mut proof) = tree
249
- . generate_proof ( index, depth as usize )
250
- . map_err ( Error :: MerkleTreeError ) ?;
251
-
252
- // Add the branch corresponding to the length mix-in.
253
- let length = body. blob_kzg_commitments . len ( ) ;
254
- let usize_len = std:: mem:: size_of :: < usize > ( ) ;
255
- let mut length_bytes = [ 0 ; BYTES_PER_CHUNK ] ;
256
- length_bytes
257
- . get_mut( 0 ..usize_len)
258
- . ok_or( Error :: MerkleTreeError ( MerkleTreeError :: PleaseNotifyTheDevs ) ) ?
259
- . copy_from_slice( & length. to_le_bytes( ) ) ;
260
- let length_root = Hash256 :: from_slice ( length_bytes. as_slice ( ) ) ;
261
- proof. push( length_root) ;
262
-
263
- // Part 2
264
- // Branches for `BeaconBlockBody` container
265
- let leaves = [
266
- body. randao_reveal . tree_hash_root ( ) ,
267
- body. eth1_data . tree_hash_root ( ) ,
268
- body. graffiti . tree_hash_root ( ) ,
269
- body. proposer_slashings . tree_hash_root ( ) ,
270
- body. attester_slashings . tree_hash_root ( ) ,
271
- body. attestations . tree_hash_root ( ) ,
272
- body. deposits . tree_hash_root ( ) ,
273
- body. voluntary_exits . tree_hash_root ( ) ,
274
- body. sync_aggregate . tree_hash_root ( ) ,
275
- body. execution_payload . tree_hash_root ( ) ,
276
- body. bls_to_execution_changes . tree_hash_root ( ) ,
277
- body. blob_kzg_commitments . tree_hash_root ( ) ,
278
- body. consolidations . tree_hash_root ( ) ,
279
- ] ;
280
- let beacon_block_body_depth = leaves. len ( ) . next_power_of_two ( ) . ilog2 ( ) as usize ;
281
- let tree = MerkleTree :: create ( & leaves, beacon_block_body_depth) ;
282
- let ( _, mut proof_body) = tree
283
- . generate_proof ( BLOB_KZG_COMMITMENTS_INDEX , beacon_block_body_depth)
284
- . map_err ( Error :: MerkleTreeError ) ?;
285
- // Join the proofs for the subtree and the main tree
286
- proof. append( & mut proof_body) ;
287
-
288
- debug_assert_eq ! ( proof. len( ) , E :: kzg_proof_inclusion_proof_depth( ) ) ;
289
- Ok ( proof. into( ) )
290
- }
291
- }
226
+ Ok ( proof. into ( ) )
292
227
}
293
228
294
229
/// Return `true` if this block body has a non-zero number of blobs.
0 commit comments