@@ -55,7 +55,7 @@ fn load_decode<Backend: AuxStore, T: Decode>(
5555pub ( super ) fn write_execution_receipt < Backend : AuxStore , Block : BlockT , PBlock : BlockT > (
5656 backend : & Backend ,
5757 ( block_hash, block_number) : ( Block :: Hash , NumberFor < Block > ) ,
58- best_execution_chain_number : NumberFor < Block > ,
58+ head_receipt_number : NumberFor < Block > ,
5959 execution_receipt : & ExecutionReceipt < NumberFor < PBlock > , PBlock :: Hash , Block :: Hash > ,
6060) -> Result < ( ) , sp_blockchain:: Error > {
6161 let block_number_key = ( EXECUTION_RECEIPT_BLOCK_NUMBER , block_number) . encode ( ) ;
@@ -71,7 +71,7 @@ pub(super) fn write_execution_receipt<Backend: AuxStore, Block: BlockT, PBlock:
7171
7272 let mut keys_to_delete = vec ! [ ] ;
7373
74- if let Some ( delete_receipts_to) = best_execution_chain_number
74+ if let Some ( delete_receipts_to) = head_receipt_number
7575 . saturated_into :: < BlockNumber > ( )
7676 . checked_sub ( PRUNING_DEPTH )
7777 {
@@ -130,10 +130,10 @@ where
130130}
131131
132132pub ( super ) fn target_receipt_is_pruned (
133- best_execution_chain_number : BlockNumber ,
133+ head_receipt_number : BlockNumber ,
134134 target_block : BlockNumber ,
135135) -> bool {
136- best_execution_chain_number . saturating_sub ( target_block) >= PRUNING_DEPTH
136+ head_receipt_number . saturating_sub ( target_block) >= PRUNING_DEPTH
137137}
138138
139139/// Writes a bad execution receipt to aux storage.
@@ -464,7 +464,7 @@ mod tests {
464464
465465 assert ! ( !target_receipt_is_pruned( PRUNING_DEPTH , 1 ) ) ;
466466
467- // Create PRUNING_DEPTH + 1 receipt, best_execution_chain_number is PRUNING_DEPTH.
467+ // Create PRUNING_DEPTH + 1 receipt, head_receipt_number is PRUNING_DEPTH.
468468 let block_hash = Hash :: random ( ) ;
469469 assert ! ( receipt_at( block_hash) . is_none( ) ) ;
470470 write_receipt_at (
@@ -474,7 +474,7 @@ mod tests {
474474 ) ;
475475 assert ! ( receipt_at( block_hash) . is_some( ) ) ;
476476
477- // Create PRUNING_DEPTH + 2 receipt, best_execution_chain_number is PRUNING_DEPTH + 1.
477+ // Create PRUNING_DEPTH + 2 receipt, head_receipt_number is PRUNING_DEPTH + 1.
478478 let block_hash = Hash :: random ( ) ;
479479 write_receipt_at (
480480 block_hash,
@@ -490,7 +490,7 @@ mod tests {
490490 assert ! ( target_receipt_is_pruned( PRUNING_DEPTH + 1 , 1 ) ) ;
491491 assert_eq ! ( receipt_start( ) , Some ( 2 ) ) ;
492492
493- // Create PRUNING_DEPTH + 3 receipt, best_execution_chain_number is PRUNING_DEPTH + 2.
493+ // Create PRUNING_DEPTH + 3 receipt, head_receipt_number is PRUNING_DEPTH + 2.
494494 let block_hash = Hash :: random ( ) ;
495495 write_receipt_at (
496496 block_hash,
@@ -519,7 +519,7 @@ mod tests {
519519 }
520520
521521 #[ test]
522- fn execution_receipts_should_be_kept_against_best_execution_chain_number ( ) {
522+ fn execution_receipts_should_be_kept_against_head_receipt_number ( ) {
523523 let client = substrate_test_runtime_client:: new ( ) ;
524524
525525 let receipt_start = || {
@@ -538,20 +538,20 @@ mod tests {
538538 let receipt_at = |block_hash : Hash | load_execution_receipt ( & client, block_hash) . unwrap ( ) ;
539539
540540 let write_receipt_at = |( hash, number) : ( Hash , BlockNumber ) ,
541- best_execution_chain_number : BlockNumber ,
541+ head_receipt_number : BlockNumber ,
542542 receipt : & ExecutionReceipt | {
543543 write_execution_receipt :: < _ , Block , PBlock > (
544544 & client,
545545 ( hash, number) ,
546- best_execution_chain_number ,
546+ head_receipt_number ,
547547 receipt,
548548 )
549549 . unwrap ( )
550550 } ;
551551
552552 assert_eq ! ( receipt_start( ) , None ) ;
553553
554- // Create PRUNING_DEPTH receipts, best_execution_chain_number is 0, i.e., no receipt
554+ // Create PRUNING_DEPTH receipts, head_receipt_number is 0, i.e., no receipt
555555 // has ever been included on primary chain.
556556 let block_hash_list = ( 1 ..=PRUNING_DEPTH )
557557 . map ( |block_number| {
@@ -567,7 +567,7 @@ mod tests {
567567
568568 assert ! ( !target_receipt_is_pruned( PRUNING_DEPTH , 1 ) ) ;
569569
570- // Create PRUNING_DEPTH + 1 receipt, best_execution_chain_number is 0.
570+ // Create PRUNING_DEPTH + 1 receipt, head_receipt_number is 0.
571571 let block_hash = Hash :: random ( ) ;
572572 assert ! ( receipt_at( block_hash) . is_none( ) ) ;
573573 write_receipt_at (
@@ -576,7 +576,7 @@ mod tests {
576576 & create_execution_receipt ( PRUNING_DEPTH + 1 ) ,
577577 ) ;
578578
579- // Create PRUNING_DEPTH + 2 receipt, best_execution_chain_number is 0.
579+ // Create PRUNING_DEPTH + 2 receipt, head_receipt_number is 0.
580580 let block_hash = Hash :: random ( ) ;
581581 write_receipt_at (
582582 ( block_hash, PRUNING_DEPTH + 2 ) ,
@@ -591,15 +591,15 @@ mod tests {
591591 assert ! ( !target_receipt_is_pruned( 0 , 1 ) ) ;
592592 assert_eq ! ( receipt_start( ) , Some ( 1 ) ) ;
593593
594- // Create PRUNING_DEPTH + 3 receipt, best_execution_chain_number is 0.
594+ // Create PRUNING_DEPTH + 3 receipt, head_receipt_number is 0.
595595 let block_hash = Hash :: random ( ) ;
596596 write_receipt_at (
597597 ( block_hash, PRUNING_DEPTH + 3 ) ,
598598 0 ,
599599 & create_execution_receipt ( PRUNING_DEPTH + 3 ) ,
600600 ) ;
601601
602- // Create PRUNING_DEPTH + 4 receipt, best_execution_chain_number is PRUNING_DEPTH + 3.
602+ // Create PRUNING_DEPTH + 4 receipt, head_receipt_number is PRUNING_DEPTH + 3.
603603 let block_hash = Hash :: random ( ) ;
604604 write_receipt_at (
605605 ( block_hash, PRUNING_DEPTH + 4 ) ,
0 commit comments