-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose nonparticipation txn field in teal #2823
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part looks good, except the new field should be enabled only for v5 and onward.
Also, we may want to make it such that LogicSigs running programs v4 and lower automatically reject transactions that contain true for the nonparticipation field, since they cannot inspect it. A similar thing was done when we introducing rekeying in TEAL v2. I'll see if I can find any relevant code.
edit: the relevant code is ComputeMinTealVersion
in data/transactions/logic/eval.go
. But since it's currently valid for programs to execute in the same group as nonparticipation keyreg txns, we'd probably need to introduce a new consensus param to make this change. I'm not sure if that would be worth it.
data/transactions/logic/doc.go
Outdated
@@ -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": "Flag for participation key", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better description might be "Key registration participation flag"
data/transactions/logic/fields.go
Outdated
@@ -232,6 +235,7 @@ var txnFieldSpecs = []txnFieldSpec{ | |||
{LocalNumUint, StackUint64, 3}, | |||
{LocalNumByteSlice, StackUint64, 3}, | |||
{ExtraProgramPages, StackUint64, 4}, | |||
{Nonparticipation, StackUint64, 0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I think we'll need to make this first available in v5
I don't think it would be worth a consensus upgrade either. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Two small recomendations.
data/transactions/logic/eval.go
Outdated
if txn.Nonparticipation { | ||
sv.Uint = 1 | ||
} else { | ||
sv.Uint = 0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if txn.Nonparticipation { | |
sv.Uint = 1 | |
} else { | |
sv.Uint = 0 | |
} | |
sv.Uint = boolToUint(txn.Nonparticipation) |
data/transactions/logic/doc.go
Outdated
@@ -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": "Key registration participation flag", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Marks an account nonparticipating for rewards"?
That is similar to the language we use here: https://developer.algorand.org/docs/reference/transactions/
Codecov Report
@@ Coverage Diff @@
## master #2823 +/- ##
==========================================
- Coverage 47.14% 47.11% -0.04%
==========================================
Files 349 349
Lines 56430 56433 +3
==========================================
- Hits 26606 26590 -16
- Misses 26845 26861 +16
- Partials 2979 2982 +3
Continue to review full report at Codecov.
|
Summary
Expose the field Nonparticipation from KeyregTxnFields in teal. This is needed for checking keyreg txns' nonparticipation value in logicsigns.
Test Plan
Updated tests in logic