I am currently converting bytes4 into bytes like this:

function convert(bytes4 x) public {
    bytes memory y = abi.encodeWithSelector(x);

Is there a more efficient way?

Also, is there an efficient way for converting bytes4 into byte[4] instead of bytes?

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.