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'
}