Duplicate public key length validation in Bridge::registerKeyPairWithTransfer
registerKeyPairWithTransfer re-checks publicKey.length even though getAddressFromPublicKey already enforces the same constraint immediately above.
Description
In Bridge::registerKeyPairWithTransfer, the public key length is
validated more than once. First, the contract calls:
address unconfirmedPublicKey =getAddressFromPublicKey(ctx.unconfirmed.publicKey);
Inside Bridge::getAddressFromPublicKey, the length is already checked:
function getAddressFromPublicKey(bytes memory publicKey)public pure returns (address) {if (publicKey.length != PUBLIC_KEY_LENGTH) revert InvalidPublicKey();// ...}
Later in the same function, the code checks the length again:
if (ctx.unconfirmed.publicKey.length != PUBLIC_KEY_LENGTH)revert InvalidPublicKey();
Since Bridge::getAddressFromPublicKey already reverts if the length is
incorrect, these additional length checks are unnecessary and will never
catch anything new.
Recommendation
Remove the duplicate length checks and rely on
Bridge::getAddressFromPublicKey to handle validation.
Resolution
YadaCoin, Confirmed.
Zealynx, Fixed.

