@@ -262,3 +262,35 @@ def test_deposit_transition__deposit_and_top_up_same_block(spec, state):
262
262
assert state .pending_deposits [pre_pending_deposits ].amount == block .body .deposits [0 ].data .amount
263
263
amount_from_deposit = block .body .execution_requests .deposits [0 ].amount
264
264
assert state .pending_deposits [pre_pending_deposits + 1 ].amount == amount_from_deposit
265
+
266
+
267
+ @with_phases ([ELECTRA ])
268
+ @spec_state_test
269
+ def test_deposit_transition__deposit_with_same_pubkey_different_withdrawal_credentials (spec , state ):
270
+ deposit_count = 1
271
+ deposit_request_count = 4
272
+
273
+ state , block = prepare_state_and_block (spec , state ,
274
+ deposit_cnt = deposit_count ,
275
+ deposit_request_cnt = deposit_request_count )
276
+
277
+ # pick 2 indices among deposit requests to have the same pubkey as the deposit
278
+ indices_with_same_pubkey = [1 , 3 ]
279
+ for index in indices_with_same_pubkey :
280
+ block .body .execution_requests .deposits [index ].pubkey = block .body .deposits [0 ].data .pubkey
281
+ # ensure top-up deposit request withdrawal credentials are different than the deposit
282
+ assert (block .body .execution_requests .deposits [index ].withdrawal_credentials
283
+ != block .body .deposits [0 ].data .withdrawal_credentials )
284
+
285
+ block .body .execution_payload .block_hash = compute_el_block_hash_for_block (spec , block )
286
+
287
+ deposit_requests = block .body .execution_requests .deposits .copy ()
288
+
289
+ yield from run_deposit_transition_block (spec , state , block )
290
+
291
+ assert len (state .pending_deposits ) == deposit_request_count + deposit_count
292
+ for index in indices_with_same_pubkey :
293
+ assert state .pending_deposits [deposit_count + index ].pubkey == deposit_requests [index ].pubkey
294
+ # ensure withdrawal credentials are retained, rather than being made the same
295
+ assert (state .pending_deposits [deposit_count + index ].withdrawal_credentials
296
+ == deposit_requests [index ].withdrawal_credentials )
0 commit comments