Repository: algorand/js-algorand-sdk
Pull request #376 (2021-06-15 14:40:29)

update langSpec


Patch:
diff --git a/src/logic/langspec.json b/src/logic/langspec.json
index 5001e02..12070d7 100644
--- a/src/logic/langspec.json
+++ b/src/logic/langspec.json
@@ -1,5 +1,5 @@
 {
-  "EvalMaxVersion": 3,
+  "EvalMaxVersion": 4,
   "LogicSigVersion": 3,
   "Ops": [
     {
@@ -80,6 +80,7 @@
       "Cost": 1,
       "Size": 1,
       "Doc": "A divided by B. Panic if B == 0.",
+      "DocExtra": "`divmodw` is available to divide the two-element values produced by `mulw` and `addw`.",
       "Groups": ["Arithmetic"]
     },
     {
@@ -284,6 +285,16 @@
       "Doc": "A plus B out to 128-bit long result as sum (top) and carry-bit uint64 values on the stack",
       "Groups": ["Arithmetic"]
     },
+    {
+      "Opcode": 31,
+      "Name": "divmodw",
+      "Args": "UUUU",
+      "Returns": "UUUU",
+      "Cost": 20,
+      "Size": 1,
+      "Doc": "Pop four uint64 values.  The deepest two are interpreted as a uint128 dividend (deepest value is high word), the top two are interpreted as a uint128 divisor.  Four uint64 values are pushed to the stack. The deepest two are the quotient (deeper value is the high uint64). The top two are the remainder, low bits on top.",
+      "Groups": ["Arithmetic"]
+    },
     {
       "Opcode": 32,
       "Name": "intcblock",
@@ -504,9 +515,10 @@
         "GlobalNumUint",
         "GlobalNumByteSlice",
         "LocalNumUint",
-        "LocalNumByteSlice"
+        "LocalNumByteSlice",
+        "ExtraProgramPages"
       ],
-      "ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUU",
+      "ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUUU",
       "Doc": "push field F of current transaction to stack",
       "DocExtra": "FirstValidTime causes the program to fail. The field is reserved for future use.",
       "ImmediateNote": "{uint8 transaction field index}",
@@ -597,9 +609,10 @@
         "GlobalNumUint",
         "GlobalNumByteSlice",
         "LocalNumUint",
-        "LocalNumByteSlice"
+        "LocalNumByteSlice",
+        "ExtraProgramPages"
       ],
-      "ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUU",
+      "ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUUU",
       "Doc": "push field F of the Tth transaction in the current group",
       "DocExtra": "for notes on transaction fields available, see `txn`. If this transaction is _i_ in the group, `gtxn i field` is equivalent to `txn field`.",
       "ImmediateNote": "{uint8 transaction group index} {uint8 transaction field index}",
@@ -656,6 +669,66 @@
       "Returns": ".",
       "Cost": 1,
       "Size": 2,
+      "ArgEnum": [
+        "Sender",
+        "Fee",
+        "FirstValid",
+        "FirstValidTime",
+        "LastValid",
+        "Note",
+        "Lease",
+        "Receiver",
+        "Amount",
+        "CloseRemainderTo",
+        "VotePK",
+        "SelectionPK",
+        "VoteFirst",
+        "VoteLast",
+        "VoteKeyDilution",
+        "Type",
+        "TypeEnum",
+        "XferAsset",
+        "AssetAmount",
+        "AssetSender",
+        "AssetReceiver",
+        "AssetCloseTo",
+        "GroupIndex",
+        "TxID",
+        "ApplicationID",
+        "OnCompletion",
+        "ApplicationArgs",
+        "NumAppArgs",
+        "Accounts",
+        "NumAccounts",
+        "ApprovalProgram",
+        "ClearStateProgram",
+        "RekeyTo",
+        "ConfigAsset",
+        "ConfigAssetTotal",
+        "ConfigAssetDecimals",
+        "ConfigAssetDefaultFrozen",
+        "ConfigAssetUnitName",
+        "ConfigAssetName",
+        "ConfigAssetURL",
+        "ConfigAssetMetadataHash",
+        "ConfigAssetManager",
+        "ConfigAssetReserve",
+        "ConfigAssetFreeze",
+        "ConfigAssetClawback",
+        "FreezeAsset",
+        "FreezeAssetAccount",
+        "FreezeAssetFrozen",
+        "Assets",
+        "NumAssets",
+        "Applications",
+        "NumApplications",
+        "GlobalNumUint",
+        "GlobalNumByteSlice",
+        "LocalNumUint",
+        "LocalNumByteSlice",
+        "ExtraProgramPages"
+      ],
+      "ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUUU",
       "Doc": "push field F of the Ath transaction in the current group",
       "DocExtra": "for notes on transaction fields available, see `txn`. If top of stack is _i_, `gtxns field` is equivalent to `gtxn _i_ field`. gtxns exists so that _i_ can be calculated, often based on the index of the current transaction.",
       "ImmediateNote": "{uint8 transaction field index}",
@@ -668,10 +741,56 @@
       "Returns": ".",
       "Cost": 1,
       "Size": 3,
+      "ArgEnum": ["ApplicationArgs", "Accounts"],
+      "ArgEnumTypes": "BBUU",
       "Doc": "push Ith value of the array field F from the Ath transaction in the current group",
       "ImmediateNote": "{uint8 transaction field index} {uint8 transaction field array index}",
       "Groups": ["Loading Values"]
     },
+    {
+      "Opcode": 58,
+      "Name": "gload",
+      "Returns": ".",
+      "Cost": 1,
+      "Size": 3,
+      "Doc": "push Ith scratch space index of the Tth transaction in the current group",
+      "DocExtra": "The `gload` opcode can only access scratch spaces of previous app calls contained in the current group.",
+      "ImmediateNote": "{uint8 transaction group index} {uint8 position in scratch space to load from}",
+      "Groups": ["Loading Values"]
+    },
+    {
+      "Opcode": 59,
+      "Name": "gloads",
+      "Args": "U",
+      "Returns": ".",
+      "Cost": 1,
+      "Size": 2,
+      "Doc": "push Ith scratch space index of the Ath transaction in the current group",
+      "DocExtra": "The `gloads` opcode can only access scratch spaces of previous app calls contained in the current group.",
+      "ImmediateNote": "{uint8 position in scratch space to load from}",
+      "Groups": ["Loading Values"]
+    },
+    {
+      "Opcode": 60,
+      "Name": "gaid",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 2,
+      "Doc": "push the ID of the asset or application created in the Tth transaction of the current group",
+      "DocExtra": "The `gaid` opcode can only access the ID of assets or applications created by previous txns in the current group.",
+      "Groups": ["Loading Values"]
+    },
+    {
+      "Opcode": 61,
+      "Name": "gaids",
+      "Args": "U",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "push the ID of the asset or application created in the Ath transaction of the current group",
+      "DocExtra": "The `gaids` opcode can only access the ID of assets or applications created by previous txns in the current group.",
+      "Groups": ["Loading Values"]
+    },
     {
       "Opcode": 64,
       "Name": "bnz",
@@ -679,8 +798,8 @@
       "Cost": 1,
       "Size": 3,
       "Doc": "branch to TARGET if value X is not zero",
-      "DocExtra": "The `bnz` instruction opcode 0x40 is followed by two immediate data bytes which are a high byte first and low byte second which together form a 16 bit offset which the instruction may branch to. For a bnz instruction at `pc`, if the last element of the stack is not zero then branch to instruction at `pc + 3 + N`, else proceed to next instruction at `pc + 3`. Branch targets must be well aligned instructions. (e.g. Branching to the second byte of a 2 byte op will be rejected.) Branch offsets are currently limited to forward branches only, 0-0x7fff. A future expansion might make this a signed 16 bit integer allowing for backward branches and looping.\n\nAt LogicSigVersion 2 it became allowed to branch to the end of the program exactly after the last instruction: bnz to byte N (with 0-indexing) was illegal for a TEAL program with N bytes before LogicSigVersion 2, and is legal after it. This change eliminates the need for a last instruction of no-op as a branch target at the end. (Branching beyond the end--in other words, to a byte larger than N--is still illegal and will cause the program to fail.)",
-      "ImmediateNote": "{0..0x7fff forward branch offset, big endian}",
+      "DocExtra": "The `bnz` instruction opcode 0x40 is followed by two immediate data bytes which are a high byte first and low byte second which together form a 16 bit offset which the instruction may branch to. For a bnz instruction at `pc`, if the last element of the stack is not zero then branch to instruction at `pc + 3 + N`, else proceed to next instruction at `pc + 3`. Branch targets must be well aligned instructions. (e.g. Branching to the second byte of a 2 byte op will be rejected.) Branch offsets are limited to forward branches only, 0-0x7fff until v4. v4 treats offset as a signed 16 bit integer allowing for backward branches and looping.\n\nAt LogicSigVersion 2 it became allowed to branch to the end of the program exactly after the last instruction: bnz to byte N (with 0-indexing) was illegal for a TEAL program with N bytes before LogicSigVersion 2, and is legal after it. This change eliminates the need for a last instruction of no-op as a branch target at the end. (Branching beyond the end--in other words, to a byte larger than N--is still illegal and will cause the program to fail.)",
+      "ImmediateNote": "{int16 branch offset, big endian. (negative offsets are illegal before v4)}",
       "Groups": ["Flow Control"]
     },
     {
@@ -691,7 +810,7 @@
       "Size": 3,
       "Doc": "branch to TARGET if value X is zero",
       "DocExtra": "See `bnz` for details on how branches work. `bz` inverts the behavior of `bnz`.",
-      "ImmediateNote": "{0..0x7fff forward branch offset, big endian}",
+      "ImmediateNote": "{int16 branch offset, big endian. (negative offsets are illegal before v4)}",
       "Groups": ["Flow Control"]
     },
     {
@@ -701,7 +820,7 @@
       "Size": 3,
       "Doc": "branch unconditionally to TARGET",
       "DocExtra": "See `bnz` for details on how branches work. `b` always jumps to the offset.",
-      "ImmediateNote": "{0..0x7fff forward branch offset, big endian}",
+      "ImmediateNote": "{int16 branch offset, big endian. (negative offsets are illegal before v4)}",
       "Groups": ["Flow Control"]
     },
     {
@@ -829,7 +948,7 @@
       "Opcode": 84,
       "Name": "setbit",
       "Args": ".UU",
-      "Returns": "U",
+      "Returns": ".",
       "Cost": 1,
       "Size": 1,
       "Doc": "pop a target A, index B, and bit C. Set the Bth bit of A to C, and push the result",
@@ -859,44 +978,45 @@
     {
       "Opcode": 96,
       "Name": "balance",
-      "Args": "U",
+      "Args": ".",
       "Returns": "U",
       "Cost": 1,
       "Size": 1,
-      "Doc": "get balance for the requested account specified by Txn.Accounts[A] in microalgos. A is specified as an account index in the Accounts field of the ApplicationCall transaction, zero index means the sender. The balance is observed after the effects of previous transactions in the group, and after the fee for the current transaction is deducted.",
+      "Doc": "get balance account A, in microalgos. The balance is observed after the effects of previous transactions in the group, and after the fee for the current transaction is deducted.",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender). Return: value.",
       "Groups": ["State Access"]
     },
     {
       "Opcode": 97,
       "Name": "app_opted_in",
-      "Args": "UU",
+      "Args": ".U",
       "Returns": "U",
       "Cost": 1,
       "Size": 1,
-      "Doc": "check if account specified by Txn.Accounts[A] opted in for the application B =\u003e {0 or 1}",
-      "DocExtra": "params: account index, application id (top of the stack on opcode entry). Return: 1 if opted in and 0 otherwise.",
+      "Doc": "check if account A opted in for the application B =\u003e {0 or 1}",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), application id (or, since v4, a Txn.ForeignApps offset). Return: 1 if opted in and 0 otherwise.",
       "Groups": ["State Access"]
     },
     {
       "Opcode": 98,
       "Name": "app_local_get",
-      "Args": "UB",
+      "Args": ".B",
       "Returns": ".",
       "Cost": 1,
       "Size": 1,
-      "Doc": "read from account specified by Txn.Accounts[A] from local state of the current application key B =\u003e value",
-      "DocExtra": "params: account index, state key. Return: value. The value is zero (of type uint64) if the key does not exist.",
+      "Doc": "read from account A from local state of the current application key B =\u003e value",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), state key. Return: value. The value is zero (of type uint64) if the key does not exist.",
       "Groups": ["State Access"]
     },
     {
       "Opcode": 99,
       "Name": "app_local_get_ex",
-      "Args": "UUB",
+      "Args": ".UB",
       "Returns": ".U",
       "Cost": 1,
       "Size": 1,
-      "Doc": "read from account specified by Txn.Accounts[A] from local state of the application B key C =\u003e [*... stack*, value, 0 or 1]",
-      "DocExtra": "params: account index, application id, state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.",
+      "Doc": "read from account A from local state of the application B key C =\u003e [*... stack*, value, 0 or 1]",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), application id (or, since v4, a Txn.ForeignApps offset), state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.",
       "Groups": ["State Access"]
     },
     {
@@ -917,18 +1037,18 @@
       "Returns": ".U",
       "Cost": 1,
       "Size": 1,
-      "Doc": "read from application Txn.ForeignApps[A] global state key B =\u003e [*... stack*, value, 0 or 1]. A is specified as an account index in the ForeignApps field of the ApplicationCall transaction, zero index means this app",
-      "DocExtra": "params: application index, state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.",
+      "Doc": "read from application A global state key B =\u003e [*... stack*, value, 0 or 1]",
+      "DocExtra": "params: Txn.ForeignApps offset (or, since v4, an application id that appears in Txn.ForeignApps or is the CurrentApplicationID), state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.",
       "Groups": ["State Access"]
     },
     {
       "Opcode": 102,
       "Name": "app_local_put",
-      "Args": "UB.",
+      "Args": ".B.",
       "Cost": 1,
       "Size": 1,
-      "Doc": "write to account specified by Txn.Accounts[A] to local state of a current application key B with value C",
-      "DocExtra": "params: account index, state key, value.",
+      "Doc": "write to account specified by A to local state of a current application key B with value C",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), state key, value.",
       "Groups": ["State Access"]
     },
     {
@@ -943,11 +1063,11 @@
     {
       "Opcode": 104,
       "Name": "app_local_del",
-      "Args": "UB",
+      "Args": ".B",
       "Cost": 1,
       "Size": 1,
-      "Doc": "delete from account specified by Txn.Accounts[A] local state key B of the current application",
-      "DocExtra": "params: account index, state key.\n\nDeleting a key which is already absent has no effect on the application local state. (In particular, it does _not_ cause the program to fail.)",
+      "Doc": "delete from account A local state key B of the current application",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), state key.\n\nDeleting a key which is already absent has no effect on the application local state. (In particular, it does _not_ cause the program to fail.)",
       "Groups": ["State Access"]
     },
     {
@@ -963,14 +1083,14 @@
     {
       "Opcode": 112,
       "Name": "asset_holding_get",
-      "Args": "UU",
+      "Args": ".U",
       "Returns": ".U",
       "Cost": 1,
       "Size": 2,
       "ArgEnum": ["AssetBalance", "AssetFrozen"],
       "ArgEnumTypes": "UU",
-      "Doc": "read from account specified by Txn.Accounts[A] and asset B holding field X (imm arg) =\u003e {0 or 1 (top), value}",
-      "DocExtra": "params: account index, asset id. Return: did_exist flag (1 if exist and 0 otherwise), value.",
+      "Doc": "read from account A and asset B holding field X (imm arg) =\u003e {0 or 1 (top), value}",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), asset id (or, since v4, a Txn.ForeignAssets offset). Return: did_exist flag (1 if exist and 0 otherwise), value.",
       "ImmediateNote": "{uint8 asset holding field index}",
       "Groups": ["State Access"]
     },
@@ -995,19 +1115,20 @@
         "AssetClawback"
       ],
       "ArgEnumTypes": "UUUBBBBBBBB",
-      "Doc": "read from asset Txn.ForeignAssets[A] params field X (imm arg) =\u003e {0 or 1 (top), value}",
-      "DocExtra": "params: txn.ForeignAssets offset. Return: did_exist flag (1 if exist and 0 otherwise), value.",
+      "Doc": "read from asset A params field X (imm arg) =\u003e {0 or 1 (top), value}",
+      "DocExtra": "params: Txn.ForeignAssets offset (or, since v4, an asset id that appears in Txn.ForeignAssets). Return: did_exist flag (1 if exist and 0 otherwise), value.",
       "ImmediateNote": "{uint8 asset params field index}",
       "Groups": ["State Access"]
     },
     {
       "Opcode": 120,
       "Name": "min_balance",
-      "Args": "U",
+      "Args": ".",
       "Returns": "U",
       "Cost": 1,
       "Size": 1,
-      "Doc": "get minimum required balance for the requested account specified by Txn.Accounts[A] in microalgos. A is specified as an account index in the Accounts field of the ApplicationCall transaction, zero index means the sender. Required balance is affected by [ASA](https://developer.algorand.org/docs/features/asa/#assets-overview) and [App](https://developer.algorand.org/docs/features/asc1/stateful/#minimum-balance-requirement-for-a-smart-contract) usage. When creating or opting into an app, the minimum balance grows before the app code runs, therefore the increase is visible there. When deleting or closing out, the minimum balance decreases after the app executes.",
+      "Doc": "get minimum required balance account A, in microalgos. Required balance is affected by [ASA](https://developer.algorand.org/docs/features/asa/#assets-overview) and [App](https://developer.algorand.org/docs/features/asc1/stateful/#minimum-balance-requirement-for-a-smart-contract) usage. When creating or opting into an app, the minimum balance grows before the app code runs, therefore the increase is visible there. When deleting or closing out, the minimum balance decreases after the app executes.",
+      "DocExtra": "params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender). Return: value.",
       "Groups": ["State Access"]
     },
     {
@@ -1017,6 +1138,7 @@
       "Cost": 1,
       "Size": 0,
       "Doc": "push the following program bytes to the stack",
+      "DocExtra": "pushbytes args are not added to the bytecblock during assembly processes",
       "ImmediateNote": "{varuint length} {bytes}",
       "Groups": ["Loading Values"]
     },
@@ -1027,8 +1149,248 @@
       "Cost": 1,
       "Size": 0,
       "Doc": "push immediate UINT to the stack as an integer",
+      "DocExtra": "pushint args are not added to the intcblock during assembly processes",
       "ImmediateNote": "{varuint int}",
       "Groups": ["Loading Values"]
+    },
+    {
+      "Opcode": 136,
+      "Name": "callsub",
+      "Cost": 1,
+      "Size": 3,
+      "Doc": "branch unconditionally to TARGET, saving the next instruction on the call stack",
+      "DocExtra": "The call stack is separate from the data stack. Only `callsub` and `retsub` manipulate it.`",
+      "Groups": ["Flow Control"]
+    },
+    {
+      "Opcode": 137,
+      "Name": "retsub",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "pop the top instruction from the call stack and branch to it",
+      "DocExtra": "The call stack is separate from the data stack. Only `callsub` and `retsub` manipulate it.`",
+      "Groups": ["Flow Control"]
+    },
+    {
+      "Opcode": 144,
+      "Name": "shl",
+      "Args": "UU",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A times 2^B, modulo 2^64",
+      "Groups": ["Arithmetic"]
+    },
+    {
+      "Opcode": 145,
+      "Name": "shr",
+      "Args": "UU",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A divided by 2^B",
+      "Groups": ["Arithmetic"]
+    },
+    {
+      "Opcode": 146,
+      "Name": "sqrt",
+      "Args": "U",
+      "Returns": "U",
+      "Cost": 4,
+      "Size": 1,
+      "Doc": "The largest integer X such that X^2 \u003c= A",
+      "Groups": ["Arithmetic"]
+    },
+    {
+      "Opcode": 147,
+      "Name": "bitlen",
+      "Args": ".",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "The index of the highest bit in A. If A is a byte-array, it is interpreted as a big-endian unsigned integer",
+      "DocExtra": "bitlen interprets arrays as big-endian integers, unlike setbit/getbit",
+      "Groups": ["Arithmetic"]
+    },
+    {
+      "Opcode": 148,
+      "Name": "exp",
+      "Args": "UU",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A raised to the Bth power. Panic if A == B == 0 and on overflow",
+      "Groups": ["Arithmetic"]
+    },
+    {
+      "Opcode": 149,
+      "Name": "expw",
+      "Args": "UU",
+      "Returns": "UU",
+      "Cost": 10,
+      "Size": 1,
+      "Doc": "A raised to the Bth power as a 128-bit long result as low (top) and high uint64 values on the stack. Panic if A == B == 0 or if the results exceeds 2^128-1",
+      "Groups": ["Arithmetic"]
+    },
+    {
+      "Opcode": 160,
+      "Name": "b+",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 10,
+      "Size": 1,
+      "Doc": "A plus B, where A and B are byte-arrays interpreted as big-endian unsigned integers",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 161,
+      "Name": "b-",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 10,
+      "Size": 1,
+      "Doc": "A minus B, where A and B are byte-arrays interpreted as big-endian unsigned integers. Panic on underflow.",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 162,
+      "Name": "b/",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 20,
+      "Size": 1,
+      "Doc": "A divided by B, where A and B are byte-arrays interpreted as big-endian unsigned integers. Panic if B is zero.",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 163,
+      "Name": "b*",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 20,
+      "Size": 1,
+      "Doc": "A times B, where A and B are byte-arrays interpreted as big-endian unsigned integers.",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 164,
+      "Name": "b\u003c",
+      "Args": "BB",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A is less than B, where A and B are byte-arrays interpreted as big-endian unsigned integers =\u003e { 0 or 1}",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 165,
+      "Name": "b\u003e",
+      "Args": "BB",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A is greater than B, where A and B are byte-arrays interpreted as big-endian unsigned integers =\u003e { 0 or 1}",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 166,
+      "Name": "b\u003c=",
+      "Args": "BB",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A is less than or equal to B, where A and B are byte-arrays interpreted as big-endian unsigned integers =\u003e { 0 or 1}",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 167,
+      "Name": "b\u003e=",
+      "Args": "BB",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A is greater than or equal to B, where A and B are byte-arrays interpreted as big-endian unsigned integers =\u003e { 0 or 1}",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 168,
+      "Name": "b==",
+      "Args": "BB",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A is equals to B, where A and B are byte-arrays interpreted as big-endian unsigned integers =\u003e { 0 or 1}",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 169,
+      "Name": "b!=",
+      "Args": "BB",
+      "Returns": "U",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "A is not equal to B, where A and B are byte-arrays interpreted as big-endian unsigned integers =\u003e { 0 or 1}",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 170,
+      "Name": "b%",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 20,
+      "Size": 1,
+      "Doc": "A modulo B, where A and B are byte-arrays interpreted as big-endian unsigned integers. Panic if B is zero.",
+      "Groups": ["Byteslice Arithmetic"]
+    },
+    {
+      "Opcode": 171,
+      "Name": "b|",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 6,
+      "Size": 1,
+      "Doc": "A bitwise-or B, where A and B are byte-arrays, zero-left extended to the greater of their lengths",
+      "Groups": ["Byteslice Logic"]
+    },
+    {
+      "Opcode": 172,
+      "Name": "b\u0026",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 6,
+      "Size": 1,
+      "Doc": "A bitwise-and B, where A and B are byte-arrays, zero-left extended to the greater of their lengths",
+      "Groups": ["Byteslice Logic"]
+    },
+    {
+      "Opcode": 173,
+      "Name": "b^",
+      "Args": "BB",
+      "Returns": "B",
+      "Cost": 6,
+      "Size": 1,
+      "Doc": "A bitwise-xor B, where A and B are byte-arrays, zero-left extended to the greater of their lengths",
+      "Groups": ["Byteslice Logic"]
+    },
+    {
+      "Opcode": 174,
+      "Name": "b~",
+      "Args": "B",
+      "Returns": "B",
+      "Cost": 4,
+      "Size": 1,
+      "Doc": "A with all bits inverted",
+      "Groups": ["Byteslice Logic"]
+    },
+    {
+      "Opcode": 175,
+      "Name": "bzero",
+      "Args": "U",
+      "Returns": "B",
+      "Cost": 1,
+      "Size": 1,
+      "Doc": "push a byte-array of length A, containing all zero bytes",
+      "Groups": ["Loading Values"]
     }
   ]
 }


Test patch:
diff --git a/tests/8.LogicSig.js b/tests/8.LogicSig.js
index 2c81a2e..eb114ad 100644
--- a/tests/8.LogicSig.js
+++ b/tests/8.LogicSig.js
@@ -398,6 +398,82 @@ describe('Logic validation', () => {
       ]); // int 0; int 1; swap; pop
       assert.ok(logic.checkProgram(program));
     });
+    it('should support TEAL v4 opcodes', () => {
+      assert.ok(logic.langspecEvalMaxVersion >= 4);
+
+      // divmodw
+      let program = Uint8Array.from([
+        0x04,
+        0x20,
+        0x03,
+        0x01,
+        0x00,
+        0x02,
+        0x22,
+        0x81,
+        0xd0,
+        0x0f,
+        0x23,
+        0x24,
+        0x1f,
+      ]); // int 1; pushint 2000; int 0; int 2; divmodw
+      assert.ok(logic.checkProgram(program));
+
+      // gloads i
+      program = Uint8Array.from([0x04, 0x20, 0x01, 0x00, 0x22, 0x3b, 0x00]); // int 0; gloads 0
+      assert.ok(logic.checkProgram(program));
+
+      // callsub
+      program = Uint8Array.from([
+        0x04,
+        0x20,
+        0x02,
+        0x01,
+        0x02,
+        0x22,
+        0x88,
+        0x00,
+        0x02,
+        0x23,
+        0x12,
+        0x49,
+      ]); // int 1; callsub double; int 2; ==; double: dup;
+      assert.ok(logic.checkProgram(program));
+
+      // b>=
+      program = Uint8Array.from([
+        0x04,
+        0x26,
+        0x02,
+        0x01,
+        0x11,
+        0x01,
+        0x10,
+        0x28,
+        0x29,
+        0xa7,
+      ]); // byte 0x11; byte 0x10; b>=
+      assert.ok(logic.checkProgram(program));
+
+      // b^
+      program = Uint8Array.from([
+        0x04,
+        0x26,
+        0x03,
+        0x01,
+        0x11,
+        0x01,
+        0x10,
+        0x01,
+        0x01,
+        0x28,
+        0x29,
+        0xad,
+        0x2a,
+        0x12,
+      ]); // byte 0x11; byte 0x10; b>=
+      assert.ok(logic.checkProgram(program));
+    });
   });
 });