Solidity

任何人都可以呼叫 Gnosis 錢包的“submitTransaction”函式嗎?也只有所有者可以executeTransaction

  • April 23, 2020

在查看 Gnosis Multisig 錢包(https://github.com/gnosis/MultiSigWallet/blob/master/contracts/MultiSigWallet.sol#L184)時,我注意到submitTransaction函式的註釋說允許所有者。但是,在函式聲明上,它沒有ownerExists要求。那麼這是否意味著評論應該允許任何人

   /// @dev Allows an owner to submit and confirm a transaction.
   /// @param destination Transaction target address.
   /// @param value Transaction ether value.
   /// @param data Transaction data payload.
   /// @return Returns transaction ID.
   function submitTransaction(address destination, uint value, bytes data)
       public
       returns (uint transactionId)
   {
       transactionId = addTransaction(destination, value, data);
       confirmTransaction(transactionId);
   }

函式也是如此executeTransaction。評論說允許任何人,但它ownerExists在函式聲明中。

   /// @dev Allows anyone to execute a confirmed transaction.
   /// @param transactionId Transaction ID.
   function executeTransaction(uint transactionId)
       public
       ownerExists(msg.sender)
       confirmed(transactionId, msg.sender)
       notExecuted(transactionId)
   {
       if (isConfirmed(transactionId)) {
           Transaction storage txn = transactions[transactionId];
           txn.executed = true;
           //if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
           if (txn.destination.call.value(txn.value)(txn.data))
               Execution(transactionId);
           else {
               ExecutionFailure(transactionId);
               txn.executed = false;
           }
       }
   }

由於 gnosis 多重簽名合約似乎是最安全的,並且以持有大量資金而聞名。我懷疑這是一個錯誤。但我想知道我對ownerExists需求的理解是否正確。

功能submitTransaction沒有ownerExists要求。

但它呼叫了函式confirmTransaction

引用自:https://ethereum.stackexchange.com/questions/82732