Omniscia Nexera Protocol Audit

NexeraIDSignerManager Code Style Findings

NexeraIDSignerManager Code Style Findings

NID-01C: Inefficient Transfer of Ownership

Description:

The Ownable::transferOwnership call performed by the NexeraIDSignerManager::constructor is inefficient as it will impose the Ownable::onlyOwner modifier redundantly.

Example:

sig-gating-contracts/contracts/signerManager/NexeraIDSignerManager.sol
31/**
32 * @dev Initializes the contract by setting the initial signerAddress.
33 * @param initialSigner The address of the initial signerAddress.
34 * @param initialOwner The address of the initial owner of the contract.
35 */
36constructor(address initialSigner, address initialOwner) {
37 _setSigner(initialSigner);
38 transferOwnership(initialOwner);
39}

Recommendation:

We advise the internal Ownable::_transferOwnership function counterpart to be utilized, optimizing its gas cost.

Alleviation:

The referenced invocation of Ownable::transferOwnership has been properly replaced by its efficient Ownable::_transferOwnership counterpart, optimizing the contract's construction gas cost.

NID-02C: Redundant Specification of Signature Constant

Description:

The _MAGIC_VALUE yielded by EIP-1271 is stored as a contract-level constant in the NexeraIDSignerManager contract when it remains accessible via the NexeraIDSignerManager.isValidSignature.selector syntax.

Example:

sig-gating-contracts/contracts/signerManager/NexeraIDSignerManager.sol
64/**
65 * @dev See {IERC1271-isValidSignature}.
66 * @param hash The hash of the data signed.
67 * @param signature The signature bytes.
68 * @return magicValue bytes4 constant `_MAGIC_VALUE` if the signature is valid.
69 */
70function isValidSignature(
71 bytes32 hash,
72 bytes memory signature
73) external view override returns (bytes4) {
74 address recoveredSigner = ECDSA.recover(hash, signature);
75 if (recoveredSigner == signerAddress) {
76 return _MAGIC_VALUE;
77 } else {
78 return _NON_VALID;
79 }
80}

Recommendation:

We advise the relevant syntax to be utilized, increasing the legibility of the codebase.

Alleviation:

The _MAGIC_VALUE variable has been omitted from the codebase and the selector syntax is employed per our recommendation, addressing this exhibit.