Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

remove sp-serializer which is not useful #14134

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ members = [
"primitives/runtime-interface/test",
"primitives/runtime-interface/test-wasm",
"primitives/runtime-interface/test-wasm-deprecated",
"primitives/serializer",
"primitives/session",
"primitives/staking",
"primitives/state-machine",
Expand Down
1 change: 0 additions & 1 deletion primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ sp-runtime-interface = { version = "7.0.0", default-features = false, path = "..
w3f-bls = { version = "0.1.3", default-features = false, optional = true}

[dev-dependencies]
sp-serializer = { version = "4.0.0-dev", path = "../serializer" }
rand = "0.8.5"
criterion = "0.4.0"
serde_json = "1.0"
Expand Down
21 changes: 10 additions & 11 deletions primitives/core/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub fn convert_hash<H1: Default + AsMut<[u8]>, H2: AsRef<[u8]>>(src: &H2) -> H1
#[cfg(test)]
mod tests {
use super::*;
use sp_serializer as ser;

#[test]
fn test_h160() {
Expand All @@ -47,8 +46,8 @@ mod tests {
];

for (number, expected) in tests {
assert_eq!(format!("{:?}", expected), ser::to_string_pretty(&number));
assert_eq!(number, ser::from_str(&format!("{:?}", expected)).unwrap());
assert_eq!(format!("{:?}", expected), serde_json::to_string_pretty(&number).expect("Json pretty print failed"));
assert_eq!(number, serde_json::from_str(&format!("{:?}", expected)).unwrap());
}
}

Expand Down Expand Up @@ -86,30 +85,30 @@ mod tests {
];

for (number, expected) in tests {
assert_eq!(format!("{:?}", expected), ser::to_string_pretty(&number));
assert_eq!(number, ser::from_str(&format!("{:?}", expected)).unwrap());
assert_eq!(format!("{:?}", expected), serde_json::to_string_pretty(&number).expect("Json pretty print failed"));
assert_eq!(number, serde_json::from_str(&format!("{:?}", expected)).unwrap());
}
}

#[test]
fn test_invalid() {
assert!(ser::from_str::<H256>(
assert!(serde_json::from_str::<H256>(
"\"0x000000000000000000000000000000000000000000000000000000000000000\""
)
.unwrap_err()
.is_data());
assert!(ser::from_str::<H256>(
assert!(serde_json::from_str::<H256>(
"\"0x000000000000000000000000000000000000000000000000000000000000000g\""
)
.unwrap_err()
.is_data());
assert!(ser::from_str::<H256>(
assert!(serde_json::from_str::<H256>(
"\"0x00000000000000000000000000000000000000000000000000000000000000000\""
)
.unwrap_err()
.is_data());
assert!(ser::from_str::<H256>("\"\"").unwrap_err().is_data());
assert!(ser::from_str::<H256>("\"0\"").unwrap_err().is_data());
assert!(ser::from_str::<H256>("\"10\"").unwrap_err().is_data());
assert!(serde_json::from_str::<H256>("\"\"").unwrap_err().is_data());
assert!(serde_json::from_str::<H256>("\"0\"").unwrap_err().is_data());
assert!(serde_json::from_str::<H256>("\"10\"").unwrap_err().is_data());
}
}
15 changes: 7 additions & 8 deletions primitives/core/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub use primitive_types::{U256, U512};
mod tests {
use super::*;
use codec::{Decode, Encode};
use sp_serializer as ser;

macro_rules! test {
($name: ident, $test_name: ident) => {
Expand All @@ -43,14 +42,14 @@ mod tests {
];

for (number, expected) in tests {
assert_eq!(format!("{:?}", expected), ser::to_string_pretty(&number));
assert_eq!(number, ser::from_str(&format!("{:?}", expected)).unwrap());
assert_eq!(format!("{:?}", expected), serde_json::to_string_pretty(&number).expect("Json pretty print failed"));
assert_eq!(number, serde_json::from_str(&format!("{:?}", expected)).unwrap());
}

// Invalid examples
assert!(ser::from_str::<$name>("\"0x\"").unwrap_err().is_data());
assert!(ser::from_str::<$name>("\"0xg\"").unwrap_err().is_data());
assert!(ser::from_str::<$name>("\"\"").unwrap_err().is_data());
assert!(serde_json::from_str::<$name>("\"0x\"").unwrap_err().is_data());
assert!(serde_json::from_str::<$name>("\"0xg\"").unwrap_err().is_data());
assert!(serde_json::from_str::<$name>("\"\"").unwrap_err().is_data());
}
};
}
Expand Down Expand Up @@ -78,10 +77,10 @@ mod tests {
#[test]
fn test_large_values() {
assert_eq!(
ser::to_string_pretty(&!U256::zero()),
serde_json::to_string_pretty(&!U256::zero()).expect("Json pretty print failed"),
"\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\""
);
assert!(ser::from_str::<U256>(
assert!(serde_json::from_str::<U256>(
"\"0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\""
)
.unwrap_err()
Expand Down
18 changes: 0 additions & 18 deletions primitives/serializer/Cargo.toml

This file was deleted.

6 changes: 0 additions & 6 deletions primitives/serializer/README.md

This file was deleted.

45 changes: 0 additions & 45 deletions primitives/serializer/src/lib.rs

This file was deleted.