Skip to content

Commit

Permalink
Merge pull request algorand#4 from pzbitskiy/pavel/stf-teal
Browse files Browse the repository at this point in the history
Implement TEAL versioning
  • Loading branch information
justicz authored Mar 6, 2020
2 parents de8abf6 + e3c80d6 commit b392994
Show file tree
Hide file tree
Showing 10 changed files with 1,715 additions and 1,315 deletions.
12 changes: 7 additions & 5 deletions cmd/opdoc/opdoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ func opToMarkdown(out io.Writer, op *logic.OpSpec) (err error) {

func opsToMarkdown(out io.Writer) (err error) {
out.Write([]byte("# Opcodes\n\nOps have a 'cost' of 1 unless otherwise specified.\n\n"))
for i := range logic.OpSpecs {
err = opToMarkdown(out, &logic.OpSpecs[i])
opSpecs := logic.OpcodesByVersion(logic.LogicVersion)
for _, spec := range opSpecs {
err = opToMarkdown(out, &spec)
if err != nil {
return
}
Expand Down Expand Up @@ -197,8 +198,9 @@ func argEnumTypes(name string) string {
}

func buildLanguageSpec(opGroups map[string][]string) *LanguageSpec {
records := make([]OpRecord, len(logic.OpSpecs))
for i, spec := range logic.OpSpecs {
opSpecs := logic.OpcodesByVersion(logic.LogicVersion)
records := make([]OpRecord, len(opSpecs))
for i, spec := range opSpecs {
records[i].Opcode = spec.Opcode
records[i].Name = spec.Name
records[i].Args = typeString(spec.Args)
Expand All @@ -213,7 +215,7 @@ func buildLanguageSpec(opGroups map[string][]string) *LanguageSpec {
records[i].Groups = opGroups[spec.Name]
}
return &LanguageSpec{
EvalMaxVersion: logic.EvalMaxVersion,
EvalMaxVersion: logic.LogicVersion,
LogicSigVersion: config.Consensus[protocol.ConsensusCurrentVersion].LogicSigVersion,
Ops: records,
}
Expand Down
1 change: 1 addition & 0 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ func initConsensusProtocols() {
vFuture.MinUpgradeWaitRounds = 10000
vFuture.MaxUpgradeWaitRounds = 150000
vFuture.Application = true
vFuture.LogicSigVersion = 2
Consensus[protocol.ConsensusFuture] = vFuture
}

Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all: TEAL_opcodes.md wat.md

TEAL_opcodes.md: ../../../cmd/opdoc/opdoc.go eval.go assembler.go doc.go
TEAL_opcodes.md: ../../../cmd/opdoc/opdoc.go eval.go assembler.go doc.go opcodes.go
go run ../../../cmd/opdoc/opdoc.go

wat.md: TEAL_opcodes.md README_in.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 @@ -373,7 +373,7 @@ TypeEnum mapping:
| 3 | acfg | AssetConfig |
| 4 | axfer | AssetTransfer |
| 5 | afrz | AssetFreeze |
| 6 | appl | invalid type name |
| 6 | appl | ApplicationCall |


FirstValidTime causes the program to fail. The field is reserved for future use.
Expand All @@ -398,7 +398,7 @@ FirstValidTime causes the program to fail. The field is reserved for future use.

## gtxn

- Opcode: 0x33 {uint8 transaction group index}{uint8 transaction field index}
- Opcode: 0x33 {uint8 transaction group index}{uint8 transaction field index}{uint8 transaction field array index}
- Pops: _None_
- Pushes: any
- push field to the stack from a transaction in the current transaction group
Expand Down Expand Up @@ -501,7 +501,7 @@ params: state key (top of the stack), application id, account index. Return: is_

## app_arg

- Opcode: 0x67
- Opcode: 0x67 {uint8 arg index N}
- Pops: _None_
- Pushes: []byte
- push ApplicationArgs[N] value to stack by index
Expand Down
Loading

0 comments on commit b392994

Please sign in to comment.