verifyingContract is incorrectly set to EIP712Base instead of NativeMetaTransaction which has NativeMetaTransaction::verify and actually doing the verification. This is incompliant with EIP712 and could cause verification to fail
The verifyingContract is supposed to be the address of the contract that will verify the signature.
Currently, it is set to address(this) in the EIP712Base contract:
contracts/meta-transaction/EIP712Base.sol#L34
EIP712Base::_setDomainSeperator sets the verifyingContract to address(this).
This is generally best practice, with a catch: it's under the assumption that the verify function is in the same contract as _setDomainSeperator, making verifyingContract evaluate to the same address doing the verification.
However, in the case of this code, the verify function is in the NativeMetaTransaction contract, which inherits from EIP712Base:
contracts/meta-transaction/NativeMetaTransaction.sol#L90-L106
To put this all together: The verifyingContract will evaluate to the address of EIP712Base, which is supposed to be the address of the contract that will verify the signature. However, the actual verification will be done by EIP712Base::_setDomainSeperator.
Incompliance with EIP712 as from the specs:
address verifyingContract: the address of the contract that will verify the signature.
Read more in eip-712#definition-of-domainseparator here.
In the off-chain code, if verifyingContract is set to NativeMetaTransaction -which is specs compliant since it's the actual contract doing the verification- signatures will mismatch and verification fails since the EIP712 Domain Seperator is constructed using the incorrect EIP712Base as the verifyingContract.
EIP712.
The recommendation depends on the rationale behind seperating EIP712Base and NativeMetaTransaction contracts logic.
If it's just to keep the code clean, consider merging the two contracts into one.
Otherwise, consider passing the verifyingContract as input to to adderss of EIP712Base::constructor level, then set it to NativeMetaTransaction address.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.