1

I'm trying to sign a Safe Transaction with a Customized EIP-1271 Contract on Sepolia. I submitted the transaction using the SafeApiKit and everything looked alright on Safe UI.

await apiKit.proposeTransaction({
    safeAddress: SAFE_ADDRESS,
    safeTransactionData: transaction.data,
    safeTxHash: safeTransactionHash,
    senderAddress: contractSig.signer,
    senderSignature: contractSig.build()
  }) 

But when I tried to execute the transaction, Safe returned a error "GS024". After a little research, i found out it means

- `GS024`: `Invalid contract signature provided`

So I ran the tenderly simulation trying to find out what went wrong. Here's the line that returned the error

   S·CALL 1,907
   ([Receiver] 0x179a8bdda1ab5fef17aaf6ff0ffcb2875925668f => 0x46da26bf4f23f45a455378da9417f8d8bba0a183).0x20c13b0b(_data, _signature) => (0x1626ba7e) 
    
    REVERT 0 
    GnosisSafeL2.checkNSignatures(0x)

And then i traced back to Safe Contract code https://github.com/safe-global/safe-smart-account/blob/main/contracts/Safe.sol on line 255

if (ISignatureValidator(owner).isValidSignature(dataHash, contractSignature) != EIP1271_MAGIC_VALUE) revertWithError("GS024");

And i checked EIP1271_MAGIC_VALUE and found out it is exactly 0x1626ba7e as what my contract returned according to tenderly. So now i'm quite clueless what went wrong here. Any help would be appreciated!

Update

the content of the transaction is

  const safeTransactionData: SafeTransactionDataPartial = {
    to: '0x4cEa24Ed6aA127e0a5E4D91E51d36E8459E9B113',
    value: '10000000000000000', // 0.01 ETH
    data: '0x'
  }

3 Answers 3

1

I checked the safe contract i used carefully. It seems like safe contract is still using the old EIP1271 logic on some of the chains where the Magic value is

OLD_MAGICVALUE = 0x20c13b0b

I added the support to my contract ad everything worked like a charm.

1
  • Hey, that is very great to read. Congratulations on solving the issue yourself! Let us know if you have further questions. Commented Aug 26 at 16:48
0

What is the content of the failing transaction? Please add as much information as possible so we can help you debug the issue as best as we can 🙏.

Have you made sure you followed the steps explained in this guide? It explains the steps to take so that your Safe emits signatures correctly in different contexts.

Please let me know! Best, Louis

2
  • Hello Louis, many thanks to your help. i added content of my safe transaction and link to my safe under update. Please let me know if u need more info. And yes, i did follow the guide you provided, everything looked alright until the i tried to exeute the transaction.
    – Rex_Lee_XX
    Commented Aug 25 at 0:41
  • Hi Louis, i figured out what went wrong and posted the answer.
    – Rex_Lee_XX
    Commented Aug 26 at 1:54
0

Thanks for your question.

Do you have more context? Like the transaction (when you sent it to the Safe Transaction Service API, the safeTxHash is sufficient) the signature, and the smart contract that signed the signature?

If you provide this info, I am happy to help debugging.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.