File tree 1 file changed +4
-9
lines changed
substrate-node/pallets/pallet-tfgrid/src
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -294,8 +294,7 @@ pub fn validate_longitude_input(input: &[u8]) -> bool {
294
294
}
295
295
}
296
296
297
- pub const MIN_SERIAL_NUMBER_LENGTH : u32 = 10 ;
298
- pub const MAX_SERIAL_NUMBER_LENGTH : u32 = 50 ;
297
+ pub const MAX_SERIAL_NUMBER_LENGTH : u32 = 128 ;
299
298
pub const DEFAULT_SERIAL_NUMBER : & [ u8 ] = b"Not Specified" ;
300
299
301
300
/// A serial number in ASCI Characters.
@@ -314,10 +313,6 @@ impl<T: Config> TryFrom<SerialNumberInput> for SerialNumber<T> {
314
313
/// minimum or exceeds the maximum allowed length or contains invalid ASCII
315
314
/// characters.
316
315
fn try_from ( value : SerialNumberInput ) -> Result < Self , Self :: Error > {
317
- ensure ! (
318
- value. len( ) >= MIN_SERIAL_NUMBER_LENGTH . saturated_into( ) ,
319
- Self :: Error :: SerialNumberTooShort
320
- ) ;
321
316
ensure ! (
322
317
value. len( ) <= MAX_SERIAL_NUMBER_LENGTH . saturated_into( ) ,
323
318
Self :: Error :: SerialNumberTooLong
@@ -358,9 +353,9 @@ impl<T: Config> Clone for SerialNumber<T> {
358
353
359
354
pub fn validate_serial_number ( input : & [ u8 ] ) -> bool {
360
355
input == DEFAULT_SERIAL_NUMBER
361
- || input
362
- . iter ( )
363
- . all ( |c| c . is_ascii_alphanumeric ( ) || matches ! ( c , b'-' | b'_' | b'.' ) )
356
+ || input. iter ( ) . all ( |c| {
357
+ c . is_ascii_alphanumeric ( ) || c . is_ascii_whitespace ( ) || matches ! ( c , b'-' | b'_' | b'.' )
358
+ } )
364
359
}
365
360
366
361
#[ test]
You can’t perform that action at this time.
0 commit comments