From 719d5ef2ca8941623e84bfc5c1ec232c8ef3d5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8r=E2=88=82=C2=A1?= Date: Thu, 5 Dec 2024 14:09:25 +0100 Subject: [PATCH 1/3] Clearer names for encryption methods and events --- TEST_TREE.md | 5 +- src/EncryptionRegistry.sol | 69 +++-- src/SignerList.sol | 27 +- src/interfaces/IEncryptionRegistry.sol | 40 +-- src/interfaces/ISignerList.sol | 20 +- test/EmergencyMultisig.t.sol | 30 +-- test/EncryptionRegistry.t.sol | 354 ++++++++++++------------- test/Multisig.t.sol | 32 +-- test/SignerList.t.sol | 30 +-- test/SignerList.t.yaml | 4 +- 10 files changed, 307 insertions(+), 304 deletions(-) diff --git a/TEST_TREE.md b/TEST_TREE.md index f3a233f..81b13a3 100644 --- a/TEST_TREE.md +++ b/TEST_TREE.md @@ -545,8 +545,8 @@ SignerListTest │ │ └── It votingWallet should be the given address │ └── Given the resolved owner was not listed on resolveEncryptionAccountAtBlock │ ├── It should return a zero owner -│ └── It should return a zero appointedWallet -└── When calling getEncryptionRecipients +│ └── It should return a zero appointedAgent +└── When calling getEncryptionAgents ├── Given the encryption registry has no accounts │ ├── It returns an empty list, even with signers │ └── It returns an empty list, without signers @@ -560,4 +560,3 @@ SignerListTest ├── It result does not contain unlisted addresses └── It result does not contain non appointed addresses ``` - diff --git a/src/EncryptionRegistry.sol b/src/EncryptionRegistry.sol index 58e9b79..a226947 100644 --- a/src/EncryptionRegistry.sol +++ b/src/EncryptionRegistry.sol @@ -12,18 +12,18 @@ import {IEncryptionRegistry} from "./interfaces/IEncryptionRegistry.sol"; /// @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, ERC165 { - struct AccountEntry { - address appointedWallet; + struct RegisteredAccount { + address appointedAgent; bytes32 publicKey; } /// @notice Allows to enumerate the addresses on the registry - address[] public registeredAccounts; + address[] public accountList; - /// @notice The database of appointed wallets and their public key - mapping(address => AccountEntry) public accounts; + /// @notice The public key and (optional) appointed agent or each registered account + mapping(address => RegisteredAccount) public accounts; - /// @notice A reference to the account that appointed each wallet + /// @notice A reference to the account that appointed each agent mapping(address => address) public appointerOf; /// @dev The contract to check whether the caller is a multisig member @@ -38,26 +38,26 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { } /// @inheritdoc IEncryptionRegistry - function appointWallet(address _newWallet) public { + function appointAgent(address _newAgent) public { // Appointing ourselves is the same as unappointing - if (_newWallet == msg.sender) _newWallet = address(0); + if (_newAgent == msg.sender) _newAgent = address(0); if (!addresslist.isListed(msg.sender)) { revert MustBeListed(); - } else if (Address.isContract(_newWallet)) { + } else if (Address.isContract(_newAgent)) { revert CannotAppointContracts(); - } else if (addresslist.isListed(_newWallet)) { + } else if (addresslist.isListed(_newAgent)) { // Appointing an already listed signer is not allowed, as votes would be locked revert AlreadyListed(); - } else if (_newWallet == accounts[msg.sender].appointedWallet) { + } else if (_newAgent == accounts[msg.sender].appointedAgent) { return; // done - } else if (appointerOf[_newWallet] != address(0)) { + } else if (appointerOf[_newAgent] != address(0)) { revert AlreadyAppointed(); } bool exists; - for (uint256 i = 0; i < registeredAccounts.length;) { - if (registeredAccounts[i] == msg.sender) { + for (uint256 i = 0; i < accountList.length;) { + if (accountList[i] == msg.sender) { exists = true; break; } @@ -68,26 +68,26 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { // New account? if (!exists) { - registeredAccounts.push(msg.sender); + accountList.push(msg.sender); } // Existing account else { // Clear the current appointerOf[], if needed - if (accounts[msg.sender].appointedWallet != address(0)) { - appointerOf[accounts[msg.sender].appointedWallet] = address(0); + if (accounts[msg.sender].appointedAgent != address(0)) { + appointerOf[accounts[msg.sender].appointedAgent] = address(0); } // Clear the current public key, if needed if (accounts[msg.sender].publicKey != bytes32(0)) { - // The old appointed wallet should no longer be able to see new content + // The old appointed agent should no longer be able to see new content accounts[msg.sender].publicKey = bytes32(0); } } - accounts[msg.sender].appointedWallet = _newWallet; - if (_newWallet != address(0)) { - appointerOf[_newWallet] = msg.sender; + accounts[msg.sender].appointedAgent = _newAgent; + if (_newAgent != address(0)) { + appointerOf[_newAgent] = msg.sender; } - emit WalletAppointed(msg.sender, _newWallet); + emit AgentAppointed(msg.sender, _newAgent); } /// @inheritdoc IEncryptionRegistry @@ -97,10 +97,9 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { } // If someone else if appointed, the public key cannot be overriden. // The appointed value should be set to address(0) or msg.sender first. - else if ( - accounts[msg.sender].appointedWallet != address(0) && accounts[msg.sender].appointedWallet != msg.sender - ) { - revert MustResetAppointment(); + else if (accounts[msg.sender].appointedAgent != address(0) && accounts[msg.sender].appointedAgent != msg.sender) + { + revert MustResetAppointedAgent(); } _setPublicKey(msg.sender, _publicKey); @@ -111,7 +110,7 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { function setPublicKey(address _accountOwner, bytes32 _publicKey) public { if (!addresslist.isListed(_accountOwner)) { revert MustBeListed(); - } else if (accounts[_accountOwner].appointedWallet != msg.sender) { + } else if (accounts[_accountOwner].appointedAgent != msg.sender) { revert MustBeAppointed(); } @@ -121,15 +120,15 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { /// @inheritdoc IEncryptionRegistry function getRegisteredAccounts() public view returns (address[] memory) { - return registeredAccounts; + return accountList; } /// @inheritdoc IEncryptionRegistry - function getAppointedWallet(address _member) public view returns (address) { - if (accounts[_member].appointedWallet != address(0)) { - return accounts[_member].appointedWallet; + function getAppointedAgent(address _account) public view returns (address) { + if (accounts[_account].appointedAgent != address(0)) { + return accounts[_account].appointedAgent; } - return _member; + return _account; } /// @notice Checks if this or the parent contract supports an interface by its ID. @@ -143,8 +142,8 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { function _setPublicKey(address _account, bytes32 _publicKey) internal { bool exists; - for (uint256 i = 0; i < registeredAccounts.length;) { - if (registeredAccounts[i] == _account) { + for (uint256 i = 0; i < accountList.length;) { + if (accountList[i] == _account) { exists = true; break; } @@ -154,7 +153,7 @@ contract EncryptionRegistry is IEncryptionRegistry, ERC165 { } if (!exists) { // New account - registeredAccounts.push(_account); + accountList.push(_account); } accounts[_account].publicKey = _publicKey; diff --git a/src/SignerList.sol b/src/SignerList.sol index 1904e1c..19bc211 100644 --- a/src/SignerList.sol +++ b/src/SignerList.sol @@ -138,7 +138,7 @@ contract SignerList is ISignerList, Addresslist, ERC165Upgradeable, DaoAuthoriza { if (isListedAtBlock(_address, _blockNumber)) { // The owner + the voter - return (_address, settings.encryptionRegistry.getAppointedWallet(_address)); + return (_address, settings.encryptionRegistry.getAppointedAgent(_address)); } address _appointer = settings.encryptionRegistry.appointerOf(_address); @@ -151,41 +151,42 @@ contract SignerList is ISignerList, Addresslist, ERC165Upgradeable, DaoAuthoriza } /// @inheritdoc ISignerList - function getEncryptionRecipients() external view returns (address[] memory result) { + function getEncryptionAgents() external view returns (address[] memory result) { address[] memory _encryptionAccounts = settings.encryptionRegistry.getRegisteredAccounts(); // Allocating the full length. // If any member is no longer listed, the size will be decreased. result = new address[](_encryptionAccounts.length); - uint256 rIdx; // Result iterator. Will never be greater than erIdx. - uint256 erIdx; // EncryptionRegistry iterator + uint256 resIdx; // Result iterator. Will never be greater than accIdx. + uint256 accIdx; // Encryption accounts iterator address appointed; - for (erIdx = 0; erIdx < _encryptionAccounts.length;) { - if (isListed(_encryptionAccounts[erIdx])) { + for (accIdx = 0; accIdx < _encryptionAccounts.length;) { + if (isListed(_encryptionAccounts[accIdx])) { // Add it to the result array if listed - appointed = settings.encryptionRegistry.getAppointedWallet(_encryptionAccounts[erIdx]); + appointed = settings.encryptionRegistry.getAppointedAgent(_encryptionAccounts[accIdx]); // Use the appointed address if non-zero if (appointed != address(0)) { - result[rIdx] = appointed; + result[resIdx] = appointed; } else { - result[rIdx] = _encryptionAccounts[erIdx]; + result[resIdx] = _encryptionAccounts[accIdx]; } unchecked { - rIdx++; + resIdx++; } } // Skip non-listed accounts othersise unchecked { - erIdx++; + accIdx++; } } - if (rIdx < erIdx) { + // Is the resulting list smaller than the list of registered accounts? + if (resIdx < accIdx) { // Decrease the array size to return listed accounts without blank entries - uint256 diff = erIdx - rIdx; + uint256 diff = accIdx - resIdx; assembly { mstore(result, sub(mload(result), diff)) } diff --git a/src/interfaces/IEncryptionRegistry.sol b/src/interfaces/IEncryptionRegistry.sol index 7413300..4270dd9 100644 --- a/src/interfaces/IEncryptionRegistry.sol +++ b/src/interfaces/IEncryptionRegistry.sol @@ -6,8 +6,8 @@ interface IEncryptionRegistry { /// @notice Emitted when a public key is defined event PublicKeySet(address account, bytes32 publicKey); - /// @notice Emitted when an externally owned wallet is appointed - event WalletAppointed(address account, address appointedWallet); + /// @notice Emitted when an externally owned wallet is appointed as the encryption agent + event AgentAppointed(address account, address agent); /// @notice Raised when the caller is not an addresslist member error MustBeListed(); @@ -21,39 +21,41 @@ interface IEncryptionRegistry { /// @notice Raised when attempting to appoint an already appointed address error AlreadyAppointed(); - /// @notice Raised when a non appointed wallet tries to define the public key + /// @notice Raised when a wallet not appointed as an agent tries to define a public key error MustBeAppointed(); - /// @notice Raised when someone else is appointed and the account owner tries to override the public key of the appointed wallet. The appointed value should be set to address(0) or msg.sender first. - error MustResetAppointment(); + /// @notice Raised when an agent is appointed and the account owner tries to override the account's public key. The appointed value should be set to address(0) or msg.sender first. + error MustResetAppointedAgent(); - /// @notice Raised when the caller is not an addresslist compatible contract + /// @notice Raised when the caller is not an AddressList compatible contract error InvalidAddressList(); - /// @notice Registers the externally owned wallet's address to use for encryption. This allows smart contracts to appoint an EOA that can decrypt data. - /// @dev NOTE: calling this function will wipe any existing public key previously registered. - function appointWallet(address newWallet) external; + /// @notice Registers the given address as the account's encryption agent. This allows smart contract accounts to appoint an EOA that can decrypt data on their behalf. + /// @dev NOTE: calling this function will wipe any previously registered public key. + /// @param newAgent The address of an EOA to define as the new agent. + function appointAgent(address newAgent) external; /// @notice Registers the given public key as the account's target for decrypting messages. /// @dev NOTE: Calling this function from a smart contracts will revert. + /// @param publicKey The libsodium public key to register function setOwnPublicKey(bytes32 publicKey) external; - /// @notice Registers the given public key as the member's target for decrypting messages. Only if the sender is appointed. - /// @param account The address of the account to set the public key for. The sender must be appointed or the transaction will revert. + /// @notice Registers the given public key as the agent's target for decrypting messages. Only if the sender is an appointed agent. + /// @param accountOwner The address of the account to set the public key for. The sender must be appointed or the transaction will revert. /// @param publicKey The libsodium public key to register - function setPublicKey(address account, bytes32 publicKey) external; + function setPublicKey(address accountOwner, bytes32 publicKey) external; - /// @notice Returns the address of the account that appointed the given wallet, if any. - /// @return appointerAddress The address of the appointer account or zero. - function appointerOf(address wallet) external returns (address appointerAddress); + /// @notice Returns the address of the account that appointed the given agent, if any. + /// @return owner The address of the owner who appointed the given agent, or zero. + function appointerOf(address agent) external returns (address owner); /// @notice Returns the address of the account registered at the given index - function registeredAccounts(uint256) external view returns (address); + function accountList(uint256) external view returns (address); /// @notice Returns the list of addresses on the registry - /// @dev Use this function to get all addresses in a single call. You can still call registeredAccounts[idx] to resolve them one by one. + /// @dev Use this function to get all addresses in a single call. You can still call accountList[idx] to resolve them one by one. function getRegisteredAccounts() external view returns (address[] memory); - /// @notice Returns the address of the wallet appointed for encryption purposes - function getAppointedWallet(address member) external view returns (address); + /// @notice Returns the address of the account's encryption agent, or the account itself if no agent is appointed. + function getAppointedAgent(address account) external view returns (address agent); } diff --git a/src/interfaces/ISignerList.sol b/src/interfaces/ISignerList.sol index 82846fe..7aca3b8 100644 --- a/src/interfaces/ISignerList.sol +++ b/src/interfaces/ISignerList.sol @@ -24,19 +24,21 @@ interface ISignerList { /// @return listedOrAppointedByListed If resolved, whether the given address is currently listed as a member. False otherwise. function isListedOrAppointedByListed(address _address) external returns (bool listedOrAppointedByListed); - /// @notice Given an address, determines the corresponding (listed) owner account and the appointed wallet, if any. - /// @param sender The address to check within the list of signers or the appointed accounts. + /// @notice Given an address, determines the corresponding (listed) owner account and the appointed agent, if any. + /// @param addr The address to check within the list of signers or appointed agents. /// @param blockNumber The block at which the list should be checked /// @return owner If resolved to an account, it contains the encryption owner's address. Returns address(0) otherwise. - function getListedEncryptionOwnerAtBlock(address sender, uint256 blockNumber) external returns (address owner); + function getListedEncryptionOwnerAtBlock(address addr, uint256 blockNumber) external returns (address owner); - /// @notice Given an address, determines the corresponding (listed) owner account and the appointed wallet, if any. - /// @return owner If listed and resolved to an account, it contains the encryption owner's address. Returns address(0) otherwise. - /// @return voter If listed and resolved, it contains the wallet address appointed for decryption, if any. Returns address(0) otherwise. - function resolveEncryptionAccountAtBlock(address sender, uint256 _blockNumber) + /// @notice Given an address, determines the corresponding (listed) owner account and the appointed agent, if any. + /// @param addr The address to check within the list of signers or appointed agents. + /// @param blockNumber The block at which the list should be checked + /// @return owner If addr is listed or appointed, it contains the encryption owner's address. Returns address(0) otherwise. + /// @return agent If addr is listed or appointed, it contains the appointed agent's address, if any. Returns address(0) otherwise. + function resolveEncryptionAccountAtBlock(address addr, uint256 blockNumber) external - returns (address owner, address voter); + returns (address owner, address agent); /// @notice Among the SignerList's members registered on the EncryptionRegistry, return the effective address they use for encryption - function getEncryptionRecipients() external view returns (address[] memory); + function getEncryptionAgents() external view returns (address[] memory); } diff --git a/test/EmergencyMultisig.t.sol b/test/EmergencyMultisig.t.sol index 822b502..0571fe9 100644 --- a/test/EmergencyMultisig.t.sol +++ b/test/EmergencyMultisig.t.sol @@ -962,7 +962,7 @@ contract EmergencyMultisigTest is AragonTest { { // It reverts - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); dao.grant(address(signerList), alice, UPDATE_SIGNER_LIST_PERMISSION_ID); dao.grant(address(signerList), alice, UPDATE_SIGNER_LIST_SETTINGS_PERMISSION_ID); signerList.updateSettings(SignerList.Settings(encryptionRegistry, 3)); @@ -1011,19 +1011,19 @@ contract EmergencyMultisigTest is AragonTest { // It creates the proposal vm.startPrank(alice); - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); eMultisig.createProposal("a", 0, 0, optimisticPlugin, false); vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); eMultisig.createProposal("b", 0, 0, optimisticPlugin, false); vm.startPrank(carol); - encryptionRegistry.appointWallet(address(0x3456)); + encryptionRegistry.appointAgent(address(0x3456)); eMultisig.createProposal("c", 0, 0, optimisticPlugin, false); vm.startPrank(david); - encryptionRegistry.appointWallet(address(0x4567)); + encryptionRegistry.appointAgent(address(0x4567)); eMultisig.createProposal("d", 0, 0, optimisticPlugin, false); } @@ -1035,22 +1035,22 @@ contract EmergencyMultisigTest is AragonTest { // It creates the proposal vm.startPrank(alice); - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); vm.startPrank(address(0x1234)); eMultisig.createProposal("a", 0, 0, optimisticPlugin, false); vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); vm.startPrank(address(0x2345)); eMultisig.createProposal("b", 0, 0, optimisticPlugin, false); vm.startPrank(carol); - encryptionRegistry.appointWallet(address(0x3456)); + encryptionRegistry.appointAgent(address(0x3456)); vm.startPrank(address(0x3456)); eMultisig.createProposal("c", 0, 0, optimisticPlugin, false); vm.startPrank(david); - encryptionRegistry.appointWallet(address(0x4567)); + encryptionRegistry.appointAgent(address(0x4567)); vm.startPrank(address(0x4567)); eMultisig.createProposal("d", 0, 0, optimisticPlugin, false); } @@ -1132,7 +1132,7 @@ contract EmergencyMultisigTest is AragonTest { // Bob: listed, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer @@ -1292,7 +1292,7 @@ contract EmergencyMultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation @@ -1600,7 +1600,7 @@ contract EmergencyMultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation @@ -1726,7 +1726,7 @@ contract EmergencyMultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation @@ -1983,7 +1983,7 @@ contract EmergencyMultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation @@ -2143,7 +2143,7 @@ contract EmergencyMultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation diff --git a/test/EncryptionRegistry.t.sol b/test/EncryptionRegistry.t.sol index b501c27..30e39d0 100644 --- a/test/EncryptionRegistry.t.sol +++ b/test/EncryptionRegistry.t.sol @@ -18,7 +18,7 @@ contract EncryptionRegistryTest is AragonTest { // Events/errors to be tested here (duplicate) event PublicKeySet(address member, bytes32 publicKey); - event WalletAppointed(address member, address appointedWallet); + event AgentAppointed(address member, address appointedAgent); function setUp() public { builder = new DaoBuilder(); @@ -37,7 +37,7 @@ contract EncryptionRegistryTest is AragonTest { // Alice vm.startPrank(alice); - registry.appointWallet(address(0x1234000000000000000000000000000000000000)); + registry.appointAgent(address(0x1234000000000000000000000000000000000000)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(bytesValue, 0); @@ -45,7 +45,7 @@ contract EncryptionRegistryTest is AragonTest { // Bob vm.startPrank(bob); - registry.appointWallet(address(0x0000567800000000000000000000000000000000)); + registry.appointAgent(address(0x0000567800000000000000000000000000000000)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(bytesValue, 0); @@ -56,7 +56,7 @@ contract EncryptionRegistryTest is AragonTest { // Carol vm.startPrank(carol); - registry.appointWallet(address(0x0000000090aB0000000000000000000000000000)); + registry.appointAgent(address(0x0000000090aB0000000000000000000000000000)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(bytesValue, 0); @@ -70,7 +70,7 @@ contract EncryptionRegistryTest is AragonTest { // David vm.startPrank(david); - registry.appointWallet(address(0x000000000000cdEf000000000000000000000000)); + registry.appointAgent(address(0x000000000000cdEf000000000000000000000000)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(bytesValue, 0); @@ -145,8 +145,8 @@ contract EncryptionRegistryTest is AragonTest { assertEq(bytesValue, 0x000000000000cdef000000000000000000000000000000000000000000000000); } - function testFuzz_ShouldRegisterMemberPublicKeys(address appointedWallet) public { - if (skipAppointedWallet(appointedWallet)) return; + function testFuzz_ShouldRegisterMemberPublicKeys(address appointedAgent) public { + if (skipAppointedWallet(appointedAgent)) return; address addrValue; bytes32 bytesValue; @@ -157,65 +157,65 @@ contract EncryptionRegistryTest is AragonTest { // Alice vm.startPrank(alice); - registry.appointWallet(appointedWallet); - vm.startPrank(appointedWallet); + registry.appointAgent(appointedAgent); + vm.startPrank(appointedAgent); registry.setPublicKey(alice, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); // Bob vm.startPrank(bob); - registry.appointWallet(address(uint160(appointedWallet) + 10)); - vm.startPrank(address(uint160(appointedWallet) + 10)); + registry.appointAgent(address(uint160(appointedAgent) + 10)); + vm.startPrank(address(uint160(appointedAgent) + 10)); registry.setPublicKey(bob, 0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000567800000000000000000000000000000000000000000000000000000000); // Carol vm.startPrank(carol); - registry.appointWallet(address(uint160(appointedWallet) + 20)); - vm.startPrank(address(uint160(appointedWallet) + 20)); + registry.appointAgent(address(uint160(appointedAgent) + 20)); + vm.startPrank(address(uint160(appointedAgent) + 20)); registry.setPublicKey(carol, 0x0000000090ab0000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(carol); - assertEq(addrValue, address(uint160(appointedWallet) + 20)); + assertEq(addrValue, address(uint160(appointedAgent) + 20)); assertEq(bytesValue, 0x0000000090ab0000000000000000000000000000000000000000000000000000); // David vm.startPrank(david); - registry.appointWallet(address(uint160(appointedWallet) + 30)); - vm.startPrank(address(uint160(appointedWallet) + 30)); + registry.appointAgent(address(uint160(appointedAgent) + 30)); + vm.startPrank(address(uint160(appointedAgent) + 30)); registry.setPublicKey(david, 0x000000000000cdef000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(carol); - assertEq(addrValue, address(uint160(appointedWallet) + 20)); + assertEq(addrValue, address(uint160(appointedAgent) + 20)); assertEq(bytesValue, 0x0000000090ab0000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(david); - assertEq(addrValue, address(uint160(appointedWallet) + 30)); + assertEq(addrValue, address(uint160(appointedAgent) + 30)); assertEq(bytesValue, 0x000000000000cdef000000000000000000000000000000000000000000000000); } - function testFuzz_ShouldClearPublicKeyAfterAppointing(address appointedWallet) public { - if (skipAppointedWallet(appointedWallet)) return; + function testFuzz_ShouldClearPublicKeyAfterAppointing(address appointedAgent) public { + if (skipAppointedWallet(appointedAgent)) return; address addrValue; bytes32 bytesValue; @@ -230,10 +230,10 @@ contract EncryptionRegistryTest is AragonTest { (addrValue, bytesValue) = registry.accounts(alice); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); - registry.appointWallet(appointedWallet); + registry.appointAgent(appointedAgent); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // Bob @@ -242,13 +242,13 @@ contract EncryptionRegistryTest is AragonTest { (addrValue, bytesValue) = registry.accounts(bob); assertEq(bytesValue, 0x0000567800000000000000000000000000000000000000000000000000000000); - registry.appointWallet(address(uint160(appointedWallet) + 10)); + registry.appointAgent(address(uint160(appointedAgent) + 10)); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // Carol @@ -257,16 +257,16 @@ contract EncryptionRegistryTest is AragonTest { (addrValue, bytesValue) = registry.accounts(carol); assertEq(bytesValue, 0x0000000090ab0000000000000000000000000000000000000000000000000000); - registry.appointWallet(address(uint160(appointedWallet) + 20)); + registry.appointAgent(address(uint160(appointedAgent) + 20)); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(carol); - assertEq(addrValue, address(uint160(appointedWallet) + 20)); + assertEq(addrValue, address(uint160(appointedAgent) + 20)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // David @@ -275,19 +275,19 @@ contract EncryptionRegistryTest is AragonTest { (addrValue, bytesValue) = registry.accounts(david); assertEq(bytesValue, 0x000000000000cdef000000000000000000000000000000000000000000000000); - registry.appointWallet(address(uint160(appointedWallet) + 30)); + registry.appointAgent(address(uint160(appointedAgent) + 30)); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(carol); - assertEq(addrValue, address(uint160(appointedWallet) + 20)); + assertEq(addrValue, address(uint160(appointedAgent) + 20)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(david); - assertEq(addrValue, address(uint160(appointedWallet) + 30)); + assertEq(addrValue, address(uint160(appointedAgent) + 30)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); } @@ -302,33 +302,33 @@ contract EncryptionRegistryTest is AragonTest { vm.startPrank(alice); // OK - registry.appointWallet(address(0x1234)); + registry.appointAgent(address(0x1234)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x1234)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // OK - registry.appointWallet(address(0x1111)); - registry.appointWallet(address(0x2222)); - registry.appointWallet(address(0x3333)); + registry.appointAgent(address(0x1111)); + registry.appointAgent(address(0x2222)); + registry.appointAgent(address(0x3333)); // KO vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.CannotAppointContracts.selector)); - registry.appointWallet(address(dao)); + registry.appointAgent(address(dao)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x3333)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // KO vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.CannotAppointContracts.selector)); - registry.appointWallet(address(multisig)); + registry.appointAgent(address(multisig)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x3333)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // KO vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.CannotAppointContracts.selector)); - registry.appointWallet(address(registry)); + registry.appointAgent(address(registry)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x3333)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); @@ -345,53 +345,53 @@ contract EncryptionRegistryTest is AragonTest { vm.startPrank(alice); // Neutral - registry.appointWallet(address(0x0)); + registry.appointAgent(address(0x0)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x0)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // Repeated appointments - registry.appointWallet(address(0x1234)); + registry.appointAgent(address(0x1234)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x1234)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); - registry.appointWallet(address(0x1234)); + registry.appointAgent(address(0x1234)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x1234)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // Bob - registry.appointWallet(address(0x1111)); + registry.appointAgent(address(0x1111)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x1111)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); - registry.appointWallet(address(0x1111)); + registry.appointAgent(address(0x1111)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x1111)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); - registry.appointWallet(address(0x1111)); + registry.appointAgent(address(0x1111)); (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0x1111)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // More - registry.appointWallet(address(0x2222)); - registry.appointWallet(address(0x2222)); - registry.appointWallet(address(0x2222)); + registry.appointAgent(address(0x2222)); + registry.appointAgent(address(0x2222)); + registry.appointAgent(address(0x2222)); - registry.appointWallet(address(0x3333)); - registry.appointWallet(address(0x3333)); - registry.appointWallet(address(0x3333)); + registry.appointAgent(address(0x3333)); + registry.appointAgent(address(0x3333)); + registry.appointAgent(address(0x3333)); // OK again - registry.appointWallet(address(0x1234)); - registry.appointWallet(address(0x1111)); - registry.appointWallet(address(0x2222)); - registry.appointWallet(address(0x3333)); + registry.appointAgent(address(0x1234)); + registry.appointAgent(address(0x1111)); + registry.appointAgent(address(0x2222)); + registry.appointAgent(address(0x3333)); } function test_getRegisteredAccountsOnlyReturnsAddressesOnce() public { @@ -404,11 +404,11 @@ contract EncryptionRegistryTest is AragonTest { vm.startPrank(alice); // No appointment - registry.appointWallet(address(0x0)); + registry.appointAgent(address(0x0)); assertEq(registry.getRegisteredAccounts().length, 0, "Incorrect count"); // Appoint + define pubKey's - registry.appointWallet(ad1); + registry.appointAgent(ad1); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); vm.startPrank(ad1); @@ -416,7 +416,7 @@ contract EncryptionRegistryTest is AragonTest { assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); vm.startPrank(alice); - registry.appointWallet(ad2); + registry.appointAgent(ad2); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); vm.startPrank(ad2); @@ -424,7 +424,7 @@ contract EncryptionRegistryTest is AragonTest { assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); vm.startPrank(alice); - registry.appointWallet(ad3); + registry.appointAgent(ad3); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); vm.startPrank(ad3); @@ -433,7 +433,7 @@ contract EncryptionRegistryTest is AragonTest { // Appoint self back vm.startPrank(alice); - registry.appointWallet(address(0)); + registry.appointAgent(address(0)); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); // Set own public key @@ -441,7 +441,7 @@ contract EncryptionRegistryTest is AragonTest { assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); // Appoint + define pubKey's (2) - registry.appointWallet(ad1); + registry.appointAgent(ad1); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); vm.startPrank(ad1); @@ -450,7 +450,7 @@ contract EncryptionRegistryTest is AragonTest { // Appoint self back vm.startPrank(alice); - registry.appointWallet(address(0)); + registry.appointAgent(address(0)); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); // BOB @@ -458,11 +458,11 @@ contract EncryptionRegistryTest is AragonTest { vm.startPrank(bob); // No appointment - registry.appointWallet(address(0x0)); + registry.appointAgent(address(0x0)); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect count"); // Appoint + define pubKey's - registry.appointWallet(ad1); + registry.appointAgent(ad1); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); vm.startPrank(ad1); @@ -470,7 +470,7 @@ contract EncryptionRegistryTest is AragonTest { assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); vm.startPrank(bob); - registry.appointWallet(ad2); + registry.appointAgent(ad2); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); vm.startPrank(ad2); @@ -478,7 +478,7 @@ contract EncryptionRegistryTest is AragonTest { assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); vm.startPrank(bob); - registry.appointWallet(ad3); + registry.appointAgent(ad3); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); vm.startPrank(ad3); @@ -487,7 +487,7 @@ contract EncryptionRegistryTest is AragonTest { // Appoint self back vm.startPrank(bob); - registry.appointWallet(address(0)); + registry.appointAgent(address(0)); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); // Set own public key @@ -495,7 +495,7 @@ contract EncryptionRegistryTest is AragonTest { assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); // Appoint + define pubKey's (2) - registry.appointWallet(ad1); + registry.appointAgent(ad1); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect count"); vm.startPrank(ad1); @@ -506,46 +506,46 @@ contract EncryptionRegistryTest is AragonTest { function test_shouldRevertIfAppointingAnotherSigner() public { vm.startPrank(alice); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyListed.selector)); - registry.appointWallet(bob); + registry.appointAgent(bob); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyListed.selector)); - registry.appointWallet(carol); + registry.appointAgent(carol); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyListed.selector)); - registry.appointWallet(david); + registry.appointAgent(david); vm.startPrank(bob); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyListed.selector)); - registry.appointWallet(alice); + registry.appointAgent(alice); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyListed.selector)); - registry.appointWallet(carol); + registry.appointAgent(carol); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyListed.selector)); - registry.appointWallet(david); + registry.appointAgent(david); // ok - registry.appointWallet(address(0x5555)); + registry.appointAgent(address(0x5555)); } function test_shouldRevertWhenAlreadyAppointed() public { vm.startPrank(alice); - registry.appointWallet(address(0x1234)); + registry.appointAgent(address(0x1234)); vm.startPrank(bob); - registry.appointWallet(address(0x2345)); + registry.appointAgent(address(0x2345)); // Fail vm.startPrank(alice); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyAppointed.selector)); - registry.appointWallet(address(0x2345)); + registry.appointAgent(address(0x2345)); vm.startPrank(bob); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.AlreadyAppointed.selector)); - registry.appointWallet(address(0x1234)); + registry.appointAgent(address(0x1234)); // ok - registry.appointWallet(address(0x5555)); + registry.appointAgent(address(0x5555)); } - function testFuzz_AppointShouldRevertIfNotListed(address appointedWallet) public { - if (Address.isContract(appointedWallet)) return; + function testFuzz_AppointShouldRevertIfNotListed(address appointedAgent) public { + if (Address.isContract(appointedAgent)) return; SignerList signerList; address addrValue; @@ -553,7 +553,7 @@ contract EncryptionRegistryTest is AragonTest { // Only Alice (,, multisig,,, signerList, registry,) = new DaoBuilder().withMultisigMember(alice).build(); - if (signerList.isListed(appointedWallet)) return; + if (signerList.isListed(appointedAgent)) return; (addrValue, bytesValue) = registry.accounts(alice); assertEq(addrValue, address(0)); @@ -571,12 +571,12 @@ contract EncryptionRegistryTest is AragonTest { assertEq(bytesValue, 0x5678000000000000000000000000000000000000000000000000000000000000); // Appoint self - registry.appointWallet(appointedWallet); - vm.startPrank(appointedWallet); + registry.appointAgent(appointedAgent); + vm.startPrank(appointedAgent); registry.setPublicKey(alice, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); // NOT OK @@ -584,15 +584,15 @@ contract EncryptionRegistryTest is AragonTest { // Bob vm.startPrank(bob); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); - registry.appointWallet(address(uint160(appointedWallet) + 10)); + registry.appointAgent(address(uint160(appointedAgent) + 10)); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); registry.setOwnPublicKey(0x0000567800000000000000000000000000000000000000000000000000000000); - vm.startPrank(address(uint160(appointedWallet) + 10)); + vm.startPrank(address(uint160(appointedAgent) + 10)); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); registry.setPublicKey(bob, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); assertEq(addrValue, address(0)); @@ -601,15 +601,15 @@ contract EncryptionRegistryTest is AragonTest { // Carol vm.startPrank(carol); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); - registry.appointWallet(address(uint160(appointedWallet) + 20)); + registry.appointAgent(address(uint160(appointedAgent) + 20)); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); registry.setOwnPublicKey(0x0000567800000000000000000000000000000000000000000000000000000000); - vm.startPrank(address(uint160(appointedWallet) + 20)); + vm.startPrank(address(uint160(appointedAgent) + 20)); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); registry.setPublicKey(carol, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); assertEq(addrValue, address(0)); @@ -621,15 +621,15 @@ contract EncryptionRegistryTest is AragonTest { // David vm.startPrank(david); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); - registry.appointWallet(address(uint160(appointedWallet) + 30)); + registry.appointAgent(address(uint160(appointedAgent) + 30)); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); registry.setOwnPublicKey(0x0000567800000000000000000000000000000000000000000000000000000000); - vm.startPrank(address(uint160(appointedWallet) + 30)); + vm.startPrank(address(uint160(appointedAgent) + 30)); vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustBeListed.selector)); registry.setPublicKey(david, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); assertEq(addrValue, address(0)); @@ -642,8 +642,8 @@ contract EncryptionRegistryTest is AragonTest { assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); } - function testFuzz_ShouldRevertOnSetPublicKeyIfNotAppointed(address appointedWallet) public { - if (skipAppointedWallet(appointedWallet)) return; + function testFuzz_ShouldRevertOnSetPublicKeyIfNotAppointed(address appointedAgent) public { + if (skipAppointedWallet(appointedAgent)) return; address addrValue; bytes32 bytesValue; @@ -658,14 +658,14 @@ contract EncryptionRegistryTest is AragonTest { assertEq(addrValue, address(0)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); - registry.appointWallet(appointedWallet); + registry.appointAgent(appointedAgent); // Appointed - vm.startPrank(appointedWallet); + vm.startPrank(appointedAgent); registry.setPublicKey(alice, 0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000567800000000000000000000000000000000000000000000000000000000); // Bob @@ -678,35 +678,35 @@ contract EncryptionRegistryTest is AragonTest { assertEq(addrValue, address(0)); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); - registry.appointWallet(address(uint160(appointedWallet) + 10)); + registry.appointAgent(address(uint160(appointedAgent) + 10)); // Appointed - vm.startPrank(address(uint160(appointedWallet) + 10)); + vm.startPrank(address(uint160(appointedAgent) + 10)); registry.setPublicKey(bob, 0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, address(uint160(appointedWallet) + 10)); + assertEq(addrValue, address(uint160(appointedAgent) + 10)); assertEq(bytesValue, 0x0000567800000000000000000000000000000000000000000000000000000000); } - function testFuzz_ShouldRevertOnSetOwnPublicKeyIfOwnerIsAppointing(address appointedWallet) public { - if (skipAppointedWallet(appointedWallet)) return; + function testFuzz_ShouldRevertOnSetOwnPublicKeyIfOwnerIsAppointing(address appointedAgent) public { + if (skipAppointedWallet(appointedAgent)) return; address addrValue; bytes32 bytesValue; // Alice vm.startPrank(alice); - registry.appointWallet(appointedWallet); - vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustResetAppointment.selector)); + registry.appointAgent(appointedAgent); + vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustResetAppointedAgent.selector)); registry.setOwnPublicKey(0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // Appointed - registry.appointWallet(alice); + registry.appointAgent(alice); registry.setOwnPublicKey(0x0000567800000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(alice); @@ -715,16 +715,16 @@ contract EncryptionRegistryTest is AragonTest { // Bob vm.startPrank(bob); - registry.appointWallet(appointedWallet); - vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustResetAppointment.selector)); + registry.appointAgent(appointedAgent); + vm.expectRevert(abi.encodeWithSelector(IEncryptionRegistry.MustResetAppointedAgent.selector)); registry.setOwnPublicKey(0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); - assertEq(addrValue, appointedWallet); + assertEq(addrValue, appointedAgent); assertEq(bytesValue, 0x0000000000000000000000000000000000000000000000000000000000000000); // Appointed - registry.appointWallet(bob); + registry.appointAgent(bob); registry.setOwnPublicKey(0x1234000000000000000000000000000000000000000000000000000000000000); (addrValue, bytesValue) = registry.accounts(bob); @@ -756,25 +756,25 @@ contract EncryptionRegistryTest is AragonTest { // As the appointee vm.startPrank(alice); - registry.appointWallet(alice); // Self + registry.appointAgent(alice); // Self vm.expectEmit(); emit PublicKeySet(alice, 0x0000000000000000cdef00000000000000000000000000000000000000000000); registry.setOwnPublicKey(0x0000000000000000cdef00000000000000000000000000000000000000000000); vm.startPrank(bob); - registry.appointWallet(bob); // Self + registry.appointAgent(bob); // Self vm.expectEmit(); emit PublicKeySet(bob, 0x00000000000090ab000000000000000000000000000000000000000000000000); registry.setOwnPublicKey(0x00000000000090ab000000000000000000000000000000000000000000000000); vm.startPrank(carol); - registry.appointWallet(carol); // Self + registry.appointAgent(carol); // Self vm.expectEmit(); emit PublicKeySet(carol, 0x0000000056780000000000000000000000000000000000000000000000000000); registry.setOwnPublicKey(0x0000000056780000000000000000000000000000000000000000000000000000); vm.startPrank(david); - registry.appointWallet(david); // Self + registry.appointAgent(david); // Self vm.expectEmit(); emit PublicKeySet(david, 0x0000123400000000000000000000000000000000000000000000000000000000); registry.setOwnPublicKey(0x0000123400000000000000000000000000000000000000000000000000000000); @@ -789,32 +789,32 @@ contract EncryptionRegistryTest is AragonTest { vm.startPrank(alice); registry.setOwnPublicKey(bytes32(uint256(1234))); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect length"); - registry.appointWallet(address(0x1234)); + registry.appointAgent(address(0x1234)); assertEq(registry.getRegisteredAccounts().length, 1, "Incorrect length"); // Bob vm.startPrank(bob); registry.setOwnPublicKey(bytes32(uint256(2345))); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect length"); - registry.appointWallet(address(0x5678)); + registry.appointAgent(address(0x5678)); assertEq(registry.getRegisteredAccounts().length, 2, "Incorrect length"); // Appoint first // Carol vm.startPrank(carol); - registry.appointWallet(address(0x90ab)); + registry.appointAgent(address(0x90ab)); assertEq(registry.getRegisteredAccounts().length, 3, "Incorrect length"); - registry.appointWallet(address(0x6666)); + registry.appointAgent(address(0x6666)); vm.startPrank(address(0x6666)); registry.setPublicKey(carol, bytes32(uint256(3456))); assertEq(registry.getRegisteredAccounts().length, 3, "Incorrect length"); // David vm.startPrank(david); - registry.appointWallet(address(0xcdef)); + registry.appointAgent(address(0xcdef)); assertEq(registry.getRegisteredAccounts().length, 4, "Incorrect length"); - registry.appointWallet(address(0x7777)); + registry.appointAgent(address(0x7777)); vm.startPrank(address(0x7777)); registry.setPublicKey(david, bytes32(uint256(4567))); assertEq(registry.getRegisteredAccounts().length, 4, "Incorrect length"); @@ -826,43 +826,43 @@ contract EncryptionRegistryTest is AragonTest { // Alice vm.startPrank(alice); registry.setOwnPublicKey(bytes32(uint256(1234))); - assertEq(registry.registeredAccounts(0), alice); - registry.appointWallet(address(0x1234)); - assertEq(registry.registeredAccounts(0), alice); + assertEq(registry.accountList(0), alice); + registry.appointAgent(address(0x1234)); + assertEq(registry.accountList(0), alice); // Bob vm.startPrank(bob); registry.setOwnPublicKey(bytes32(uint256(2345))); - assertEq(registry.registeredAccounts(1), bob); - registry.appointWallet(address(0x5678)); - assertEq(registry.registeredAccounts(1), bob); + assertEq(registry.accountList(1), bob); + registry.appointAgent(address(0x5678)); + assertEq(registry.accountList(1), bob); // Appoint first // Carol vm.startPrank(carol); - registry.appointWallet(address(0x90ab)); - assertEq(registry.registeredAccounts(2), carol); - registry.appointWallet(address(0x6666)); + registry.appointAgent(address(0x90ab)); + assertEq(registry.accountList(2), carol); + registry.appointAgent(address(0x6666)); vm.startPrank(address(0x6666)); registry.setPublicKey(carol, bytes32(uint256(3456))); - assertEq(registry.registeredAccounts(2), carol); + assertEq(registry.accountList(2), carol); // David vm.startPrank(david); - registry.appointWallet(address(0xcdef)); - assertEq(registry.registeredAccounts(3), david); - registry.appointWallet(address(0x7777)); + registry.appointAgent(address(0xcdef)); + assertEq(registry.accountList(3), david); + registry.appointAgent(address(0x7777)); vm.startPrank(address(0x7777)); registry.setPublicKey(david, bytes32(uint256(4567))); - assertEq(registry.registeredAccounts(3), david); + assertEq(registry.accountList(3), david); assertEq(registry.getRegisteredAccounts().length, 4, "Incorrect length"); - assertEq(registry.registeredAccounts(0), alice); - assertEq(registry.registeredAccounts(1), bob); - assertEq(registry.registeredAccounts(2), carol); - assertEq(registry.registeredAccounts(3), david); + assertEq(registry.accountList(0), alice); + assertEq(registry.accountList(1), bob); + assertEq(registry.accountList(2), carol); + assertEq(registry.accountList(3), david); } function test_ShouldLoadTheRegisteredAddresses() public { @@ -871,36 +871,36 @@ contract EncryptionRegistryTest is AragonTest { // Alice vm.startPrank(alice); registry.setOwnPublicKey(bytes32(uint256(1234))); - assertEq(registry.registeredAccounts(0), alice); - registry.appointWallet(address(0x1234)); - assertEq(registry.registeredAccounts(0), alice); + assertEq(registry.accountList(0), alice); + registry.appointAgent(address(0x1234)); + assertEq(registry.accountList(0), alice); // Bob vm.startPrank(bob); registry.setOwnPublicKey(bytes32(uint256(2345))); - assertEq(registry.registeredAccounts(1), bob); - registry.appointWallet(address(0x5678)); - assertEq(registry.registeredAccounts(1), bob); + assertEq(registry.accountList(1), bob); + registry.appointAgent(address(0x5678)); + assertEq(registry.accountList(1), bob); // Appoint first // Carol vm.startPrank(carol); - registry.appointWallet(address(0x90ab)); - assertEq(registry.registeredAccounts(2), carol); - registry.appointWallet(address(0x6666)); + registry.appointAgent(address(0x90ab)); + assertEq(registry.accountList(2), carol); + registry.appointAgent(address(0x6666)); vm.startPrank(address(0x6666)); registry.setPublicKey(carol, bytes32(uint256(3456))); - assertEq(registry.registeredAccounts(2), carol); + assertEq(registry.accountList(2), carol); // David vm.startPrank(david); - registry.appointWallet(address(0xcdef)); - assertEq(registry.registeredAccounts(3), david); - registry.appointWallet(address(0x7777)); + registry.appointAgent(address(0xcdef)); + assertEq(registry.accountList(3), david); + registry.appointAgent(address(0x7777)); vm.startPrank(address(0x7777)); registry.setPublicKey(david, bytes32(uint256(4567))); - assertEq(registry.registeredAccounts(3), david); + assertEq(registry.accountList(3), david); address[] memory addresses = registry.getRegisteredAccounts(); assertEq(addresses.length, 4); @@ -926,34 +926,34 @@ contract EncryptionRegistryTest is AragonTest { // Internal helpers - function skipAppointedWallet(address appointedWallet) internal view returns (bool) { + function skipAppointedWallet(address appointedAgent) internal view returns (bool) { // Avoid fuzz tests overflowing - if (appointedWallet >= address(uint160(0xFFFfFFfFfFFffFFfFFFffffFfFfFffFFfFFFFF00))) return true; + if (appointedAgent >= address(uint160(0xFFFfFFfFfFFffFFfFFFffffFfFfFffFFfFFFFF00))) return true; if ( - appointedWallet == address(0) || appointedWallet == alice || appointedWallet == bob - || appointedWallet == carol || appointedWallet == david || Address.isContract(appointedWallet) + appointedAgent == address(0) || appointedAgent == alice || appointedAgent == bob || appointedAgent == carol + || appointedAgent == david || Address.isContract(appointedAgent) ) return true; - appointedWallet = address(uint160(appointedWallet) + 10); + appointedAgent = address(uint160(appointedAgent) + 10); if ( - appointedWallet == address(0) || appointedWallet == alice || appointedWallet == bob - || appointedWallet == carol || appointedWallet == david || Address.isContract(appointedWallet) + appointedAgent == address(0) || appointedAgent == alice || appointedAgent == bob || appointedAgent == carol + || appointedAgent == david || Address.isContract(appointedAgent) ) return true; - appointedWallet = address(uint160(appointedWallet) + 10); + appointedAgent = address(uint160(appointedAgent) + 10); if ( - appointedWallet == address(0) || appointedWallet == alice || appointedWallet == bob - || appointedWallet == carol || appointedWallet == david || Address.isContract(appointedWallet) + appointedAgent == address(0) || appointedAgent == alice || appointedAgent == bob || appointedAgent == carol + || appointedAgent == david || Address.isContract(appointedAgent) ) return true; - appointedWallet = address(uint160(appointedWallet) + 10); + appointedAgent = address(uint160(appointedAgent) + 10); if ( - appointedWallet == address(0) || appointedWallet == alice || appointedWallet == bob - || appointedWallet == carol || appointedWallet == david || Address.isContract(appointedWallet) + appointedAgent == address(0) || appointedAgent == alice || appointedAgent == bob || appointedAgent == carol + || appointedAgent == david || Address.isContract(appointedAgent) ) return true; return false; diff --git a/test/Multisig.t.sol b/test/Multisig.t.sol index c3a25ca..3f56c83 100644 --- a/test/Multisig.t.sol +++ b/test/Multisig.t.sol @@ -958,7 +958,7 @@ contract MultisigTest is AragonTest { // It reverts - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); dao.grant(address(signerList), alice, UPDATE_SIGNER_LIST_PERMISSION_ID); dao.grant(address(signerList), alice, UPDATE_SIGNER_LIST_SETTINGS_PERMISSION_ID); signerList.updateSettings(SignerList.Settings(encryptionRegistry, 3)); @@ -1011,19 +1011,19 @@ contract MultisigTest is AragonTest { // It creates the proposal vm.startPrank(alice); - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); multisig.createProposal("a", actions, optimisticPlugin, false); vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); multisig.createProposal("b", actions, optimisticPlugin, false); vm.startPrank(carol); - encryptionRegistry.appointWallet(address(0x3456)); + encryptionRegistry.appointAgent(address(0x3456)); multisig.createProposal("c", actions, optimisticPlugin, false); vm.startPrank(david); - encryptionRegistry.appointWallet(address(0x4567)); + encryptionRegistry.appointAgent(address(0x4567)); multisig.createProposal("d", actions, optimisticPlugin, false); } @@ -1037,22 +1037,22 @@ contract MultisigTest is AragonTest { // It creates the proposal vm.startPrank(alice); - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); vm.startPrank(address(0x1234)); multisig.createProposal("a", actions, optimisticPlugin, false); vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); vm.startPrank(address(0x2345)); multisig.createProposal("b", actions, optimisticPlugin, false); vm.startPrank(carol); - encryptionRegistry.appointWallet(address(0x3456)); + encryptionRegistry.appointAgent(address(0x3456)); vm.startPrank(address(0x3456)); multisig.createProposal("c", actions, optimisticPlugin, false); vm.startPrank(david); - encryptionRegistry.appointWallet(address(0x4567)); + encryptionRegistry.appointAgent(address(0x4567)); vm.startPrank(address(0x4567)); multisig.createProposal("d", actions, optimisticPlugin, false); } @@ -1098,7 +1098,7 @@ contract MultisigTest is AragonTest { // Bob: listed, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer @@ -1249,7 +1249,7 @@ contract MultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation // 0x1234: unlisted and unappointed on creation @@ -1641,7 +1641,7 @@ contract MultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation // 0x1234: unlisted and unappointed on creation @@ -1821,7 +1821,7 @@ contract MultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation // 0x1234: unlisted and unappointed on creation @@ -2011,7 +2011,7 @@ contract MultisigTest is AragonTest { // Alice: listed on creation and self appointed // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation // 0x1234: unlisted and unappointed on creation @@ -2064,7 +2064,7 @@ contract MultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation // 0x1234: unlisted and unappointed on creation @@ -2225,7 +2225,7 @@ contract MultisigTest is AragonTest { // Bob: listed on creation, appointing someone else now vm.startPrank(bob); - encryptionRegistry.appointWallet(randomWallet); + encryptionRegistry.appointAgent(randomWallet); // Random Wallet: appointed by a listed signer on creation // 0x1234: unlisted and unappointed on creation diff --git a/test/SignerList.t.sol b/test/SignerList.t.sol index e0b7e53..0a636d3 100644 --- a/test/SignerList.t.sol +++ b/test/SignerList.t.sol @@ -699,7 +699,7 @@ contract SignerListTest is AragonTest { signerList.removeSigners(rmSigners); // Alice (owner) appoints david - encryptionRegistry.appointWallet(david); + encryptionRegistry.appointAgent(david); // Bob is the owner @@ -743,11 +743,11 @@ contract SignerListTest is AragonTest { modifier whenCallingGetListedEncryptionOwnerAtBlock() { // Alice (owner) appoints address(0x1234) - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); // Bob (owner) appoints address(0x2345) vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); vm.startPrank(alice); @@ -873,11 +873,11 @@ contract SignerListTest is AragonTest { modifier whenCallingResolveEncryptionAccountAtBlock() { // Alice (owner) appoints address(0x1234) - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); // Bob (owner) appoints address(0x2345) vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); vm.startPrank(alice); @@ -1053,7 +1053,7 @@ contract SignerListTest is AragonTest { // No accounts registered a public key // It returns an empty list, even with signers - address[] memory recipients = signerList.getEncryptionRecipients(); + address[] memory recipients = signerList.getEncryptionAgents(); assertEq(recipients.length, 0, "Should be empty"); // Empty the list @@ -1067,7 +1067,7 @@ contract SignerListTest is AragonTest { signerList.removeSigners(rmSigners); // It returns an empty list, without signers - recipients = signerList.getEncryptionRecipients(); + recipients = signerList.getEncryptionAgents(); assertEq(recipients.length, 0, "Should be empty"); } @@ -1086,18 +1086,18 @@ contract SignerListTest is AragonTest { vm.startPrank(alice); encryptionRegistry.setOwnPublicKey(bytes32(uint256(0x5555))); vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); vm.startPrank(address(0x1234)); encryptionRegistry.setPublicKey(bob, bytes32(uint256(0x1234))); vm.startPrank(carol); encryptionRegistry.setOwnPublicKey(bytes32(uint256(0x5555))); vm.startPrank(david); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); vm.startPrank(address(0x2345)); encryptionRegistry.setPublicKey(david, bytes32(uint256(0x2345))); // It returns an empty list - address[] memory recipients = signerList.getEncryptionRecipients(); + address[] memory recipients = signerList.getEncryptionAgents(); assertEq(recipients.length, 4, "Should have 4 members"); assertEq(recipients[0], alice, "Should be alice"); assertEq(recipients[1], address(0x1234), "Should be 1234"); @@ -1122,7 +1122,7 @@ contract SignerListTest is AragonTest { signerList.removeSigners(rmSigners); // It returns an empty list - recipients = signerList.getEncryptionRecipients(); + recipients = signerList.getEncryptionAgents(); assertEq(recipients.length, 0, "Should be empty"); } @@ -1151,7 +1151,7 @@ contract SignerListTest is AragonTest { encryptionRegistry.setOwnPublicKey(bytes32(uint256(0x5555))); // Appointing 1234 vm.startPrank(bob); - encryptionRegistry.appointWallet(address(0x1234)); + encryptionRegistry.appointAgent(address(0x1234)); // Appointed vm.startPrank(address(0x1234)); encryptionRegistry.setPublicKey(bob, bytes32(uint256(0x1234))); @@ -1160,12 +1160,12 @@ contract SignerListTest is AragonTest { // encryptionRegistry.setOwnPublicKey(bytes32(uint256(0))); // Appointing 2345 vm.startPrank(david); - encryptionRegistry.appointWallet(address(0x2345)); + encryptionRegistry.appointAgent(address(0x2345)); // Appointed with no pubKey // vm.startPrank(address(0x2345)); // encryptionRegistry.setPublicKey(david, bytes32(uint256(0))); - address[] memory recipients = signerList.getEncryptionRecipients(); + address[] memory recipients = signerList.getEncryptionAgents(); assertEq(recipients.length, 3, "Should have 3 members"); assertEq(recipients[0], alice, "Should be alice"); assertEq(recipients[1], address(0x1234), "Should be 1234"); @@ -1180,7 +1180,7 @@ contract SignerListTest is AragonTest { encryptionRegistry.setPublicKey(david, bytes32(uint256(0x2345))); // Updated list - recipients = signerList.getEncryptionRecipients(); + recipients = signerList.getEncryptionAgents(); assertEq(recipients.length, 4, "Should have 4 members"); assertEq(recipients[0], alice, "Should be alice"); assertEq(recipients[1], address(0x1234), "Should be 1234"); diff --git a/test/SignerList.t.yaml b/test/SignerList.t.yaml index 24644cc..732f732 100644 --- a/test/SignerList.t.yaml +++ b/test/SignerList.t.yaml @@ -171,9 +171,9 @@ SignerListTest: - given: the resolved owner was not listed [on resolveEncryptionAccountAtBlock] then: - it: should return a zero owner - - it: should return a zero appointedWallet + - it: should return a zero appointedAgent - - when: calling getEncryptionRecipients + - when: calling getEncryptionAgents and: - given: the encryption registry has no accounts then: From 007b5994553cf3e9bdc7ce5e9eab4928743858b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8r=E2=88=82=C2=A1?= Date: Thu, 5 Dec 2024 15:39:38 +0100 Subject: [PATCH 2/3] Last touches --- src/EmergencyMultisig.sol | 10 +++++----- src/Multisig.sol | 10 +++++----- src/SignerList.sol | 6 +++--- src/interfaces/IEmergencyMultisig.sol | 2 +- src/interfaces/IMultisig.sol | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/EmergencyMultisig.sol b/src/EmergencyMultisig.sol index 7a02f6e..5d25d41 100644 --- a/src/EmergencyMultisig.sol +++ b/src/EmergencyMultisig.sol @@ -357,17 +357,17 @@ contract EmergencyMultisig is IEmergencyMultisig, PluginUUPSUpgradeable, Proposa // This internally calls `isListedAtBlock`. // If not listed or resolved, it returns address(0) - (address _resolvedOwner, address _resolvedVoter) = + (address _owner, address _agent) = multisigSettings.signerList.resolveEncryptionAccountAtBlock(_approver, proposal_.parameters.snapshotBlock); - if (_resolvedOwner == address(0) || _resolvedVoter == address(0)) { + if (_owner == address(0) || _agent == address(0)) { // Not listedAtBlock() nor appointed by a listed owner return false; - } else if (_approver != _resolvedVoter) { - // Only the voter account can vote (owners who appointed, can't) + } else if (_approver != _agent) { + // Only the agent can vote (owners who appointed, can't) return false; } - if (proposal_.approvers[_resolvedOwner]) { + if (proposal_.approvers[_owner]) { // The account already approved return false; } diff --git a/src/Multisig.sol b/src/Multisig.sol index 976039b..a326237 100644 --- a/src/Multisig.sol +++ b/src/Multisig.sol @@ -342,17 +342,17 @@ contract Multisig is IMultisig, PluginUUPSUpgradeable, ProposalUpgradeable { // This internally calls `isListedAtBlock`. // If not listed or resolved, it returns address(0) - (address _resolvedOwner, address _resolvedVoter) = + (address _owner, address _agent) = multisigSettings.signerList.resolveEncryptionAccountAtBlock(_approver, proposal_.parameters.snapshotBlock); - if (_resolvedOwner == address(0) || _resolvedVoter == address(0)) { + if (_owner == address(0) || _agent == address(0)) { // Not listedAtBlock() nor appointed by a listed owner return false; - } else if (_approver != _resolvedVoter) { - // Only the voter account can vote (owners who appointed, can't) + } else if (_approver != _agent) { + // Only the agent can vote (owners who appointed, can't) return false; } - if (proposal_.approvers[_resolvedOwner]) { + if (proposal_.approvers[_owner]) { // The account already approved return false; } diff --git a/src/SignerList.sol b/src/SignerList.sol index 19bc211..09b95f3 100644 --- a/src/SignerList.sol +++ b/src/SignerList.sol @@ -134,16 +134,16 @@ contract SignerList is ISignerList, Addresslist, ERC165Upgradeable, DaoAuthoriza function resolveEncryptionAccountAtBlock(address _address, uint256 _blockNumber) public view - returns (address _owner, address _voter) + returns (address _owner, address _agent) { if (isListedAtBlock(_address, _blockNumber)) { - // The owner + the voter + // The owner + the agent return (_address, settings.encryptionRegistry.getAppointedAgent(_address)); } address _appointer = settings.encryptionRegistry.appointerOf(_address); if (this.isListedAtBlock(_appointer, _blockNumber)) { - // The appointed wallet votes + // The appointed agent votes return (_appointer, _address); } diff --git a/src/interfaces/IEmergencyMultisig.sol b/src/interfaces/IEmergencyMultisig.sol index b57f8c8..85d5907 100644 --- a/src/interfaces/IEmergencyMultisig.sol +++ b/src/interfaces/IEmergencyMultisig.sol @@ -14,7 +14,7 @@ interface IEmergencyMultisig { /// @notice Checks if an account can participate on a proposal vote. This can be because the vote /// - was executed, or - /// - the voter is not listed. + /// - the approver is not listed or appointed. /// @param _proposalId The proposal Id. /// @param _account The address of the user to check. /// @return Returns true if the account is allowed to vote. diff --git a/src/interfaces/IMultisig.sol b/src/interfaces/IMultisig.sol index 79e9e66..658b474 100644 --- a/src/interfaces/IMultisig.sol +++ b/src/interfaces/IMultisig.sol @@ -15,7 +15,7 @@ interface IMultisig { /// @notice Checks if an account can participate on a proposal vote. This can be because the vote /// - was executed, or - /// - the voter is not listed. + /// - the approver is not listed or appointed. /// @param _proposalId The proposal Id. /// @param _account The address of the user to check. /// @return Returns true if the account is allowed to vote. From 7ca725fd0946857d66ec2b31e177982e2c0ef3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8r=E2=88=82=C2=A1?= Date: Thu, 5 Dec 2024 15:47:55 +0100 Subject: [PATCH 3/3] Updated env example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 00441d1..c908e8c 100644 --- a/.env.example +++ b/.env.example @@ -17,7 +17,6 @@ PRODNET_RPC_URL="https://eth.drpc.org" # ETHERSCAN_API_KEY="..." # MULTISIG PARAMETERS -# define a list of multisig members - said multisig will be assigned administrator roles of the ve contracts MULTISIG_MEMBERS_JSON_FILE_NAME="/script/multisig-members.json" # GOVERNANCE PARAMETERS @@ -37,6 +36,7 @@ TAIKO_L1_ADDRESS="0x79C9109b764609df928d16fC4a91e9081F7e87DB" # Address of the T TAIKO_BRIDGE_ADDRESS="0xA098b76a3Dd499D3F6D58D8AcCaFC8efBFd06807" # Address of the Taiko Bridge # OSx BASE CONTRACT ADDRESSES (network dependent, see active_contracts.json on lib/osx) +# HOLESKY DAO_FACTORY="0xE640Da5AD169630555A86D9b6b9C145B4961b1EB" PLUGIN_SETUP_PROCESSOR="0xCe0B4124dea6105bfB85fB4461c4D39f360E9ef3" PLUGIN_REPO_FACTORY="0x95D563382BeD5AcB458759EE05b27DF2CB019Cc7"