5 请教一下GnosisSafe多签钱包开发的问题

请教一下GnosisSafe多签钱包开发的问题,一下是GnosisSafe的相关代码:

function execTransaction(
            address to,
            uint256 value,
            bytes calldata data,
            Enum.Operation operation,
            uint256 safeTxGas,
            uint256 baseGas,
            uint256 gasPrice,
            address gasToken,
            address payable refundReceiver,
            bytes memory signatures
        ) public payable virtual returns (bool success) {
            bytes32 txHash;
            // Use scope here to limit variable lifetime and prevent `stack too deep` errors
            {
                bytes memory txHashData =
                    encodeTransactionData(
                        // Transaction info
                        to,
                        value,
                        data,
                        operation,
                        safeTxGas,
                        // Payment info
                        baseGas,
                        gasPrice,
                        gasToken,
                        refundReceiver,
                        // Signature info
                        nonce
                    );
                // Increase nonce and execute transaction.
                nonce++;
                txHash = keccak256(txHashData);
                checkSignatures(txHash, txHashData, signatures);
            }
            address guard = getGuard();
            {
                if (guard != address(0)) {
                    Guard(guard).checkTransaction(
                        // Transaction info
                        to,
                        value,
                        data,
                        operation,
                        safeTxGas,
                        // Payment info
                        baseGas,
                        gasPrice,
                        gasToken,
                        refundReceiver,
                        // Signature info
                        signatures,
                        msg.sender
                    );
                }
            }
            // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)
            // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150
            require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, "GS010");
            // Use scope here to limit variable lifetime and prevent `stack too deep` errors
            {
                uint256 gasUsed = gasleft();
                // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)
                // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas
                success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);
                gasUsed = gasUsed.sub(gasleft());
                // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful
                // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert
                require(success || safeTxGas != 0 || gasPrice != 0, "GS013");
                // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls
                uint256 payment = 0;
                if (gasPrice > 0) {
                    payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);
                }
                if (success) emit ExecutionSuccess(txHash, payment);
                else emit ExecutionFailure(txHash, payment);
            }
            {
                if (guard != address(0)) {
                    Guard(guard).checkAfterExecution(txHash, success);
                }
            }
        }

contract Executor {
function execute(
    address to,
    uint256 value,
    bytes memory data,
    Enum.Operation operation,
    uint256 txGas
) internal returns (bool success) {
    if (operation == Enum.Operation.DelegateCall) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)
        }
    } else {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)
        }
    }
}
}

=========================================================== 上面是GnosisSafe的相关代码,我在开发一个基于GnosisSafe的应用程序,在调用execTransaction 进行转账操作,前面的的验证签名已经通过了,但是在执行execute时发生了错误,提示 GS013 错误,由于execute是嵌入式汇编,没有返回失败的原因,大佬们能帮忙分析一下可能的原因吗?

返回错误: 2024-11-25T09:33:59 | 信息 | 交易将会失败,原因: execution reverted: GS013

1732498472172.png

请先 登录 后评论

最佳答案 2024-11-25 18:16

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,264 浏览
  • 张文阁 提出于 2024-11-25 09:35