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

Run forge update and use Calldata library #65

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions contracts/utils/cryptography/ERC7739Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

pragma solidity ^0.8.20;

import {Calldata} from "@openzeppelin/contracts/utils/Calldata.sol";

/**
* @dev Utilities to process https://ercs.ethereum.org/ERCS/erc-7739[ERC-7739] typed data signatures
* that are specific to an EIP-712 domain.
Expand Down Expand Up @@ -71,13 +73,13 @@ library ERC7739Utils {
unchecked {
uint256 sigLength = encodedSignature.length;

if (sigLength < 4) return (_emptyCalldataBytes(), 0, 0, _emptyCalldataString());
if (sigLength < 4) return (Calldata.emptyBytes(), 0, 0, Calldata.emptyString());

uint256 contentsDescrEnd = sigLength - 2; // Last 2 bytes
uint256 contentsDescrLength = uint16(bytes2(encodedSignature[contentsDescrEnd:]));

if (contentsDescrLength + 64 > contentsDescrEnd)
return (_emptyCalldataBytes(), 0, 0, _emptyCalldataString());
return (Calldata.emptyBytes(), 0, 0, Calldata.emptyString());

uint256 contentsHashEnd = contentsDescrEnd - contentsDescrLength;
uint256 separatorEnd = contentsHashEnd - 32;
Expand Down Expand Up @@ -195,23 +197,7 @@ library ERC7739Utils {
}
}
}
return (_emptyCalldataString(), _emptyCalldataString());
}

// slither-disable-next-line write-after-write
function _emptyCalldataBytes() private pure returns (bytes calldata result) {
assembly ("memory-safe") {
result.offset := 0
result.length := 0
}
}

// slither-disable-next-line write-after-write
function _emptyCalldataString() private pure returns (string calldata result) {
assembly ("memory-safe") {
result.offset := 0
result.length := 0
}
return (Calldata.emptyString(), Calldata.emptyString());
}

function _isForbiddenChar(bytes1 char) private pure returns (bool) {
Expand Down
2 changes: 1 addition & 1 deletion lib/@openzeppelin-contracts
Submodule @openzeppelin-contracts updated 58 files
+0 −5 .changeset/eighty-hounds-promise.md
+0 −5 .changeset/four-chairs-help.md
+5 −0 .changeset/good-cameras-serve.md
+0 −5 .changeset/great-lions-hear.md
+0 −5 .changeset/healthy-books-shout.md
+0 −5 .changeset/hot-shrimps-wait.md
+5 −0 .changeset/long-walls-draw.md
+0 −5 .changeset/lovely-dodos-lay.md
+0 −5 .changeset/pink-wasps-hammer.md
+0 −5 .changeset/proud-planes-arrive.md
+0 −5 .changeset/seven-donkeys-tap.md
+0 −5 .changeset/small-seahorses-bathe.md
+0 −5 .changeset/tricky-bats-pretend.md
+0 −5 .changeset/weak-roses-bathe.md
+42 −0 CHANGELOG.md
+1 −1 contracts/access/AccessControl.sol
+5 −11 contracts/account/utils/draft-ERC4337Utils.sol
+1 −0 contracts/account/utils/draft-ERC7579Utils.sol
+1 −1 contracts/finance/VestingWallet.sol
+1 −1 contracts/governance/Governor.sol
+1 −0 contracts/governance/extensions/GovernorCountingOverridable.sol
+1 −1 contracts/governance/extensions/GovernorPreventLateQuorum.sol
+1 −1 contracts/governance/utils/Votes.sol
+1 −0 contracts/governance/utils/VotesExtended.sol
+1 −0 contracts/interfaces/draft-IERC4337.sol
+123 −0 contracts/interfaces/draft-IERC6909.sol
+3 −2 contracts/interfaces/draft-IERC7579.sol
+1 −1 contracts/package.json
+1 −1 contracts/proxy/Clones.sol
+1 −1 contracts/proxy/ERC1967/ERC1967Proxy.sol
+1 −1 contracts/proxy/ERC1967/ERC1967Utils.sol
+1 −1 contracts/proxy/beacon/BeaconProxy.sol
+1 −1 contracts/proxy/transparent/ProxyAdmin.sol
+1 −1 contracts/proxy/transparent/TransparentUpgradeableProxy.sol
+1 −1 contracts/proxy/utils/UUPSUpgradeable.sol
+1 −1 contracts/token/ERC20/ERC20.sol
+1 −1 contracts/token/ERC20/extensions/ERC1363.sol
+1 −1 contracts/token/ERC20/utils/SafeERC20.sol
+1 −1 contracts/utils/Address.sol
+1 −0 contracts/utils/Bytes.sol
+1 −0 contracts/utils/CAIP10.sol
+1 −0 contracts/utils/CAIP2.sol
+24 −0 contracts/utils/Calldata.sol
+1 −0 contracts/utils/NoncesKeyed.sol
+1 −1 contracts/utils/Packing.sol
+1 −1 contracts/utils/ReentrancyGuardTransient.sol
+1 −1 contracts/utils/Strings.sol
+2 −2 contracts/utils/cryptography/MessageHashUtils.sol
+2 −2 contracts/utils/structs/MerkleTree.sol
+1 −1 docs/modules/ROOT/pages/access-control.adoc
+1 −1 docs/modules/ROOT/pages/index.adoc
+1 −1 package.json
+1 −1 scripts/prepare-docs.sh
+43 −43 test/account/utils/draft-ERC4337Utils.test.js
+31 −28 test/account/utils/draft-ERC7579Utils.test.js
+12 −12 test/governance/extensions/GovernorSequentialProposalId.test.js
+22 −0 test/utils/Calldata.test.js
+25 −25 test/utils/Nonces.behavior.js
2 changes: 1 addition & 1 deletion lib/@openzeppelin-contracts-upgradeable
Submodule @openzeppelin-contracts-upgradeable updated 90 files
+5 −0 .changeset/brave-islands-sparkle.md
+5 −0 .changeset/cyan-taxis-travel.md
+0 −5 .changeset/eighty-hounds-promise.md
+0 −5 .changeset/four-chairs-help.md
+5 −0 .changeset/good-cameras-serve.md
+0 −5 .changeset/great-lions-hear.md
+0 −5 .changeset/healthy-books-shout.md
+0 −5 .changeset/hot-shrimps-wait.md
+5 −0 .changeset/long-walls-draw.md
+0 −5 .changeset/lovely-dodos-lay.md
+0 −5 .changeset/pink-wasps-hammer.md
+0 −5 .changeset/proud-planes-arrive.md
+0 −5 .changeset/seven-donkeys-tap.md
+5 −0 .changeset/seven-insects-taste.md
+0 −5 .changeset/small-seahorses-bathe.md
+5 −0 .changeset/ten-fishes-fold.md
+5 −0 .changeset/thin-eels-cross.md
+0 −5 .changeset/tricky-bats-pretend.md
+0 −5 .changeset/weak-roses-bathe.md
+0 −8 .githooks/pre-push
+1 −5 .github/workflows/checks.yml
+1 −1 .github/workflows/formal-verification.yml
+2 −0 .husky/pre-commit
+42 −0 CHANGELOG.md
+ audits/2024-12-v5.2.pdf
+9 −8 audits/README.md
+1 −1 contracts/access/AccessControlUpgradeable.sol
+1 −1 contracts/finance/VestingWalletUpgradeable.sol
+20 −7 contracts/governance/GovernorUpgradeable.sol
+5 −4 contracts/governance/extensions/GovernorCountingOverridableUpgradeable.sol
+1 −1 contracts/governance/extensions/GovernorPreventLateQuorumUpgradeable.sol
+98 −0 contracts/governance/extensions/GovernorSequentialProposalIdUpgradeable.sol
+1 −1 contracts/governance/extensions/GovernorTimelockCompoundUpgradeable.sol
+1 −0 contracts/governance/utils/VotesExtendedUpgradeable.sol
+1 −1 contracts/governance/utils/VotesUpgradeable.sol
+7 −0 contracts/mocks/WithInit.sol
+45 −0 contracts/mocks/governance/GovernorSequentialProposalIdMockUpgradeable.sol
+2 −2 contracts/package.json
+1 −1 contracts/proxy/utils/UUPSUpgradeable.sol
+1 −1 contracts/token/ERC20/ERC20Upgradeable.sol
+6 −3 contracts/token/ERC20/extensions/ERC1363Upgradeable.sol
+5 −8 contracts/token/ERC20/extensions/ERC4626Upgradeable.sol
+1 −1 contracts/token/ERC721/README.adoc
+1 −0 contracts/utils/NoncesKeyedUpgradeable.sol
+1 −1 contracts/utils/README.adoc
+1 −1 contracts/utils/ReentrancyGuardTransientUpgradeable.sol
+1 −1 docs/modules/ROOT/pages/access-control.adoc
+1 −1 docs/modules/ROOT/pages/erc1155.adoc
+1 −1 docs/modules/ROOT/pages/index.adoc
+1 −0 foundry.toml
+1 −1 fv-requirements.txt
+31 −0 hardhat/common-contracts.js
+1 −1 lib/openzeppelin-contracts
+828 −123 package-lock.json
+19 −7 package.json
+2 −0 scripts/checks/coverage.sh
+1 −1 scripts/checks/inheritance-ordering.js
+1 −1 scripts/checks/pragma-consistency.js
+1 −1 scripts/prepare-docs.sh
+0 −5 scripts/prepare.sh
+10 −0 scripts/set-max-old-space-size.sh
+4 −1 scripts/solhint-custom/package.json
+1 −2 slither.config.json
+1 −1 solhint.config.js
+1 −1 test/TESTING.md
+78 −37 test/account/utils/draft-ERC4337Utils.test.js
+421 −0 test/account/utils/draft-ERC7579Utils.t.sol
+45 −42 test/account/utils/draft-ERC7579Utils.test.js
+1 −0 test/bin/EntryPoint070.abi
+ test/bin/EntryPoint070.bytecode
+1 −0 test/bin/SenderCreator070.abi
+ test/bin/SenderCreator070.bytecode
+1 −1 test/governance/Governor.test.js
+1 −1 test/governance/extensions/GovernorCountingFractional.test.js
+3 −1 test/governance/extensions/GovernorCountingOverridable.test.js
+1 −1 test/governance/extensions/GovernorERC721.test.js
+1 −1 test/governance/extensions/GovernorPreventLateQuorum.test.js
+202 −0 test/governance/extensions/GovernorSequentialProposalId.test.js
+1 −1 test/governance/extensions/GovernorStorage.test.js
+1 −1 test/governance/extensions/GovernorTimelockAccess.test.js
+1 −1 test/governance/extensions/GovernorTimelockCompound.test.js
+1 −1 test/governance/extensions/GovernorTimelockControl.test.js
+1 −1 test/governance/extensions/GovernorVotesQuorumFraction.test.js
+1 −1 test/governance/extensions/GovernorWithParams.test.js
+14 −12 test/helpers/governance.js
+7 −2 test/helpers/iterate.js
+1 −1 test/metatx/ERC2771Context.test.js
+22 −0 test/utils/Calldata.test.js
+25 −25 test/utils/Nonces.behavior.js
+45 −33 test/utils/introspection/SupportsInterface.behavior.js
2 changes: 1 addition & 1 deletion lib/forge-std
Loading