Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions data/transactions/logic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ Some of these have immediate data in the byte or bytes after the opcode.
| 54 | LocalNumUint | uint64 | Number of local state integers in ApplicationCall. LogicSigVersion >= 3. |
| 55 | LocalNumByteSlice | uint64 | Number of local state byteslices in ApplicationCall. LogicSigVersion >= 3. |
| 56 | ExtraProgramPages | uint64 | Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. LogicSigVersion >= 4. |
| 57 | Nonparticipation | uint64 | Marks an account nonparticipating for rewards. LogicSigVersion >= 5. |


Additional details in the [opcodes document](TEAL_opcodes.md#txn) on the `txn` op.
Expand Down
1 change: 1 addition & 0 deletions data/transactions/logic/TEAL_opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ Overflow is an error condition which halts execution and fails the transaction.
| 54 | LocalNumUint | uint64 | Number of local state integers in ApplicationCall. LogicSigVersion >= 3. |
| 55 | LocalNumByteSlice | uint64 | Number of local state byteslices in ApplicationCall. LogicSigVersion >= 3. |
| 56 | ExtraProgramPages | uint64 | Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. LogicSigVersion >= 4. |
| 57 | Nonparticipation | uint64 | Marks an account nonparticipating for rewards. LogicSigVersion >= 5. |


TypeEnum mapping:
Expand Down
5 changes: 4 additions & 1 deletion data/transactions/logic/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ extract32bits
int 0
extract16bits
log
txn Nonparticipation
gtxn 0 Nonparticipation
`

var nonsense = map[uint64]string{
Expand All @@ -325,7 +327,7 @@ var compiled = map[uint64]string{
2: "022008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f23102311231223132314181b1c2b171615400003290349483403350222231d4a484848482a50512a63222352410003420000432105602105612105270463484821052b62482b642b65484821052b2106662b21056721072b682b692107210570004848210771004848361c0037001a0031183119311b311d311e311f3120210721051e312131223123312431253126312731283129312a312b312c312d312e312f",
3: "032008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f23102311231223132314181b1c2b171615400003290349483403350222231d4a484848482a50512a63222352410003420000432105602105612105270463484821052b62482b642b65484821052b2106662b21056721072b682b692107210570004848210771004848361c0037001a0031183119311b311d311e311f3120210721051e312131223123312431253126312731283129312a312b312c312d312e312f4478222105531421055427042106552105082106564c4d4b02210538212106391c0081e80780046a6f686e",
4: "042004010200b7a60c26040242420c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f23102311231223132314181b1c28171615400003290349483403350222231d4a484848482a50512a632223524100034200004322602261222b634848222862482864286548482228236628226724286828692422700048482471004848361c0037001a0031183119311b311d311e311f312024221e312131223123312431253126312731283129312a312b312c312d312e312f44782522531422542b2355220823564c4d4b0222382123391c0081e80780046a6f686e2281d00f24231f880003420001892223902291922394239593a0a1a2a3a4a5a6a7a8a9aaabacadae23af3a00003b003c003d8164",
5: "052004010200b7a60c26040242420c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f23102311231223132314181b1c28171615400003290349483403350222231d4a484848482a50512a632223524100034200004322602261222b634848222862482864286548482228236628226724286828692422700048482471004848361c0037001a0031183119311b311d311e311f312024221e312131223123312431253126312731283129312a312b312c312d312e312f44782522531422542b2355220823564c4d4b0222382123391c0081e80780046a6f686e2281d00f24231f880003420001892223902291922394239593a0a1a2a3a4a5a6a7a8a9aaabacadae23af3a00003b003c003d816472064e014f0180070123456789abcd57000824810858245b245a2459b0",
5: "052004010200b7a60c26040242420c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f23102311231223132314181b1c28171615400003290349483403350222231d4a484848482a50512a632223524100034200004322602261222b634848222862482864286548482228236628226724286828692422700048482471004848361c0037001a0031183119311b311d311e311f312024221e312131223123312431253126312731283129312a312b312c312d312e312f44782522531422542b2355220823564c4d4b0222382123391c0081e80780046a6f686e2281d00f24231f880003420001892223902291922394239593a0a1a2a3a4a5a6a7a8a9aaabacadae23af3a00003b003c003d816472064e014f0180070123456789abcd57000824810858245b245a2459b03139330039",
}

func pseudoOp(opcode string) bool {
Expand Down Expand Up @@ -1312,6 +1314,7 @@ txn LocalNumUint
txn LocalNumByteSlice
gtxn 12 Fee
txn ExtraProgramPages
txn Nonparticipation
`, AssemblerMaxVersion)
for _, globalField := range GlobalFieldNames {
if !strings.Contains(text, globalField) {
Expand Down
1 change: 1 addition & 0 deletions data/transactions/logic/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ var txnFieldDocs = map[string]string{
"VoteFirst": "The first round that the participation key is valid.",
"VoteLast": "The last round that the participation key is valid.",
"VoteKeyDilution": "Dilution for the 2-level participation key",
"Nonparticipation": "Marks an account nonparticipating for rewards",
"Type": "Transaction type as bytes",
"TypeEnum": "See table below",
"XferAsset": "Asset ID",
Expand Down
2 changes: 2 additions & 0 deletions data/transactions/logic/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,8 @@ func (cx *evalContext) txnFieldToStack(txn *transactions.Transaction, field TxnF
sv.Uint = uint64(txn.VoteLast)
case VoteKeyDilution:
sv.Uint = txn.VoteKeyDilution
case Nonparticipation:
sv.Uint = boolToUint(txn.Nonparticipation)
case Type:
sv.Bytes = []byte(txn.Type)
case TypeEnum:
Expand Down
11 changes: 10 additions & 1 deletion data/transactions/logic/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,13 @@ assert
int 1
`

const testTxnProgramTextV5 = testTxnProgramTextV4 + `
txn Nonparticipation
pop
int 1
==
`

func makeSampleTxn() transactions.SignedTxn {
var txn transactions.SignedTxn
copy(txn.Txn.Sender[:], []byte("aoeuiaoeuiaoeuiaoeuiaoeuiaoeui00"))
Expand All @@ -1435,6 +1442,7 @@ func makeSampleTxn() transactions.SignedTxn {
txn.Txn.VoteFirst = 1317
txn.Txn.VoteLast = 17776
txn.Txn.VoteKeyDilution = 1
txn.Txn.Nonparticipation = false
txn.Txn.Type = protocol.PaymentTx
txn.Txn.AssetAmount = 1234
txn.Txn.AssetSender = txn.Txn.Receiver
Expand Down Expand Up @@ -1502,7 +1510,7 @@ func TestTxn(t *testing.T) {

t.Parallel()
for _, txnField := range TxnFieldNames {
if !strings.Contains(testTxnProgramTextV4, txnField) {
if !strings.Contains(testTxnProgramTextV5, txnField) {
if txnField != FirstValidTime.String() {
t.Errorf("TestTxn missing field %v", txnField)
}
Expand All @@ -1514,6 +1522,7 @@ func TestTxn(t *testing.T) {
2: testTxnProgramTextV2,
3: testTxnProgramTextV3,
4: testTxnProgramTextV4,
5: testTxnProgramTextV5,
}

clearOps := testProg(t, "int 1", 1)
Expand Down
4 changes: 4 additions & 0 deletions data/transactions/logic/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ const (
// ExtraProgramPages AppParams.ExtraProgramPages
ExtraProgramPages

// Nonparticipation Transaction.Nonparticipation
Nonparticipation

invalidTxnField // fence for some setup that loops from Sender..invalidTxnField
)

Expand Down Expand Up @@ -232,6 +235,7 @@ var txnFieldSpecs = []txnFieldSpec{
{LocalNumUint, StackUint64, 3},
{LocalNumByteSlice, StackUint64, 3},
{ExtraProgramPages, StackUint64, 4},
{Nonparticipation, StackUint64, 5},
}

// TxnaFieldNames are arguments to the 'txna' opcode
Expand Down
7 changes: 4 additions & 3 deletions data/transactions/logic/fields_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.