mirror of
https://github.com/luxfi/mpc.git
synced 2026-09-24 00:26:24 +00:00
Follow-up to #19 (emit 33-byte compressed keygen pubkey). pubKeyToEVMAddress's case-33 assembled the EVM preimage as append(x.Bytes(), y.Bytes()...). big.Int. Bytes() drops leading zero bytes, so a coordinate < 2^248 (X or Y with a high zero byte, ~1/256 of keys) produced xyBytes<64 → the len!=64 guard returned an EMPTY address for an otherwise-valid key. Now FillBytes zero-pads each coordinate into a fixed 32-byte slice (case 32 already did this; case 33 did not — it was latent until #19 made keygen actually emit 33-byte keys). Verified: pubkey 03·005056e0… (X has a leading 00 byte) → old path xyBytes=63 → empty; fixed path xyBytes=64 → 0x7242EFb11FB1A669486F10649C9B73739731a5e6, byte- identical to luxfi/crypto DecompressPubkey+PubkeyToAddress. Co-authored-by: hanzo-dev <[email protected]>