Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Jan 26, 2024
1 parent dfa6dad commit b3b0a88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/utils/ReentrancyGuard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ abstract contract ReentrancyGuard {
modifier nonReentrant() virtual {
/// @solidity memory-safe-assembly
assembly {
if eq(tload(_REENTRANCY_GUARD_SLOT), 1) {
if tload(_REENTRANCY_GUARD_SLOT) {
mstore(0x00, 0xab143c06) // `Reentrancy()`.
revert(0x1c, 0x04)
}
tstore(_REENTRANCY_GUARD_SLOT, 1)
tstore(_REENTRANCY_GUARD_SLOT, address())
}
_;
/// @solidity memory-safe-assembly
Expand All @@ -48,7 +48,7 @@ abstract contract ReentrancyGuard {
modifier nonReadReentrant() virtual {
/// @solidity memory-safe-assembly
assembly {
if eq(tload(_REENTRANCY_GUARD_SLOT), 1) {
if tload(_REENTRANCY_GUARD_SLOT) {
mstore(0x00, 0xab143c06) // `Reentrancy()`.
revert(0x1c, 0x04)
}
Expand Down
2 changes: 1 addition & 1 deletion test/utils/mocks/MockReentrancyGuard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract MockReentrancyGuard is ReentrancyGuard {
function isReentrancyGuardLocked() public view returns (bool locked) {
/// @solidity memory-safe-assembly
assembly {
if eq(tload(_REENTRANCY_GUARD_SLOT), 1) { locked := true }
if tload(_REENTRANCY_GUARD_SLOT) { locked := true }
}
}

Expand Down

0 comments on commit b3b0a88

Please sign in to comment.