What is the (a) technical difference between and (b) practical difference between these, i.e., when do you use one or the other:

bool result = address(contract).call.value(10)(bytes4(keccak256("buyItem(uint256)", _sku)));

bool result = address(contract).call.value(10)(abi.encodeWithSignature("buyItem(uint256)", _sku));

The code refers to an exercise where we buy an inventory item, identified by _sku (a uint) for an amount value aka msg.value Thanks

1 Answer 1


as per solidity documentation here

keccak256() now accept only a single bytes argument. Moreover, the argument is not padded. This was changed to make more explicit and clear how the arguments are concatenated.

Change every keccak256(a, b, c) to keccak256(abi.encodePacked(a, b, c)).

Even though it is not a breaking change, it is suggested that developers change x.call(bytes4(keccak256("f(uint256)"), a, b) to x.call(abi.encodeWithSignature("f(uint256)", a, b)).

  • For anyone else creating their own Modules with Gnosis' Zodiac framework, this answer will save you a lot of headache, thanks!!! Apr 13, 2022 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.