Skip to content

Commit

Permalink
Annotate Memory-Safe Assembly (OpenZeppelin#3392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik0099 authored May 6, 2022
1 parent 3b9381d commit 3bdf4bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/utils/Create2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ library Create2 {
address addr;
require(address(this).balance >= amount, "Create2: insufficient balance");
require(bytecode.length != 0, "Create2: bytecode length is zero");
/// @solidity memory-safe-assembly
assembly {
addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
}
Expand Down
2 changes: 2 additions & 0 deletions contracts/utils/cryptography/ECDSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ library ECDSA {
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
Expand All @@ -75,6 +76,7 @@ library ECDSA {
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
Expand Down
1 change: 1 addition & 0 deletions contracts/utils/cryptography/MerkleProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ library MerkleProof {
}

function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
Expand Down

0 comments on commit 3bdf4bf

Please sign in to comment.