0age / create2crunch

A Rust program for finding salts that create gas-efficient Ethereum addresses via CREATE2.
MIT License
472 stars 83 forks source link

🐛 Fix leading 0 count bug #20

Closed Philogy closed 6 months ago

Philogy commented 7 months ago

Currently the leading zero counting logic has a bug that if an address starts with a non-zero byte but has subsequent zero-bytes e.g. 0xaf0000b3... the logic will essentially skip the leading byte because 0 is used as the "magic value" for recognizing whether the value has been set yet.

I thought of going the Rust way and using options but I assume that has some overhead which wouldn't be good here? Using the unreachable 21 as the magic value fixes this.