Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use array-bytes everywhere #6945

Open
2 tasks done
AurevoirXavier opened this issue Dec 18, 2024 · 1 comment
Open
2 tasks done

Use array-bytes everywhere #6945

AurevoirXavier opened this issue Dec 18, 2024 · 1 comment
Labels
I5-enhancement An additional feature request.

Comments

@AurevoirXavier
Copy link
Contributor

AurevoirXavier commented Dec 18, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

Continue paritytech/substrate#12190.

And there are numerous hex crates in this codespace which is perplexing.

array-bytes, hex, hex-literal, rustc_hex.

And such re-implementation can be found at

pub const fn private_hex2array<const N: usize>(hex: &str) -> [u8; N] {
, and more..

Request

Recently, I released array-bytes v8.0.0.

Its performance is as fast as faster-hex. With smallvec, it's even faster than faster-hex in some cases.

It's pure no_std (without the need to specify default-features = false). Pretty polkadot-sdk friendly.

It provides a lot of array/bytes helper functions.

It has easy-to-understand API names. (e.g. hex2bytes, bytes2hex, vec2array..)

It has fuzz test.

Basically, it's designed for Substrate at the beginning.

Solution

use array_bytes;

Are you willing to help with this request?

Yes!

@AurevoirXavier AurevoirXavier added the I5-enhancement An additional feature request. label Dec 18, 2024
@bkchr
Copy link
Member

bkchr commented Dec 18, 2024

And such re-implementation can be found at

The reimplementation exists because it is a const fn. Would be nice if array-bytes could provide const versions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request.
Projects
None yet
Development

No branches or pull requests

2 participants