diff --git a/buildnumber.dat b/buildnumber.dat
index 573541ac97..d00491fd7e 100644
--- a/buildnumber.dat
+++ b/buildnumber.dat
@@ -1 +1 @@
-0
+1
diff --git a/cmd/opdoc/opdoc.go b/cmd/opdoc/opdoc.go
index 226d87a78b..1a1e9941d1 100644
--- a/cmd/opdoc/opdoc.go
+++ b/cmd/opdoc/opdoc.go
@@ -245,10 +245,11 @@ type OpRecord struct {
ArgEnum []string `json:",omitempty"`
ArgEnumTypes string `json:",omitempty"`
- Doc string
- DocExtra string `json:",omitempty"`
- ImmediateNote string `json:",omitempty"`
- Groups []string
+ Doc string
+ DocExtra string `json:",omitempty"`
+ ImmediateNote string `json:",omitempty"`
+ IntroducedVersion uint64
+ Groups []string
}
// LanguageSpec records the ops of the language at some version
@@ -332,6 +333,7 @@ func buildLanguageSpec(opGroups map[string][]string) *LanguageSpec {
records[i].DocExtra = logic.OpDocExtra(spec.Name)
records[i].ImmediateNote = logic.OpImmediateNote(spec.Name)
records[i].Groups = opGroups[spec.Name]
+ records[i].IntroducedVersion = spec.Version
}
return &LanguageSpec{
EvalMaxVersion: docVersion,
diff --git a/daemon/algod/api/README.md b/daemon/algod/api/README.md
index 15c382e0c4..b23f77128d 100644
--- a/daemon/algod/api/README.md
+++ b/daemon/algod/api/README.md
@@ -9,7 +9,35 @@ The API is defined using [OpenAPI v2](https://swagger.io/specification/v2/) in *
1. Document your changes by editing **algod.oas2.json**
2. Regenerate the endpoints by running **make generate**.
-3. Update the implementation in **server/v2/handlers.go**. It is sometimes useful to consult **generated/routes.go** to make sure the handler properly implements **ServerInterface**.
+3. Update the implementation in **server/v2/handlers.go**. It is sometimes useful to consult **generated/\*/\*/routes.go** to make sure the handler properly implements **ServerInterface**.
+
+### Adding a new V2 API
+When adding a new endpoint to the V2 APIs, you will need to add `tags` to the path. The tags are a way of separating our
+APIs into groups--the motivation of which is to more easily be able to conditionally enable and/or disable groups of
+endpoints based on the use case for the node.
+
+Each API in `algod.oas2.json`, except for some pre-existing `common` APIs, should have two tags.
+1. Either `public` or `private`. This controls the type of authentication used by the API--the `public` APIs use the
+`algod.token` token, while the `private` APIs use the admin token, found in `algod.admin.token` within the algod data
+directory.
+2. The type, or group, of API. This is currently `participating`, `nonparticipating`, or `data`, but may expand in the
+future to encompass different sets of APIs such as `experimental` APIs. Additional APIs should be added to one of the
+existing sets of tags based on its use case--unless you intend to create a new group in which case you will need to
+additionally ensure your new APIs are registered.
+
+For backwards compatibility, the default set of APIs registered will always be `participating` and `nonparticipating`
+APIs.
+
+The current set of API groups and some rough descriptions of how to think about them:
+* `participating`
+ * APIs used in forming blocks/transactions and generally advancing the chain. Things which use the txn pool,
+participation keys, the agreement service, etc.
+* `nonparticipating`
+ * Generally available APIs used to do things such as fetch data. For example, GetGenesis, GetBlock, Catchpoint Catchup, etc.
+* `data`
+ * A special set of APIs which require manipulating the node state in order to provide additional data about the node state
+at some predefined granularity. For example, SetSyncRound and GetLedgerStateDelta used together control and expose StateDelta objects
+containing per-round ledger differences that get compacted when actually written to the ledger DB.
## What codegen tool is used?
diff --git a/daemon/algod/api/algod.oas2.json b/daemon/algod/api/algod.oas2.json
index 5d031442aa..ce1c9f5879 100644
--- a/daemon/algod/api/algod.oas2.json
+++ b/daemon/algod/api/algod.oas2.json
@@ -1371,7 +1371,7 @@
"get": {
"description": "Get ledger deltas for a round.",
"tags": [
- "private",
+ "public",
"data"
],
"produces": [
@@ -1861,7 +1861,7 @@
"delete": {
"description": "Unset the ledger sync round.",
"tags": [
- "private",
+ "public",
"data"
],
"schemes": [
@@ -1905,7 +1905,7 @@
"get": {
"description": "Gets the minimum sync round for the ledger.",
"tags": [
- "private",
+ "public",
"data"
],
"schemes": [
@@ -1951,7 +1951,7 @@
"post": {
"description": "Sets the minimum sync round on the ledger.",
"tags": [
- "private",
+ "public",
"data"
],
"schemes": [
diff --git a/daemon/algod/api/algod.oas3.yml b/daemon/algod/api/algod.oas3.yml
index 0f50ac905a..bbb5e85b16 100644
--- a/daemon/algod/api/algod.oas3.yml
+++ b/daemon/algod/api/algod.oas3.yml
@@ -3903,7 +3903,7 @@
},
"summary": "Get a LedgerStateDelta object for a given round",
"tags": [
- "private",
+ "public",
"data"
]
}
@@ -4019,7 +4019,7 @@
},
"summary": "Removes minimum sync round restriction from the ledger.",
"tags": [
- "private",
+ "public",
"data"
]
},
@@ -4093,7 +4093,7 @@
},
"summary": "Returns the minimum sync round the ledger is keeping in cache.",
"tags": [
- "private",
+ "public",
"data"
]
}
@@ -4165,7 +4165,7 @@
},
"summary": "Given a round, tells the ledger to keep that round in its cache.",
"tags": [
- "private",
+ "public",
"data"
]
}
diff --git a/daemon/algod/api/generated_server.yml b/daemon/algod/api/generated_server.yml
deleted file mode 100644
index 404cd35cc7..0000000000
--- a/daemon/algod/api/generated_server.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-package: generated
-generate:
- echo-server: true
- embedded-spec: true
-output-options:
- exclude-tags:
- - private
- - common
- type-mappings:
- integer: uint64
- skip-prune: true
-output: ./server/v2/generated/routes.go
diff --git a/daemon/algod/api/generated_types.yml b/daemon/algod/api/generated_types.yml
deleted file mode 100644
index 5a612cb006..0000000000
--- a/daemon/algod/api/generated_types.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-package: generated
-generate:
- models: true
-output-options:
- exclude-tags:
- - private
- - common
- type-mappings:
- integer: uint64
- skip-prune: true
-output: ./server/v2/generated/types.go
diff --git a/daemon/algod/api/private_server.yml b/daemon/algod/api/private_server.yml
deleted file mode 100644
index 9a3755acd5..0000000000
--- a/daemon/algod/api/private_server.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-package: private
-generate:
- echo-server: true
- embedded-spec: true
-output-options:
- include-tags:
- - private
- type-mappings:
- integer: uint64
- skip-prune: true
-output: ./server/v2/generated/private/routes.go
diff --git a/daemon/algod/api/private_types.yml b/daemon/algod/api/private_types.yml
deleted file mode 100644
index 74ea99716a..0000000000
--- a/daemon/algod/api/private_types.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-package: private
-generate:
- models: true
-output-options:
- include-tags:
- - private
- type-mappings:
- integer: uint64
- skip-prune: true
-output: ./server/v2/generated/private/types.go
diff --git a/daemon/algod/api/server/v2/generated/data/data_routes.yml b/daemon/algod/api/server/v2/generated/data/data_routes.yml
index 6520d51221..6de9f2be58 100644
--- a/daemon/algod/api/server/v2/generated/data/data_routes.yml
+++ b/daemon/algod/api/server/v2/generated/data/data_routes.yml
@@ -5,10 +5,10 @@ generate:
output-options:
include-tags:
- data
- - private
+ - public
exclude-tags:
- common
- - public
+ - private
- participating
- nonparticipating
type-mappings:
diff --git a/daemon/algod/api/server/v2/generated/data/routes.go b/daemon/algod/api/server/v2/generated/data/routes.go
index fdc064fb51..3e44f8c82f 100644
--- a/daemon/algod/api/server/v2/generated/data/routes.go
+++ b/daemon/algod/api/server/v2/generated/data/routes.go
@@ -296,14 +296,14 @@ var swaggerSpec = []string{
"W6/35MO4p8nAT2e09AwUczUMkUuYI1AfYp/tVLNodMcHtWWHqjDdfsRSLGisxmP1/Pj4YC/2dnARebq3",
"HYCXVbFzL4+fHQySZkRzBIwzjs5nw4qIZbUIwcuHg+A16r9caLJgPLPPj2mKVGG3GAH66uEA0mztjcYc",
"n14EhTz/iwNSyIh9MbISzQm2tNO/eLjpz0FesxTIBawLIalk+Zb8zKu80aCKWZd3/MyvuLjhHnIjvZTr",
- "NZVbx1coaZ8P/0qt5THB+9Lm2qRLhVZjya4pypEo3X+8dQzNHp8jrKKzrfmc/3nLXdpWDjH/+89cgVc5",
- "bL72lqd9XA4bn295+r5iPR0GgsT6gHRyXsGLRwgdtP8UPOTP03L/0/Ie1uIaFHEXWUCcRILRWqy3C8MV",
- "axqeDZ2aae9972zn3am836AevXP57zgU47ehqYoO+N9HwbkjYMYOP+b9/+p9/VaWhJ3qUWyHJn9ygj85",
- "wQE5gS4l7z2iwQWGQWRQuPJdKU1XMNvjGt3yNFQOChGrk3I+wC1cdYg+ZnHeZBb/girCQ5/r15T7A93Y",
- "chu2QGXOQFZkQHm3YMefbOC/j/iMorFTw6dEQ56r8PBrgYffGtJdcDC3EQljGUH7ffjYz0efms+uNQwi",
- "alXqTNwEfdGBab3vXTtJ9WJ34++jG8p0shDSRQZjTeluZw00P3KFR1q/1rm+nS+YwBz8GNhU4r8eVfX0",
- "oh/bxqrYV2es8Y1qa3Ro3UUeWNl1P3w0HAgrvjr2WBsrT46OMJxuJZQ+mtxOP7UMmeHHj9Wm+4Jr1ebf",
- "frz9/wEAAP//msdBKCzJAAA=",
+ "NZVbx1coaZ8P/0qt5THB+9Lm2qRLhVZjfPpiMrWR9B9vHT+zp+cIi+hsazbnf95yl7WVQ8z9/jNX4DUO",
+ "m6695Wkfk8PG51uevq84T4d/IK0+IJmcV/DiCUL/7D8FC/nzsNz/sLyHtbgGRdw9FhAnkWCUFuvswmjF",
+ "moZnA4dm2nvbO8t5dybvNagH71z9O87E+F1oKqID3vdRcO4Il7HDj3n9v3pdv5UjYad6FNugyZ+M4E9G",
+ "cEBGoEvJe49ocH9hCBkUrnhXStMVzMZfoluehppBIWJFUs4HmIUrDdHHK86bvOJfUD946GP9mnJ/nhs7",
+ "bmMWqMwZyIoKKO9W6/iTC/z3kZ1RLnY6+JRoyHMVnn0t8OxbK7qLDOY2HGEkH2i/DR/7+ehT88m1hjFE",
+ "rUqdiZugLzovree9ayOpXutu/H10Q5lOFkK6qGCsJ93trIHmR67oSOvXOs+38wWTl4MfA3tK/NejqpZe",
+ "9GPbUBX76gw1vlFtiQ4tu8gCK5vuh4+GAWG1V8cda0PlydERhtKthNJHk9vpp5YRM/z4sdpzX2xtUkh2",
+ "jbnbH2//fwAAAP//SDOA3yjJAAA=",
}
// GetSwagger returns the content of the embedded swagger specification file
diff --git a/data/pools/transactionPool.go b/data/pools/transactionPool.go
index a4670c3020..44852c3459 100644
--- a/data/pools/transactionPool.go
+++ b/data/pools/transactionPool.go
@@ -585,6 +585,7 @@ func (pool *TransactionPool) addToPendingBlockEvaluatorOnce(txgroup []transactio
Round: r,
FirstValid: tx.Txn.FirstValid,
LastValid: tx.Txn.LastValid,
+ Early: false,
}
}
}
diff --git a/data/transactions/error.go b/data/transactions/error.go
index d29db15fc8..86ce011023 100644
--- a/data/transactions/error.go
+++ b/data/transactions/error.go
@@ -41,6 +41,7 @@ type TxnDeadError struct {
Round basics.Round
FirstValid basics.Round
LastValid basics.Round
+ Early bool
}
func (err *TxnDeadError) Error() string {
diff --git a/data/transactions/logic/eval.go b/data/transactions/logic/eval.go
index f89da449bc..ab03e0f954 100644
--- a/data/transactions/logic/eval.go
+++ b/data/transactions/logic/eval.go
@@ -583,12 +583,12 @@ type EvalContext struct {
// Set of PC values that branches we've seen so far might
// go. So, if checkStep() skips one, that branch is trying to
// jump into the middle of a multibyte instruction
- branchTargets map[int]bool
+ branchTargets []bool
// Set of PC values that we have begun a checkStep() with. So
// if a back jump is going to a value that isn't here, it's
// jumping into the middle of multibyte instruction.
- instructionStarts map[int]bool
+ instructionStarts []bool
programHashCached crypto.Digest
@@ -933,8 +933,8 @@ func check(program []byte, params *EvalParams, mode runMode) (err error) {
cx.EvalParams = params
cx.runModeFlags = mode
cx.program = program
- cx.branchTargets = make(map[int]bool)
- cx.instructionStarts = make(map[int]bool)
+ cx.branchTargets = make([]bool, len(program)+1) // teal v2 allowed jumping to the end of the prog
+ cx.instructionStarts = make([]bool, len(program)+1)
maxCost := cx.remainingBudget()
staticCost := 0
@@ -1229,7 +1229,7 @@ func (cx *EvalContext) checkStep() (int, error) {
fmt.Fprintf(cx.Trace, "%3d %s\n", prevpc, spec.Name)
}
for pc := prevpc + 1; pc < cx.pc; pc++ {
- if _, ok := cx.branchTargets[pc]; ok {
+ if pc < len(cx.branchTargets) && cx.branchTargets[pc] {
return 0, fmt.Errorf("branch target %d is not an aligned instruction", pc)
}
}
@@ -2183,7 +2183,7 @@ func checkBranch(cx *EvalContext) error {
}
if target < cx.pc+3 {
// If a branch goes backwards, we should have already noted that an instruction began at that location.
- if _, ok := cx.instructionStarts[target]; !ok {
+ if ok := cx.instructionStarts[target]; !ok {
return fmt.Errorf("back branch target %d is not an aligned instruction", target)
}
}
@@ -2204,7 +2204,7 @@ func checkSwitch(cx *EvalContext) error {
if target < eoi {
// If a branch goes backwards, we should have already noted that an instruction began at that location.
- if _, ok := cx.instructionStarts[target]; !ok {
+ if ok := cx.instructionStarts[target]; !ok {
return fmt.Errorf("back branch target %d is not an aligned instruction", target)
}
}
diff --git a/data/transactions/logic/evalBench_test.go b/data/transactions/logic/evalBench_test.go
new file mode 100644
index 0000000000..956e1441e1
--- /dev/null
+++ b/data/transactions/logic/evalBench_test.go
@@ -0,0 +1,48 @@
+// Copyright (C) 2019-2022 Algorand, Inc.
+// This file is part of go-algorand
+//
+// go-algorand is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// go-algorand is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with go-algorand. If not, see .
+
+package logic_test
+
+import (
+ "testing"
+
+ "github.com/algorand/go-algorand/config"
+ "github.com/algorand/go-algorand/data/transactions"
+ "github.com/algorand/go-algorand/data/transactions/logic"
+ "github.com/algorand/go-algorand/data/txntest"
+ "github.com/algorand/go-algorand/protocol"
+ "github.com/stretchr/testify/require"
+)
+
+func BenchmarkCheckSignature(b *testing.B) {
+ proto := config.Consensus[protocol.ConsensusCurrentVersion]
+ txns := txntest.CreateTinyManTxGroup(b, true)
+ ops, err := logic.AssembleString(txntest.TmLsig)
+ require.NoError(b, err)
+ stxns := []transactions.SignedTxn{{Txn: txns[3].Txn(), Lsig: transactions.LogicSig{Logic: ops.Program}}}
+ txgroup := transactions.WrapSignedTxnsWithAD(stxns)
+ ep := logic.EvalParams{
+ Proto: &proto,
+ TxnGroup: txgroup,
+ SigLedger: &logic.NoHeaderLedger{},
+ }
+ b.ResetTimer()
+
+ for i := 0; i < b.N; i++ {
+ err = logic.CheckSignature(0, &ep)
+ require.NoError(b, err)
+ }
+}
diff --git a/data/transactions/logic/eval_test.go b/data/transactions/logic/eval_test.go
index 1529186e33..5fcbd3f193 100644
--- a/data/transactions/logic/eval_test.go
+++ b/data/transactions/logic/eval_test.go
@@ -397,6 +397,46 @@ byte base64 5rZMNsevs5sULO+54aN+OvU6lQ503z2X+SSYUABIx7E=
}
}
+func TestBranchEnd(t *testing.T) {
+ partitiontest.PartitionTest(t)
+
+ t.Parallel()
+ for v := uint64(2); v <= AssemblerMaxVersion; v++ {
+ t.Run(fmt.Sprintf("v=%d", v), func(t *testing.T) {
+ ops := testProg(t, `int 1
+b end
+end:
+`, v)
+ var txn transactions.SignedTxn
+ txn.Lsig.Logic = ops.Program
+ ep := defaultEvalParams(txn)
+ err := CheckSignature(0, ep)
+ require.NoError(t, err)
+ })
+ }
+ for v := uint64(2); v <= AssemblerMaxVersion; v++ {
+ t.Run(fmt.Sprintf("v=%d", v), func(t *testing.T) {
+ ops := testProg(t, `int 1
+return
+`, v)
+ var txn transactions.SignedTxn
+ txn.Lsig.Logic = ops.Program
+ ep := defaultEvalParams(txn)
+ err := CheckSignature(0, ep)
+ require.NoError(t, err)
+ })
+ }
+
+ // now craft pushint \x01 + cut program and ensure the checker does not fail
+ // this \x01 varint value forces nextpc=3 with program length=3
+ pushint := OpsByName[LogicVersion]["pushint"]
+ var txn transactions.SignedTxn
+ txn.Lsig.Logic = []byte{LogicVersion, pushint.Opcode, 0x01}
+ ep := defaultEvalParams(txn)
+ err := CheckSignature(0, ep)
+ require.NoError(t, err)
+}
+
const tlhcProgramText = `txn CloseRemainderTo
addr DFPKC2SJP3OTFVJFMCD356YB7BOT4SJZTGWLIPPFEWL3ZABUFLTOY6ILYE
==
diff --git a/data/transactions/logic/langspec.json b/data/transactions/logic/langspec.json
index f4054ff144..148f83e073 100644
--- a/data/transactions/logic/langspec.json
+++ b/data/transactions/logic/langspec.json
@@ -7,6 +7,7 @@
"Name": "err",
"Size": 1,
"Doc": "Fail immediately.",
+ "IntroducedVersion": 1,
"Groups": [
"Flow Control"
]
@@ -18,6 +19,7 @@
"Returns": "B",
"Size": 1,
"Doc": "SHA256 hash of value A, yields [32]byte",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -29,6 +31,7 @@
"Returns": "B",
"Size": 1,
"Doc": "Keccak256 hash of value A, yields [32]byte",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -40,6 +43,7 @@
"Returns": "B",
"Size": 1,
"Doc": "SHA512_256 hash of value A, yields [32]byte",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -52,6 +56,7 @@
"Size": 1,
"Doc": "for (data A, signature B, pubkey C) verify the signature of (\"ProgData\" || program_hash || data) against the pubkey =\u003e {0 or 1}",
"DocExtra": "The 32 byte public key is the last element on the stack, preceded by the 64 byte signature at the second-to-last element on the stack, preceded by the data which was signed at the third-to-last element on the stack.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -65,6 +70,7 @@
"Doc": "for (data A, signature B, C and pubkey D, E) verify the signature of the data against the pubkey =\u003e {0 or 1}",
"DocExtra": "The 32 byte Y-component of a public key is the last element on the stack, preceded by X-component of a pubkey, preceded by S and R components of a signature, preceded by the data that is fifth element on the stack. All values are big-endian encoded. The signed data must be 32 bytes long, and signatures in lower-S form are only accepted.",
"ImmediateNote": "{uint8 curve index}",
+ "IntroducedVersion": 5,
"Groups": [
"Arithmetic"
]
@@ -78,6 +84,7 @@
"Doc": "decompress pubkey A into components X, Y",
"DocExtra": "The 33 byte public key in a compressed form to be decompressed into X and Y (top) components. All values are big-endian encoded.",
"ImmediateNote": "{uint8 curve index}",
+ "IntroducedVersion": 5,
"Groups": [
"Arithmetic"
]
@@ -91,6 +98,7 @@
"Doc": "for (data A, recovery id B, signature C, D) recover a public key",
"DocExtra": "S (top) and R elements of a signature, recovery id and data (bottom) are expected on the stack and used to deriver a public key. All values are big-endian encoded. The signed data must be 32 bytes long.",
"ImmediateNote": "{uint8 curve index}",
+ "IntroducedVersion": 5,
"Groups": [
"Arithmetic"
]
@@ -103,6 +111,7 @@
"Size": 1,
"Doc": "A plus B. Fail on overflow.",
"DocExtra": "Overflow is an error condition which halts execution and fails the transaction. Full precision is available from `addw`.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -114,6 +123,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A minus B. Fail if B \u003e A.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -126,6 +136,7 @@
"Size": 1,
"Doc": "A divided by B (truncated division). Fail if B == 0.",
"DocExtra": "`divmodw` is available to divide the two-element values produced by `mulw` and `addw`.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -138,6 +149,7 @@
"Size": 1,
"Doc": "A times B. Fail on overflow.",
"DocExtra": "Overflow is an error condition which halts execution and fails the transaction. Full precision is available from `mulw`.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -149,6 +161,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A less than B =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -160,6 +173,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A greater than B =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -171,6 +185,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A less than or equal to B =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -182,6 +197,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A greater than or equal to B =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -193,6 +209,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A is not zero and B is not zero =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -204,6 +221,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A is not zero or B is not zero =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -215,6 +233,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A is equal to B =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -226,6 +245,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A is not equal to B =\u003e {0 or 1}",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -237,6 +257,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A == 0 yields 1; else 0",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -248,6 +269,7 @@
"Returns": "U",
"Size": 1,
"Doc": "yields length of byte value A",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -259,6 +281,7 @@
"Returns": "B",
"Size": 1,
"Doc": "converts uint64 A to big-endian byte array, always of length 8",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -271,6 +294,7 @@
"Size": 1,
"Doc": "converts big-endian byte array A to uint64. Fails if len(A) \u003e 8. Padded by leading 0s if len(A) \u003c 8.",
"DocExtra": "`btoi` fails if the input is longer than 8 bytes.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -282,6 +306,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A modulo B. Fail if B == 0.",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -293,6 +318,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A bitwise-or B",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -304,6 +330,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A bitwise-and B",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -315,6 +342,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A bitwise-xor B",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -326,6 +354,7 @@
"Returns": "U",
"Size": 1,
"Doc": "bitwise invert value A",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -337,6 +366,7 @@
"Returns": "UU",
"Size": 1,
"Doc": "A times B as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low",
+ "IntroducedVersion": 1,
"Groups": [
"Arithmetic"
]
@@ -348,6 +378,7 @@
"Returns": "UU",
"Size": 1,
"Doc": "A plus B as a 128-bit result. X is the carry-bit, Y is the low-order 64 bits.",
+ "IntroducedVersion": 2,
"Groups": [
"Arithmetic"
]
@@ -360,6 +391,7 @@
"Size": 1,
"Doc": "W,X = (A,B / C,D); Y,Z = (A,B modulo C,D)",
"DocExtra": "The notation J,K indicates that two uint64 values J and K are interpreted as a uint128 value, with J as the high uint64 and K the low.",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -371,6 +403,7 @@
"Doc": "prepare block of uint64 constants for use by intc",
"DocExtra": "`intcblock` loads following program bytes into an array of integer constants in the evaluator. These integer constants can be referred to by `intc` and `intc_*` which will push the value onto the stack. Subsequent calls to `intcblock` reset and replace the integer constants available to the script.",
"ImmediateNote": "{varuint count} [{varuint value}, ...]",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -382,6 +415,7 @@
"Size": 2,
"Doc": "Ith constant from intcblock",
"ImmediateNote": "{uint8 int constant index}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -392,6 +426,7 @@
"Returns": "U",
"Size": 1,
"Doc": "constant 0 from intcblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -402,6 +437,7 @@
"Returns": "U",
"Size": 1,
"Doc": "constant 1 from intcblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -412,6 +448,7 @@
"Returns": "U",
"Size": 1,
"Doc": "constant 2 from intcblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -422,6 +459,7 @@
"Returns": "U",
"Size": 1,
"Doc": "constant 3 from intcblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -433,6 +471,7 @@
"Doc": "prepare block of byte-array constants for use by bytec",
"DocExtra": "`bytecblock` loads the following program bytes into an array of byte-array constants in the evaluator. These constants can be referred to by `bytec` and `bytec_*` which will push the value onto the stack. Subsequent calls to `bytecblock` reset and replace the bytes constants available to the script.",
"ImmediateNote": "{varuint count} [({varuint value length} bytes), ...]",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -444,6 +483,7 @@
"Size": 2,
"Doc": "Ith constant from bytecblock",
"ImmediateNote": "{uint8 byte constant index}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -454,6 +494,7 @@
"Returns": "B",
"Size": 1,
"Doc": "constant 0 from bytecblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -464,6 +505,7 @@
"Returns": "B",
"Size": 1,
"Doc": "constant 1 from bytecblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -474,6 +516,7 @@
"Returns": "B",
"Size": 1,
"Doc": "constant 2 from bytecblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -484,6 +527,7 @@
"Returns": "B",
"Size": 1,
"Doc": "constant 3 from bytecblock",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -495,6 +539,7 @@
"Size": 2,
"Doc": "Nth LogicSig argument",
"ImmediateNote": "{uint8 arg index N}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -505,6 +550,7 @@
"Returns": "B",
"Size": 1,
"Doc": "LogicSig argument 0",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -515,6 +561,7 @@
"Returns": "B",
"Size": 1,
"Doc": "LogicSig argument 1",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -525,6 +572,7 @@
"Returns": "B",
"Size": 1,
"Doc": "LogicSig argument 2",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -535,6 +583,7 @@
"Returns": "B",
"Size": 1,
"Doc": "LogicSig argument 3",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -617,6 +666,7 @@
"ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUUUUBUUUBBBUBU",
"Doc": "field F of current transaction",
"ImmediateNote": "{uint8 transaction field index}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -646,6 +696,7 @@
"ArgEnumTypes": "UUUBUUUUUBBBUUB",
"Doc": "global field F",
"ImmediateNote": "{uint8 global field index}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -729,6 +780,7 @@
"Doc": "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}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -740,6 +792,7 @@
"Size": 2,
"Doc": "Ith scratch space value. All scratch spaces are 0 at program start.",
"ImmediateNote": "{uint8 position in scratch space to load from}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -751,6 +804,7 @@
"Size": 2,
"Doc": "store A to the Ith scratch space",
"ImmediateNote": "{uint8 position in scratch space to store to}",
+ "IntroducedVersion": 1,
"Groups": [
"Loading Values"
]
@@ -772,6 +826,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ith value of the array field F of the current transaction\n`txna` can be called using `txn` with 2 immediates.",
"ImmediateNote": "{uint8 transaction field index} {uint8 transaction field array index}",
+ "IntroducedVersion": 2,
"Groups": [
"Loading Values"
]
@@ -793,6 +848,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ith value of the array field F from the Tth transaction in the current group\n`gtxna` can be called using `gtxn` with 3 immediates.",
"ImmediateNote": "{uint8 transaction group index} {uint8 transaction field index} {uint8 transaction field array index}",
+ "IntroducedVersion": 2,
"Groups": [
"Loading Values"
]
@@ -877,6 +933,7 @@
"Doc": "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}",
+ "IntroducedVersion": 3,
"Groups": [
"Loading Values"
]
@@ -899,6 +956,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ith value of the array field F from the Ath transaction in the current group\n`gtxnsa` can be called using `gtxns` with 2 immediates.",
"ImmediateNote": "{uint8 transaction field index} {uint8 transaction field array index}",
+ "IntroducedVersion": 3,
"Groups": [
"Loading Values"
]
@@ -911,6 +969,7 @@
"Doc": "Ith scratch space value of the Tth transaction in the current group",
"DocExtra": "`gload` fails unless the requested transaction is an ApplicationCall and T \u003c GroupIndex.",
"ImmediateNote": "{uint8 transaction group index} {uint8 position in scratch space to load from}",
+ "IntroducedVersion": 4,
"Groups": [
"Loading Values"
]
@@ -924,6 +983,7 @@
"Doc": "Ith scratch space value of the Ath transaction in the current group",
"DocExtra": "`gloads` fails unless the requested transaction is an ApplicationCall and A \u003c GroupIndex.",
"ImmediateNote": "{uint8 position in scratch space to load from}",
+ "IntroducedVersion": 4,
"Groups": [
"Loading Values"
]
@@ -936,6 +996,7 @@
"Doc": "ID of the asset or application created in the Tth transaction of the current group",
"DocExtra": "`gaid` fails unless the requested transaction created an asset or application and T \u003c GroupIndex.",
"ImmediateNote": "{uint8 transaction group index}",
+ "IntroducedVersion": 4,
"Groups": [
"Loading Values"
]
@@ -948,6 +1009,7 @@
"Size": 1,
"Doc": "ID of the asset or application created in the Ath transaction of the current group",
"DocExtra": "`gaids` fails unless the requested transaction created an asset or application and A \u003c GroupIndex.",
+ "IntroducedVersion": 4,
"Groups": [
"Loading Values"
]
@@ -959,6 +1021,7 @@
"Returns": ".",
"Size": 1,
"Doc": "Ath scratch space value. All scratch spaces are 0 at program start.",
+ "IntroducedVersion": 5,
"Groups": [
"Loading Values"
]
@@ -969,6 +1032,7 @@
"Args": "U.",
"Size": 1,
"Doc": "store B to the Ath scratch space",
+ "IntroducedVersion": 5,
"Groups": [
"Loading Values"
]
@@ -981,6 +1045,7 @@
"Doc": "branch to TARGET if value A 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 aligned instructions. (e.g. Branching to the second byte of a 2 byte op will be rejected.) Starting at v4, the offset is treated as a signed 16 bit integer allowing for backward branches and looping. In prior version (v1 to v3), branch offsets are limited to forward branches only, 0-0x7fff.\n\nAt v2 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 v2, 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}",
+ "IntroducedVersion": 1,
"Groups": [
"Flow Control"
]
@@ -993,6 +1058,7 @@
"Doc": "branch to TARGET if value A is zero",
"DocExtra": "See `bnz` for details on how branches work. `bz` inverts the behavior of `bnz`.",
"ImmediateNote": "{int16 branch offset, big-endian}",
+ "IntroducedVersion": 2,
"Groups": [
"Flow Control"
]
@@ -1004,6 +1070,7 @@
"Doc": "branch unconditionally to TARGET",
"DocExtra": "See `bnz` for details on how branches work. `b` always jumps to the offset.",
"ImmediateNote": "{int16 branch offset, big-endian}",
+ "IntroducedVersion": 2,
"Groups": [
"Flow Control"
]
@@ -1014,6 +1081,7 @@
"Args": "U",
"Size": 1,
"Doc": "use A as success value; end",
+ "IntroducedVersion": 2,
"Groups": [
"Flow Control"
]
@@ -1024,6 +1092,7 @@
"Args": "U",
"Size": 1,
"Doc": "immediately fail unless A is a non-zero number",
+ "IntroducedVersion": 3,
"Groups": [
"Flow Control"
]
@@ -1035,6 +1104,7 @@
"Size": 2,
"Doc": "replace the Nth value from the top of the stack with A. bury 0 fails.",
"ImmediateNote": "{uint8 depth}",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1045,6 +1115,7 @@
"Size": 2,
"Doc": "remove N values from the top of the stack",
"ImmediateNote": "{uint8 stack depth}",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1056,6 +1127,7 @@
"Size": 2,
"Doc": "duplicate A, N times",
"ImmediateNote": "{uint8 copy count}",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1066,6 +1138,7 @@
"Args": ".",
"Size": 1,
"Doc": "discard A",
+ "IntroducedVersion": 1,
"Groups": [
"Flow Control"
]
@@ -1077,6 +1150,7 @@
"Returns": "..",
"Size": 1,
"Doc": "duplicate A",
+ "IntroducedVersion": 1,
"Groups": [
"Flow Control"
]
@@ -1088,6 +1162,7 @@
"Returns": "....",
"Size": 1,
"Doc": "duplicate A and B",
+ "IntroducedVersion": 2,
"Groups": [
"Flow Control"
]
@@ -1100,6 +1175,7 @@
"Size": 2,
"Doc": "Nth value from the top of the stack. dig 0 is equivalent to dup",
"ImmediateNote": "{uint8 depth}",
+ "IntroducedVersion": 3,
"Groups": [
"Flow Control"
]
@@ -1111,6 +1187,7 @@
"Returns": "..",
"Size": 1,
"Doc": "swaps A and B on stack",
+ "IntroducedVersion": 3,
"Groups": [
"Flow Control"
]
@@ -1122,6 +1199,7 @@
"Returns": ".",
"Size": 1,
"Doc": "selects one of two values based on top-of-stack: B if C != 0, else A",
+ "IntroducedVersion": 3,
"Groups": [
"Flow Control"
]
@@ -1134,6 +1212,7 @@
"Size": 2,
"Doc": "remove top of stack, and place it deeper in the stack such that N elements are above it. Fails if stack depth \u003c= N.",
"ImmediateNote": "{uint8 depth}",
+ "IntroducedVersion": 5,
"Groups": [
"Flow Control"
]
@@ -1146,6 +1225,7 @@
"Size": 2,
"Doc": "remove the value at depth N in the stack and shift above items down so the Nth deep value is on top of the stack. Fails if stack depth \u003c= N.",
"ImmediateNote": "{uint8 depth}",
+ "IntroducedVersion": 5,
"Groups": [
"Flow Control"
]
@@ -1158,6 +1238,7 @@
"Size": 1,
"Doc": "join A and B",
"DocExtra": "`concat` fails if the result would be greater than 4096 bytes.",
+ "IntroducedVersion": 2,
"Groups": [
"Arithmetic"
]
@@ -1170,6 +1251,7 @@
"Size": 3,
"Doc": "A range of bytes from A starting at S up to but not including E. If E \u003c S, or either is larger than the array length, the program fails",
"ImmediateNote": "{uint8 start position} {uint8 end position}",
+ "IntroducedVersion": 2,
"Groups": [
"Byte Array Manipulation"
]
@@ -1181,6 +1263,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A range of bytes from A starting at B up to but not including C. If C \u003c B, or either is larger than the array length, the program fails",
+ "IntroducedVersion": 2,
"Groups": [
"Byte Array Manipulation"
]
@@ -1193,6 +1276,7 @@
"Size": 1,
"Doc": "Bth bit of (byte-array or integer) A. If B is greater than or equal to the bit length of the value (8*byte length), the program fails",
"DocExtra": "see explanation of bit ordering in setbit",
+ "IntroducedVersion": 3,
"Groups": [
"Arithmetic"
]
@@ -1205,6 +1289,7 @@
"Size": 1,
"Doc": "Copy of (byte-array or integer) A, with the Bth bit set to (0 or 1) C. If B is greater than or equal to the bit length of the value (8*byte length), the program fails",
"DocExtra": "When A is a uint64, index 0 is the least significant bit. Setting bit 3 to 1 on the integer 0 yields 8, or 2^3. When A is a byte array, index 0 is the leftmost bit of the leftmost byte. Setting bits 0 through 11 to 1 in a 4-byte-array of 0s yields the byte array 0xfff00000. Setting bit 3 to 1 on the 1-byte-array 0x00 yields the byte array 0x10.",
+ "IntroducedVersion": 3,
"Groups": [
"Arithmetic"
]
@@ -1216,6 +1301,7 @@
"Returns": "U",
"Size": 1,
"Doc": "Bth byte of A, as an integer. If B is greater than or equal to the array length, the program fails",
+ "IntroducedVersion": 3,
"Groups": [
"Arithmetic"
]
@@ -1227,6 +1313,7 @@
"Returns": "B",
"Size": 1,
"Doc": "Copy of A with the Bth byte set to small integer (between 0..255) C. If B is greater than or equal to the array length, the program fails",
+ "IntroducedVersion": 3,
"Groups": [
"Arithmetic"
]
@@ -1239,6 +1326,7 @@
"Size": 3,
"Doc": "A range of bytes from A starting at S up to but not including S+L. If L is 0, then extract to the end of the string. If S or S+L is larger than the array length, the program fails",
"ImmediateNote": "{uint8 start position} {uint8 length}",
+ "IntroducedVersion": 5,
"Groups": [
"Byte Array Manipulation"
]
@@ -1250,6 +1338,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A range of bytes from A starting at B up to but not including B+C. If B+C is larger than the array length, the program fails\n`extract3` can be called using `extract` with no immediates.",
+ "IntroducedVersion": 5,
"Groups": [
"Byte Array Manipulation"
]
@@ -1261,6 +1350,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A uint16 formed from a range of big-endian bytes from A starting at B up to but not including B+2. If B+2 is larger than the array length, the program fails",
+ "IntroducedVersion": 5,
"Groups": [
"Byte Array Manipulation"
]
@@ -1272,6 +1362,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A uint32 formed from a range of big-endian bytes from A starting at B up to but not including B+4. If B+4 is larger than the array length, the program fails",
+ "IntroducedVersion": 5,
"Groups": [
"Byte Array Manipulation"
]
@@ -1283,6 +1374,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A uint64 formed from a range of big-endian bytes from A starting at B up to but not including B+8. If B+8 is larger than the array length, the program fails",
+ "IntroducedVersion": 5,
"Groups": [
"Byte Array Manipulation"
]
@@ -1295,6 +1387,7 @@
"Size": 2,
"Doc": "Copy of A with the bytes starting at S replaced by the bytes of B. Fails if S+len(B) exceeds len(A)\n`replace2` can be called using `replace` with 1 immediate.",
"ImmediateNote": "{uint8 start position}",
+ "IntroducedVersion": 7,
"Groups": [
"Byte Array Manipulation"
]
@@ -1306,6 +1399,7 @@
"Returns": "B",
"Size": 1,
"Doc": "Copy of A with the bytes starting at B replaced by the bytes of C. Fails if B+len(C) exceeds len(A)\n`replace3` can be called using `replace` with no immediates.",
+ "IntroducedVersion": 7,
"Groups": [
"Byte Array Manipulation"
]
@@ -1319,6 +1413,7 @@
"Doc": "decode A which was base64-encoded using _encoding_ E. Fail if A is not base64 encoded with encoding E",
"DocExtra": "*Warning*: Usage should be restricted to very rare use cases. In almost all cases, smart contracts should directly handle non-encoded byte-strings.\tThis opcode should only be used in cases where base64 is the only available option, e.g. interoperability with a third-party that only signs base64 strings.\n\n Decodes A using the base64 encoding E. Specify the encoding with an immediate arg either as URL and Filename Safe (`URLEncoding`) or Standard (`StdEncoding`). See [RFC 4648 sections 4 and 5](https://rfc-editor.org/rfc/rfc4648.html#section-4). It is assumed that the encoding ends with the exact number of `=` padding characters as required by the RFC. When padding occurs, any unused pad bits in the encoding must be set to zero or the decoding will fail. The special cases of `\\n` and `\\r` are allowed but completely ignored. An error will result when attempting to decode a string with a character that is not in the encoding alphabet or not one of `=`, `\\r`, or `\\n`.",
"ImmediateNote": "{uint8 encoding index}",
+ "IntroducedVersion": 7,
"Groups": [
"Byte Array Manipulation"
]
@@ -1332,6 +1427,7 @@
"Doc": "key B's value, of type R, from a [valid](jsonspec.md) utf-8 encoded json object A",
"DocExtra": "*Warning*: Usage should be restricted to very rare use cases, as JSON decoding is expensive and quite limited. In addition, JSON objects are large and not optimized for size.\n\nAlmost all smart contracts should use simpler and smaller methods (such as the [ABI](https://arc.algorand.foundation/ARCs/arc-0004). This opcode should only be used in cases where JSON is only available option, e.g. when a third-party only signs JSON.",
"ImmediateNote": "{uint8 return type}",
+ "IntroducedVersion": 7,
"Groups": [
"Byte Array Manipulation"
]
@@ -1344,6 +1440,7 @@
"Size": 1,
"Doc": "balance for 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. Changes caused by inner transactions are observable immediately following `itxn_submit`",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: value.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1356,6 +1453,7 @@
"Size": 1,
"Doc": "1 if account A is opted in to application B, else 0",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: 1 if opted in and 0 otherwise.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1368,6 +1466,7 @@
"Size": 1,
"Doc": "local state of the key B in the current application in account A",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key. Return: value. The value is zero (of type uint64) if the key does not exist.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1380,6 +1479,7 @@
"Size": 1,
"Doc": "X is the local state of application B, key C in account A. Y is 1 if key existed, else 0",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset), state key. Return: did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1392,6 +1492,7 @@
"Size": 1,
"Doc": "global state of the key A in the current application",
"DocExtra": "params: state key. Return: value. The value is zero (of type uint64) if the key does not exist.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1404,6 +1505,7 @@
"Size": 1,
"Doc": "X is the global state of application A, key B. Y is 1 if key existed, else 0",
"DocExtra": "params: Txn.ForeignApps offset (or, since v4, an _available_ application id), state key. Return: did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1415,6 +1517,7 @@
"Size": 1,
"Doc": "write C to key B in account A's local state of the current application",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key, value.",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1425,6 +1528,7 @@
"Args": "B.",
"Size": 1,
"Doc": "write B to key A in the global state of the current application",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1436,6 +1540,7 @@
"Size": 1,
"Doc": "delete key B from account A's local state of the current application",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), 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.)",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1447,6 +1552,7 @@
"Size": 1,
"Doc": "delete key A from the global state of the current application",
"DocExtra": "params: state key.\n\nDeleting a key which is already absent has no effect on the application global state. (In particular, it does _not_ cause the program to fail.)",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1465,6 +1571,7 @@
"Doc": "X is field F from account A's holding of asset B. Y is 1 if A is opted into B, else 0",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ address), asset id (or, since v4, a Txn.ForeignAssets offset). Return: did_exist flag (1 if the asset existed and 0 otherwise), value.",
"ImmediateNote": "{uint8 asset holding field index}",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1493,6 +1600,7 @@
"Doc": "X is field F from asset A. Y is 1 if A exists, else 0",
"DocExtra": "params: Txn.ForeignAssets offset (or, since v4, an _available_ asset id. Return: did_exist flag (1 if the asset existed and 0 otherwise), value.",
"ImmediateNote": "{uint8 asset params field index}",
+ "IntroducedVersion": 2,
"Groups": [
"State Access"
]
@@ -1518,6 +1626,7 @@
"Doc": "X is field F from app A. Y is 1 if A exists, else 0",
"DocExtra": "params: Txn.ForeignApps offset or an _available_ app id. Return: did_exist flag (1 if the application existed and 0 otherwise), value.",
"ImmediateNote": "{uint8 app params field index}",
+ "IntroducedVersion": 5,
"Groups": [
"State Access"
]
@@ -1545,6 +1654,7 @@
"ArgEnumTypes": "UUBUUUUUUUUU",
"Doc": "X is field F from account A. Y is 1 if A owns positive algos, else 0",
"ImmediateNote": "{uint8 account params field index}",
+ "IntroducedVersion": 6,
"Groups": [
"State Access"
]
@@ -1557,6 +1667,7 @@
"Size": 1,
"Doc": "minimum required balance for account A, in microalgos. Required balance is affected by ASA, App, and Box 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. Changes caused by inner transactions or box usage are observable immediately following the opcode effecting the change.",
"DocExtra": "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: value.",
+ "IntroducedVersion": 3,
"Groups": [
"State Access"
]
@@ -1569,6 +1680,7 @@
"Doc": "immediate BYTES",
"DocExtra": "pushbytes args are not added to the bytecblock during assembly processes",
"ImmediateNote": "{varuint length} {bytes}",
+ "IntroducedVersion": 3,
"Groups": [
"Loading Values"
]
@@ -1581,6 +1693,7 @@
"Doc": "immediate UINT",
"DocExtra": "pushint args are not added to the intcblock during assembly processes",
"ImmediateNote": "{varuint int}",
+ "IntroducedVersion": 3,
"Groups": [
"Loading Values"
]
@@ -1592,6 +1705,7 @@
"Doc": "push sequences of immediate byte arrays to stack (first byte array being deepest)",
"DocExtra": "pushbytess args are not added to the bytecblock during assembly processes",
"ImmediateNote": "{varuint count} [({varuint value length} bytes), ...]",
+ "IntroducedVersion": 8,
"Groups": [
"Loading Values"
]
@@ -1603,6 +1717,7 @@
"Doc": "push sequence of immediate uints to stack in the order they appear (first uint being deepest)",
"DocExtra": "pushints args are not added to the intcblock during assembly processes",
"ImmediateNote": "{varuint count} [{varuint value}, ...]",
+ "IntroducedVersion": 8,
"Groups": [
"Loading Values"
]
@@ -1614,6 +1729,7 @@
"Returns": "U",
"Size": 1,
"Doc": "for (data A, signature B, pubkey C) verify the signature of the data against the pubkey =\u003e {0 or 1}",
+ "IntroducedVersion": 7,
"Groups": [
"Arithmetic"
]
@@ -1625,6 +1741,7 @@
"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`, `retsub`, and `proto` manipulate it.",
"ImmediateNote": "{int16 branch offset, big-endian}",
+ "IntroducedVersion": 4,
"Groups": [
"Flow Control"
]
@@ -1635,6 +1752,7 @@
"Size": 1,
"Doc": "pop the top instruction from the call stack and branch to it",
"DocExtra": "If the current frame was prepared by `proto A R`, `retsub` will remove the 'A' arguments from the stack, move the `R` return values down, and pop any stack locations above the relocated return values.",
+ "IntroducedVersion": 4,
"Groups": [
"Flow Control"
]
@@ -1646,6 +1764,7 @@
"Doc": "Prepare top call frame for a retsub that will assume A args and R return values.",
"DocExtra": "Fails unless the last instruction executed was a `callsub`.",
"ImmediateNote": "{uint8 arguments} {uint8 return values}",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1657,6 +1776,7 @@
"Size": 2,
"Doc": "Nth (signed) value from the frame pointer.",
"ImmediateNote": "{int8 frame slot}",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1668,6 +1788,7 @@
"Size": 2,
"Doc": "replace the Nth (signed) value from the frame pointer in the stack with A",
"ImmediateNote": "{int8 frame slot}",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1679,6 +1800,7 @@
"Size": 0,
"Doc": "branch to the Ath label. Continue at following instruction if index A exceeds the number of labels.",
"ImmediateNote": "{uint8 branch count} [{int16 branch offset, big-endian}, ...]",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1690,6 +1812,7 @@
"Doc": "given match cases from A[1] to A[N], branch to the Ith label where A[I] = B. Continue to the following instruction if no matches are found.",
"DocExtra": "`match` consumes N+1 values from the stack. Let the top stack value be B. The following N values represent an ordered list of match cases/constants (A), where the first value (A[0]) is the deepest in the stack. The immediate arguments are an ordered list of N labels (T). `match` will branch to target T[I], where A[I] = B. If there are no matches then execution continues on to the next instruction.",
"ImmediateNote": "{uint8 branch count} [{int16 branch offset, big-endian}, ...]",
+ "IntroducedVersion": 8,
"Groups": [
"Flow Control"
]
@@ -1701,6 +1824,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A times 2^B, modulo 2^64",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -1712,6 +1836,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A divided by 2^B",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -1723,6 +1848,7 @@
"Returns": "U",
"Size": 1,
"Doc": "The largest integer I such that I^2 \u003c= A",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -1735,6 +1861,7 @@
"Size": 1,
"Doc": "The highest set bit in A. If A is a byte-array, it is interpreted as a big-endian unsigned integer. bitlen of 0 is 0, bitlen of 8 is 4",
"DocExtra": "bitlen interprets arrays as big-endian integers, unlike setbit/getbit",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -1746,6 +1873,7 @@
"Returns": "U",
"Size": 1,
"Doc": "A raised to the Bth power. Fail if A == B == 0 and on overflow",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -1757,6 +1885,7 @@
"Returns": "UU",
"Size": 1,
"Doc": "A raised to the Bth power as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low. Fail if A == B == 0 or if the results exceeds 2^128-1",
+ "IntroducedVersion": 4,
"Groups": [
"Arithmetic"
]
@@ -1768,6 +1897,7 @@
"Returns": "B",
"Size": 1,
"Doc": "The largest integer I such that I^2 \u003c= A. A and I are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 6,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1780,6 +1910,7 @@
"Size": 1,
"Doc": "A,B / C. Fail if C == 0 or if result overflows.",
"DocExtra": "The notation A,B indicates that A and B are interpreted as a uint128 value, with A as the high uint64 and B the low.",
+ "IntroducedVersion": 6,
"Groups": [
"Arithmetic"
]
@@ -1791,6 +1922,7 @@
"Returns": "B",
"Size": 1,
"Doc": "SHA3_256 hash of value A, yields [32]byte",
+ "IntroducedVersion": 7,
"Groups": [
"Arithmetic"
]
@@ -1802,6 +1934,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A plus B. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1813,6 +1946,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A minus B. A and B are interpreted as big-endian unsigned integers. Fail on underflow.",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1824,6 +1958,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A divided by B (truncated division). A and B are interpreted as big-endian unsigned integers. Fail if B is zero.",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1835,6 +1970,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A times B. A and B are interpreted as big-endian unsigned integers.",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1846,6 +1982,7 @@
"Returns": "U",
"Size": 1,
"Doc": "1 if A is less than B, else 0. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1857,6 +1994,7 @@
"Returns": "U",
"Size": 1,
"Doc": "1 if A is greater than B, else 0. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1868,6 +2006,7 @@
"Returns": "U",
"Size": 1,
"Doc": "1 if A is less than or equal to B, else 0. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1879,6 +2018,7 @@
"Returns": "U",
"Size": 1,
"Doc": "1 if A is greater than or equal to B, else 0. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1890,6 +2030,7 @@
"Returns": "U",
"Size": 1,
"Doc": "1 if A is equal to B, else 0. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1901,6 +2042,7 @@
"Returns": "U",
"Size": 1,
"Doc": "0 if A is equal to B, else 1. A and B are interpreted as big-endian unsigned integers",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1912,6 +2054,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A modulo B. A and B are interpreted as big-endian unsigned integers. Fail if B is zero.",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Arithmetic"
]
@@ -1923,6 +2066,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A bitwise-or B. A and B are zero-left extended to the greater of their lengths",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Logic"
]
@@ -1934,6 +2078,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A bitwise-and B. A and B are zero-left extended to the greater of their lengths",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Logic"
]
@@ -1945,6 +2090,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A bitwise-xor B. A and B are zero-left extended to the greater of their lengths",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Logic"
]
@@ -1956,6 +2102,7 @@
"Returns": "B",
"Size": 1,
"Doc": "A with all bits inverted",
+ "IntroducedVersion": 4,
"Groups": [
"Byte Array Logic"
]
@@ -1967,6 +2114,7 @@
"Returns": "B",
"Size": 1,
"Doc": "zero filled byte-array of length A",
+ "IntroducedVersion": 4,
"Groups": [
"Loading Values"
]
@@ -1978,6 +2126,7 @@
"Size": 1,
"Doc": "write A to log state of the current application",
"DocExtra": "`log` fails if called more than MaxLogCalls times in a program, or if the sum of logged bytes exceeds 1024 bytes.",
+ "IntroducedVersion": 5,
"Groups": [
"State Access"
]
@@ -1988,6 +2137,7 @@
"Size": 1,
"Doc": "begin preparation of a new inner transaction in a new transaction group",
"DocExtra": "`itxn_begin` initializes Sender to the application address; Fee to the minimum allowable, taking into account MinTxnFee and credit from overpaying in earlier transactions; FirstValid/LastValid to the values in the invoking transaction, and all other fields to zero or empty values.",
+ "IntroducedVersion": 5,
"Groups": [
"Inner Transactions"
]
@@ -2054,6 +2204,7 @@
"Doc": "set field F of the current inner transaction to A",
"DocExtra": "`itxn_field` fails if A is of the wrong type for F, including a byte array of the wrong size for use as an address when F is an address field. `itxn_field` also fails if A is an account, asset, or app that is not _available_, or an attempt is made extend an array field beyond the limit imposed by consensus parameters. (Addresses set into asset params of acfg transactions need not be _available_.)",
"ImmediateNote": "{uint8 transaction field index}",
+ "IntroducedVersion": 5,
"Groups": [
"Inner Transactions"
]
@@ -2064,6 +2215,7 @@
"Size": 1,
"Doc": "execute the current inner transaction group. Fail if executing this group would exceed the inner transaction limit, or if any transaction in the group fails.",
"DocExtra": "`itxn_submit` resets the current transaction so that it can not be resubmitted. A new `itxn_begin` is required to prepare another inner transaction.",
+ "IntroducedVersion": 5,
"Groups": [
"Inner Transactions"
]
@@ -2146,6 +2298,7 @@
"ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUUUUBUUUBBBUBU",
"Doc": "field F of the last inner transaction",
"ImmediateNote": "{uint8 transaction field index}",
+ "IntroducedVersion": 5,
"Groups": [
"Inner Transactions"
]
@@ -2167,6 +2320,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ith value of the array field F of the last inner transaction",
"ImmediateNote": "{uint8 transaction field index} {uint8 transaction field array index}",
+ "IntroducedVersion": 5,
"Groups": [
"Inner Transactions"
]
@@ -2177,6 +2331,7 @@
"Size": 1,
"Doc": "begin preparation of a new inner transaction in the same transaction group",
"DocExtra": "`itxn_next` initializes the transaction exactly as `itxn_begin` does",
+ "IntroducedVersion": 6,
"Groups": [
"Inner Transactions"
]
@@ -2259,6 +2414,7 @@
"ArgEnumTypes": "BUUUUBBBUBBBUUUBUUUBBBUBUUBUBUBBBUUUUBBBBBBBBUBUUUUUUUUUUUBUUUBBBUBU",
"Doc": "field F of the Tth transaction in the last inner group submitted",
"ImmediateNote": "{uint8 transaction group index} {uint8 transaction field index}",
+ "IntroducedVersion": 6,
"Groups": [
"Inner Transactions"
]
@@ -2280,6 +2436,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ith value of the array field F from the Tth transaction in the last inner group submitted",
"ImmediateNote": "{uint8 transaction group index} {uint8 transaction field index} {uint8 transaction field array index}",
+ "IntroducedVersion": 6,
"Groups": [
"Inner Transactions"
]
@@ -2292,6 +2449,7 @@
"Size": 1,
"Doc": "create a box named A, of length B. Fail if A is empty or B exceeds 32,768. Returns 0 if A already existed, else 1",
"DocExtra": "Newly created boxes are filled with 0 bytes. `box_create` will fail if the referenced box already exists with a different size. Otherwise, existing boxes are unchanged by `box_create`.",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2303,6 +2461,7 @@
"Returns": "B",
"Size": 1,
"Doc": "read C bytes from box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size.",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2313,6 +2472,7 @@
"Args": "BUB",
"Size": 1,
"Doc": "write byte-array C into box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size.",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2324,6 +2484,7 @@
"Returns": "U",
"Size": 1,
"Doc": "delete box named A if it exists. Return 1 if A existed, 0 otherwise",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2335,6 +2496,7 @@
"Returns": "UU",
"Size": 1,
"Doc": "X is the length of box A if A exists, else 0. Y is 1 if A exists, else 0.",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2347,6 +2509,7 @@
"Size": 1,
"Doc": "X is the contents of box A if A exists, else ''. Y is 1 if A exists, else 0.",
"DocExtra": "For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace`",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2358,6 +2521,7 @@
"Size": 1,
"Doc": "replaces the contents of box A with byte-array B. Fails if A exists and len(B) != len(box A). Creates A if it does not exist",
"DocExtra": "For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace`",
+ "IntroducedVersion": 8,
"Groups": [
"Box Access"
]
@@ -2380,6 +2544,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ath value of the array field F of the current transaction",
"ImmediateNote": "{uint8 transaction field index}",
+ "IntroducedVersion": 5,
"Groups": [
"Loading Values"
]
@@ -2402,6 +2567,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Ath value of the array field F from the Tth transaction in the current group",
"ImmediateNote": "{uint8 transaction group index} {uint8 transaction field index}",
+ "IntroducedVersion": 5,
"Groups": [
"Loading Values"
]
@@ -2424,6 +2590,7 @@
"ArgEnumTypes": "BBUUBBB",
"Doc": "Bth value of the array field F from the Ath transaction in the current group",
"ImmediateNote": "{uint8 transaction field index}",
+ "IntroducedVersion": 5,
"Groups": [
"Loading Values"
]
@@ -2435,6 +2602,7 @@
"Returns": "B",
"Size": 1,
"Doc": "Ath LogicSig argument",
+ "IntroducedVersion": 5,
"Groups": [
"Loading Values"
]
@@ -2446,6 +2614,7 @@
"Returns": ".",
"Size": 1,
"Doc": "Bth scratch space value of the Ath transaction in the current group",
+ "IntroducedVersion": 6,
"Groups": [
"Loading Values"
]
@@ -2458,6 +2627,7 @@
"Size": 2,
"Doc": "Ath value of the array field F of the last inner transaction",
"ImmediateNote": "{uint8 transaction field index}",
+ "IntroducedVersion": 6,
"Groups": [
"Inner Transactions"
]
@@ -2470,6 +2640,7 @@
"Size": 3,
"Doc": "Ath value of the array field F from the Tth transaction in the last inner group submitted",
"ImmediateNote": "{uint8 transaction group index} {uint8 transaction field index}",
+ "IntroducedVersion": 6,
"Groups": [
"Inner Transactions"
]
@@ -2483,6 +2654,7 @@
"Doc": "Verify the proof B of message A against pubkey C. Returns vrf output and verification flag.",
"DocExtra": "`VrfAlgorand` is the VRF used in Algorand. It is ECVRF-ED25519-SHA512-Elligator2, specified in the IETF internet draft [draft-irtf-cfrg-vrf-03](https://datatracker.ietf.org/doc/draft-irtf-cfrg-vrf/03/).",
"ImmediateNote": "{uint8 parameters index}",
+ "IntroducedVersion": 7,
"Groups": [
"Arithmetic"
]
@@ -2495,6 +2667,7 @@
"Size": 2,
"Doc": "field F of block A. Fail unless A falls between txn.LastValid-1002 and txn.FirstValid (exclusive)",
"ImmediateNote": "{uint8 block field}",
+ "IntroducedVersion": 7,
"Groups": [
"State Access"
]
diff --git a/data/transactions/transaction.go b/data/transactions/transaction.go
index 8aa93740c7..e0d908fd63 100644
--- a/data/transactions/transaction.go
+++ b/data/transactions/transaction.go
@@ -239,6 +239,7 @@ func (tx Header) Alive(tc TxnContext) error {
Round: round,
FirstValid: tx.FirstValid,
LastValid: tx.LastValid,
+ Early: round < tx.FirstValid,
}
}
diff --git a/data/transactions/verify/artifact_test.go b/data/transactions/verify/artifact_test.go
new file mode 100644
index 0000000000..8444dfa353
--- /dev/null
+++ b/data/transactions/verify/artifact_test.go
@@ -0,0 +1,100 @@
+// Copyright (C) 2019-2022 Algorand, Inc.
+// This file is part of go-algorand
+//
+// go-algorand is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// go-algorand is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with go-algorand. If not, see .
+
+package verify
+
+import (
+ "testing"
+
+ "github.com/algorand/go-algorand/config"
+ "github.com/algorand/go-algorand/data/bookkeeping"
+ "github.com/algorand/go-algorand/data/transactions"
+ "github.com/algorand/go-algorand/data/transactions/logic"
+ "github.com/algorand/go-algorand/data/txntest"
+ "github.com/algorand/go-algorand/protocol"
+
+ "github.com/stretchr/testify/require"
+)
+
+// test/benchmark real programs found in the wild (testnet/mainnet).
+
+// BenchmarkTinyMan tries to reproduce
+// https://algoexplorer.io/tx/group/d1bUcqFbNZDMIdcreM9Vw2jzOIZIa2UzDgTTlr2Sl4o%3D
+// which is an algo to USDC swap. The source code below is extracted from
+// algoexplorer, which adds some unusual stuff as comments
+func BenchmarkTinyMan(b *testing.B) {
+ txns := txntest.CreateTinyManTxGroup(b, false)
+ b.Run("eval-lsig-signature", func(b *testing.B) {
+ stxns, _ := txntest.CreateTinyManSignedTxGroup(b, txns)
+ require.NotEmpty(b, stxns[0].Sig)
+ require.NotEmpty(b, stxns[1].Lsig.Logic)
+ require.NotEmpty(b, stxns[2].Sig)
+ require.NotEmpty(b, stxns[3].Lsig.Logic)
+ txgroup := transactions.WrapSignedTxnsWithAD(stxns)
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ proto := config.Consensus[protocol.ConsensusCurrentVersion]
+ ep := logic.EvalParams{
+ Proto: &proto,
+ TxnGroup: txgroup,
+ SigLedger: &logic.NoHeaderLedger{},
+ }
+ pass, err := logic.EvalSignature(1, &ep)
+ require.NoError(b, err)
+ require.True(b, pass)
+ pass, err = logic.EvalSignature(3, &ep)
+ require.NoError(b, err)
+ require.True(b, pass)
+ }
+ })
+
+ hdr := bookkeeping.BlockHeader{
+ UpgradeState: bookkeeping.UpgradeState{
+ CurrentProtocol: protocol.ConsensusCurrentVersion,
+ },
+ }
+
+ b.Run("group-check-actual", func(b *testing.B) {
+ stxnss := make([][]transactions.SignedTxn, b.N)
+ for i := 0; i < b.N; i++ {
+ txns := txntest.CreateTinyManTxGroup(b, true)
+ stxnss[i], _ = txntest.CreateTinyManSignedTxGroup(b, txns)
+ }
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ _, err := TxnGroup(stxnss[i], hdr, nil, &logic.NoHeaderLedger{})
+ require.NoError(b, err)
+ }
+ })
+
+ b.Run("group-check-all-crypto", func(b *testing.B) {
+ stxns, secrets := txntest.CreateTinyManSignedTxGroup(b, txns)
+ stxns[1] = stxns[1].Txn.Sign(secrets[0])
+ stxns[3] = stxns[3].Txn.Sign(secrets[0])
+ require.Empty(b, stxns[0].Lsig.Logic)
+ require.Empty(b, stxns[1].Lsig.Logic)
+ require.Empty(b, stxns[2].Lsig.Logic)
+ require.Empty(b, stxns[3].Lsig.Logic)
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ _, err := TxnGroup(stxns, hdr, nil, &logic.NoHeaderLedger{})
+ require.NoError(b, err)
+ }
+ })
+}
diff --git a/data/transactions/verify/txn.go b/data/transactions/verify/txn.go
index 4dc8bc6563..a4fe2ebd4d 100644
--- a/data/transactions/verify/txn.go
+++ b/data/transactions/verify/txn.go
@@ -39,7 +39,7 @@ var logicErrTotal = metrics.MakeCounter(metrics.MetricName{Name: "algod_ledger_l
var logicCostTotal = metrics.MakeCounter(metrics.MetricName{Name: "algod_ledger_logic_cost", Description: "Total cost of transaction scripts executed"})
var msigLessOrEqual4 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_4", Description: "Total transactions with 1-4 msigs"})
var msigLessOrEqual10 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_5_10", Description: "Total transactions with 5-10 msigs"})
-var msigMore10 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_16", Description: "Total transactions with 11+ msigs"})
+var msigMore10 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_11", Description: "Total transactions with 11+ msigs"})
var msigLsigLessOrEqual4 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_lsig_4", Description: "Total transaction scripts with 1-4 msigs"})
var msigLsigLessOrEqual10 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_lsig_5_10", Description: "Total transaction scripts with 5-10 msigs"})
var msigLsigMore10 = metrics.MakeCounter(metrics.MetricName{Name: "algod_verify_msig_lsig_10", Description: "Total transaction scripts with 11+ msigs"})
diff --git a/data/txHandler.go b/data/txHandler.go
index 59bb572e8e..ade8b80187 100644
--- a/data/txHandler.go
+++ b/data/txHandler.go
@@ -68,14 +68,14 @@ var transactionGroupTxSyncRemember = metrics.MakeCounter(metrics.TransactionGrou
var transactionGroupTxSyncAlreadyCommitted = metrics.MakeCounter(metrics.TransactionGroupTxSyncAlreadyCommitted)
var transactionMessageTxPoolRememberCounter = metrics.NewTagCounter(
- "algod_transaction_messages_txpool_remember_{TAG}", "Number of transaction messages not remembered by txpool b/c if {TAG}",
- txPoolRememberTagCap, txPoolRememberPendingEval, txPoolRememberTagNoSpace, txPoolRememberTagFee, txPoolRememberTagTxnDead, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
+ "algod_transaction_messages_txpool_remember_err_{TAG}", "Number of transaction messages not remembered by txpool b/c of {TAG}",
+ txPoolRememberTagCap, txPoolRememberPendingEval, txPoolRememberTagNoSpace, txPoolRememberTagFee, txPoolRememberTagTxnDead, txPoolRememberTagTxnEarly, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxID, txPoolRememberTagLease, txPoolRememberTagTxIDEval, txPoolRememberTagLeaseEval, txPoolRememberTagEvalGeneric,
)
var transactionMessageTxPoolCheckCounter = metrics.NewTagCounter(
- "algod_transaction_messages_txpool_check_{TAG}", "Number of transaction messages that didn't pass check by txpool b/c if {TAG}",
- txPoolRememberTagTxnNotWellFormed, txPoolRememberTagTxnDead, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
+ "algod_transaction_messages_txpool_check_err_{TAG}", "Number of transaction messages that didn't pass check by txpool b/c of {TAG}",
+ txPoolRememberTagTxnNotWellFormed, txPoolRememberTagTxnDead, txPoolRememberTagTxnEarly, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxID, txPoolRememberTagLease, txPoolRememberTagTxIDEval, txPoolRememberTagLeaseEval, txPoolRememberTagEvalGeneric,
)
@@ -85,6 +85,7 @@ const (
txPoolRememberTagNoSpace = "no_space"
txPoolRememberTagFee = "fee"
txPoolRememberTagTxnDead = "txn_dead"
+ txPoolRememberTagTxnEarly = "txn_early"
txPoolRememberTagTooLarge = "too_large"
txPoolRememberTagGroupID = "groupid"
txPoolRememberTagTxID = "txid"
@@ -290,7 +291,11 @@ func (handler *TxHandler) checkReportErrors(err error) {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnNotWellFormed, 1)
return
case *transactions.TxnDeadError:
- transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnDead, 1)
+ if err.Early {
+ transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnEarly, 1)
+ } else {
+ transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnDead, 1)
+ }
return
case *ledgercore.TransactionInLedgerError:
if err.InBlockEvaluator {
@@ -348,7 +353,11 @@ func (handler *TxHandler) rememberReportErrors(err error) {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagFee, 1)
return
case *transactions.TxnDeadError:
- transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnDead, 1)
+ if err.Early {
+ transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnEarly, 1)
+ } else {
+ transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnDead, 1)
+ }
return
case *ledgercore.TransactionInLedgerError:
if err.InBlockEvaluator {
diff --git a/data/txHandler_test.go b/data/txHandler_test.go
index 389eb6d2be..4e8dcdfe1d 100644
--- a/data/txHandler_test.go
+++ b/data/txHandler_test.go
@@ -1763,9 +1763,19 @@ func TestTxHandlerRememberReportErrorsWithTxPool(t *testing.T) {
handler.postProcessCheckedTxn(&wi)
require.Equal(t, 1, getMetricCounter(txPoolRememberTagEvalGeneric))
- // trigger TxnDeadErr from the evaluator
+ // trigger TxnDeadErr from the evaluator for "early" case
txn2 = txn1
txn2.FirstValid = ledger.LastRound() + 10
+ prevTxnEarly := getMetricCounter(txPoolRememberTagTxnEarly)
+ wi.unverifiedTxGroup = []transactions.SignedTxn{txn2.Sign(secrets[0])}
+ handler.postProcessCheckedTxn(&wi)
+ require.Equal(t, prevTxnEarly+1, getMetricCounter(txPoolRememberTagTxnEarly))
+ handler.checkAlreadyCommitted(&wi)
+ require.Equal(t, 1, getCheckMetricCounter(txPoolRememberTagTxnEarly))
+
+ // trigger TxnDeadErr from the evaluator for "late" case
+ txn2 = txn1
+ txn2.LastValid = 0
prevTxnDead := getMetricCounter(txPoolRememberTagTxnDead)
wi.unverifiedTxGroup = []transactions.SignedTxn{txn2.Sign(secrets[0])}
handler.postProcessCheckedTxn(&wi)
diff --git a/data/txntest/defi.go b/data/txntest/defi.go
new file mode 100644
index 0000000000..888b51c0e0
--- /dev/null
+++ b/data/txntest/defi.go
@@ -0,0 +1,550 @@
+// Copyright (C) 2019-2022 Algorand, Inc.
+// This file is part of go-algorand
+//
+// go-algorand is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// go-algorand is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with go-algorand. If not, see .
+
+package txntest
+
+import (
+ "testing"
+
+ "github.com/algorand/go-algorand/crypto"
+ "github.com/algorand/go-algorand/data/basics"
+ "github.com/algorand/go-algorand/data/transactions"
+ "github.com/algorand/go-algorand/data/transactions/logic"
+ "github.com/stretchr/testify/require"
+)
+
+// Test/benchmark real programs found in the wild (testnet/mainnet).
+
+// CreateTinyManTxGroup repro this tx group by tinyman
+// https://algoexplorer.io/tx/group/d1bUcqFbNZDMIdcreM9Vw2jzOIZIa2UzDgTTlr2Sl4o%3D
+func CreateTinyManTxGroup(tb testing.TB, randNote bool) []Txn {
+ user, err := basics.UnmarshalChecksumAddress("W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY")
+ require.NoError(tb, err)
+
+ luser, err := basics.UnmarshalChecksumAddress("FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA")
+ require.NoError(tb, err)
+
+ var note []byte = nil
+ if randNote {
+ note = make([]byte, 12)
+ crypto.RandBytes(note[:])
+ }
+
+ fees := Txn{
+ Type: "pay",
+ Fee: 1000,
+ Sender: user,
+ Receiver: luser,
+ Amount: 2000, // must cover the luser fees in appcall and withdraw
+ Note: note,
+ }
+
+ appcall := Txn{
+ Type: "appl",
+ Fee: 1000,
+ Sender: luser,
+ ApplicationID: 552635992,
+ Accounts: []basics.Address{user},
+ Note: note,
+ }.Args("swap", "fo")
+
+ deposit := Txn{
+ Type: "axfer",
+ Fee: 1000,
+ Sender: user,
+ AssetReceiver: luser,
+ Note: note,
+ }
+
+ withdraw := Txn{
+ Type: "pay",
+ Fee: 1000,
+ Sender: luser,
+ Receiver: user,
+ Note: note,
+ }
+ return []Txn{fees, *appcall, deposit, withdraw}
+}
+
+// TmLsig is a tinyman lsig contract used in tests/benchmarks
+const TmLsig = `
+ #pragma version 4
+ intcblock 1 0 0 31566704 3 4 5 6
+ intc_3 // 31566704
+ intc_2 // 0
+ >
+ assert
+ txn CloseRemainderTo // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ global ZeroAddress
+ ==
+ assert
+ txn AssetCloseTo // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ global ZeroAddress
+ ==
+ assert
+ txn RekeyTo // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ global ZeroAddress
+ ==
+ assert
+ global GroupSize // size=4
+ intc_0 // 1
+ >
+ assert
+ gtxn 1 Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 1 TypeEnum
+ intc 7 // 6
+ ==
+ assert
+ gtxn 1 ApplicationID // id=552635992
+ pushint 552635992
+ ==
+ assert // PC=65
+ gtxn 1 OnCompletion
+ intc_0 // 1
+ ==
+ gtxn 1 NumAppArgs // index=2
+ intc 4 // 3
+ ==
+ &&
+ gtxna 1 ApplicationArgs 0 // arg=73776170
+ pushbytes 0x626f6f747374726170 // "bootstrap"
+ ==
+ &&
+ bnz label1
+ gtxn 1 OnCompletion
+ intc_1 // 0
+ ==
+ assert
+ gtxn 1 NumAppArgs // index=2
+ pushint 2
+ ==
+ gtxna 1 ApplicationArgs 0 // arg=73776170
+ pushbytes 0x73776170 // "swap"
+ ==
+ &&
+ bnz label2
+ gtxn 1 NumAppArgs // index=2
+ intc_0 // 1
+ ==
+ assert
+ gtxna 1 ApplicationArgs 0 // arg=73776170
+ pushbytes 0x6d696e74 // "mint"
+ ==
+ bnz label3
+ gtxna 1 ApplicationArgs 0 // arg=73776170
+ pushbytes 0x6275726e // "burn"
+ ==
+ bnz label4
+ gtxna 1 ApplicationArgs 0 // arg=73776170
+ pushbytes 0x72656465656d // "redeem"
+ ==
+ bnz label5
+ gtxna 1 ApplicationArgs 0 // arg=73776170
+ pushbytes 0x66656573 // "fees"
+ ==
+ bnz label6
+ err
+label1:
+ intc 6 // 5
+ intc 5 // 4
+ intc_2 // 0
+ intc_1 // 0
+ ==
+ select
+ global GroupSize // size=4
+ ==
+ assert
+ gtxna 1 ApplicationArgs 1 // arg=666f
+ btoi
+ intc_3 // 31566704
+ ==
+ gtxna 1 ApplicationArgs 2
+ btoi
+ intc_2 // 0
+ ==
+ &&
+ assert
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 2 TypeEnum
+ intc 4 // 3
+ ==
+ assert
+ gtxn 2 ConfigAsset // id=0
+ intc_1 // 0
+ ==
+ assert
+ gtxn 2 ConfigAssetTotal // total=0.
+ intc_1 // 0
+ ~
+ ==
+ assert
+ gtxn 2 ConfigAssetDecimals // dec=0
+ intc 7 // 6
+ ==
+ assert
+ gtxn 2 ConfigAssetDefaultFrozen // default=false
+ intc_1 // 0
+ ==
+ assert
+ gtxn 2 ConfigAssetUnitName //
+ pushbytes 0x544d504f4f4c3131 // "TMPOOL11"
+ ==
+ assert
+ gtxn 2 ConfigAssetName //
+ substring 0 15
+ pushbytes 0x54696e796d616e506f6f6c312e3120 // "TinymanPool1.1 "
+ ==
+ assert
+ gtxn 2 ConfigAssetURL //
+ pushbytes 0x68747470733a2f2f74696e796d616e2e6f7267 // "https://tinyman.org"
+ ==
+ assert
+ gtxn 2 ConfigAssetManager
+ global ZeroAddress
+ ==
+ assert
+ gtxn 2 ConfigAssetReserve
+ global ZeroAddress
+ ==
+ assert
+ gtxn 2 ConfigAssetFreeze
+ global ZeroAddress
+ ==
+ assert
+ gtxn 2 ConfigAssetClawback
+ global ZeroAddress
+ ==
+ assert
+ gtxn 3 Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 TypeEnum
+ intc 5 // 4
+ ==
+ assert
+ gtxn 3 XferAsset // id=0
+ intc_3 // 31566704
+ ==
+ assert
+ gtxn 3 AssetReceiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 AssetAmount
+ intc_1 // 0
+ ==
+ assert
+ intc_2 // 0
+ intc_1 // 0
+ !=
+ bnz label7
+ gtxn 1 Fee // 0.001000
+ gtxn 2 Fee // 0.001000
+ +
+ gtxn 3 Fee // 0.001000
+ +
+ store 1
+ b label8
+label7:
+ gtxn 4 Sender
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 4 TypeEnum
+ intc 5 // 4
+ ==
+ assert
+ gtxn 4 XferAsset
+ intc_2 // 0
+ ==
+ assert
+ gtxn 4 AssetReceiver
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 4 AssetAmount
+ intc_1 // 0
+ ==
+ assert
+ gtxn 1 Fee // 0.001000
+ gtxn 2 Fee // 0.001000
+ +
+ gtxn 3 Fee // 0.001000
+ +
+ gtxn 4 Fee
+ +
+ store 1
+ b label8
+label3:
+ global GroupSize // size=4
+ intc 6 // 5
+ ==
+ assert
+ gtxna 1 Accounts 1
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxna 1 Accounts 1
+ gtxn 4 AssetReceiver
+ ==
+ assert
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxn 2 AssetReceiver // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ ==
+ assert
+ gtxn 2 XferAsset // id=31566704
+ intc_3 // 31566704
+ ==
+ assert
+ gtxn 3 AssetReceiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ gtxn 3 Receiver // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ gtxn 3 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 XferAsset // id=0
+ intc_1 // 0
+ gtxn 3 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ intc_2 // 0
+ ==
+ assert
+ gtxn 4 Sender
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 4 AssetReceiver
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ ==
+ assert
+ gtxn 1 Fee // 0.001000
+ gtxn 4 Fee
+ +
+ store 1
+ b label8
+label4:
+ global GroupSize // size=4
+ intc 6 // 5
+ ==
+ assert
+ gtxna 1 Accounts 1
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxna 1 Accounts 1
+ gtxn 2 AssetReceiver // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 AssetReceiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ gtxn 3 Receiver // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ gtxn 3 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ gtxna 1 Accounts 1
+ ==
+ assert
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 2 AssetReceiver // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ gtxn 4 Sender
+ ==
+ assert
+ gtxn 2 XferAsset // id=31566704
+ intc_3 // 31566704
+ ==
+ assert
+ gtxn 3 Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 AssetReceiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ gtxn 3 Receiver // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ gtxn 3 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ gtxn 4 Sender
+ ==
+ assert
+ gtxn 3 XferAsset // id=0
+ intc_1 // 0
+ gtxn 3 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ intc_2 // 0
+ ==
+ assert
+ gtxn 4 Sender
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxn 4 AssetReceiver
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 1 Fee // 0.001000
+ gtxn 2 Fee // 0.001000
+ +
+ gtxn 3 Fee // 0.001000
+ +
+ store 1
+ b label8
+label2: // swap
+ global GroupSize // size=4
+ intc 5 // 4
+ ==
+ assert
+ gtxna 1 Accounts 1
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ gtxna 1 Accounts 1
+ ==
+ assert // PC=718
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxn 3 Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert // PC=732
+ gtxn 2 AssetReceiver // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ gtxn 2 Receiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ gtxn 2 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert
+ gtxn 3 AssetReceiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ gtxn 3 Receiver // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ gtxn 3 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ gtxn 2 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ ==
+ assert // PC=765
+ gtxn 1 Fee // 0.001000
+ gtxn 3 Fee // 0.001000
+ +
+ store 1
+ b label8
+label5:
+ global GroupSize // size=4
+ intc 4 // 3
+ ==
+ assert
+ gtxna 1 Accounts 1
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxn 2 AssetReceiver // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ gtxn 2 Receiver // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ
+ gtxn 2 TypeEnum
+ intc_0 // 1
+ ==
+ select
+ gtxna 1 Accounts 1
+ ==
+ assert
+ gtxn 1 Fee // 0.001000
+ gtxn 2 Fee // 0.001000
+ +
+ store 1
+ b label8
+label6:
+ global GroupSize // size=4
+ intc 4 // 3
+ ==
+ assert
+ gtxn 1 Fee // 0.001000
+ gtxn 2 Fee // 0.001000
+ +
+ store 1
+ b label8
+label8:
+ gtxn 0 Sender // W2IZ3EHDRW2IQNPC33CI2CXSLMFCFICVKQVWIYLJWXCTD765RW47ONNCEY
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ !=
+ assert
+ gtxn 0 Receiver // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ txn Sender // FPOU46NBKTWUZCNMNQNXRWNW3SMPOOK4ZJIN5WSILCWP662ANJLTXVRUKA
+ ==
+ assert // PC=853
+ gtxn 0 Amount // 0.002000
+ load 1
+ >=
+ return
+`
+
+// CreateTinyManSignedTxGroup repro this tx group by tinyman
+// https://algoexplorer.io/tx/group/d1bUcqFbNZDMIdcreM9Vw2jzOIZIa2UzDgTTlr2Sl4o%3D
+// which is an algo to USDC swap. The source code below is extracted from
+// algoexplorer, which adds some unusual stuff as comments
+func CreateTinyManSignedTxGroup(tb testing.TB, txns []Txn) ([]transactions.SignedTxn, []*crypto.SignatureSecrets) {
+ ops, err := logic.AssembleString(TmLsig)
+ require.NoError(tb, err)
+
+ stxns := SignedTxns(&txns[0], &txns[1], &txns[2], &txns[3])
+ stxns[1].Lsig.Logic = ops.Program
+ stxns[3].Lsig.Logic = ops.Program
+
+ // add in some signatures, so TxnGroup can succeed. A randomly generated
+ // private key. The actual value does not matter, as long as this is a valid
+ // private key.
+ signer := crypto.PrivateKey{
+ 128, 128, 92, 23, 212, 119, 175, 51, 157, 2, 165,
+ 215, 137, 37, 82, 42, 52, 227, 54, 41, 243, 67,
+ 141, 76, 208, 17, 199, 17, 140, 46, 113, 0, 159,
+ 50, 105, 52, 77, 104, 118, 200, 104, 220, 105, 21,
+ 147, 162, 191, 236, 115, 201, 197, 128, 8, 91, 224,
+ 78, 104, 209, 2, 185, 110, 28, 42, 97,
+ }
+ secrets, err := crypto.SecretKeyToSignatureSecrets(signer)
+ require.NoError(tb, err)
+
+ stxns[0] = stxns[0].Txn.Sign(secrets)
+ stxns[2] = stxns[2].Txn.Sign(secrets)
+ return stxns, []*crypto.SignatureSecrets{secrets}
+}
diff --git a/data/txntest/txn.go b/data/txntest/txn.go
index cab0ded5c6..f1ac3768b5 100644
--- a/data/txntest/txn.go
+++ b/data/txntest/txn.go
@@ -14,22 +14,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand. If not, see .
-// Copyright (C) 2021 Algorand, Inc.
-// This file is part of go-algorand
-//
-// go-algorand is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// go-algorand is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with go-algorand. If not, see .
-
package txntest
import (
diff --git a/util/metrics/metrics.go b/util/metrics/metrics.go
index af3a21b36c..06a0431ecb 100644
--- a/util/metrics/metrics.go
+++ b/util/metrics/metrics.go
@@ -100,7 +100,7 @@ var (
// TransactionMessagesTxnSigNotWellFormed "Number of transaction messages with bad formed signature"
TransactionMessagesTxnSigNotWellFormed = MetricName{Name: "algod_transaction_messages_sig_bad_formed", Description: "Number of transaction messages with bad formed signature"}
// TransactionMessagesTxnMsigNotWellFormed "Number of transaction messages with bad formed multisig"
- TransactionMessagesTxnMsigNotWellFormed = MetricName{Name: "algod_transaction_messages_msig_bas_formed", Description: "Number of transaction messages with bad formed msig"}
+ TransactionMessagesTxnMsigNotWellFormed = MetricName{Name: "algod_transaction_messages_msig_bad_formed", Description: "Number of transaction messages with bad formed msig"}
// TransactionMessagesTxnLogicSig "Number of transaction messages with invalid logic sig"
TransactionMessagesTxnLogicSig = MetricName{Name: "algod_transaction_messages_logic_sig_failed", Description: "Number of transaction messages with invalid logic sig"}
// TransactionMessagesTxnSigVerificationFailed "Number of transaction messages with signature verification failed"