From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 18 Nov 2024 11:27:05 -0800 Received: from mail-qt1-f192.google.com ([209.85.160.192]) by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tD7Oq-0007p0-Sq for bitcoindev@gnusha.org; Mon, 18 Nov 2024 11:27:05 -0800 Received: by mail-qt1-f192.google.com with SMTP id d75a77b69052e-460b5727217sf3747811cf.2 for ; Mon, 18 Nov 2024 11:27:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731958019; cv=pass; d=google.com; s=arc-20240605; b=bpBzyJGDV9qAut/Z+WZsboKi98UmOBcagt8CQmWrDbt+e0E/izpzPGA/TFX9Fj0OAK oy9lau0jR+x6w5urHvl2FCcuNHEsaKk6U4BCI8Mlg+aiAXI6W4FF710qQtFpKjzt/9Iw hdvXW6QaRhnS75qeZgiTNpNAnpDcg3lvgqfHGibqORjUUyjO58+ueOeRf7JppZIWTMZJ vy5a+jsu+fUiSPU6dqdSbu0nY/6vyEcK5twQHtUJ5dWAIocMZ9wunWtNl0Ao5cIjNpYz XvRvUvDa2LzJgIFjpuHEQ1uEsIhCarJhGWzx3fcwGjeyFr5gwXmnT6zX5YBUrE7K9Yah myAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=2orU2e1ThMNMv2yxtcgOHbE/1v6ATabIiGdCeTMzTe8=; fh=4AT8ikx7zoB+9YYPvSHz0WxtZRd/564nPY9EhRjiDZo=; b=EZG7rcebxyjNYKC88aJtRGpOCS4Hok7hq84F/eLbKGxbgc0klgcNv0/HtkiHdbsQSe dOmPFppcnaYGn/IRSk8TSPwPld9gg4JtoI2P+RgLRpADXO4LIHOSxkJX1L0fit2nFTrv HtPdDG/GA1feYJoy5gdDV0w3aa2+xkt/FT3vu9JWBOslXarPyPANajNqw/aBv9RuWT0S 2Gef4tWRpy3y2PLsm58h5eQeSzy4aQjcJ9t/Px2gzYU2qYvX0I7knSBeTLilrC12x4se 4hExl0Yl5wBdX9yeo+EWXsoddU0qRGtXjL5w9ZgL52Ev526A7Fwt8+Rxv0WQrmQJqA/s /t6g==; darn=gnusha.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WWCzHIci; spf=pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=eth3rs@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1731958019; x=1732562819; darn=gnusha.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:sender:from:to:cc:subject:date:message-id :reply-to; bh=2orU2e1ThMNMv2yxtcgOHbE/1v6ATabIiGdCeTMzTe8=; b=e0adkbDIeyoFbehuXWFD9Br0DTprKhTQxAZuPMAQTJXpkIVFUJRvag8bJVzvm/Mqun Tax6o0jn3qCV4IWRBKBbCaIDFcN6kD/euXK/u0TbydDDhAUZbSOsnAL+Fqaz6a91G2Zl dhT5hLvKmDswdm634VFfeco66qkhNAZRamGA2PCTkTciej4+myZ9XvUitnH3A9mY/e84 jSusGUUnGOmkdKAiBCAASaGpCegGIMV0XhJyPplluSg0B1/e64tD4JaZLR2ZRlgR+ymj J8Zz4D+rnXxROcmdgV8NuMZfVQJllK0jwxCY19YbfPgF1trVKHTsbil45GkGrgLsqK5e HVUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731958019; x=1732562819; darn=gnusha.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2orU2e1ThMNMv2yxtcgOHbE/1v6ATabIiGdCeTMzTe8=; b=Y47PPJgh3Q9N9pvnJNBSWB16SJ05Wkw3/eN4POJ8jEE6e9cszX0B34K12qe9K8mBo3 4rwcAbSkDazmjwc1+A9KBmXWcQbztCwiqW8mmq6SvE8yfYdEcu0sSz4hmR0pWSFlc9kt fnLd3ExiA/ivivgWrD2rGT8X2NXE3kG3tjqOfPPk+jVHjvs8XfZpm6DlXnrgmabwZBzr tMce22L+4vZwgI3C6O91kS26f2VZZ7WEvCXlZeY7osFF8Np8dTxlCXhTadowEbqfKLg+ EhZD7Ut/HCa7rQkgEg8DbtyIppZVJjoKL1p9BRyK33SdHPQ6zqFg/UZ21q3pf0Eckfy+ OeYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731958019; x=1732562819; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=2orU2e1ThMNMv2yxtcgOHbE/1v6ATabIiGdCeTMzTe8=; b=UhPeyB3UfzDPgMFb8MxGByqwXFRKbQ4pV48tLRpYNzMSwrtLBEEqRaXpKW1uap53hn YJiPAt3DYmmZFA6YudVddrh5YDkMqNr+VMt9zxGhhANAkkcHKKd4WEa3An61FqFoHlMb w8BIHa+bpevAoyo1ZA15C27sVi9CwaXLiFi0lryq9gCUpuZzsQ5dJYxH+gqwC4NmxZNH wHFxO1sJunbabFv/JglSKraxb22EFZSKi3rGOXP9SNVdsOCcrUmrKKy+8DTHU2oVIqjD 8JDYfUeZgUeAgde/9soW3yEuzvxbHM6ijBkhe4JDDrpMX7z8CE2YHyb6WUja4hoSWGJn xONQ== Sender: bitcoindev@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXRYDKLw+ZfUmXDDehdFfZJLCO13mWeYKIN98m3dfqmkILr4w4JzgI6uULYk05ug5fu1FS8CDlzpgzG@gnusha.org X-Gm-Message-State: AOJu0YzcBbtPMkbwfeLMdxJ9UE/vWGLmK+krFfXWv+iF4BRE3xdJjlVg NvZs23dlHH+gAwB4e9IVE/a2OzYXU2Xrn2u0N0nGL4SM8tV3GpgY X-Google-Smtp-Source: AGHT+IHGt0yhG8BkX8fiNjQ1XUaLOoyjPnK5b6RYu3RLjBs4cqqOJzwojv7vwkERb5A7/3kbnP/KSg== X-Received: by 2002:a05:622a:47c4:b0:462:b46b:8bf8 with SMTP id d75a77b69052e-46363ec1f06mr74938411cf.14.1731958018592; Mon, 18 Nov 2024 11:26:58 -0800 (PST) X-BeenThere: bitcoindev@googlegroups.com Received: by 2002:ac8:5a11:0:b0:460:89b7:cac0 with SMTP id d75a77b69052e-46370581d61ls20605441cf.1.-pod-prod-06-us; Mon, 18 Nov 2024 11:26:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVM4DuvOhygxR8PgnyE6bVjXXqzwQngwYXvGs5Q2em8kmJuzi42aSsa+dMgxqLPANbha+s09D9tkn8q@googlegroups.com X-Received: by 2002:a05:620a:3945:b0:7b1:4869:38dc with SMTP id af79cd13be357-7b3622eac3bmr1907640385a.27.1731958016093; Mon, 18 Nov 2024 11:26:56 -0800 (PST) Received: by 2002:a05:620a:3bcc:b0:7a1:d643:94b4 with SMTP id af79cd13be357-7b37b4fa669ms85a; Mon, 18 Nov 2024 10:54:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVHeScIupa6958AA/gNIN1gVe9V5r/GkkkaBj67hKZO5gwom6qTdvP/Qyf+eOygS2jjk/8jc3lW6qkD@googlegroups.com X-Received: by 2002:a05:600c:a06:b0:431:44fe:fd9a with SMTP id 5b1f17b1804b1-432df74ebdcmr113438895e9.19.1731956070652; Mon, 18 Nov 2024 10:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731956070; cv=none; d=google.com; s=arc-20240605; b=NonGib7720RidvPm09MVmOkwH11c1OwfBZaYA1nEqeBBhNYRZQZhENNSCICb5ZocMj s7KTMnjlRIZLD004r2Yol+0sIv3+csFheyqn5fb5zIUyJ+UGsjA7rkFMURcxA6XnIA/E d45aO474C5N5u4rSrFXAsf10/lbexuVAb2s+Jqs1/r/ZzgZkGvCHIxOoHJtkr/SPPHTV kLhCWsnqZ32ia7fsTbUtQjEFgtZs+oXjtKjMGOAwKkEIpitccSh8GKxR37jSTmNXBg3d lc5TMZSNlAwu+eN6JhPbufxUyHtKwifsmP8W3ohVJ7WQyOkJOGI3lf6uvmQAftkruU8h U9cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=udb/4bsG1eoHWa3bpiV9HPIDaGMnEOMSA3gMgyx3BLI=; fh=Ornq4ujrzM14uEWB6nQ0gE2ur3l/NhiDdyjP31Bza+k=; b=asaM9pLHmSTDDKWNz2wN25Tc5pI+It+cVGnHC6ccXDo9Po4e8tO2q8zJ/b+bSIv1Qn 9jB+j44atbp2ZeyJJzu2+aAlTYUVlBVPN3LjIifeS1XVpubgIKz78eG6AEqO83UgECgF g1eeTBOs7tSAChDEjuu7BRYal5F7Osqwr+Wk5I8E3YSiMmhjKrNkLdthxF4RQ3nErVMh eDUVSG1mLATGHR/NmBMgGFQRM645BYrmQzwOmA/aJ7SoZC8fH0G9/iXaBUQK9xKPK5JY pVufsI6s+mMG8TG2Y5JrF328VYbIJ1RJ/pzyzhxwhwhTJvJWBWHyMnjJxs2YJ2VMvSmY DWLQ==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WWCzHIci; spf=pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=eth3rs@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com. [2a00:1450:4864:20::633]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-432d48a6cfbsi10206115e9.1.2024.11.18.10.54.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Nov 2024 10:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) client-ip=2a00:1450:4864:20::633; Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-aa1e87afd31so341387466b.3 for ; Mon, 18 Nov 2024 10:54:30 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVMk85BBgL07EMynJ16OxX1zp0YeTmA0em68iuYiCKcOmODtxHgGuCmsNwRCmP+0331LwxffmbQc3JU@googlegroups.com X-Received: by 2002:a17:907:26cb:b0:a99:742c:5b5 with SMTP id a640c23a62f3a-aa4834215a5mr1107879366b.13.1731956069958; Mon, 18 Nov 2024 10:54:29 -0800 (PST) MIME-Version: 1.0 References: <4235f7d2-8e09-428a-813d-9034cb21f48an@googlegroups.com> In-Reply-To: From: Ethan Heilman Date: Mon, 18 Nov 2024 13:54:17 -0500 Message-ID: Subject: Re: [bitcoindev] Multi-byte opcodes To: Brandon Black Cc: Weikeng Chen , Bitcoin Development Mailing List Content-Type: multipart/alternative; boundary="0000000000005111d706273472f8" X-Original-Sender: eth3rs@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WWCzHIci; spf=pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=eth3rs@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Precedence: list Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com List-ID: X-Google-Group-Id: 786775582512 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Score: -0.5 (/) --0000000000005111d706273472f8 Content-Type: text/plain; charset="UTF-8" Couldn't we add opcodes contexts via the script version? By context I mean an opcode that loads a 1 to N byte map rewriting the mapping from opcode number to what instruction that number signifies. This should let you have an infinite number of instructions. You could change the context multiple times in a script as a cost of only two or three bytes. On Mon, Nov 18, 2024, 1:36 PM Brandon Black wrote: > Hi Weikeng, thanks for your thoughts on this! > > > We can, however, solve that by allowing multi-byte opcodes. > > > > Say, for example, we can have: > > OP_OP { 0x1521 } > > which will set the current opcode to be the one with the assigned number > > 0x1521. > > > > Another idea is maybe OP_OP takes a stack element as the opcode. > > { 0x1521 } OP_OP > > Another option that works for many cases is to have opcode families > where an argument is augmented with flags to determine the behavior. We > can consider this to already be the case for OP_CHECKSIG* where the > signature determines the behavior of the hashing portion of the opcode. > > This is also how OP_CHECKTEMPLATEVERIFY is designed, and how > OP_CHECKSIGFROMSTACKVERIFY as currently spec'd in the PR is designed. > CTV and CSFSV only constrain 32-byte first arguments, but not other > lengths leaving open extensions using any other length, including using > other lengths of either opcode as OP_OP, or as variants on CTV and CSFSV > respectively. > > The benefit of this approach is that it doesn't "waste" the length byte > only to specify the opcode behavior, but enables it to do double duty as > specifying the total length of the first argument including both flags > and data. > > Best, > > --Brandon > > -- > You received this message because you are subscribed to the Google Groups > "Bitcoin Development Mailing List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to bitcoindev+unsubscribe@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/bitcoindev/Zzt2OCE6Aj9H3DiY%40console. > -- You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/CAEM%3Dy%2BVpeEwqWtXqs%2BRpOFrO%3DWGzbSkPEEqBqBxc-87Z4ruh2g%40mail.gmail.com. --0000000000005111d706273472f8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Couldn't we add opcodes contexts via the script versi= on?

By context I mean an opcod= e that loads a 1 to N byte map rewriting the mapping from opcode number to = what instruction that number signifies. This should let you have an infinit= e number of instructions. You could change the context multiple times in a = script as a cost of only two or three bytes.



On Mon, Nov 18, 2024, 1:36 PM Brandon Black = <freedom@reardencode.com&= gt; wrote:
Hi We= ikeng, thanks for your thoughts on this!

> We can, however, solve that by allowing multi-byte opcodes.
>
> Say, for example, we can have:
>=C2=A0 =C2=A0 =C2=A0OP_OP { 0x1521 }
> which will set the current opcode to be the one with the assigned numb= er
> 0x1521.
>
> Another idea is maybe OP_OP takes a stack element as the opcode.
>=C2=A0 =C2=A0 =C2=A0{ 0x1521 } OP_OP

Another option that works for many cases is to have opcode families
where an argument is augmented with flags to determine the behavior. We
can consider this to already be the case for OP_CHECKSIG* where the
signature determines the behavior of the hashing portion of the opcode.

This is also how OP_CHECKTEMPLATEVERIFY is designed, and how
OP_CHECKSIGFROMSTACKVERIFY as currently spec'd in the PR is designed. CTV and CSFSV only constrain 32-byte first arguments, but not other
lengths leaving open extensions using any other length, including using
other lengths of either opcode as OP_OP, or as variants on CTV and CSFSV respectively.

The benefit of this approach is that it doesn't "waste" the l= ength byte
only to specify the opcode behavior, but enables it to do double duty as specifying the total length of the first argument including both flags
and data.

Best,

--Brandon

--
You received this message because you are subscribed to the Google Groups &= quot;Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to bitcoindev+unsubscribe@googlegroups.com.=
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/Zzt2OCE6Aj9H3DiY%4= 0console.

--
You received this message because you are subscribed to the Google Groups &= quot;Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to bitcoind= ev+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.= com/d/msgid/bitcoindev/CAEM%3Dy%2BVpeEwqWtXqs%2BRpOFrO%3DWGzbSkPEEqBqBxc-87= Z4ruh2g%40mail.gmail.com.
--0000000000005111d706273472f8--