alloy-rs / core

High-performance, well-tested & documented core libraries for Ethereum, in Rust
https://alloy.rs
Apache License 2.0
792 stars 155 forks source link

[Feature] Replace `hex-literal` crate with `hexlit` in order to support `"0x"` prefix in the `address!()` macro #764

Open gsnoff opened 1 month ago

gsnoff commented 1 month ago

Component

primitives

Describe the feature you would like

The primitives library defines the fixed_bytes_macros! {} internal utility macro, which in turn is used to define exported macros such as address!() for compile-time values. The latter takes in a hex-encoded string literal, which is then represented as an Address value.

Currently the hex-literal crate is responsible for translating hex-encoded string literals into byte arrays in compile time. It is not feature-complete though, notably it lacks the support for "0x" prefix.

There exists an alternative hexlit crate which seems to be a more recent drop-in replacement for hex-literal, and which does support additional features such as "0x" prefix, as well as some extra kinds of formatting characters, such as hyphen '-' and underscore '_'.

Additional context

No response