From 3e2e0429f37fff1e1cb38a27ed7ba08a6ff4c11b Mon Sep 17 00:00:00 2001 From: Peersky <61459744+peersky@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:16:57 +0700 Subject: [PATCH 1/2] added aux code indexer interface, fixed more typos (#28) --- .changeset/nasty-points-wait.md | 5 +++++ src/ICodeIndexDep.sol | 14 ++++++++++++++ src/abstracts/Distributor.sol | 6 +++--- src/libraries/LibSemver.sol | 16 ++++++++-------- 4 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 .changeset/nasty-points-wait.md create mode 100644 src/ICodeIndexDep.sol diff --git a/.changeset/nasty-points-wait.md b/.changeset/nasty-points-wait.md new file mode 100644 index 0000000..5cdae27 --- /dev/null +++ b/.changeset/nasty-points-wait.md @@ -0,0 +1,5 @@ +--- +"@peeramid-labs/eds": patch +--- + +added aux file for codeIndex interface in more loose pragma to be more reusable as library diff --git a/src/ICodeIndexDep.sol b/src/ICodeIndexDep.sol new file mode 100644 index 0000000..75ce0b6 --- /dev/null +++ b/src/ICodeIndexDep.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: CC0-1.0 +pragma solidity >=0.8.0 <0.9.0; + +// This file is exactly same as ./ICodeIndexer.sol\ +// With exception for more loose pragma version +// Updating the CodeIndex pragma directly would cause changing the deployed bytecode for ERC7744 +interface ICodeIndex { + event Indexed(address indexed container, bytes32 indexed codeHash); + error alreadyExists(bytes32 id, address source); + + function register(address container) external; + + function get(bytes32 id) external view returns (address); +} \ No newline at end of file diff --git a/src/abstracts/Distributor.sol b/src/abstracts/Distributor.sol index 6bdaafe..ce27e51 100644 --- a/src/abstracts/Distributor.sol +++ b/src/abstracts/Distributor.sol @@ -31,7 +31,7 @@ abstract contract Distributor is IDistributor, CodeIndexer, ERC165 { EnumerableSet.Bytes32Set private distributionsSet; mapping(address instance => uint256 instanceId) private instanceIds; mapping(uint256 instance => bytes32 distributorsId) public distributionOf; - mapping(bytes32 distributorsId => DistributionComponent distirbution) public distributionComponents; + mapping(bytes32 distributorsId => DistributionComponent distribution) public distributionComponents; mapping(bytes32 distributorsId => LibSemver.VersionRequirement VersionRequirement) public versionRequirements; mapping(uint256 instanceId => LibSemver.Version instanceVersion) public instanceVersions; @@ -114,7 +114,7 @@ abstract contract Distributor is IDistributor, CodeIndexer, ERC165 { LibSemver.VersionRequirement memory versionRequirement = versionRequirements[distributorsId]; // External initializer is provided, delegatecall to it - // Countrary, if no initializer is provided, the distribution is expected to be self-initializing + // Contrary, if no initializer is provided, the distribution is expected to be self-initializing bool externallyInitialized = distributionComponent.initializer == address(0); bytes4 selector = IInitializer.initialize.selector; bytes memory instantiationArgs = externallyInitialized ? args : bytes(""); @@ -130,7 +130,7 @@ abstract contract Distributor is IDistributor, CodeIndexer, ERC165 { instantiationArgs ); // Unversioned distributions are considered to be at version 0, and are not expected to change - // This might change in the future, as it could make sence to inherit `distributionVersion` from the distribution + // This might change in the future, as it could make sense to inherit `distributionVersion` from the distribution // Yet for ease of runtime validation and to avoid potential issues, we keep it at 0 instanceVersions[numInstances] = LibSemver.parse(0); } else { diff --git a/src/libraries/LibSemver.sol b/src/libraries/LibSemver.sol index cd96b56..9c1b2b4 100644 --- a/src/libraries/LibSemver.sol +++ b/src/libraries/LibSemver.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/utils/Strings.sol"; library LibSemver { - error versionMissmatch(string message); + error versionMismatch(string message); struct Version { uint64 major; uint64 minor; @@ -47,32 +47,32 @@ library LibSemver { } function require_exact(Version memory _version1, Version memory _version2) internal pure { - if (toUint256(_version1) != toUint256(_version2)) revert versionMissmatch("Version mismatch"); + if (toUint256(_version1) != toUint256(_version2)) revert versionMismatch("Version mismatch"); } function require_major(Version memory _version1, Version memory _version2) internal pure { - if (_version1.major != _version2.major) revert versionMissmatch("Major version mismatch"); + if (_version1.major != _version2.major) revert versionMismatch("Major version mismatch"); } function require_major_minor(Version memory _version1, Version memory _version2) internal pure { if (_version1.major != _version2.major || _version1.minor != _version2.minor) - revert versionMissmatch("Major and minor version mismatch"); + revert versionMismatch("Major and minor version mismatch"); } function require_greater_equal(Version memory _version1, Version memory _version2) internal pure { - if (toUint256(_version1) < toUint256(_version2)) revert versionMissmatch("Version is not greater or equal"); + if (toUint256(_version1) < toUint256(_version2)) revert versionMismatch("Version is not greater or equal"); } function require_greater(Version memory _version1, Version memory _version2) internal pure { - if (toUint256(_version1) <= toUint256(_version2)) revert versionMissmatch("Version is not greater"); + if (toUint256(_version1) <= toUint256(_version2)) revert versionMismatch("Version is not greater"); } function require_lesser_equal(Version memory _version1, Version memory _version2) internal pure { - if (toUint256(_version1) > toUint256(_version2)) revert versionMissmatch("Version is not lesser or equal"); + if (toUint256(_version1) > toUint256(_version2)) revert versionMismatch("Version is not lesser or equal"); } function require_lesser(Version memory _version1, Version memory _version2) internal pure { - if (toUint256(_version1) >= toUint256(_version2)) revert versionMissmatch("Version is not lesser"); + if (toUint256(_version1) >= toUint256(_version2)) revert versionMismatch("Version is not lesser"); } function areEqual(Version memory _version1, Version memory _version2) internal pure returns (bool) { From a02d47872767ca198bb0afd60f4edc27daa64098 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:21:04 +0700 Subject: [PATCH 2/2] chore: new release (#29) Co-authored-by: github-actions[bot] --- .changeset/nasty-points-wait.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/ICodeIndexDep.sol | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) delete mode 100644 .changeset/nasty-points-wait.md diff --git a/.changeset/nasty-points-wait.md b/.changeset/nasty-points-wait.md deleted file mode 100644 index 5cdae27..0000000 --- a/.changeset/nasty-points-wait.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@peeramid-labs/eds": patch ---- - -added aux file for codeIndex interface in more loose pragma to be more reusable as library diff --git a/CHANGELOG.md b/CHANGELOG.md index 41c0fea..ea04709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @peeramid-labs/eds +## 2.1.2 + +### Patch Changes + +- [#28](https://github.com/peeramid-labs/eds/pull/28) [`3e2e0429f37fff1e1cb38a27ed7ba08a6ff4c11b`](https://github.com/peeramid-labs/eds/commit/3e2e0429f37fff1e1cb38a27ed7ba08a6ff4c11b) Thanks [@peersky](https://github.com/peersky)! - added aux file for codeIndex interface in more loose pragma to be more reusable as library + ## 2.1.1 ### Patch Changes diff --git a/package.json b/package.json index 833e871..0728c83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@peeramid-labs/eds", - "version": "2.1.1", + "version": "2.1.2", "files": [ "abi", "deployments", diff --git a/src/ICodeIndexDep.sol b/src/ICodeIndexDep.sol index 75ce0b6..eee6fbb 100644 --- a/src/ICodeIndexDep.sol +++ b/src/ICodeIndexDep.sol @@ -11,4 +11,4 @@ interface ICodeIndex { function register(address container) external; function get(bytes32 id) external view returns (address); -} \ No newline at end of file +}