Skip to content

Commit b38377c

Browse files
chore: release v2.2.3
1 parent 1b1d5bf commit b38377c

File tree

3 files changed

+4
-56
lines changed

3 files changed

+4
-56
lines changed

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

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use sp_std::marker::PhantomData;
99
// 1: Y
1010
pub const MIN_CITY_NAME_LENGTH: u32 = 1;
1111
// 85: Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch
12-
pub const MAX_CITY_NAME_LENGTH: u32 = 58;
12+
pub const MAX_CITY_NAME_LENGTH: u32 = 100;
1313
pub const DEFAULT_CITY_NAME: &[u8] = b"Unknown";
1414

1515
/// A city name in ASCI Characters.
@@ -36,7 +36,6 @@ impl<T: Config> TryFrom<CityNameInput> for CityName<T> {
3636
value.len() <= MAX_CITY_NAME_LENGTH.saturated_into(),
3737
Self::Error::CityNameTooLong
3838
);
39-
ensure!(validate_city_name(&value), Self::Error::InvalidCityName);
4039

4140
Ok(Self(value, PhantomData))
4241
}
@@ -65,22 +64,10 @@ impl<T: Config> Clone for CityName<T> {
6564
}
6665
}
6766

68-
pub fn validate_city_name(input: &[u8]) -> bool {
69-
input == DEFAULT_CITY_NAME
70-
|| match core::str::from_utf8(input) {
71-
Ok(val) => val
72-
.chars()
73-
.all(|c| c.is_alphabetic() || matches!(c, '-' | '.' | ' ')),
74-
Err(_) => false,
75-
}
76-
// we convert to &str and then to chars to handle
77-
// special alphabetic characters thanks to is_alphabetic()
78-
}
79-
8067
// 2: Allow country code like BE, FR, BR, ...
8168
pub const MIN_COUNTRY_NAME_LENGTH: u32 = 2;
8269
// 56: The United Kingdom of Great Britain and Northern Ireland
83-
pub const MAX_COUNTRY_NAME_LENGTH: u32 = 56;
70+
pub const MAX_COUNTRY_NAME_LENGTH: u32 = 100;
8471
pub const DEFAULT_COUNTRY_NAME: &[u8] = b"Unknown";
8572

8673
/// A city name in ASCI Characters.
@@ -107,10 +94,6 @@ impl<T: Config> TryFrom<CountryNameInput> for CountryName<T> {
10794
value.len() <= MAX_COUNTRY_NAME_LENGTH.saturated_into(),
10895
Self::Error::CountryNameTooLong
10996
);
110-
ensure!(
111-
validate_country_name(&value),
112-
Self::Error::InvalidCountryName
113-
);
11497

11598
Ok(Self(value, PhantomData))
11699
}
@@ -139,18 +122,6 @@ impl<T: Config> Clone for CountryName<T> {
139122
}
140123
}
141124

142-
pub fn validate_country_name(input: &[u8]) -> bool {
143-
input == DEFAULT_COUNTRY_NAME
144-
|| match core::str::from_utf8(input) {
145-
Ok(val) => val
146-
.chars()
147-
.all(|c| c.is_alphabetic() || matches!(c, '-' | '.' | ' ')),
148-
Err(_) => false,
149-
}
150-
// we convert to &str and then to chars to handle
151-
// special alphabetic characters thanks to is_alphabetic()
152-
}
153-
154125
pub const MIN_LATITUDE_LENGTH: u32 = 1;
155126
pub const MAX_LATITUDE_LENGTH: u32 = 50;
156127
pub const DEFAULT_LATITUDE: &[u8] = b"Unknown";
@@ -354,29 +325,6 @@ pub fn validate_serial_number(input: &[u8]) -> bool {
354325
})
355326
}
356327

357-
#[test]
358-
fn test_validate_city_name_works() {
359-
assert_eq!(validate_city_name(b"Rio de Janeiro"), true);
360-
assert_eq!(validate_city_name(b"Ghent"), true);
361-
assert_eq!(validate_city_name(b"Cairo"), true);
362-
assert_eq!(
363-
validate_city_name(&vec![76, 105, 195, 168, 103, 101]), // b"Liège"
364-
true
365-
);
366-
367-
assert_eq!(validate_city_name(b"Los_Angeles"), false);
368-
}
369-
370-
#[test]
371-
fn test_validate_country_name_works() {
372-
assert_eq!(validate_country_name(b"Brazil"), true);
373-
assert_eq!(validate_country_name(b"Belgium"), true);
374-
assert_eq!(validate_country_name(b"Egypt"), true);
375-
assert_eq!(validate_country_name(b"U.S.A"), true);
376-
377-
assert_eq!(validate_country_name(b"Costa_Rica"), false);
378-
}
379-
380328
#[test]
381329
fn test_validate_latitude_input_works() {
382330
assert_eq!(validate_latitude_input(b"90.0"), true);

substrate-node/runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ homepage = 'https://substrate.dev'
55
license = 'Unlicense'
66
name = 'tfchain-runtime'
77
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
8-
version = '2.2.2'
8+
version = '2.2.3'
99

1010
[package.metadata.docs.rs]
1111
targets = ['x86_64-unknown-linux-gnu']

substrate-node/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
145145
spec_name: create_runtime_str!("substrate-threefold"),
146146
impl_name: create_runtime_str!("substrate-threefold"),
147147
authoring_version: 1,
148-
spec_version: 125,
148+
spec_version: 126,
149149
impl_version: 1,
150150
apis: RUNTIME_API_VERSIONS,
151151
transaction_version: 2,

0 commit comments

Comments
 (0)