Omniscia Boson Protocol Audit

EIP712Lib Code Style Findings

EIP712Lib Code Style Findings

EIP-01C: Deprecated Chain ID Retrieval Code

TypeSeverityLocation
Gas OptimizationEIP712Lib.sol:L38-L40

Description:

The linked assembly block is meant to retrieve the currently active chain ID via the chainid assembly instruction, however, the block.chainid globally available variable is meant to be used instead since Solidity 0.8.X.

Example:

contracts/protocol/libs/EIP712Lib.sol
32/**
33 * @notice Get the chain id
34 *
35 * @return id - the chain id, 1 for Ethereum mainnet, > 1 for public testnets.
36 */
37function getChainID() internal view returns (uint256 id) {
38 assembly {
39 id := chainid()
40 }
41}

Recommendation:

We advise the block.chainid variable to be yielded by the getChainID function or as an additional optimization step the block.chainid variable to be used in place of the getChainID function call thus optimizing the codebase's gas cost.

Alleviation (44009967e4f68092941d841e9e0f5dd2bb31bf0b):

The getChainID function has been omitted entirely in favour of direct block.chainid statements thus optimizing the codebase's legibility and gas cost.