This is a reasonable suggestion. Committing to every spent scriptPubKey and therefore every element of the TxOut instead of just the amount makes sense conceptually. And it would be a small diff (~4 lines + rationale) compared to the current bip-taproot version.
As far aas I understand, coinjoin with offline signers would be substantially harder without this proposal. There is a WIP "SLIP" that helped me understand how the Proof of Ownership would work . For every input, the offline signing device verifies a signature against the corresponding scriptPubKey. In order to obtain the correct scriptPubKey, sending the whole input transaction to the signing device is prohibitive when the available bandwidth is low (QR codes). The idea of only sending the transaction midstate along with the rest of to-be-hashed transaction data is an improvement, but still results in a lot of data (whole vout and witness stacks). Adding a new sighash flag that marks coinjoin transactions would be a step backwards fungibility-wise. Thus, the same reasoning for for committing to the input values in the transaction digest to allow compact fee proofs would similarly apply the scriptPubKeys - with the only difference that coinjoins with offline signers are less common. The downsides of this proposal seem to be limited. It requires additional review, but the BIP is only in the draft stage and should incorporate reasonable feedback. It does not invite further scope creep because the full TxOut would be already included. The costs to verifiers is only slightly increased using Anthony Town's suggested sighash change. Availability of the scriptPubKeys for signing devices does not seem to be an issue because the input amounts are already required. And if all inputs belong to the signing device, there's no additional data sent to the device.  https://github.com/satoshilabs/slips/blob/slips-19-20-coinjoin-proofs/slip-0019.md On 4/29/20 2:57 PM, Andrew Kozlik via bitcoin-dev wrote: > Hi everyone, > > In the current draft of BIP-0341  the signature message commits to the > scriptPubKey of the output being spent by the input. I propose that the > signature message should commit to the scriptPubKeys of *all* transaction > inputs. > > In certain applications like CoinJoin, a wallet has to deal with > transactions containing external inputs. To calculate the actual amount > that the user is spending, the wallet needs to reliably determine for each > input whether it belongs to the wallet or not. Without such a mechanism an > adversary can fool the wallet into displaying incorrect information about > the amount being spent, which can result in theft of user funds . > > In order to ascertain non-ownership of an input which is claimed to be > external, the wallet needs the scriptPubKey of the previous output spent by > this input. It must acquire the full transaction being spent and verify its > hash against that which is given in the outpoint. This is an obstacle in > the implementation of lightweight air-gapped wallets and hardware wallets > in general. If the signature message would commit to the scriptPubKeys of > all transaction inputs, then the wallet would only need to acquire the > scriptPubKey of the output being spent without having to acquire and verify > the hash of the entire previous transaction. If an attacker would provide > an incorrect scriptPubKey, then that would cause the wallet to generate an > invalid signature message. > > Note that committing only to the scriptPubKey of the output being spent is > insufficient for this application, because the scriptPubKeys which are > needed to ascertain non-ownership of external inputs are precisely the ones > that would not be included in any of the signature messages produced by the > wallet. > > The obvious way to implement this is to add another hash to the signature > message: > sha_scriptPubKeys (32): the SHA256 of the serialization of all > scriptPubKeys of the previous outputs spent by this transaction. > > Cheers, > Andrew Kozlik > >  > https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#common-signature-message >  > https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-August/014843.html > > > _______________________________________________ > bitcoin-dev mailing list > firstname.lastname@example.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > _______________________________________________ bitcoin-dev mailing list email@example.com https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev