Skip to content

Commit

Permalink
📝 plugin: document all external functions
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Jul 3, 2024
1 parent 80e8dff commit eaac759
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ MultiOwnerPluginIntegration:test_userOpValidation_owner_standardExecute() (gas:
MultiOwnerPluginTest:testFuzz_isValidSignature_ContractOwner(bytes32) (runs: 256, μ: 110067, ~: 110067)
MultiOwnerPluginTest:testFuzz_isValidSignature_ContractOwnerWithEOAOwner(bytes32) (runs: 256, μ: 120381, ~: 120381)
MultiOwnerPluginTest:testFuzz_isValidSignature_EOAOwner(string,bytes32) (runs: 256, μ: 130741, ~: 130734)
MultiOwnerPluginTest:testFuzz_isValidSignature_PasskeyOwner(bytes32) (runs: 256, μ: 365647, ~: 365955)
MultiOwnerPluginTest:testFuzz_isValidSignature_PasskeyOwner(bytes32) (runs: 256, μ: 365504, ~: 365652)
MultiOwnerPluginTest:testFuzz_runtimeValidationFunction_BadFunctionId(uint8) (runs: 256, μ: 9747, ~: 9747)
MultiOwnerPluginTest:testFuzz_userOpValidationFunction_BadFunctionId(uint8) (runs: 256, μ: 10744, ~: 10744)
MultiOwnerPluginTest:testFuzz_userOpValidationFunction_ContractOwner((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)) (runs: 256, μ: 130908, ~: 130897)
MultiOwnerPluginTest:testFuzz_userOpValidationFunction_ContractOwnerWithEOAOwner((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)) (runs: 256, μ: 144523, ~: 144512)
MultiOwnerPluginTest:testFuzz_userOpValidationFunction_EOAOwner(string,(address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)) (runs: 256, μ: 138777, ~: 138780)
MultiOwnerPluginTest:testFuzz_userOpValidationFunction_PasskeyOwner((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)) (runs: 256, μ: 373571, ~: 373577)
MultiOwnerPluginTest:testFuzz_userOpValidationFunction_PasskeyOwner((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)) (runs: 256, μ: 373703, ~: 373630)
MultiOwnerPluginTest:test_eip712Domain() (gas: 35438)
MultiOwnerPluginTest:test_isValidSignature_failMalformedAddress() (gas: 15544)
MultiOwnerPluginTest:test_isValidSignature_failWithOutOfBounds() (gas: 12319)
Expand Down
15 changes: 15 additions & 0 deletions src/IWebauthnOwnerPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@ interface IWebauthnOwnerPlugin is IMultiOwnerPlugin {
/// @param removedOwners The public key or address array of removed owners.
event OwnerUpdated(address indexed account, PublicKey[] addedOwners, PublicKey[] removedOwners);

/// @notice Thrown if a provided owner is 32 bytes long but does not fit in an `address` type.
/// @param owner The invalid owner.
error InvalidEthereumAddressOwner(bytes32 owner);

/// @notice Get the public keys of the owners of `account`.
/// @param account The account to get the owners of.
/// @return owners The public keys of the owners of the account.
function ownersPublicKeysOf(address account) external view returns (PublicKey[] memory owners);

/// @notice Get the index of an owner in the owners array of `account`.
/// @param account The account to get the owners of.
/// @param owner The owner to get the index of.
/// @return index The index of the owner in the owners array.
function ownerIndexOf(address account, PublicKey calldata owner) external view returns (uint8 index);

/// @notice Update owners of the account. Owners can update owners.
/// @dev This function is installed on the account as part of plugin installation, and should
/// only be called from an account.
/// @param ownersToAdd The public key array of owners to be added.
/// @param ownersToRemove The public key array of owners to be removed.
function updateOwnersPublicKeys(PublicKey[] memory ownersToAdd, PublicKey[] memory ownersToRemove) external;
}

Expand Down
3 changes: 3 additions & 0 deletions src/WebauthnOwnerPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ contract WebauthnOwnerPlugin is BasePlugin, IWebauthnOwnerPlugin, IERC1271 {
emit OwnerUpdated(msg.sender, ownersToAdd, ownersToRemove);
}

/// @inheritdoc IWebauthnOwnerPlugin
function updateOwnersPublicKeys(PublicKey[] memory ownersToAdd, PublicKey[] memory ownersToRemove)
public
isInitialized(msg.sender)
Expand Down Expand Up @@ -301,10 +302,12 @@ contract WebauthnOwnerPlugin is BasePlugin, IWebauthnOwnerPlugin, IERC1271 {
owners = _owners[account].allAddresses();
}

/// @inheritdoc IWebauthnOwnerPlugin
function ownersPublicKeysOf(address account) external view returns (PublicKey[] memory owners) {
owners = _owners[account].all();
}

/// @inheritdoc IWebauthnOwnerPlugin
function ownerIndexOf(address account, PublicKey calldata owner) external view returns (uint8 index) {
Owners storage owners = _owners[account];
uint256 ownerCount = owners.length;
Expand Down

0 comments on commit eaac759

Please sign in to comment.