@@ -40,7 +40,7 @@ fn should_report_an_authority_and_trigger_on_offence() {
4040 } ;
4141
4242 // when
43- Offences :: report_offence ( vec ! [ ] , offence) ;
43+ Offences :: report_offence ( vec ! [ ] , offence) . unwrap ( ) ;
4444
4545 // then
4646 with_on_offence_fractions ( |f| {
@@ -61,15 +61,15 @@ fn should_not_report_the_same_authority_twice_in_the_same_slot() {
6161 time_slot,
6262 offenders : vec ! [ 5 ] ,
6363 } ;
64- Offences :: report_offence ( vec ! [ ] , offence. clone ( ) ) ;
64+ Offences :: report_offence ( vec ! [ ] , offence. clone ( ) ) . unwrap ( ) ;
6565 with_on_offence_fractions ( |f| {
6666 assert_eq ! ( f. clone( ) , vec![ Perbill :: from_percent( 25 ) ] ) ;
6767 f. clear ( ) ;
6868 } ) ;
6969
7070 // when
7171 // report for the second time
72- Offences :: report_offence ( vec ! [ ] , offence) ;
72+ assert_eq ! ( Offences :: report_offence( vec![ ] , offence) , Err ( OffenceError :: DuplicateReport ) ) ;
7373
7474 // then
7575 with_on_offence_fractions ( |f| {
@@ -91,7 +91,7 @@ fn should_report_in_different_time_slot() {
9191 time_slot,
9292 offenders : vec ! [ 5 ] ,
9393 } ;
94- Offences :: report_offence ( vec ! [ ] , offence. clone ( ) ) ;
94+ Offences :: report_offence ( vec ! [ ] , offence. clone ( ) ) . unwrap ( ) ;
9595 with_on_offence_fractions ( |f| {
9696 assert_eq ! ( f. clone( ) , vec![ Perbill :: from_percent( 25 ) ] ) ;
9797 f. clear ( ) ;
@@ -100,7 +100,7 @@ fn should_report_in_different_time_slot() {
100100 // when
101101 // report for the second time
102102 offence. time_slot += 1 ;
103- Offences :: report_offence ( vec ! [ ] , offence) ;
103+ Offences :: report_offence ( vec ! [ ] , offence) . unwrap ( ) ;
104104
105105 // then
106106 with_on_offence_fractions ( |f| {
@@ -123,7 +123,7 @@ fn should_deposit_event() {
123123 } ;
124124
125125 // when
126- Offences :: report_offence ( vec ! [ ] , offence) ;
126+ Offences :: report_offence ( vec ! [ ] , offence) . unwrap ( ) ;
127127
128128 // then
129129 assert_eq ! (
@@ -149,15 +149,15 @@ fn doesnt_deposit_event_for_dups() {
149149 time_slot,
150150 offenders : vec ! [ 5 ] ,
151151 } ;
152- Offences :: report_offence ( vec ! [ ] , offence. clone ( ) ) ;
152+ Offences :: report_offence ( vec ! [ ] , offence. clone ( ) ) . unwrap ( ) ;
153153 with_on_offence_fractions ( |f| {
154154 assert_eq ! ( f. clone( ) , vec![ Perbill :: from_percent( 25 ) ] ) ;
155155 f. clear ( ) ;
156156 } ) ;
157157
158158 // when
159159 // report for the second time
160- Offences :: report_offence ( vec ! [ ] , offence) ;
160+ assert_eq ! ( Offences :: report_offence( vec![ ] , offence) , Err ( OffenceError :: DuplicateReport ) ) ;
161161
162162 // then
163163 // there is only one event.
@@ -191,15 +191,15 @@ fn should_properly_count_offences() {
191191 time_slot,
192192 offenders : vec ! [ 4 ] ,
193193 } ;
194- Offences :: report_offence ( vec ! [ ] , offence1) ;
194+ Offences :: report_offence ( vec ! [ ] , offence1) . unwrap ( ) ;
195195 with_on_offence_fractions ( |f| {
196196 assert_eq ! ( f. clone( ) , vec![ Perbill :: from_percent( 25 ) ] ) ;
197197 f. clear ( ) ;
198198 } ) ;
199199
200200 // when
201201 // report for the second time
202- Offences :: report_offence ( vec ! [ ] , offence2) ;
202+ Offences :: report_offence ( vec ! [ ] , offence2) . unwrap ( ) ;
203203
204204 // then
205205 // the 1st authority should have count 2 and the 2nd one should be reported only once.
0 commit comments