Skip to content
This repository was archived by the owner on Sep 19, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion ethbloom/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ethbloom"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Ethereum bloom filter"
license = "MIT"
Expand All @@ -18,6 +18,7 @@ serde = { version = "1.0", optional = true }
[dev-dependencies]
rand = { version = "0.4" }
hex-literal = "0.1.1"
rustc-hex = "1.0"

[features]
default = ["std", "heapsize", "serialize", "fixed-hash/libc", "fixed-hash/rustc-hex"]
Expand Down
2 changes: 1 addition & 1 deletion ethereum-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ethereum-types"
version = "0.5.0"
version = "0.5.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
homepage = "https://github.com/paritytech/primitives"
Expand Down
3 changes: 2 additions & 1 deletion ethereum-types/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ mod tests {
}

// Invalid examples
assert!(ser::from_str::<$name>("\"∀∂\"").unwrap_err().is_data());
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());
Expand Down Expand Up @@ -324,4 +325,4 @@ mod tests {
let result = U256([1, 2, 3, 4]).full_mul(U256([5, 6, 7, 8]));
assert_eq!(U512([5, 16, 34, 60, 61, 52, 32, 0]), result);
}
}
}
4 changes: 2 additions & 2 deletions serialize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn deserialize_check_len<'a, 'de, D>(deserializer: D, len: ExpectedLen<'a>)
}

fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
if v.len() < 2 || &v[0..2] != "0x" {
if !v.starts_with("0x") {
return Err(E::custom("prefix is missing"))
}

Expand Down Expand Up @@ -119,7 +119,7 @@ pub fn deserialize_check_len<'a, 'de, D>(deserializer: D, len: ExpectedLen<'a>)
continue
}
_ => {
let ch = v[idx..].chars().next().unwrap();
let ch = v.bytes().skip(idx).next().unwrap() as char;
return Err(E::custom(&format!("invalid hex character: {}, at {}", ch, idx)))
}
}
Expand Down