You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function _setRecords(
address resolver,
bytes32 label,
bytes[] calldata data
) internal {
// use hardcoded .eth namehash
bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));
for (uint256 i = 0; i < data.length; i++) {
// check first few bytes are namehash
bytes32 txNamehash = bytes32(data[i][4:36]);
require(
txNamehash == nodehash,
"ETHRegistrarController: Namehash on record do not match the name being registered"
);
resolver.functionCall(
data[i],
"ETHRegistrarController: Failed to set Record"
);
}
}
Place the length outside of the array and use unchecked{}, ++i
New _setRecords function:
function _setRecords(
address resolver,
bytes32 label,
bytes[] calldata data
) internal {
// use hardcoded .eth namehash
bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));
uint256 length = data.lenth;
for (uint256 i = 0; i < length; ) {
// check first few bytes are namehash
bytes32 txNamehash = bytes32(data[i][4:36]);
require(
txNamehash == nodehash,
"ETHRegistrarController: Namehash on record does not match name being registered"
);
resolver.functionCall(
data[i],
"ETHRegistrarController: Failed to set Record"
);
unchecked{ ++i; }
}
}
Minor debatable gas optimizations
ETHRegistrarController.sol
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/ethregistrar/ETHRegistrarController.sol#L249
Function: _setRecords
Place the length outside of the array and use unchecked{}, ++i
New _setRecords function:
ERC1155Fuse.sol
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/wrapper/ERC1155Fuse.sol#L78
function: balanceOfBatch
Place the length outside of the array and use unchecked{}, ++i
new balanceOfBatch function
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/wrapper/ERC1155Fuse.sol#L188
function: safeBatchTransferFrom
Place the length outside of the array and use unchecked{}, ++i
new safeBatchTransferFrom function:
BulkRenewal.sol
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/ethregistrar/BulkRenewal.sol#L50
function: renewAll
Place the length outside of the array and use unchecked{}, ++i
New renewAll function:
The text was updated successfully, but these errors were encountered: