Skip to content

Commit

Permalink
chore: remove serial valdiation (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVerstraete authored Feb 27, 2023
1 parent 4fa7835 commit cf8d4e2
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions substrate-node/pallets/pallet-tfgrid/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ impl<T: Config> TryFrom<SerialNumberInput> for SerialNumber<T> {
value.len() <= MAX_SERIAL_NUMBER_LENGTH.saturated_into(),
Self::Error::SerialNumberTooLong
);
ensure!(
validate_serial_number(&value),
Self::Error::InvalidSerialNumber
);

Ok(Self(value, PhantomData))
}
Expand Down Expand Up @@ -351,13 +347,6 @@ impl<T: Config> Clone for SerialNumber<T> {
}
}

pub fn validate_serial_number(input: &[u8]) -> bool {
input == DEFAULT_SERIAL_NUMBER
|| input.iter().all(|c| {
c.is_ascii_alphanumeric() || c.is_ascii_whitespace() || matches!(c, b'-' | b'_' | b'.')
})
}

#[test]
fn test_validate_city_name_works() {
assert_eq!(validate_city_name(b"Rio de Janeiro"), true);
Expand Down

0 comments on commit cf8d4e2

Please sign in to comment.