Use array-bytes for All Array/Bytes/Hex Operations (#12190)

* Use `array-bytes` for All Array/Bytes/Hex Operations

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* Reorder

* Self Review

* Format

* Fix Tests

* Bump `array-bytes`

* Optimize large test res

Signed-off-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: parity-processbot <>
This commit is contained in:
Xavier Lau
2022-09-21 14:12:20 +08:00
committed by GitHub
parent e4b6f4a66d
commit 86198c5471
79 changed files with 520 additions and 510 deletions
@@ -13,13 +13,13 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
array-bytes = "4.1"
chrono = "0.4"
clap = { version = "3.1.18", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
comfy-table = { version = "6.0.0", default-features = false }
handlebars = "4.2.2"
hash-db = "0.15.2"
hex = "0.4.3"
Inflector = "0.11.4"
itertools = "0.10.3"
kvdb = "0.11.0"
@@ -131,7 +131,9 @@ where
fn consumed_weight(&self, block: &BlockId<Block>) -> Result<NanoSeconds> {
// Hard-coded key for System::BlockWeight. It could also be passed in as argument
// for the benchmark, but I think this should work as well.
let hash = hex::decode("26aa394eea5630e07c48ae0c9558cef734abf5cb34d6244378cddbf18e849d96")?;
let hash = array_bytes::hex2bytes(
"26aa394eea5630e07c48ae0c9558cef734abf5cb34d6244378cddbf18e849d96",
)?;
let key = StorageKey(hash);
let mut raw_weight = &self