2

I'm having problems with executing a multisig transaction on a 2/2 Gnosis Safe. I've successfully executed single sig transactions on a different vault, but I can't get multisig to work:

Here's the full code:

const safeTransaction = await safeForTheFirstSigner.createTransaction({
  to: toAddress,
  value: ethers.utils.parseEther(String(amount)).toString(),
  data: toAddress,
  nonce: 17,
});

const safeTxHash = await safeForTheFirstSigner.getTransactionHash(safeTransaction);
// Note: this returns the 2 owners after approving the tx, so the approval part definitively works
const approvers = await safeForTheFirstSigner.getOwnersWhoApprovedTx(safeTxHash);

await safeForTheFirstSigner.approveTransactionHash(safeTxHash);
await response.transactionResponse?.wait();

const executeTxResponse = await safeForTheSecondSigner.executeTransaction(safeTransaction);
await executeTxResponse.transactionResponse?.wait();

In GnosisSafe.sol this line is throwing the error:

require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "GS025");

https://github.dev/gnosis/safe-contracts/blob/1448705d9cee77c912ff808ad9d9b77491ab4182/contracts/GnosisSafe.sol#L291

I'm stuck on how to debug further from here

1 Answer 1

3

I would say this is a shortcoming in the Safe core sdk (maybe worth opening an issues).

You create a transaction with nonce 17 and also approve this transaction. But the executeTransaction function doesn't check if this is the current nonce of the Safe. The issue here is, that the Safe contracts enforce the order of transaction by nonce (similar to a normal Ethereum account). Therefore in the executeTransaction contract method it uses the current nonce (which was for the mentioned Safe 1 at the point of writing), but the approveTransactionHash was based on a transaction hash that uses nonce 17.

A simple fix is to not specify the nonce, then the sdk will automatically retrieve the correct nonce.

Note: GS025 stands for Hash has not been approved. You can see all error codes in the safe-contracts repo.

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.