File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,7 @@ impl<N: Unsigned + Clone> Bitfield<Variable<N>> {
163
163
pub fn from_bytes ( bytes : Vec < u8 > ) -> Result < Self , Error > {
164
164
let mut initial_bitfield: Bitfield < Variable < N > > = {
165
165
let num_bits = bytes. len ( ) * 8 ;
166
- Bitfield :: from_raw_bytes ( bytes, num_bits)
167
- . expect ( "Must have adequate bytes for bit count." )
166
+ Bitfield :: from_raw_bytes ( bytes, num_bits) ?
168
167
} ;
169
168
170
169
let len = initial_bitfield
@@ -802,6 +801,11 @@ mod bitlist {
802
801
803
802
#[ test]
804
803
fn ssz_decode ( ) {
804
+ assert ! ( BitList0 :: from_ssz_bytes( & [ ] ) . is_err( ) ) ;
805
+ assert ! ( BitList1 :: from_ssz_bytes( & [ ] ) . is_err( ) ) ;
806
+ assert ! ( BitList8 :: from_ssz_bytes( & [ ] ) . is_err( ) ) ;
807
+ assert ! ( BitList16 :: from_ssz_bytes( & [ ] ) . is_err( ) ) ;
808
+
805
809
assert ! ( BitList0 :: from_ssz_bytes( & [ 0b0000_0000 ] ) . is_err( ) ) ;
806
810
assert ! ( BitList1 :: from_ssz_bytes( & [ 0b0000_0000 , 0b0000_0000 ] ) . is_err( ) ) ;
807
811
assert ! ( BitList8 :: from_ssz_bytes( & [ 0b0000_0000 ] ) . is_err( ) ) ;
You can’t perform that action at this time.
0 commit comments