Open erichfi opened 1 year ago
_hashArray
bytes32 private constant EIP712DOMAIN_TYPEHASH
, bytes32 private constant STAMP_TYPEHASH
, bytes32 private constant PASSPORT_TYPEHASH
can be prehashed and the values can be assigned to the bytes32 value - will minimize gas in deploymentTo save some gas, we could make the iterator in the for loop of _hashPassport unchecked. Nobody would ever have > 2^256 stamps so we shouldn't have to worry about overflow, and even if it did overflow they'd just fail validation b/c it wouldn't match.
I think we can also just do uint256 i
instead of uint256 i = 0
, in solidity it starts as 0.
In _verify, we should do the revert statements as Tim mentioned. We can drop the if statement both in Attester waiting on the verify result, and the if statement around recipientNonces[]++. Also, no need for verify to return a value.
In hashPassport, passport should be passed as calldata
We should revert with custom errors instead of strings.
Also, my previous comment applies to the for loop in getMultiAttestRequest as well.
Here's a PR where I tried some of this stuff out (didn't add the custom errors to this): https://github.com/gitcoinco/eas-proxy/pull/13
Have merged in https://github.com/gitcoinco/eas-proxy/pull/13 , this looks good.
The primary goal of this SPIKE is to conduct a thorough audit of the smart contract responsible for bringing stamps on-chain. This is a crucial component of our system, and as such, requires a meticulous review to ensure its security, efficiency, and compatibility with the rest of our infrastructure.
Tasks:
Deliverables:
Once we've completed this SPIKE, we will be well-equipped to make informed decisions about any necessary changes or improvements to the smart contract, bolstering the security and efficiency of our on-chain stamp integration.