mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 01:01:01 +00:00
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:
@@ -83,9 +83,10 @@ pub mod grandpa_protocol_name {
|
||||
genesis_hash: &Hash,
|
||||
chain_spec: &Box<dyn ChainSpec>,
|
||||
) -> ProtocolName {
|
||||
let genesis_hash = genesis_hash.as_ref();
|
||||
let chain_prefix = match chain_spec.fork_id() {
|
||||
Some(fork_id) => format!("/{}/{}", hex::encode(genesis_hash), fork_id),
|
||||
None => format!("/{}", hex::encode(genesis_hash)),
|
||||
Some(fork_id) => format!("/{}/{}", array_bytes::bytes2hex("", genesis_hash), fork_id),
|
||||
None => format!("/{}", array_bytes::bytes2hex("", genesis_hash)),
|
||||
};
|
||||
format!("{}{}", chain_prefix, NAME).into()
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ fn grandpa_protocol_name() {
|
||||
|
||||
// Create protocol name using random genesis hash.
|
||||
let genesis_hash = sp_core::H256::random();
|
||||
let expected = format!("/{}/grandpa/1", hex::encode(genesis_hash));
|
||||
let expected = format!("/{}/grandpa/1", array_bytes::bytes2hex("", genesis_hash.as_ref()));
|
||||
let proto_name = grandpa_protocol_name::standard_name(&genesis_hash, &chain_spec);
|
||||
assert_eq!(proto_name.to_string(), expected);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user