OpenRelay is an open source relay for the 0x protocol. OpenRelay provides an open, scalable orderbook. Users can post offers for any ERC20 or ERC721 token, or search for trades with other users
We were encountering a strange issue where signatures were coming
up as invalid. Checks would pass in the ingest service, and fail in
subsequent services.
It turns out that signature checks with crypto.Ecrecover are destructive.
I think I've encountered this before, as in verifyEthSign I had already
made a copy of the signature for verification, but in verifyEIP712 we
were using the signature directly. I'm not sure why this manipulates
the signature (especially the sigtype byte, which isn't even part of
what we pass to Ecrecover), but passing a copy resolves the issue.
We were encountering a strange issue where signatures were coming up as invalid. Checks would pass in the ingest service, and fail in subsequent services.
It turns out that signature checks with crypto.Ecrecover are destructive. I think I've encountered this before, as in verifyEthSign I had already made a copy of the signature for verification, but in verifyEIP712 we were using the signature directly. I'm not sure why this manipulates the signature (especially the sigtype byte, which isn't even part of what we pass to Ecrecover), but passing a copy resolves the issue.