diff --git a/src/accounts/ERC1271.sol b/src/accounts/ERC1271.sol index be8fedb8d..01b3de013 100644 --- a/src/accounts/ERC1271.sol +++ b/src/accounts/ERC1271.sol @@ -254,7 +254,9 @@ abstract contract ERC1271 is EIP712 { let e := 0 // Length of `contentsName` in explicit mode. for { let q := sub(add(p, c), 1) } 1 {} { e := add(e, 1) // Scan backwards until we encounter a ')'. - if iszero(gt(lt(e, c), eq(byte(0, mload(sub(q, e))), 41))) { break } + if iszero(gt(lt(e, c), eq(byte(0, mload(sub(q, e))), 41))) { + break + } } c := sub(c, e) // Truncate `contentsDescription` to `contentsType`. calldatacopy(p, add(add(o, 0x40), c), e) // Copy `contentsName`. diff --git a/src/accounts/LibEIP7702.sol b/src/accounts/LibEIP7702.sol index 0280cbb94..5a900fef8 100644 --- a/src/accounts/LibEIP7702.sol +++ b/src/accounts/LibEIP7702.sol @@ -78,7 +78,9 @@ library LibEIP7702 { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0) - if iszero(staticcall(gas(), account, 0x00, 0x01, 0x00, 0x20)) { revert(0x00, 0x00) } + if iszero(staticcall(gas(), account, 0x00, 0x01, 0x00, 0x20)) { + revert(0x00, 0x00) + } implementation := mload(0x00) } } @@ -91,7 +93,9 @@ library LibEIP7702 { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0) - if iszero(staticcall(gas(), target, 0x00, 0x01, 0x00, 0x20)) { revert(0x00, 0x00) } + if iszero(staticcall(gas(), target, 0x00, 0x01, 0x00, 0x20)) { + revert(0x00, 0x00) + } result := mload(0x00) } } diff --git a/src/auth/TimedRoles.sol b/src/auth/TimedRoles.sol index 2206a5bff..31ded1ee1 100644 --- a/src/auth/TimedRoles.sol +++ b/src/auth/TimedRoles.sol @@ -167,12 +167,10 @@ abstract contract TimedRoles { } /// @dev Checks that the caller is authorized to set the timed role. - function _authorizeSetTimedRole( - address holder, - uint256 timedRole, - uint40 start, - uint40 expires - ) internal virtual { + function _authorizeSetTimedRole(address holder, uint256 timedRole, uint40 start, uint40 expires) + internal + virtual + { if (!_timedRolesSenderIsContractOwner()) _revertTimedRolesUnauthorized(); // Silence compiler warning on unused variables. (holder, timedRole, start, expires) = (holder, timedRole, start, expires); diff --git a/src/tokens/ERC20Votes.sol b/src/tokens/ERC20Votes.sol index eb249ce2b..d9cc37dad 100644 --- a/src/tokens/ERC20Votes.sol +++ b/src/tokens/ERC20Votes.sol @@ -228,7 +228,9 @@ abstract contract ERC20Votes is ERC20 { let checkpointPacked := sload(add(i, lengthSlot)) checkpointClock := and(0xffffffffffff, checkpointPacked) checkpointValue := shr(96, checkpointPacked) - if eq(checkpointValue, address()) { checkpointValue := sload(not(add(i, lengthSlot))) } + if eq(checkpointValue, address()) { + checkpointValue := sload(not(add(i, lengthSlot))) + } } } diff --git a/src/utils/LibBit.sol b/src/utils/LibBit.sol index 43683255f..ca81ef599 100644 --- a/src/utils/LibBit.sol +++ b/src/utils/LibBit.sol @@ -105,7 +105,9 @@ library LibBit { let l := shl(5, shr(5, n)) s := add(s, 0x20) for { let i } xor(i, l) { i := add(i, 0x20) } { c := add(czb(mload(add(s, i))), c) } - if lt(l, n) { c := add(czb(or(shr(shl(3, sub(n, l)), not(0)), mload(add(s, l)))), c) } + if lt(l, n) { + c := add(czb(or(shr(shl(3, sub(n, l)), not(0)), mload(add(s, l)))), c) + } } } @@ -209,8 +211,8 @@ library LibBit { mstore(add(o, add(i, i)), and(0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f, or(shl(4, x), x))) } - mstore(add(o, add(s, s)), 0) // Zeroize slot after result. - mstore(0x40, add(0x40, add(o, add(s, s)))) // Allocate memory. + mstore(add(o, mload(result)), 0) // Zeroize slot after result. + mstore(0x40, add(0x40, add(o, mload(result)))) // Allocate memory. } } diff --git a/src/utils/LibBytes.sol b/src/utils/LibBytes.sol index e0b727580..06d082b23 100644 --- a/src/utils/LibBytes.sol +++ b/src/utils/LibBytes.sol @@ -170,7 +170,9 @@ library LibBytes { if iszero(gt(needleLen, mload(subject))) { let subjectSearchEnd := add(sub(mload(0x00), needleLen), 1) let h := 0 // The hash of `needle`. - if iszero(lt(needleLen, 0x20)) { h := keccak256(add(needle, 0x20), needleLen) } + if iszero(lt(needleLen, 0x20)) { + h := keccak256(add(needle, 0x20), needleLen) + } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(needleLen, 0x1f))) } 1 {} { let t := mload(i) @@ -552,7 +554,9 @@ library LibBytes { let o := add(result, 0x20) let subjectSearchEnd := add(sub(add(i, mload(subject)), searchLen), 1) let h := 0 // The hash of `needle`. - if iszero(lt(searchLen, 0x20)) { h := keccak256(add(needle, 0x20), searchLen) } + if iszero(lt(searchLen, 0x20)) { + h := keccak256(add(needle, 0x20), searchLen) + } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(searchLen, 0x1f))) } 1 {} { let t := mload(i) diff --git a/src/utils/LibClone.sol b/src/utils/LibClone.sol index 7148aaa67..344ce2999 100644 --- a/src/utils/LibClone.sol +++ b/src/utils/LibClone.sol @@ -2566,11 +2566,10 @@ library LibClone { } /// @dev Deploys a deterministic ERC1967I beacon proxy with `args` and `salt`. - function deployDeterministicERC1967IBeaconProxy( - address beacon, - bytes memory args, - bytes32 salt - ) internal returns (address instance) { + function deployDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) + internal + returns (address instance) + { instance = deployDeterministicERC1967IBeaconProxy(0, beacon, args, salt); } @@ -2604,11 +2603,10 @@ library LibClone { /// @dev Creates a deterministic ERC1967I beacon proxy with `args` and `salt`. /// Note: This method is intended for use in ERC4337 factories, /// which are expected to NOT revert if the proxy is already deployed. - function createDeterministicERC1967IBeaconProxy( - address beacon, - bytes memory args, - bytes32 salt - ) internal returns (bool alreadyDeployed, address instance) { + function createDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { return createDeterministicERC1967IBeaconProxy(0, beacon, args, salt); } diff --git a/src/utils/RedBlackTreeLib.sol b/src/utils/RedBlackTreeLib.sol index d0b55b116..7aa5d6520 100644 --- a/src/utils/RedBlackTreeLib.sol +++ b/src/utils/RedBlackTreeLib.sol @@ -326,7 +326,9 @@ library RedBlackTreeLib { for {} 1 {} { if iszero(result) { break } packed := sload(or(nodes, result)) - if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { break } + if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { + break + } target := result result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY) } @@ -427,7 +429,9 @@ library RedBlackTreeLib { let s_ := or(nodes_, cursor_) let cPacked_ := sload(s_) let cValue_ := shr(_BITPOS_PACKED_VALUE, cPacked_) - if iszero(cValue_) { cValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) } + if iszero(cValue_) { + cValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) + } if iszero(lt(x_, cValue_)) { sstore(s_, setKey(cPacked_, _BITPOS_RIGHT, totalNodes_)) break @@ -598,7 +602,9 @@ library RedBlackTreeLib { key_ := t_ } - if iszero(and(_BITMASK_RED, cursorPacked_)) { removeFixup(nodes_, probe_) } + if iszero(and(_BITMASK_RED, cursorPacked_)) { + removeFixup(nodes_, probe_) + } // Remove last workflow: diff --git a/src/utils/SafeTransferLib.sol b/src/utils/SafeTransferLib.sol index ba7c83efe..1e08d0ec4 100644 --- a/src/utils/SafeTransferLib.sol +++ b/src/utils/SafeTransferLib.sol @@ -139,7 +139,9 @@ library SafeTransferLib { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. - if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. + if iszero(create(selfbalance(), 0x0b, 0x16)) { + revert(codesize(), codesize()) + } // For gas estimation. } } } diff --git a/src/utils/SignatureCheckerLib.sol b/src/utils/SignatureCheckerLib.sol index 2ef62b906..c4f69f553 100644 --- a/src/utils/SignatureCheckerLib.sol +++ b/src/utils/SignatureCheckerLib.sol @@ -278,13 +278,11 @@ library SignatureCheckerLib { /// @dev Returns whether the signature (`v`, `r`, `s`) is valid for `hash` /// for an ERC1271 `signer` contract. - function isValidERC1271SignatureNow( - address signer, - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s - ) internal view returns (bool isValid) { + function isValidERC1271SignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (bool isValid) + { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) diff --git a/src/utils/ext/zksync/SafeTransferLib.sol b/src/utils/ext/zksync/SafeTransferLib.sol index e0894d501..7a5bc1f4a 100644 --- a/src/utils/ext/zksync/SafeTransferLib.sol +++ b/src/utils/ext/zksync/SafeTransferLib.sol @@ -107,7 +107,9 @@ library SafeTransferLib { /// @solidity memory-safe-assembly assembly { mstore(0x00, shr(96, shl(96, to))) - if iszero(call(gas(), vault, amount, 0x00, 0x20, 0x00, 0x00)) { revert(0x00, 0x00) } + if iszero(call(gas(), vault, amount, 0x00, 0x20, 0x00, 0x00)) { + revert(0x00, 0x00) + } } emit SingleUseETHVaultCreated(to, amount, vault); } diff --git a/src/utils/ext/zksync/SignatureCheckerLib.sol b/src/utils/ext/zksync/SignatureCheckerLib.sol index 5543a2eeb..6120e8766 100644 --- a/src/utils/ext/zksync/SignatureCheckerLib.sol +++ b/src/utils/ext/zksync/SignatureCheckerLib.sol @@ -286,13 +286,11 @@ library SignatureCheckerLib { /// @dev Returns whether the signature (`v`, `r`, `s`) is valid for `hash` /// for an ERC1271 `signer` contract. - function isValidERC1271SignatureNow( - address signer, - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s - ) internal view returns (bool isValid) { + function isValidERC1271SignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (bool isValid) + { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) diff --git a/src/utils/g/LibBytes.sol b/src/utils/g/LibBytes.sol index 189da23f7..310794921 100644 --- a/src/utils/g/LibBytes.sol +++ b/src/utils/g/LibBytes.sol @@ -174,7 +174,9 @@ library LibBytes { if iszero(gt(needleLen, mload(subject))) { let subjectSearchEnd := add(sub(mload(0x00), needleLen), 1) let h := 0 // The hash of `needle`. - if iszero(lt(needleLen, 0x20)) { h := keccak256(add(needle, 0x20), needleLen) } + if iszero(lt(needleLen, 0x20)) { + h := keccak256(add(needle, 0x20), needleLen) + } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(needleLen, 0x1f))) } 1 {} { let t := mload(i) @@ -556,7 +558,9 @@ library LibBytes { let o := add(result, 0x20) let subjectSearchEnd := add(sub(add(i, mload(subject)), searchLen), 1) let h := 0 // The hash of `needle`. - if iszero(lt(searchLen, 0x20)) { h := keccak256(add(needle, 0x20), searchLen) } + if iszero(lt(searchLen, 0x20)) { + h := keccak256(add(needle, 0x20), searchLen) + } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(searchLen, 0x1f))) } 1 {} { let t := mload(i) diff --git a/src/utils/g/RedBlackTreeLib.sol b/src/utils/g/RedBlackTreeLib.sol index efa863ce4..b46faeac8 100644 --- a/src/utils/g/RedBlackTreeLib.sol +++ b/src/utils/g/RedBlackTreeLib.sol @@ -330,7 +330,9 @@ library RedBlackTreeLib { for {} 1 {} { if iszero(result) { break } packed := sload(or(nodes, result)) - if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { break } + if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { + break + } target := result result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY) } @@ -431,7 +433,9 @@ library RedBlackTreeLib { let s_ := or(nodes_, cursor_) let cPacked_ := sload(s_) let cValue_ := shr(_BITPOS_PACKED_VALUE, cPacked_) - if iszero(cValue_) { cValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) } + if iszero(cValue_) { + cValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) + } if iszero(lt(x_, cValue_)) { sstore(s_, setKey(cPacked_, _BITPOS_RIGHT, totalNodes_)) break @@ -602,7 +606,9 @@ library RedBlackTreeLib { key_ := t_ } - if iszero(and(_BITMASK_RED, cursorPacked_)) { removeFixup(nodes_, probe_) } + if iszero(and(_BITMASK_RED, cursorPacked_)) { + removeFixup(nodes_, probe_) + } // Remove last workflow: diff --git a/test/Base58.t.sol b/test/Base58.t.sol index dd61b222b..f39dfbe6e 100644 --- a/test/Base58.t.sol +++ b/test/Base58.t.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.4; import "./utils/SoladyTest.sol"; import {Base58} from "../src/utils/Base58.sol"; import {LibString} from "../src/utils/LibString.sol"; +import {LibBytes} from "../src/utils/LibBytes.sol"; contract Base58Test is SoladyTest { function testBase58DecodeRevertsIfInvalidCharacter(bytes1 c) public { @@ -28,6 +29,10 @@ contract Base58Test is SoladyTest { } function testBase58EncodeDecode(bytes memory data, uint256 r) public { + if (data.length > 1000) { + LibBytes.truncate(data, 1000); + } + if (r & 0x00f == 0) { _brutalizeMemory(); } diff --git a/test/Base64.t.sol b/test/Base64.t.sol index 957e787f2..250617e31 100644 --- a/test/Base64.t.sol +++ b/test/Base64.t.sol @@ -122,11 +122,9 @@ contract Base64Test is SoladyTest { } } - function testBase64EncodeFileSafeAndNoPadding( - bytes memory input, - bool fileSafe, - bool noPadding - ) public { + function testBase64EncodeFileSafeAndNoPadding(bytes memory input, bool fileSafe, bool noPadding) + public + { string memory expectedEncoded = Base64.encode(input); if (fileSafe) { diff --git a/test/ERC1155.t.sol b/test/ERC1155.t.sol index 3962a895c..6aec87a2c 100644 --- a/test/ERC1155.t.sol +++ b/test/ERC1155.t.sol @@ -145,13 +145,11 @@ contract MockERC1155WithHooks is MockERC1155 { beforeCounter++; } - function _afterTokenTransfer( - address, - address, - uint256[] memory, - uint256[] memory, - bytes memory - ) internal virtual override { + function _afterTokenTransfer(address, address, uint256[] memory, uint256[] memory, bytes memory) + internal + virtual + override + { afterCounter++; } } diff --git a/test/ERC20Votes.t.sol b/test/ERC20Votes.t.sol index 19fa7727a..b78ac9351 100644 --- a/test/ERC20Votes.t.sol +++ b/test/ERC20Votes.t.sol @@ -466,7 +466,9 @@ contract ERC20VotesTest is SoladyTest { let checkpointPacked := sload(add(i, lengthSlot)) checkpointClock := and(0xffffffffffff, checkpointPacked) checkpointValue := shr(96, checkpointPacked) - if eq(checkpointValue, address()) { checkpointValue := sload(not(add(i, lengthSlot))) } + if eq(checkpointValue, address()) { + checkpointValue := sload(not(add(i, lengthSlot))) + } } } diff --git a/test/ERC721.t.sol b/test/ERC721.t.sol index 6ce389dc2..985affed3 100644 --- a/test/ERC721.t.sol +++ b/test/ERC721.t.sol @@ -988,10 +988,9 @@ contract ERC721Test is SoladyTest { token.safeMint(to, id); } - function testSafeMintToERC721RecipientWithWrongReturnDataWithData( - uint256 id, - bytes memory data - ) public { + function testSafeMintToERC721RecipientWithWrongReturnDataWithData(uint256 id, bytes memory data) + public + { address to = address(new WrongReturnDataERC721Recipient()); vm.expectRevert(ERC721.TransferToNonERC721ReceiverImplementer.selector); token.safeMint(to, id, data); diff --git a/test/LibBit.t.sol b/test/LibBit.t.sol index b3fcd5c5a..1a3eba4e0 100644 --- a/test/LibBit.t.sol +++ b/test/LibBit.t.sol @@ -345,6 +345,12 @@ contract LibBitTest is SoladyTest { bytes memory expected = hex"0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f"; assertEq(LibBit.toNibbles(s), expected); + + bytes memory s1 = + hex"6080604052600436106100b15760003560e01c8063545e7c611161006957806399a88ec41161004e57806399a88ec41461019d578063a97b90d5146101b0578063db4c545e146101c357600080fd5b8063545e7c61146101775780639623609d1461018a57600080fd5b80633729f9221161009a5780633729f922146101315780634314f120146101445780635414dff01461015757600080fd5b80631acfd02a146100b65780632abbef15146100d8575b600080fd5b3480156100c257600080fd5b506100d66100d1366004610604565b6101e6565b005b3480156100e457600080fd5b506101076100f3366004610637565b30600c908152600091909152602090205490565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61010761013f366004610652565b610237565b6101076101523660046106d7565b61024e565b34801561016357600080fd5b50610107610172366004610738565b610267565b610107610185366004610604565b61029a565b6100d66101983660046106d7565b6102af565b6100d66101ab366004610604565b61035f565b6101076101be366004610751565b610370565b3480156101cf57600080fd5b506101d86103a9565b604051908152602001610128565b30600c52816000526020600c2033815414610209576382b429006000526004601cfd5b81905580827f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f600080a35050565b60006102468484843685610370565b949350505050565b600061025e8585838087876103c2565b95945050505050565b6000806102726103a9565b905060ff600053806035523060601b6001528260155260556000209150600060355250919050565b60006102a88383368461024e565b9392505050565b30600c5283600052336020600c2054146102d1576382b429006000526004601cfd5b6040518381527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc602082015281836040830137600080836040018334895af1610331573d610327576355299b496000526004601cfd5b3d6000803e3d6000fd5b5082847f5d611f318680d00598bb735d61bacf0c514c6b50e1e5ad30040a4df2b12791c7600080a350505050565b61036c82823660006102af565b5050565b60008360601c33148460601c151761039057632f6348366000526004601cfd5b61039f868686600187876103c2565b9695505050505050565b6000806103b461049c565b608960139091012092915050565b6000806103cd61049c565b90508480156103e757866089601384016000f592506103f3565b6089601383016000f092505b50816104075763301164256000526004601cfd5b8781527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc602082015282846040830137600080846040018334865af161045a573d6103275763301164256000526004601cfd5b30600c5281600052866020600c20558688837fc95935a66d15e0da5e412aca0ad27ae891d20b2fb91cf3994b6a3bf2b8178082600080a4509695505050505050565b6040513060701c801561054257666052573d6000fd607b8301527f3d356020355560408036111560525736038060403d373d3d355af43d6000803e60748301527f3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b60548301527f14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc60348301523060148301526c607f3d8160093d39f33d3d337382525090565b66604c573d6000fd60758301527f3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e606e8301527f3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b604e8301527f14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc602e83015230600e8301526c60793d8160093d39f33d3d336d82525090565b803573ffffffffffffffffffffffffffffffffffffffff811681146105ff57600080fd5b919050565b6000806040838503121561061757600080fd5b610620836105db565b915061062e602084016105db565b90509250929050565b60006020828403121561064957600080fd5b6102a8826105db565b60008060006060848603121561066757600080fd5b610670846105db565b925061067e602085016105db565b9150604084013590509250925092565b60008083601f8401126106a057600080fd5b50813567ffffffffffffffff8111156106b857600080fd5b6020830191508360208285010111156106d057600080fd5b9250929050565b600080600080606085870312156106ed57600080fd5b6106f6856105db565b9350610704602086016105db565b9250604085013567ffffffffffffffff81111561072057600080fd5b61072c8782880161068e565b95989497509550505050565b60006020828403121561074a57600080fd5b5035919050565b60008060008060006080868803121561076957600080fd5b610772866105db565b9450610780602087016105db565b935060408601359250606086013567ffffffffffffffff8111156107a357600080fd5b6107af8882890161068e565b96999598509396509294939250505056fea26469706673582212200ac7c3ccbc2d311c48bf5465b021542e0e306fe3c462c060ba6a3d2f81ff6c5f64736f6c63430008130033"; + bytes memory expected1 = + hex"060008000600040005020600000403060100060100000b01050706000000030506000e00010c080006030504050e070c0601010106010000060905070800060309090a08080e0c04010106010000040e05070800060309090a08080e0c04010406010001090d0507080006030a09070b09000d050104060100010b000507080006030d0b040c0504050e0104060100010c0305070600000008000f0d050b080006030504050e070c06010104060100010707050708000603090602030600090d010406010001080a05070600000008000f0d050b08000603030702090f090202010106010000090a050708000603030702090f0902020104060100010301050708000603040301040f0102000104060100010404050708000603050401040d0f0f00010406010001050705070600000008000f0d050b08000603010a0c0f0d00020a0104060100000b06050708000603020a0b0b0e0f01050104060100000d080507050b0600000008000f0d050b030408000105060100000c0205070600000008000f0d050b0500060100000d06060100000d010306060000040601000600040506050b060100010e060506050b0000050b030408000105060100000e0405070600000008000f0d050b0500060100010007060100000f030306060000040601000603070506050b03000600000c0900080105020600000009010900090105020600020009000200050409000506050b06000400050107030f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f09000901010608010502060002000001050b06000400050108000901000309000f03050b06010001000706010001030f0306060000040601000605020506050b0601000203070506050b060100010007060100010502030606000004060100060d070506050b06010002040e0506050b03040800010506010001060305070600000008000f0d050b05000601000100070601000107020306060000040601000703080506050b0601000206070506050b0601000100070601000108050306060000040601000600040506050b06010002090a0506050b060100000d06060100010908030606000004060100060d070506050b060100020a0f0506050b060100000d06060100010a0b0306060000040601000600040506050b06010003050f0506050b060100010007060100010b0e0306060000040601000705010506050b0601000307000506050b030408000105060100010c0f05070600000008000f0d050b0500060100010d08060100030a090506050b0600040005010900080105020600020000010601000102080506050b03000600000c05020801060000000502060002000600000c020003030801050401040601000200090507060308020b0402090000060000000502060000040600010c0f0d050b08010900050508000802070f070e0604040d07090402020f01070c00010e040809040b050f040f0508080d0303010e0b0f0a02080605030d04020a0e0803020d0c05090e03080c090709080f0600000008000a03050005000506050b06000000060100020406080408040804030608050601000307000506050b0904090305000500050005000506050b0600000006010002050e080508050803080008070807060100030c020506050b09050904050005000500050005000506050b060000000800060100020702060100030a090506050b0900050006000f0f0600000005030800060003050502030006000600010b060000010502080206000105050206000505060000000200090105000600000006000305050205000901090005000506050b06000000060100020a08080308030306080406010002040e0506050b090309020500050005000506050b03000600000c050208030600000005020303060002000600000c020005040104060100020d010507060308020b0402090000060000000502060000040600010c0f0d050b060004000501080308010502070f0306000809040a01030b0a010a030201000606070c0802080409020d0b09080d0c0a030e020007060c0c030703050a0902000a030c0a0500050d0308020b0b0c0600020008020001050208010803060004000803000103070600000008000803060004000001080303040809050a0f010601000303010507030d0601000302070507060305050209090b0409060000000502060000040600010c0f0d050b030d060000000800030e030d060000000f0d050b050008020804070f050d0601010f0301080608000d00000509080b0b0703050d06010b0a0c0f000c0501040c060b05000e010e050a0d03000004000a040d0f020b01020709010c070600000008000a0305000500050005000506050b06010003060c08020802030606000000060100020a0f0506050b050005000506050b06000000080306000600010c03030104080406000600010c0105010706010003090005070603020f060304080306060000000502060000040600010c0f0d050b06010003090f0806080608060600000108070807060100030c020506050b090609050500050005000500050005000506050b060000000800060100030b0406010004090c0506050b0600080906000103090009010001020009020901050005000506050b060000000800060100030c0d06010004090c0506050b09000500080408000105060100030e0705070806060008090600010308040001060000000f0509020500060100030f030506050b060008090600010308030001060000000f0009020500050b05000801060100040007050706030300010106040205060000000502060000040600010c0f0d050b080708010502070f0306000809040a01030b0a010a030201000606070c0802080409020d0b09080d0c0a030e020007060c0c030703050a0902000a030c0a0500050d0308020b0b0c0600020008020001050208020804060004000803000103070600000008000804060004000001080303040806050a0f0106010004050a0507030d060100030207050706030300010106040205060000000502060000040600010c0f0d050b03000600000c050208010600000005020806060002000600000c02000505080608080803070f0c09050903050a06060d01050e000d0a050e0401020a0c0a000a0d02070a0e0809010d02000b020f0b09010c0f030909040b060a030b0f020b080107080008020600000008000a040500090609050500050005000500050005000506050b060004000501030006000700010c0800010506010005040205070606060005020507030d060000000f0d0600070b080300010502070f030d0305060002000305050506000400080003060101010506000502050703060003080006000400030d0307030d030d0305050a0f04030d060000000800030e06000704080300010502070f030703050a0902000a030c0a0500050d0308020b0b0c0504050a0f04030d060000000800030e060005020507030d060000000f0d050b030d060000000f03050b06000504080300010502070f01040600050705070306030d030d03070306030d070f0306000809040a01030b0a010a030201000606070c0802080409020d0b09080d0c0a030e020007060c0c06000304080300010502030006000104080300010502060c0600070f030d080106000009030d03090f03030d030d0303070308020502050009000506050b06060600040c0507030d060000000f0d06000705080300010502070f030d030506000200030505050600040008000306010101050600040c050703060003080006000400030d0307030d030d0305050a0f04030d060000000800030e0600060e080300010502070f030703050a0902000a030c0a0500050d0308020b0b0c0504050a0f04030d060000000800030e0600040c0507030d060000000f0d050b030d060000000f03050b0600040e080300010502070f01040600050105070306030d030d03070306030d070f0306000809040a01030b0a010a030201000606070c0802080409020d0b09080d0c0a030e020007060c0c0600020e08030001050203000600000e080300010502060c06000709030d080106000009030d03090f03030d030d0303060d08020502050009000506050b0800030507030f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0801010608010104060100050f0f05070600000008000f0d050b0901090005000506050b060000000800060004000803080500030102010506010006010705070600000008000f0d050b0601000602000803060100050d0b0506050b0901050006010006020e0600020008040001060100050d0b0506050b09000500090205000902090005000506050b06000000060002000802080400030102010506010006040905070600000008000f0d050b060100020a080802060100050d0b0506050b06000000080006000000060006000804080600030102010506010006060705070600000008000f0d050b0601000607000804060100050d0b0506050b0902050006010006070e0600020008050001060100050d0b0506050b090105000600040008040001030509000500090205000902050009020506050b06000000080008030600010f080400010102060100060a0005070600000008000f0d050b05000801030506070f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f080101010105060100060b0805070600000008000f0d050b060002000803000109010500080306000200080208050001000101010105060100060d0005070600000008000f0d050b090205000902090005000506050b0600000008000600000008000600060008050807000301020105060100060e0d05070600000008000f0d050b060100060f060805060100050d0b0506050b090305000601000700040600020008060001060100050d0b0506050b090205000600040008050001030506070f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f08010101010506010007020005070600000008000f0d050b06010007020c080708020808000106010006080e0506050b09050908090409070500090505000500050005000506050b06000000060002000802080400030102010506010007040a05070600000008000f0d050b050003050901090005000506050b06000000080006000000080006000000060008000806080800030102010506010007060905070600000008000f0d050b0601000707020806060100050d0b0506050b090405000601000708000600020008070001060100050d0b0506050b0903050006000400080600010305090205000600060008060001030506070f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f080101010105060100070a0305070600000008000f0d050b060100070a0f080808020809000106010006080e0506050b09060909090509080500090309060500090209040903090205000500050005060f0e0a02060406090700060607030508020201020200000a0c070c030c0c0b0c020d0301010c04080b0f050406050b0002010504020e000e0300060f0e030c0406020c0006000b0a060a030d020f08010f0f060c050f06040703060f060c0603040300000008010300000303"; + assertEq(LibBit.toNibbles(s1), expected1); } function testToNibblesDifferential(uint256 r, bytes memory s) public { diff --git a/test/LibClone.t.sol b/test/LibClone.t.sol index d3866180b..75e1c6357 100644 --- a/test/LibClone.t.sol +++ b/test/LibClone.t.sol @@ -1207,7 +1207,9 @@ contract LibCloneTest is SoladyTest { mstore(0x00, 0x57eca1a5) // `revertWithError()`. switch staticcall(gasBudget, instance, 0x1c, 0x04, 0x20, 0x20) case 0 { - if iszero(or(iszero(returndatasize()), eq(returndatasize(), 0x24))) { invalid() } + if iszero(or(iszero(returndatasize()), eq(returndatasize(), 0x24))) { + invalid() + } } default { invalid() } } @@ -1231,7 +1233,9 @@ contract LibCloneTest is SoladyTest { mstore(0x00, 0x57eca1a5) // `revertWithError()`. switch staticcall(gasBudget, instance, 0x1c, 0x04, 0x20, 0x20) case 0 { - if iszero(or(iszero(returndatasize()), eq(returndatasize(), 0x24))) { invalid() } + if iszero(or(iszero(returndatasize()), eq(returndatasize(), 0x24))) { + invalid() + } } default { invalid() } } @@ -1616,11 +1620,11 @@ contract LibCloneTest is SoladyTest { assertEq(instance, predicted); } - function deployDeterministicERC1967IBeaconProxy( - address beacon, - bytes memory args, - bytes32 salt - ) external maybeBrutalizeMemory returns (address instance) { + function deployDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) + external + maybeBrutalizeMemory + returns (address instance) + { instance = LibClone.deployDeterministicERC1967IBeaconProxy(_brutalized(beacon), args, salt); address predicted = LibClone.predictDeterministicAddressERC1967IBeaconProxy( beacon, args, salt, address(this) @@ -1704,11 +1708,11 @@ contract LibCloneTest is SoladyTest { assertEq(instance, predicted); } - function createDeterministicERC1967IBeaconProxy( - address beacon, - bytes memory args, - bytes32 salt - ) external maybeBrutalizeMemory returns (address instance) { + function createDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) + external + maybeBrutalizeMemory + returns (address instance) + { address predicted = LibClone.predictDeterministicAddressERC1967IBeaconProxy( beacon, args, salt, address(this) ); diff --git a/test/LibString.t.sol b/test/LibString.t.sol index 2abdc0c21..9b90f9973 100644 --- a/test/LibString.t.sol +++ b/test/LibString.t.sol @@ -466,7 +466,9 @@ contract LibStringTest is SoladyTest { assertEq(keccak256(raw), hashBefore); /// @solidity memory-safe-assembly assembly { - if iszero(eq(mload(add(raw, add(0x20, mload(raw)))), hashBefore)) { revert(0, 0) } + if iszero(eq(mload(add(raw, add(0x20, mload(raw)))), hashBefore)) { + revert(0, 0) + } } } @@ -493,7 +495,9 @@ contract LibStringTest is SoladyTest { assertEq(keccak256(raw), hashBefore); /// @solidity memory-safe-assembly assembly { - if iszero(eq(mload(add(raw, add(0x20, mload(raw)))), hashBefore)) { revert(0, 0) } + if iszero(eq(mload(add(raw, add(0x20, mload(raw)))), hashBefore)) { + revert(0, 0) + } } } diff --git a/test/LibZip.t.sol b/test/LibZip.t.sol index bc41b8ff8..480393c43 100644 --- a/test/LibZip.t.sol +++ b/test/LibZip.t.sol @@ -187,7 +187,9 @@ contract LibZipTest is SoladyTest { let d := byte(31, mload(data)) // Fill with either 0xff or 0x00. mstore(o, not(0)) - if iszero(gt(d, 0x7f)) { calldatacopy(o, calldatasize(), add(d, 1)) } + if iszero(gt(d, 0x7f)) { + calldatacopy(o, calldatasize(), add(d, 1)) + } o := add(o, add(and(d, 0x7f), 1)) continue } diff --git a/test/ext/zksync/ERC1155.t.sol b/test/ext/zksync/ERC1155.t.sol index 027bf9568..f7a7af81e 100644 --- a/test/ext/zksync/ERC1155.t.sol +++ b/test/ext/zksync/ERC1155.t.sol @@ -145,13 +145,11 @@ contract MockERC1155WithHooks is MockERC1155 { beforeCounter++; } - function _afterTokenTransfer( - address, - address, - uint256[] memory, - uint256[] memory, - bytes memory - ) internal virtual override { + function _afterTokenTransfer(address, address, uint256[] memory, uint256[] memory, bytes memory) + internal + virtual + override + { afterCounter++; } } diff --git a/test/ext/zksync/ERC721.t.sol b/test/ext/zksync/ERC721.t.sol index b3348c0b1..af4ad6a83 100644 --- a/test/ext/zksync/ERC721.t.sol +++ b/test/ext/zksync/ERC721.t.sol @@ -988,10 +988,9 @@ contract ERC721Test is SoladyTest { token.safeMint(to, id); } - function testSafeMintToERC721RecipientWithWrongReturnDataWithData( - uint256 id, - bytes memory data - ) public { + function testSafeMintToERC721RecipientWithWrongReturnDataWithData(uint256 id, bytes memory data) + public + { address to = address(new WrongReturnDataERC721Recipient()); vm.expectRevert(ERC721.TransferToNonERC721ReceiverImplementer.selector); token.safeMint(to, id, data); diff --git a/test/utils/Brutalizer.sol b/test/utils/Brutalizer.sol index 1c6447ae0..969c5f865 100644 --- a/test/utils/Brutalizer.sol +++ b/test/utils/Brutalizer.sol @@ -825,7 +825,9 @@ contract Brutalizer { let remainder := and(length, 0x1f) if remainder { if shl(mul(8, remainder), lastWord) { notZeroRightPadded := 1 } } // Check if the memory allocated is sufficient. - if length { if gt(add(add(s, 0x20), length), mload(0x40)) { insufficientMalloc := 1 } } + if length { + if gt(add(add(s, 0x20), length), mload(0x40)) { insufficientMalloc := 1 } + } } if (notZeroRightPadded) revert("Not zero right padded!"); if (insufficientMalloc) revert("Insufficient memory allocation!"); diff --git a/test/utils/forge-std/Test.sol b/test/utils/forge-std/Test.sol index 7d620e943..17416dc31 100644 --- a/test/utils/forge-std/Test.sol +++ b/test/utils/forge-std/Test.sol @@ -550,12 +550,10 @@ abstract contract Test is Script { vm.assertApproxEqAbs(left, right, maxDelta, err); } - function assertApproxEqAbsDecimal( - int256 left, - int256 right, - uint256 maxDelta, - uint256 decimals - ) internal virtual { + function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) + internal + virtual + { vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals); } diff --git a/test/utils/forge-std/Vm.sol b/test/utils/forge-std/Vm.sol index 74fbde47b..acb57d1ad 100644 --- a/test/utils/forge-std/Vm.sol +++ b/test/utils/forge-std/Vm.sol @@ -927,12 +927,9 @@ interface VmSafe { /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. /// Formats values with decimals in failure message. - function assertApproxEqAbsDecimal( - int256 left, - int256 right, - uint256 maxDelta, - uint256 decimals - ) external pure; + function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) + external + pure; /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. /// Formats values with decimals in failure message. Includes error message into revert string on failure. @@ -949,12 +946,9 @@ interface VmSafe { /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. /// Includes error message into revert string on failure. - function assertApproxEqAbs( - uint256 left, - uint256 right, - uint256 maxDelta, - string calldata error - ) external pure; + function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string calldata error) + external + pure; /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) external pure;