Skip to content

Commit

Permalink
Merge pull request #20 from derbear/deprecate-firstvalidtime
Browse files Browse the repository at this point in the history
Deprecate FirstValidTime txn field inside TEAL programs.
  • Loading branch information
shaih authored Nov 20, 2019
2 parents 03ae4ea + b336749 commit 0e196e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions dev/TEAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Some of these have immediate data in the byte or bytes after the opcode.
| 0 | Sender | []byte | 32 byte address |
| 1 | Fee | uint64 | micro-Algos |
| 2 | FirstValid | uint64 | round number |
| 3 | FirstValidTime | uint64 | Seconds since 1970-01-01 00:00:00 UTC of block at FirstValid-1 |
| 3 | FirstValidTime | uint64 | Causes program to fail; reserved for future use. |
| 4 | LastValid | uint64 | round number |
| 5 | Note | []byte | |
| 6 | Lease | []byte | |
Expand Down Expand Up @@ -249,6 +249,6 @@ Current design and implementation limitations to be aware of.
* TEAL cannot lookup balances of Algos or other assets. (Standard transaction accounting will apply after TEAL has run and authorized a transaction. A TEAL-approved transaction could still be invalid by other accounting rules just as a standard signed transaction could be invalid. e.g. I can't give away money I don't have.)
* TEAL cannot access information in previous blocks. TEAL cannot access most information in other transactions in the current block. (TEAL can access fields of the transaction it is attached to and the transactions in an atomic transaction group.)
* TEAL cannot know exactly what round the current transaction will commit in (but it is somewhere in FirstValid through LastValid).
* TEAL cannot know exactly what time its transaction is committed. (`txn FirstValidTime` should be approximately the 'unix time' seconds since 1970-01-01 00:00:00 UTC of the block *before* FirstValid, but there are conditions in which this time may drift and slowly re-align to close to accurate time.)
* TEAL cannot know exactly what time its transaction is committed.
* TEAL cannot loop. Its branch instruction `bnz` "branch if not zero" can only branch forward so as to skip some code.
* TEAL cannot recurse. There is no subroutine jump operation.
* TEAL cannot recurse. There is no subroutine jump operation.
4 changes: 2 additions & 2 deletions dev/TEAL_opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ Overflow is an error condition which halts execution and fails the transaction.
| 0 | Sender | []byte | 32 byte address |
| 1 | Fee | uint64 | micro-Algos |
| 2 | FirstValid | uint64 | round number |
| 3 | FirstValidTime | uint64 | Seconds since 1970-01-01 00:00:00 UTC of block at FirstValid-1 |
| 3 | FirstValidTime | uint64 | Causes program to fail; reserved for future use. |
| 4 | LastValid | uint64 | round number |
| 5 | Note | []byte | |
| 6 | Lease | []byte | |
Expand Down Expand Up @@ -382,7 +382,7 @@ TypeEnum mapping:
| 5 | afrz | AssetFreeze |


FirstValidTime is actually the time of the round at FirstValid-1. Subtle implementation details make it much faster to serve details of an already completed round. `int` accepts the user friendly names for comparison to `txn TypeEnum`
FirstValidTime causes the program to fail. The field is reserved for future use.

## global

Expand Down

0 comments on commit 0e196e8

Please sign in to comment.