Skip to content

Commit 45ba557

Browse files
chore: apply fix for #601
1 parent 8335325 commit 45ba557

File tree

1 file changed

+4
-9
lines changed
  • substrate-node/pallets/pallet-tfgrid/src

1 file changed

+4
-9
lines changed

substrate-node/pallets/pallet-tfgrid/src/node.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@ pub fn validate_longitude_input(input: &[u8]) -> bool {
294294
}
295295
}
296296

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;
299298
pub const DEFAULT_SERIAL_NUMBER: &[u8] = b"Not Specified";
300299

301300
/// A serial number in ASCI Characters.
@@ -314,10 +313,6 @@ impl<T: Config> TryFrom<SerialNumberInput> for SerialNumber<T> {
314313
/// minimum or exceeds the maximum allowed length or contains invalid ASCII
315314
/// characters.
316315
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-
);
321316
ensure!(
322317
value.len() <= MAX_SERIAL_NUMBER_LENGTH.saturated_into(),
323318
Self::Error::SerialNumberTooLong
@@ -358,9 +353,9 @@ impl<T: Config> Clone for SerialNumber<T> {
358353

359354
pub fn validate_serial_number(input: &[u8]) -> bool {
360355
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+
})
364359
}
365360

366361
#[test]

0 commit comments

Comments
 (0)