Return-Path: <jb55@jb55.com> Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5AD60CFB for <bitcoin-dev@lists.linuxfoundation.org>; Thu, 5 Jul 2018 19:20:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from jb55.com (jb55.com [45.79.91.128]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1002976E for <bitcoin-dev@lists.linuxfoundation.org>; Thu, 5 Jul 2018 19:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d= jb55.com; h=from:to:subject:date:message-id; s=default; bh=iX0oYbNngTbatJ6+NDdCPLEzaIxOGBUak5p9NpdMpa4=; b=isN1Z0cMeoi4Wr0rlY74PbWuQcXY10jGEmaParL7/5U2jOIwtrXdvkr3W4sKALZ243UXOT0Fy5vdpu/JDVbC6NHOrIWQp1oFDlMio58mugjfyADYmI1FFFRfb8sp6+0zZSun+oWktz8zWEXs+vVBJPyCqSAscihiGXfxnVjm8w0KMRSkRq0wPjIvMRaHAn9uDlUTx/6yhbHOqAyCqT9RLn03539inAI3NGa5VPAz73iGkoMIegFCvwE69kdnaxBUBXqot0AkvTdc9CbfZI/NvRkahSaYclQCRXxDt3h540PCMTMtpiwIlKpW9Pj3gI3pOcu5mK3yGqwt++xMterhzA== Received: from jb55.com (S0106f0f24985f313.gv.shawcable.net [24.69.17.186]) by jb55.com (OpenSMTPD) with ESMTPSA id 3ecc9e34 TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Thu, 5 Jul 2018 19:20:33 +0000 (UTC) From: William Casarin <jb55@jb55.com> To: Achow101 <achow101-lists@achow101.com> In-Reply-To: <0BT4A0BFbcfUM9xlYjS-7Cy1zpaI1J9qsIpWH_xgv2ZLhcmxb4Es5KlpMJCvHVEu8BDbBweZ92RHnES5HxDMulRhJkYSZAPi-CgXQ3uwkfY=@achow101.com> References: <CAPg+sBhGMxXatsyCAqeboQKH8ASSFAfiXzxyXR9UrNFnah5PPw@mail.gmail.com> <CHCiA27GTRiVfkF1DoHdroJL1rQS77ocB42nWxIIhqi_fY3VbB3jsMQveRJOtsJiA4RaCAVe3VZmLZsXVYS3A5wVLNP2OgKQiHE0T27P2qc=@achow101.com> <21a616f5-7a17-35b9-85ea-f779f20a6a2d@satoshilabs.com> <20180621195654.GC99379@coinkite.com> <CAPg+sBgdQqZ8sRSn=dd9EkavYJA6GBiCu6-v5k9ca-9WLPp72Q@mail.gmail.com> <ljk5Z_a3KK6DHfmPJxI8o9W2CkwszkUG34h0i1MTGU4ss8r3BTQ3GnTtDTfWF6J7ZqcSAmejzrr11muWqYN-_wnWw_0NFn5_lggNnjI0_Rc=@achow101.com> <f8f5b1e3-692a-fc1e-2ad3-c4ad4464957f@satoshilabs.com> <TGyS7Azu3inMQFv9QFn8USr9v2m5QbhDRmiOI-4FWwscUeuIB9rA7mCmZA4-kwCJOMAx92fO7XICHtE7ES_QmIYLDy6RHof1WLALskGUYAc=@achow101.com> <c32dc90d-9919-354b-932c-f93fe329760b@satoshilabs.com> <J0KV-aP96fSVHPkPw85N2qdKV_F5vqXt5fIFwKDp9wBjRKJ6bZpUEtzbgHyxlWW9PCXMOEVZnyUnJ-kW281ZbblbCp2sbZI_UyTP46q-PiY=@achow101.com> <87k1qk7oca.fsf@jb55.com> Date: Thu, 05 Jul 2018 12:20:32 -0700 Message-ID: <87in5ttrpb.fsf@jb55.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Fri, 06 Jul 2018 18:31:18 +0000 Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org> Subject: Re: [bitcoin-dev] BIP 174 thoughts X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org> List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe> List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/> List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org> List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help> List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe> X-List-Received-Date: Thu, 05 Jul 2018 19:20:34 -0000 I have another concern with the format. (my original bip comment for some context: [1]) It looks like the one of the reasons I was confused is because you can only parse the format properly by first deserializing the transaction. Since there is no "length" field for the key-value map arrays, you must count the number of transaction input/outputs, and use that as the number of kv maps to parse. This is pretty brittle, because now if a Combiner writes the wrong number of key-value maps that don't align with the number of inputs and outputs in the transaction, then the psbt will not be able to be deserialized properly, but is still a valid PSBT. It can't even detect these situations, because the input and output types share the same enum values. I don't see anywhere that says the number of key value maps MUST match the number of inputs/outputs, perhaps it's implied? I think I think we should either make this explicit in the BIP, add an array length prefix, or make all (global/input/output) types share the same enum. Cheers, William [1] https://github.com/bitcoin/bips/pull/694#issuecomment-402812041