Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
17fdd31
Increment TxnCounter with inner transactions
jannotti Sep 9, 2021
95c6da7
Add creatable IDs to ApplyData and REST API.
jannotti Sep 9, 2021
50280bf
`make msgp` after adding creatable fields to ApplyData
jannotti Sep 10, 2021
a62e8b3
first round trip with foundation
jannotti Sep 10, 2021
c728fd6
Adjust v1 REST API to get app/asa id from ApplyData if possible
jannotti Sep 10, 2021
27b53c1
Typo
jannotti Sep 10, 2021
96b4b7f
Temporary explanation in leiu of a new table of fields.
jannotti Sep 10, 2021
d575c64
Confirm followup creates have the expected id after inners
jannotti Sep 10, 2021
9b7bcc2
Test suggested by @jasonpaulos
jannotti Sep 10, 2021
bae2859
acfg and afrz inner transactions
jannotti Sep 11, 2021
41d379d
Lint & Jason P. Perfect together
jannotti Sep 12, 2021
7e4f50a
CR fixups
jannotti Sep 13, 2021
abcff11
Correct outdated comment
jannotti Sep 13, 2021
e326edd
Merge branch 'master' into spec-updates
jannotti Sep 13, 2021
5222a36
Prose changes
jannotti Sep 13, 2021
68cd49f
Field versioning
jannotti Sep 13, 2021
e0939bc
Require 32 byte hash
jannotti Sep 13, 2021
b2b6bc3
tx_begin -> itxn_begin for consistency with future `itxn` opcode
jannotti Sep 13, 2021
7c81231
Put inner IDs into inner rest response
jannotti Sep 13, 2021
95b2f04
Test inner txn indexes
jasonpaulos Sep 13, 2021
9afb79b
Merge pull request #2 from jasonpaulos/inner-txn-index-test
jannotti Sep 13, 2021
1a3fda3
Adds an itxn instruction for seeing inner txns (fields and results)
jannotti Sep 14, 2021
b8443dc
Merge branch 'spec-updates' into itxn
jannotti Sep 14, 2021
7288691
Merge branch 'master' into itxn
jannotti Sep 14, 2021
69081ef
spelling
jannotti Sep 14, 2021
0658d4c
Fix doc name, unit test to avoid problems
jannotti Sep 14, 2021
3e6aa96
Generate specs
jannotti Sep 14, 2021
100227a
Spec details
jannotti Sep 14, 2021
12de4ce
partiion fucking test
jannotti Sep 14, 2021
24c76af
spelling
jannotti Sep 14, 2021
0918bcb
Rename extractXXbits
jannotti Sep 14, 2021
198ad12
Code review
jannotti Sep 14, 2021
bf4e427
Merge branch 'itxn' into extract-rename
jannotti Sep 14, 2021
e1ad562
Code review
jannotti Sep 14, 2021
ef3fe91
Merge branch 'itxn' into extract-rename
jannotti Sep 14, 2021
6d6181a
Merge branch 'master' into extract-rename
jannotti Sep 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions data/transactions/logic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ various sizes.
| `substring3` | pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including C, push the substring result. If C < B, or either is larger than the array length, the program fails |
| `extract s l` | pop a byte-array A. For immediate values in 0..255 S and L: extract a range of bytes from A starting at S up to but not including S+L, push the substring result. 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 |
| `extract3` | pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including B+C, push the substring result. If B+C is larger than the array length, the program fails |
| `extract16bits` | pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+2, convert bytes as big endian and push the uint64 result. If B+2 is larger than the array length, the program fails |
| `extract32bits` | pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+4, convert bytes as big endian and push the uint64 result. If B+4 is larger than the array length, the program fails |
| `extract64bits` | pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+8, convert bytes as big endian and push the uint64 result. If B+8 is larger than the array length, the program fails |
| `extract_uint16` | pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+2, convert bytes as big endian and push the uint64 result. If B+2 is larger than the array length, the program fails |
| `extract_uint32` | pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+4, convert bytes as big endian and push the uint64 result. If B+4 is larger than the array length, the program fails |
| `extract_uint64` | pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+8, convert bytes as big endian and push the uint64 result. If B+8 is larger than the array length, the program fails |

These opcodes take byte-array values that are interpreted as
big-endian unsigned integers. For mathematical operators, the
Expand Down Expand Up @@ -431,12 +431,12 @@ The following opcodes allow for "inner transactions". Inner
transactions allow stateful applications to have many of the effects
of a true top-level transaction, programatically. However, they are
different in significant ways. The most important differences are
that they are not signed, and do not appear in the block in the usual
away. Instead, their effects are noted in metadata associated with the
associated top-level application call transaction. An inner
transaction's `Sender` must be the SHA512_256 hash of the application
ID (prefixed by "appID"), or an account that has been rekeyed to that
hash.
that they are not signed, duplicates are not rejected, and they do not
appear in the block in the usual away. Instead, their effects are
noted in metadata associated with the associated top-level application
call transaction. An inner transaction's `Sender` must be the
SHA512_256 hash of the application ID (prefixed by "appID"), or an
account that has been rekeyed to that hash.

Currently, inner transactions may perform `pay`, `axfer`, `acfg`, and
`afrz` effects. After executing an inner transaction with
Expand All @@ -452,6 +452,16 @@ creates in addtion to the more common uses of `axfer` and `acfg`. All
fields default to the zero value, except those described under
`itxn_begin`.

Fields may be set multiple times, but may not be read. The most recent
setting is used when `itxn_submit` executes. (For this purpose `Type`
and `TypeEnum` are considered to be the same field.) `itxn_field`
fails immediately for unsupported fields, unsupported transaction
types, or improperly typed values for a particular field. `itxn_field`
makes aceptance decisions entirely from the field and value provided,
never considering previously set fields. Illegal interactions between
fields, such as setting fields that belong to two different
transaction types, are rejected by `itxn_submit`.

| Op | Description |
| --- | --- |
| `itxn_begin` | Begin preparation of a new inner transaction |
Expand Down
22 changes: 16 additions & 6 deletions data/transactions/logic/README_in.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ The following opcodes allow for "inner transactions". Inner
transactions allow stateful applications to have many of the effects
of a true top-level transaction, programatically. However, they are
different in significant ways. The most important differences are
that they are not signed, and do not appear in the block in the usual
away. Instead, their effects are noted in metadata associated with the
associated top-level application call transaction. An inner
transaction's `Sender` must be the SHA512_256 hash of the application
ID (prefixed by "appID"), or an account that has been rekeyed to that
hash.
that they are not signed, duplicates are not rejected, and they do not
appear in the block in the usual away. Instead, their effects are
noted in metadata associated with the associated top-level application
call transaction. An inner transaction's `Sender` must be the
SHA512_256 hash of the application ID (prefixed by "appID"), or an
account that has been rekeyed to that hash.

Currently, inner transactions may perform `pay`, `axfer`, `acfg`, and
`afrz` effects. After executing an inner transaction with
Expand All @@ -181,6 +181,16 @@ creates in addtion to the more common uses of `axfer` and `acfg`. All
fields default to the zero value, except those described under
`itxn_begin`.

Fields may be set multiple times, but may not be read. The most recent
setting is used when `itxn_submit` executes. (For this purpose `Type`
and `TypeEnum` are considered to be the same field.) `itxn_field`
fails immediately for unsupported fields, unsupported transaction
types, or improperly typed values for a particular field. `itxn_field`
makes aceptance decisions entirely from the field and value provided,
never considering previously set fields. Illegal interactions between
fields, such as setting fields that belong to two different
transaction types, are rejected by `itxn_submit`.

@@ Inner_Transactions.md @@


Expand Down
6 changes: 3 additions & 3 deletions data/transactions/logic/TEAL_opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -830,23 +830,23 @@ When A is a uint64, index 0 is the least significant bit. Setting bit 3 to 1 on
- pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including B+C, push the substring result. If B+C is larger than the array length, the program fails
- LogicSigVersion >= 5

## extract16bits
## extract_uint16

- Opcode: 0x59
- Pops: *... stack*, {[]byte A}, {uint64 B}
- Pushes: uint64
- pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+2, convert bytes as big endian and push the uint64 result. If B+2 is larger than the array length, the program fails
- LogicSigVersion >= 5

## extract32bits
## extract_uint32

- Opcode: 0x5a
- Pops: *... stack*, {[]byte A}, {uint64 B}
- Pushes: uint64
- pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+4, convert bytes as big endian and push the uint64 result. If B+4 is larger than the array length, the program fails
- LogicSigVersion >= 5

## extract64bits
## extract_uint64

- Opcode: 0x5b
- Pops: *... stack*, {[]byte A}, {uint64 B}
Expand Down
6 changes: 3 additions & 3 deletions data/transactions/logic/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ int 0
int 8
extract3
int 0
extract64bits
extract_uint64
int 0
extract32bits
extract_uint32
int 0
extract16bits
extract_uint16
log
txn Nonparticipation
gtxn 0 Nonparticipation
Expand Down
26 changes: 13 additions & 13 deletions data/transactions/logic/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,18 @@ var opDocByName = map[string]string{
"swap": "swaps two last values on stack: A, B -> B, A",
"select": "selects one of two values based on top-of-stack: A, B, C -> (if C != 0 then B else A)",

"concat": "pop two byte-arrays A and B and join them, push the result",
"substring": "pop a byte-array A. For immediate values in 0..255 S and E: extract a range of bytes from A starting at S up to but not including E, push the substring result. If E < S, or either is larger than the array length, the program fails",
"substring3": "pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including C, push the substring result. If C < B, or either is larger than the array length, the program fails",
"getbit": "pop a target A (integer or byte-array), and index B. Push the Bth bit of A.",
"setbit": "pop a target A, index B, and bit C. Set the Bth bit of A to C, and push the result",
"getbyte": "pop a byte-array A and integer B. Extract the Bth byte of A and push it as an integer",
"setbyte": "pop a byte-array A, integer B, and small integer C (between 0..255). Set the Bth byte of A to C, and push the result",
"extract": "pop a byte-array A. For immediate values in 0..255 S and L: extract a range of bytes from A starting at S up to but not including S+L, push the substring result. 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",
"extract3": "pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including B+C, push the substring result. If B+C is larger than the array length, the program fails",
"extract16bits": "pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+2, convert bytes as big endian and push the uint64 result. If B+2 is larger than the array length, the program fails",
"extract32bits": "pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+4, convert bytes as big endian and push the uint64 result. If B+4 is larger than the array length, the program fails",
"extract64bits": "pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+8, convert bytes as big endian and push the uint64 result. If B+8 is larger than the array length, the program fails",
"concat": "pop two byte-arrays A and B and join them, push the result",
"substring": "pop a byte-array A. For immediate values in 0..255 S and E: extract a range of bytes from A starting at S up to but not including E, push the substring result. If E < S, or either is larger than the array length, the program fails",
"substring3": "pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including C, push the substring result. If C < B, or either is larger than the array length, the program fails",
"getbit": "pop a target A (integer or byte-array), and index B. Push the Bth bit of A.",
"setbit": "pop a target A, index B, and bit C. Set the Bth bit of A to C, and push the result",
"getbyte": "pop a byte-array A and integer B. Extract the Bth byte of A and push it as an integer",
"setbyte": "pop a byte-array A, integer B, and small integer C (between 0..255). Set the Bth byte of A to C, and push the result",
"extract": "pop a byte-array A. For immediate values in 0..255 S and L: extract a range of bytes from A starting at S up to but not including S+L, push the substring result. 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",
"extract3": "pop a byte-array A and two integers B and C. Extract a range of bytes from A starting at B up to but not including B+C, push the substring result. If B+C is larger than the array length, the program fails",
"extract_uint16": "pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+2, convert bytes as big endian and push the uint64 result. If B+2 is larger than the array length, the program fails",
"extract_uint32": "pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+4, convert bytes as big endian and push the uint64 result. If B+4 is larger than the array length, the program fails",
"extract_uint64": "pop a byte-array A and integer B. Extract a range of bytes from A starting at B up to but not including B+8, convert bytes as big endian and push the uint64 result. If B+8 is larger than the array length, the program fails",

"balance": "get 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.",
"min_balance": "get minimum required balance for 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.",
Expand Down Expand Up @@ -293,7 +293,7 @@ func OpDocExtra(opName string) string {
// opcodes consecutively, even if their opcode values are not.
var OpGroups = map[string][]string{
"Arithmetic": {"sha256", "keccak256", "sha512_256", "ed25519verify", "ecdsa_verify", "ecdsa_pk_recover", "ecdsa_pk_decompress", "+", "-", "/", "*", "<", ">", "<=", ">=", "&&", "||", "shl", "shr", "sqrt", "bitlen", "exp", "==", "!=", "!", "len", "itob", "btoi", "%", "|", "&", "^", "~", "mulw", "addw", "divmodw", "expw", "getbit", "setbit", "getbyte", "setbyte", "concat"},
"Byte Array Slicing": {"substring", "substring3", "extract", "extract3", "extract16bits", "extract32bits", "extract64bits"},
"Byte Array Slicing": {"substring", "substring3", "extract", "extract3", "extract_uint16", "extract_uint32", "extract_uint64"},
"Byte Array Arithmetic": {"b+", "b-", "b/", "b*", "b<", "b>", "b<=", "b>=", "b==", "b!=", "b%"},
"Byte Array Logic": {"b|", "b&", "b^", "b~"},
"Loading Values": {"intcblock", "intc", "intc_0", "intc_1", "intc_2", "intc_3", "pushint", "bytecblock", "bytec", "bytec_0", "bytec_1", "bytec_2", "bytec_3", "pushbytes", "bzero", "arg", "arg_0", "arg_1", "arg_2", "arg_3", "args", "txn", "gtxn", "txna", "txnas", "gtxna", "gtxnas", "gtxns", "gtxnsa", "gtxnsas", "global", "load", "loads", "store", "stores", "gload", "gloads", "gaid", "gaids"},
Expand Down
14 changes: 7 additions & 7 deletions data/transactions/logic/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2264,10 +2264,10 @@ func TestExtractOp(t *testing.T) {

testAccepts(t, "byte 0x123456789abc; int 5; int 1; extract3; byte 0xbc; ==", 5)

testAccepts(t, "byte 0x123456789abcdef0; int 1; extract16bits; int 0x3456; ==", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 1; extract32bits; int 0x3456789a; ==", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 0; extract64bits; int 0x123456789abcdef0; ==", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 0; extract64bits; int 0x123456789abcdef; !=", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 1; extract_uint16; int 0x3456; ==", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 1; extract_uint32; int 0x3456789a; ==", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 0; extract_uint64; int 0x123456789abcdef0; ==", 5)
testAccepts(t, "byte 0x123456789abcdef0; int 0; extract_uint64; int 0x123456789abcdef; !=", 5)

testAccepts(t, `byte "hello"; extract 5 0; byte ""; ==`, 5)
testAccepts(t, `byte "hello"; int 5; int 0; extract3; byte ""; ==`, 5)
Expand Down Expand Up @@ -2312,17 +2312,17 @@ func TestExtractFlop(t *testing.T) {

err = testPanics(t, `byte 0xf000000000000000
int 55
extract16bits`, 5)
extract_uint16`, 5)
require.Contains(t, err.Error(), "extract range beyond length of string")

err = testPanics(t, `byte 0xf000000000000000
int 9
extract32bits`, 5)
extract_uint32`, 5)
require.Contains(t, err.Error(), "extract range beyond length of string")

err = testPanics(t, `byte 0xf000000000000000
int 1
extract64bits`, 5)
extract_uint64`, 5)
require.Contains(t, err.Error(), "extract range beyond length of string")
}

Expand Down
6 changes: 3 additions & 3 deletions data/transactions/logic/opcodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ var OpSpecs = []OpSpec{
{0x56, "setbyte", opSetByte, asmDefault, disDefault, byteIntInt, oneBytes, 3, modeAny, opDefault},
{0x57, "extract", opExtract, asmDefault, disDefault, oneBytes, oneBytes, 5, modeAny, immediates("s", "l")},
{0x58, "extract3", opExtract3, asmDefault, disDefault, byteIntInt, oneBytes, 5, modeAny, opDefault},
{0x59, "extract16bits", opExtract16Bits, asmDefault, disDefault, byteInt, oneInt, 5, modeAny, opDefault},
{0x5a, "extract32bits", opExtract32Bits, asmDefault, disDefault, byteInt, oneInt, 5, modeAny, opDefault},
{0x5b, "extract64bits", opExtract64Bits, asmDefault, disDefault, byteInt, oneInt, 5, modeAny, opDefault},
{0x59, "extract_uint16", opExtract16Bits, asmDefault, disDefault, byteInt, oneInt, 5, modeAny, opDefault},
{0x5a, "extract_uint32", opExtract32Bits, asmDefault, disDefault, byteInt, oneInt, 5, modeAny, opDefault},
{0x5b, "extract_uint64", opExtract64Bits, asmDefault, disDefault, byteInt, oneInt, 5, modeAny, opDefault},

{0x60, "balance", opBalance, asmDefault, disDefault, oneInt, oneInt, 2, runModeApplication, opDefault},
{0x60, "balance", opBalance, asmDefault, disDefault, oneAny, oneInt, directRefEnabledVersion, runModeApplication, opDefault},
Expand Down