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) {