Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement feedback for M-01, L-08, L-09 #5324

Merged
merged 15 commits into from
Nov 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {VotesExtended} from "../utils/VotesExtended.sol";
import {GovernorVotes} from "./GovernorVotes.sol";

/**
* @dev Extension of {Governor} which enables delegatees to override the vote of their delegates. This module requires a
* @dev Extension of {Governor} which enables delegators to override the vote of their delegates. This module requires a
* token that inherits {VotesExtended}.
*/
abstract contract GovernorCountingOverridable is GovernorVotes {
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/draft-IERC7579.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ interface IERC7579Execution {
/**
* @dev ERC-7579 Account Config.
*
* Accounts should implement this interface to exposes information that identifies the account, supported modules and capabilities.
* Accounts should implement this interface to expose information that identifies the account, supported modules and capabilities.
*/
interface IERC7579AccountConfig {
/**
Expand Down Expand Up @@ -174,7 +174,7 @@ interface IERC7579AccountConfig {
/**
* @dev ERC-7579 Module Config.
*
* Accounts should implement this interface to allows installing and uninstalling modules.
* Accounts should implement this interface to allow installing and uninstalling modules.
*/
interface IERC7579ModuleConfig {
event ModuleInstalled(uint256 moduleTypeId, address module);
Expand Down
4 changes: 2 additions & 2 deletions contracts/proxy/Clones.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ library Clones {
* access the arguments within the implementation, use {fetchCloneArgs}.
*
* This function uses the create2 opcode and a `salt` to deterministically deploy the clone. Using the same
* `implementation`, `args` and `salt` multiple time will revert, since the clones cannot be deployed twice
* `implementation`, `args` and `salt` multiple times will revert, since the clones cannot be deployed twice
* at the same address.
*/
function cloneDeterministicWithImmutableArgs(
Expand Down Expand Up @@ -229,7 +229,7 @@ library Clones {
function fetchCloneArgs(address instance) internal view returns (bytes memory) {
bytes memory result = new bytes(instance.code.length - 0x2d); // revert if length is too short
assembly ("memory-safe") {
extcodecopy(instance, add(result, 0x20), 0x2d, mload(result))
extcodecopy(instance, add(result, 32), 0x2d, mload(result))
Amxx marked this conversation as resolved.
Show resolved Hide resolved
}
return result;
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/utils/Strings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ library Strings {
}

/**
* @dev Variant of {tryParseUint} that does not check bounds and returns (true, 0) if they are invalid.
* @dev Implementation of {tryParseUint} that does not check bounds and returns (true, 0) if they are invalid.
Amxx marked this conversation as resolved.
Show resolved Hide resolved
*/
function _tryParseUintUncheckedBounds(
string memory input,
Expand Down Expand Up @@ -333,7 +333,7 @@ library Strings {
bytes memory buffer = bytes(input);

// skip 0x prefix if present
bool hasPrefix = (begin < end + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
uint256 offset = hasPrefix.toUint() * 2;

uint256 result = 0;
Expand Down Expand Up @@ -391,11 +391,11 @@ library Strings {
uint256 end
) internal pure returns (bool success, address value) {
// check that input is the correct length
bool hasPrefix = (begin < end + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty

uint256 expectedLength = 40 + hasPrefix.toUint() * 2;

if (end - begin == expectedLength && end <= bytes(input).length) {
if (begin <= end && end - begin == expectedLength && end <= bytes(input).length) {
Amxx marked this conversation as resolved.
Show resolved Hide resolved
// length guarantees that this does not overflow, and value is at most type(uint160).max
(bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);
return (s, address(uint160(v)));
Expand Down
Loading