Skip to content

Commit

Permalink
Signer List tests WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Nov 6, 2024
1 parent bb04d32 commit 6a804fd
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 43 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ Then use `make` to automatically sync the described branches into solidity test
```sh
$ make
Available targets:
Available targets:
- make all Builds all tree files and updates the test tree markdown
- make sync Scaffold or sync tree files into solidity tests
- make check Checks if solidity files are out of sync
Expand Down
3 changes: 2 additions & 1 deletion TEST_TREE.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ SignerListTest
│ ├── Given duplicate addresses on initialize
│ │ └── It should revert
│ ├── It should append the new addresses to the list
│ ├── It should return true on isListed
│ ├── It should emit the SignersAddedEvent
│ ├── When encryptionRegistry is not compatible on initialize
│ │ └── It should revert
Expand Down Expand Up @@ -482,6 +483,7 @@ SignerListTest
│ ├── Given duplicate addresses on updateSettings
│ │ └── It should revert
│ ├── It should append the new addresses to the list
│ ├── It should return true on isListed
│ └── It should emit the SignersAddedEvent
├── When calling removeSigners
│ ├── When removing without the permission
Expand Down Expand Up @@ -543,4 +545,3 @@ SignerListTest
├── It result does not contain unlisted addresses
└── It result does not contain non appointed addresses
```

10 changes: 9 additions & 1 deletion src/EncryptionRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ pragma solidity ^0.8.17;

import {Addresslist} from "@aragon/osx/plugins/utils/Addresslist.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {IEncryptionRegistry} from "./interfaces/IEncryptionRegistry.sol";

/// @title EncryptionRegistry - Release 1, Build 1
/// @author Aragon Association - 2024
/// @notice A smart contract where accounts can register their libsodium public key for encryption purposes, as well as appointing an EOA
contract EncryptionRegistry is IEncryptionRegistry {
contract EncryptionRegistry is IEncryptionRegistry, ERC165 {
struct AccountEntry {
address appointedWallet;
bytes32 publicKey;
Expand Down Expand Up @@ -110,6 +111,13 @@ contract EncryptionRegistry is IEncryptionRegistry {
return _member;
}

/// @notice Checks if this or the parent contract supports an interface by its ID.
/// @param _interfaceId The ID of the interface.
/// @return Returns `true` if the interface is supported.
function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
return _interfaceId == type(IEncryptionRegistry).interfaceId || super.supportsInterface(_interfaceId);
}

// Internal helpers

function _setPublicKey(address _account, bytes32 _publicKey) internal {
Expand Down
11 changes: 6 additions & 5 deletions src/SignerList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ contract SignerList is ISignerList, Addresslist, ERC165Upgradeable, DaoAuthoriza
function resolveEncryptionOwner(address _address) public view returns (address owner) {
(bool ownerIsListed, bool isAppointed) = resolveEncryptionAccountStatus(_address);

if (!ownerIsListed) return address(0);
else if (isAppointed) return settings.encryptionRegistry.appointedBy(_address);
if (!ownerIsListed) {
return address(0);
} else if (isAppointed) {
return settings.encryptionRegistry.appointedBy(_address);
}
return _address;
}

Expand Down Expand Up @@ -212,9 +215,7 @@ contract SignerList is ISignerList, Addresslist, ERC165Upgradeable, DaoAuthoriza
&& _newSettings.minSignerListLength == settings.minSignerListLength
) {
return;
} else if (
!IERC165(address(_newSettings.encryptionRegistry)).supportsInterface(type(IEncryptionRegistry).interfaceId)
) {
} else if (!_newSettings.encryptionRegistry.supportsInterface(type(IEncryptionRegistry).interfaceId)) {
revert InvalidEncryptionRegitry(address(_newSettings.encryptionRegistry));
}

Expand Down
Loading

0 comments on commit 6a804fd

Please sign in to comment.