@@ -9,7 +9,7 @@ use beacon_chain::{
9
9
} ;
10
10
use beacon_chain:: {
11
11
BeaconSnapshot , BlockError , ChainConfig , ChainSegmentResult , IntoExecutionPendingBlock ,
12
- NotifyExecutionLayer ,
12
+ InvalidSignature , NotifyExecutionLayer ,
13
13
} ;
14
14
use logging:: test_logger;
15
15
use slasher:: { Config as SlasherConfig , Slasher } ;
@@ -436,7 +436,7 @@ async fn assert_invalid_signature(
436
436
. process_chain_segment( blocks, NotifyExecutionLayer :: Yes )
437
437
. await
438
438
. into_block_error( ) ,
439
- Err ( BlockError :: InvalidSignature )
439
+ Err ( BlockError :: InvalidSignature ( InvalidSignature :: Unknown ) )
440
440
) ,
441
441
"should not import chain segment with an invalid {} signature" ,
442
442
item
@@ -478,7 +478,12 @@ async fn assert_invalid_signature(
478
478
)
479
479
. await ;
480
480
assert ! (
481
- matches!( process_res, Err ( BlockError :: InvalidSignature ) ) ,
481
+ matches!(
482
+ process_res,
483
+ Err ( BlockError :: InvalidSignature (
484
+ InvalidSignature :: BlockBodySignatures
485
+ ) )
486
+ ) ,
482
487
"should not import individual block with an invalid {} signature, got: {:?}" ,
483
488
item,
484
489
process_res
@@ -534,21 +539,25 @@ async fn invalid_signature_gossip_block() {
534
539
. into_block_error ( )
535
540
. expect ( "should import all blocks prior to the one being tested" ) ;
536
541
let signed_block = SignedBeaconBlock :: from_block ( block, junk_signature ( ) ) ;
542
+ let process_res = harness
543
+ . chain
544
+ . process_block (
545
+ signed_block. canonical_root ( ) ,
546
+ Arc :: new ( signed_block) ,
547
+ NotifyExecutionLayer :: Yes ,
548
+ BlockImportSource :: Lookup ,
549
+ || Ok ( ( ) ) ,
550
+ )
551
+ . await ;
537
552
assert ! (
538
553
matches!(
539
- harness
540
- . chain
541
- . process_block(
542
- signed_block. canonical_root( ) ,
543
- Arc :: new( signed_block) ,
544
- NotifyExecutionLayer :: Yes ,
545
- BlockImportSource :: Lookup ,
546
- || Ok ( ( ) ) ,
547
- )
548
- . await ,
549
- Err ( BlockError :: InvalidSignature )
554
+ process_res,
555
+ Err ( BlockError :: InvalidSignature (
556
+ InvalidSignature :: ProposerSignature
557
+ ) )
550
558
) ,
551
- "should not import individual block with an invalid gossip signature" ,
559
+ "should not import individual block with an invalid gossip signature, got: {:?}" ,
560
+ process_res
552
561
) ;
553
562
}
554
563
}
@@ -576,16 +585,18 @@ async fn invalid_signature_block_proposal() {
576
585
} )
577
586
. collect :: < Vec < _ > > ( ) ;
578
587
// Ensure the block will be rejected if imported in a chain segment.
588
+ let process_res = harness
589
+ . chain
590
+ . process_chain_segment ( blocks, NotifyExecutionLayer :: Yes )
591
+ . await
592
+ . into_block_error ( ) ;
579
593
assert ! (
580
594
matches!(
581
- harness
582
- . chain
583
- . process_chain_segment( blocks, NotifyExecutionLayer :: Yes )
584
- . await
585
- . into_block_error( ) ,
586
- Err ( BlockError :: InvalidSignature )
595
+ process_res,
596
+ Err ( BlockError :: InvalidSignature ( InvalidSignature :: Unknown ) )
587
597
) ,
588
- "should not import chain segment with an invalid block signature" ,
598
+ "should not import chain segment with an invalid block signature, got: {:?}" ,
599
+ process_res
589
600
) ;
590
601
}
591
602
}
@@ -879,7 +890,7 @@ async fn invalid_signature_deposit() {
879
890
. process_chain_segment( blocks, NotifyExecutionLayer :: Yes )
880
891
. await
881
892
. into_block_error( ) ,
882
- Err ( BlockError :: InvalidSignature )
893
+ Err ( BlockError :: InvalidSignature ( InvalidSignature :: Unknown ) )
883
894
) ,
884
895
"should not throw an invalid signature error for a bad deposit signature"
885
896
) ;
@@ -1075,7 +1086,7 @@ async fn block_gossip_verification() {
1075
1086
) ) )
1076
1087
. await
1077
1088
) ,
1078
- BlockError :: ProposalSignatureInvalid
1089
+ BlockError :: InvalidSignature ( InvalidSignature :: ProposerSignature )
1079
1090
) ,
1080
1091
"should not import a block with an invalid proposal signature"
1081
1092
) ;
0 commit comments