<oembed><type>rich</type><version>1.0</version><title>Pieter Wuille [ARCHIVE] wrote</title><author_name>Pieter Wuille [ARCHIVE] (npub1tj…jtl6r)</author_name><author_url>https://yabu.me/npub1tjephawh7fdf6358jufuh5eyxwauzrjqa7qn50pglee4tayc2ntqcjtl6r</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2018-06-27&#xA;📝 Original message:On Wed, Jun 27, 2018, 07:04 matejcik &lt;jan.matejek at satoshilabs.com&gt; wrote:&#xA;&#xA;&gt; hello,&#xA;&gt;&#xA;&gt; On 26.6.2018 22:30, Pieter Wuille wrote:&#xA;&gt; &gt;&gt; (Moreover, as I wrote previously, the Combiner seems like a weirdly&#xA;&gt; &gt;&gt; placed role. I still don&#39;t see its significance and why is it important&#xA;&gt; &gt;&gt; to correctly combine PSBTs by agents that don&#39;t understand them. If you&#xA;&gt; &gt;&gt; have a usecase in mind, please explain.&#xA;&gt; &gt;&#xA;&gt; &gt; Forward compatibility with new script types. A transaction may spend&#xA;&gt; &gt; inputs from different outputs, with different script types. Perhaps&#xA;&gt; &gt; some of these are highly specialized things only implemented by some&#xA;&gt; &gt; software (say HTLCs of a particular structure), in non-overlapping&#xA;&gt; &gt; ways where no piece of software can handle all scripts involved in a&#xA;&gt; &gt; single transaction. If Combiners cannot deal with unknown fields, they&#xA;&gt; &gt; won&#39;t be able to deal with unknown scripts.&#xA;&gt;&#xA;&gt; Record-based Combiners *can* deal with unknown fields. Either by&#xA;&gt; including both versions, or by including one selected at random. This is&#xA;&gt; the same in k-v model.&#xA;&gt;&#xA;&#xA;Yes, I wasn&#39;t claiming otherwise. This was just a response to your question&#xA;why it is important that Combiners can process unknown fields. It is not an&#xA;argument in favor of one model or the other.&#xA;&#xA;&gt; combining must be done independently by Combiner implementations for&#xA;&gt; &gt; each script type involved. As this is easily avoided by adding a&#xA;&gt; &gt; slight bit of structure (parts of the fields that need to be unique -&#xA;&gt; &gt; &#34;keys&#34;), this seems the preferable option.&#xA;&gt;&#xA;&gt; IIUC, you&#39;re proposing a &#34;semi-smart Combiner&#34; that understands and&#xA;&gt; processes some fields but not others? That doesn&#39;t seem to change&#xA;&gt; things. Either the &#34;dumb&#34; combiner throws data away before the &#34;smart&#34;&#xA;&gt; one sees it, or it needs to include all of it anyway.&#xA;&gt;&#xA;&#xA;No, I&#39;m exactly arguing against smartness in the Combiner. It should always&#xA;be possible to implement a Combiner without any script specific logic.&#xA;&#xA;&gt; No, a Combiner can pick any of the values in case different PSBTs have&#xA;&gt; &gt; different values for the same key. That&#39;s the point: by having a&#xA;&gt; &gt; key-value structure the choice of fields can be made such that&#xA;&gt; &gt; Combiners don&#39;t need to care about the contents. Finalizers do need to&#xA;&gt; &gt; understand the contents, but they only operate once at the end.&#xA;&gt; &gt; Combiners may be involved in any PSBT passing from one entity to&#xA;&gt; &gt; another.&#xA;&gt;&#xA;&gt; Yes. Combiners don&#39;t need to care about the contents.&#xA;&gt; So why is it important that a Combiner properly de-duplicates the case&#xA;&gt; where keys are the same but values are different? This is a job that,&#xA;&gt; AFAICT so far, can be safely left to someone along the chain who&#xA;&gt; understands that particular record.&#xA;&gt;&#xA;&#xA;That&#39;s because PSBTs can be copied, signed, and combined back together. A&#xA;Combiner which does not deduplicate (at all) would end up having every&#xA;original record present N times, one for each copy, a possibly large blowup.&#xA;&#xA;For all fields I can think of right now, that type of deduplication can be&#xA;done through whole-record uniqueness.&#xA;&#xA;The question whether you need whole-record uniqueness or specified-length&#xA;uniqueness (=what is offered by a key-value model) is a philosophical one&#xA;(as I mentioned before). I have a preference for stronger invariants on the&#xA;file format, so that it becomes illegal for a PSBT to contain multiple&#xA;signatures for the same key for example, and implementations do not need to&#xA;deal with the case where multiple are present.&#xA;&#xA;It seems that you consider the latter PSBT &#34;invalid&#34;. But it is well&#xA;&gt; formed and doesn&#39;t contain duplicate records. A Finalizer, or a&#xA;&gt; different Combiner that understands field F, can as well have the rule&#xA;&gt; &#34;throw away all but one&#34; for this case.&#xA;&gt;&#xA;&#xA;It&#39;s not about considering. We&#39;re writing a specification. Either it is&#xA;made invalid, or not.&#xA;&#xA;In a key-value model you can have dumb combiners that must pick one of the&#xA;keys in case of duplication, and remove the necessity of dealing with&#xA;duplication from all other implementations (which I consider to be a good&#xA;thing). In a record-based model you cannot guarantee deduplication of&#xA;records that permit repetition per type, because a dumb combiner cannot&#xA;understand what part is supposed to be unique. As a result, a record-based&#xA;model forces you to let all implementations deal with e.g. multiple partial&#xA;signatures for a single key. This is a minor issue, but in my view shows&#xA;how records are a less than perfect match for the problem at hand.&#xA;&#xA;To repeat and restate my central question:&#xA;&gt; Why is it important, that an agent which doesn&#39;t understand a particular&#xA;&gt; field structure, can nevertheless make decisions about its inclusion or&#xA;&gt; omission from the result (based on a repeated prefix)?&#xA;&gt;&#xA;&#xA;Again, because otherwise you may need a separate Combiner for each type of&#xA;script involved. That would be unfortunate, and is very easily avoided.&#xA;&#xA;Actually, I can imagine the opposite: having fields with same &#34;key&#34;&#xA;&gt; (identifying data), and wanting to combine their &#34;values&#34; intelligently&#xA;&gt; without losing any of the data. Say, two Signers producing separate&#xA;&gt; parts of a combined-signature under the same common public key?&#xA;&gt;&#xA;&#xA;That can always be avoided by using different identifying information as&#xA;key for these fields. In your example, assuming you&#39;re talking about some&#xA;form of threshold signature scheme, every party has their own &#34;shard&#34; of&#xA;the key, which still uniquely identifies the participant. If they have no&#xA;data that is unique to the participant, they are clones, and don&#39;t need to&#xA;interact regardless.&#xA;&#xA;&gt; In case of BIP32 derivation, computing the pubkeys is possibly&#xA;&gt; &gt; expensive. A simple signer can choose to just sign with whatever keys&#xA;&gt; &gt; are present, but they&#39;re not the only way to implement a signer, and&#xA;&gt; &gt; even less the only software interacting with this format. Others may&#xA;&gt; &gt; want to use a matching approach to find keys that are relevant;&#xA;&gt; &gt; without pubkeys in the format, they&#39;re forced to perform derivations&#xA;&gt; &gt; for all keys present.&#xA;&gt;&#xA;&gt; I&#39;m going to search for relevant keys by comparing master fingerprint; I&#xA;&gt; would expect HWWs generally don&#39;t have index based on leaf pubkeys.&#xA;&gt; OTOH, Signers with lots of keys probably aren&#39;t resource-constrained and&#xA;&gt; can do the derivations in case of collisions.&#xA;&gt;&#xA;&#xA;Perhaps you want to avoid signing with keys that are already signed with?&#xA;If you need to derive all the keys before even knowing what was already&#xA;signed with, you&#39;ve already performed 80% of the work.&#xA;&#xA;&gt; If you take the records model, and then additionally drop the&#xA;&gt; &gt; whole-record uniqueness constraint, yes, though that seems pushing it&#xA;&gt; &gt; a bit by moving even more guarantees from the file format to&#xA;&gt; &gt; application level code.&#xA;&gt;&#xA;&gt; The &#34;file format&#34; makes no guarantees, because the parsing code and&#xA;&gt; application code is the same anyway. You could say I&#39;m proposing to&#xA;&gt; separate these concerns ;)&#xA;&gt;&#xA;&#xA;Of course a file format can make guarantees. If certain combinations of&#xA;data in it do not satsify the specification, the file is illegal, and&#xA;implementations do not need to deal with it. Stricter file formats are&#xA;easier to deal with, because there are less edge cases to consider.&#xA;&#xA;To your point: proto v2 afaik has no way to declare &#34;whole record&#xA;uniqueness&#34;, so either you drop that (which I think is unacceptable - see&#xA;the copy/sign/combine argument above), or you deal with it in your&#xA;application code.&#xA;&#xA;Cheers,&#xA;&#xA;-- &#xA;Pieter&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20180627/fecd0346/attachment-0001.html&gt;</html></oembed>