Skip to content

Commit f9dd461

Browse files
committed
Update the use of keccak256 and call().
1 parent e1dc141 commit f9dd461

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

contracts/ECRecovery.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ library ECRecovery {
6868
{
6969
// 32 is the length in bytes of hash,
7070
// enforced by the type signature above
71-
return keccak256(
71+
return keccak256(abi.encodePacked(
7272
"\x19Ethereum Signed Message:\n32",
7373
hash
74-
);
74+
));
7575
}
7676
}

contracts/MerkleProof.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ library MerkleProof {
3030

3131
if (computedHash < proofElement) {
3232
// Hash(current computed hash + current element of the proof)
33-
computedHash = keccak256(computedHash, proofElement);
33+
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
3434
} else {
3535
// Hash(current element of the proof + current computed hash)
36-
computedHash = keccak256(proofElement, computedHash);
36+
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
3737
}
3838
}
3939

contracts/access/SignatureBouncer.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ contract SignatureBouncer is Ownable, RBAC {
9999
returns (bool)
100100
{
101101
return isValidDataHash(
102-
keccak256(address(this), _address),
102+
keccak256(abi.encodePacked(address(this), _address)),
103103
_sig
104104
);
105105
}
@@ -118,7 +118,7 @@ contract SignatureBouncer is Ownable, RBAC {
118118
data[i] = msg.data[i];
119119
}
120120
return isValidDataHash(
121-
keccak256(address(this), _address, data),
121+
keccak256(abi.encodePacked(address(this), _address, data)),
122122
_sig
123123
);
124124
}
@@ -139,7 +139,7 @@ contract SignatureBouncer is Ownable, RBAC {
139139
data[i] = msg.data[i];
140140
}
141141
return isValidDataHash(
142-
keccak256(address(this), _address, data),
142+
keccak256(abi.encodePacked(address(this), _address, data)),
143143
_sig
144144
);
145145
}

contracts/mocks/ReentrancyMock.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ contract ReentrancyMock is ReentrancyGuard {
2424
}
2525

2626
function countThisRecursive(uint256 n) public nonReentrant {
27-
bytes4 func = bytes4(keccak256("countThisRecursive(uint256)"));
2827
if (n > 0) {
2928
count();
3029
// solium-disable-next-line security/no-low-level-calls
31-
bool result = address(this).call(func, n - 1);
30+
bool result = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
3231
require(result == true);
3332
}
3433
}

0 commit comments

Comments
 (0)