From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0E549C0032 for ; Mon, 23 Oct 2023 13:41:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id CF22C416BD for ; Mon, 23 Oct 2023 13:41:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CF22C416BD Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=mail.wpsoftware.net header.i=@mail.wpsoftware.net header.a=rsa-sha256 header.s=default header.b=Xa5QbwJN X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -1.107 X-Spam-Level: X-Spam-Status: No, score=-1.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fMRWXk-_T_aR for ; Mon, 23 Oct 2023 13:41:53 +0000 (UTC) Received: from mail.wpsoftware.net (unknown [66.183.0.205]) by smtp2.osuosl.org (Postfix) with ESMTP id AE76C400CB for ; Mon, 23 Oct 2023 13:41:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AE76C400CB Received: from camus (camus-andrew.lan [192.168.0.190]) by mail.wpsoftware.net (Postfix) with ESMTPSA id E23D4400C6; Mon, 23 Oct 2023 13:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.wpsoftware.net; s=default; t=1698068512; bh=zDaenZXqhsdXEjG8EkU93AVys+2OBA5ZcLOCTCTqe0c=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Xa5QbwJNk3aWh82cgu7vUCkXhEE6EQFfrPGSBMDwH1QcEKVJp8KjFA6D/HzcX7+ue W4Fwl/ipkPSLHZS7oTmXGxfP/rnO5ugK2V46V4CleL6Qwtb0yxKrXABpF5Zg5UGlRu gsg58xHqutaXIUol1rcKc4RZgdzE9EdS6gJRzS4GWz3qc1tc/UU4RaniA56SlcVxOG wMfGuyY8QJYMU76FsvUzBIVP5jUkA0Tza8rQP56SmpcbPmcHLpqClIsx9yeRrj2YkT BzURtoCbZZN+yUB7ZS4NM/Ng0eiFnyg6Ds5uDQ3z1OpJHKlZzNGIu3aeAgeh6ow0mk f1ZakNliGW15w== Date: Mon, 23 Oct 2023 13:41:51 +0000 From: Andrew Poelstra To: Rusty Russell , Bitcoin Protocol Discussion Message-ID: References: <871qdmulvt.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3WEIdbII5avoQcnW" Content-Disposition: inline In-Reply-To: <871qdmulvt.fsf@rustcorp.com.au> Subject: Re: [bitcoin-dev] Proposed BIP for OP_CAT X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2023 13:41:55 -0000 --3WEIdbII5avoQcnW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 23, 2023 at 12:43:10PM +1030, Rusty Russell via bitcoin-dev wro= te: > Ethan Heilman via bitcoin-dev wri= tes: > > Hi everyone, > > > > We've posted a draft BIP to propose enabling OP_CAT as Tapscript opcode. > > https://github.com/EthanHeilman/op_cat_draft/blob/main/cat.mediawiki >=20 > This is really nice to see! >=20 > AFAICT you don't define the order of concatenation, except in the > implementation[1]. I think if A is top of stack, we get BA, not AB? >=20 > 520 feels quite small for script templates (mainly because OP_CAT itself > makes Script more interesting!). For example, using OP_TXHASH and > OP_CAT to enforce that two input amounts are equal to one output amount > takes about 250 bytes of Script[2] :( >=20 > So I have to ask: >=20 > 1. Do other uses feel like 520 is too limiting? In my view, 520 feels limiting provided that we lack rolling sha2 opcodes. If we had those, then arguably 65 bytes is enough. Without them, I'm not sure that any value is "enough". For CHECKSIGFROMSTACK emulation purposes ideally we'd want the ability to construct a full transaction on the stack, which in principle would necessitate a 4M limit. > 2. Was there a concrete rationale for maintaining 520 bytes? 10k is the = current > script limit, can we get closer to that? :) But as others have said, 520 bytes is the existing stack element limit and minimizing changes seems like a good strategy to get consensus. (On the other hand, it's been a few days without any opposition so maybe we should be more agressive :)). > 3. Should we restrict elsewhere instead? After all, OP_CAT doesn't > change total stack size, which is arguably the real limit? >=20 Interesting thought. Right now the stack size is limited to 1000 elements of 520 bytes each, which theoretically means a limit of 520k. Bitcoin Core doesn't explicitly count the "total stack size" in the sense that you're suggesting; it just enforces these two limits separately. I think trying to add a "total stack size limit" (which would have to live alongside the two existing limits; we can't replace them without a whole new Tapscript version) would add a fair bit of accounting complextiy and wind up touching almost every other opcode...probably not worth the added consensus logic. > Of course, we can increase this limit in future tapscript versions, too, > so it's not completely set in stone. >=20 --=20 Andrew Poelstra Director of Research, Blockstream Email: apoelstra at wpsoftware.net Web: https://www.wpsoftware.net/andrew The sun is always shining in space -Justin Lewis-Webster --3WEIdbII5avoQcnW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEkPnKPD7Je+ki35VexYjWPOQbl8EFAmU2eB0ACgkQxYjWPOQb l8EFFAf+NAzdRUaz6coZN9SLhStuzqq8YW2bjBBz7MnZRwyIq8LiUBtXAxfhk0JG UoMLG74qKsOg3pBfcFhnUgETBnAB5eIIp94jZAWq+vNBBU1s1O4DHoj9ebb5EfdI pVu+4B/gqud7yxhKkNQtUiMWJy/Ao/OAyMb6RMvHoWWgJD6LYV1DgjQCdJ/GkUNO QhSUWZqX7E78QM38p4SzysQPgCiS++eR9WitER5stXK0hDzZUHiwissdvZGcglF7 w7gu8hkRhDzP0z4qc86+Y85yJYDbML0o5WBfow0o1oaoT1P+JH9z15j/6BpwolFb DckRkse5zXDff4C4GaQ+HhPUdA7eJQ== =nct2 -----END PGP SIGNATURE----- --3WEIdbII5avoQcnW--