alloy-rs / core

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

[Bug] Uint's don't zero-pad when formatted with formatting specifier #622

Closed stanleyjzheng closed 4 months ago

stanleyjzheng commented 4 months ago

Component

primitives

What version of Alloy are you on?

0.7.2

Operating System

macOS (Apple Silicon)

Describe the bug

Ethers properly formats zero-padding with the format!() macro, but it seems like alloy's uints ignore it. A minimal example would be

let x = U256::from(10);

assert_eq!(
    format!("{:0>width$}", x, width = 18_usize),
    format!("{:0>width$}", x.to_string(), width = 18_usize)
)
DaniPopes commented 4 months ago

Can you please re-open the issue in recmo/uint

stanleyjzheng commented 4 months ago

Ah got it, thanks