Omniscia Gnosis Guild Audit

GPv2Signing Code Style Findings

GPv2Signing Code Style Findings

GPS-01C: Outdated Assembly Block

Description:

The referenced assembly block in the GPv2Signing::constructor is redundant as the block.chainid value is available in the pragma version of the contract.

Example:

contracts/cowProtocol/mixins/GPv2Signing.sol
63constructor() {
64 // NOTE: Currently, the only way to get the chain ID in solidity is
65 // using assembly.
66 uint256 chainId;
67 // solhint-disable-next-line no-inline-assembly
68 assembly {
69 chainId := chainid()
70 }
71
72 domainSeparator = keccak256(
73 abi.encode(
74 DOMAIN_TYPE_HASH,
75 DOMAIN_NAME,
76 DOMAIN_VERSION,
77 chainId,
78 address(this)
79 )
80 );
81}

Recommendation:

We advise the block.chainid value to be utilized directly, optimizing the legibility of the codebase as well as its gas cost.

Alleviation (da3062f6b3ff452092a0b6daa6f226f0f3b696c6):

The Gnosis Guild team evaluated this exhibit and considered out-of-scope as it relates to the Cowswap codebase which the Gnosis Guild team wishes to leave as untouched as possible.

To this end, we consider this exhibit as safely acknowledged by the Gnosis Guild team given that they do not intend to deploy the contract directly but rather interact with it.