Relayer.sign() returns 67 bytes instead of 65 bytes

When using a Defender Relayer to sign messages, Relayer.sign() returns 67 bytes instead of the required 65 bytes for the recover method in utils/cryptography/ECDSA.sol. Is there something I can do to bring down the amount of bytes? When I use ethers for signing the same message, it correctly returns 65 bytes so there must be going something wrong in the defender-relay-client library. Thanks in advance!

Code:

import { Relayer } from 'defender-relay-client';

const relayer = new Relayer({
  apiKey: process.env.OPENZEPPELIN_DEFENDER_RELAYER_API_KEY ?? '',
  apiSecret: process.env.OPENZEPPELIN_DEFENDER_RELAYER_API_SECRET ?? '',
});

const init = async () => {
  const message = ethers.utils.solidityKeccak256(
       ['string',],
       ['Hello World!',],
  );
  
  const response = await relayer.sign({ message });
  const result = ethers.utils.arrayify(response.sig);

  console.log(result);
}

init();

Result:

Uint8Array(67) [
   92,  78,  26,  44, 187, 193,  51, 149, 185, 88, 200,
   44,  32,   6, 237,  39,  93,  25, 174, 240, 54, 138,
  106,  43, 235,  80, 209, 246, 193, 213, 171, 80,  26,
  129, 217,  63,   7,  94, 187, 228, 250, 108, 50, 244,
  125, 169,  82, 173,  54,  47, 147,  44, 231, 88, 158,
    3,  31, 109, 195, 184, 123,  56, 250,  53,  2, 113,
   37
]

Hi @Jerom_Verschoote

Thanks for getting in touch.

I cannot seem to replicate a 67 byte output. With your code snippet, I am producing:

Uint8Array(65) [
  208, 255,  61, 228, 238, 219, 143, 131,  67, 157, 222,
   22,   3,  35,  63, 224,   9, 178,  57, 118,  71,   6,
  203, 227, 148,   1, 148, 234,  36,   6, 201, 184, 103,
   28, 253, 115, 189, 242, 115,  36,   9, 214,  84,  59,
   66,   5, 142, 134,  57,  28, 144, 238, 115, 213, 217,
  162,  84, 161, 168,  30, 255,  19, 232, 187,  46
]

Could you let me know which version of defender-relay-client you are using? I have produced this with the latest version at the time of writing (v1.31.1).

Really curious what makes the difference then. I'm using 1.31.1 as well. Could there be a difference in Relayer configuration on Defender? I'm running an M1 Macbook, a colleague of mine is running Linux and the problem persists. Tried using Yarn and NPM, still the same outcome.

Tried running snippet outside of the project I was working on, but the issue still persists.

Curious, just so I can replicate your setup, what network did you create the relayer on?

The relayer was created on Polygon Mumbai

Okay, so it does seem to be network related. I am now able to replicate the 67 byte output. Allow me to further investigate and I will get back to you.