summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichaeldiamant <michaeldiamant@users.noreply.github.com>2022-07-15 15:47:09 -0400
committermichaeldiamant <michaeldiamant@users.noreply.github.com>2022-07-15 15:47:09 -0400
commit134d358249881303807bd39e9ef74096507ac6a4 (patch)
treec8e933374582f6b025d88275071d7fdf8aa96190
parent5ca685ab555e984e76f079d40130bccd4d65f347 (diff)
AVM: Consolidate TEAL and AVM versioniongavm_version_consolidation
-rw-r--r--data/transactions/logic/assembler.go12
-rw-r--r--data/transactions/logic/assembler_test.go10
-rw-r--r--data/transactions/logic/backwardCompat_test.go10
-rw-r--r--data/transactions/logic/evalStateful_test.go2
-rw-r--r--data/transactions/logic/eval_test.go10
-rw-r--r--data/transactions/logic/fields.go2
-rw-r--r--data/transactions/logic/opcodes.go12
-rw-r--r--ledger/internal/eval_blackbox_test.go8
-rw-r--r--protocol/consensus.go2
-rwxr-xr-xtest/scripts/e2e_subs/rekey.sh2
10 files changed, 35 insertions, 35 deletions
diff --git a/data/transactions/logic/assembler.go b/data/transactions/logic/assembler.go
index 6a05596b2..101f1f265 100644
--- a/data/transactions/logic/assembler.go
+++ b/data/transactions/logic/assembler.go
@@ -929,7 +929,7 @@ func asmItxnField(ops *OpStream, spec *OpSpec, args []string) error {
return ops.errorf("%s %#v is not allowed.", spec.Name, args[0])
}
if fs.itxVersion > ops.Version {
- return ops.errorf("%s %s field was introduced in TEAL v%d. Missed #pragma version?", spec.Name, args[0], fs.itxVersion)
+ return ops.errorf("%s %s field was introduced in v%d. Missed #pragma version?", spec.Name, args[0], fs.itxVersion)
}
ops.pending.WriteByte(spec.Opcode)
ops.pending.WriteByte(fs.Field())
@@ -961,7 +961,7 @@ func asmDefault(ops *OpStream, spec *OpSpec, args []string) error {
ops.returns(spec, fs.Type())
}
if fs.Version() > ops.Version {
- return ops.errorf("%s %s field was introduced in TEAL v%d. Missed #pragma version?",
+ return ops.errorf("%s %s field was introduced in v%d. Missed #pragma version?",
spec.Name, args[i], fs.Version())
}
ops.pending.WriteByte(fs.Field())
@@ -1413,7 +1413,7 @@ func (ops *OpStream) assemble(text string) error {
// bail out on the assembly as a whole.
spec, ok = OpsByName[AssemblerMaxVersion][opstring]
if ok {
- ops.errorf("%s opcode was introduced in TEAL v%d", opstring, spec.Version)
+ ops.errorf("%s opcode was introduced in v%d", opstring, spec.Version)
} else {
spec, ok = keywords[opstring]
}
@@ -1450,7 +1450,7 @@ func (ops *OpStream) assemble(text string) error {
}
}
- // backward compatibility: do not allow jumps behind last instruction in TEAL v1
+ // backward compatibility: do not allow jumps behind last instruction in v1
if ops.Version <= 1 {
for label, dest := range ops.labels {
if dest == ops.pending.Len() {
@@ -1506,7 +1506,7 @@ func (ops *OpStream) pragma(line string) error {
// We initialize Version with assemblerNoVersion as a marker for
// non-specified version because version 0 is valid
- // version for TEAL v1.
+ // version for v1.
if ops.Version == assemblerNoVersion {
ops.Version = ver
} else if ops.Version != ver {
@@ -1553,7 +1553,7 @@ func (ops *OpStream) resolveLabels() {
// all branch instructions (currently) are opcode byte and 2 offset bytes, and the destination is relative to the next pc as if the branch was a no-op
naturalPc := lr.position + 3
if ops.Version < backBranchEnabledVersion && dest < naturalPc {
- ops.errorf("label %#v is a back reference, back jump support was introduced in TEAL v4", lr.label)
+ ops.errorf("label %#v is a back reference, back jump support was introduced in v4", lr.label)
continue
}
jump := dest - naturalPc
diff --git a/data/transactions/logic/assembler_test.go b/data/transactions/logic/assembler_test.go
index 6d8abbddc..f14444940 100644
--- a/data/transactions/logic/assembler_test.go
+++ b/data/transactions/logic/assembler_test.go
@@ -1686,7 +1686,7 @@ func TestAssembleVersions(t *testing.T) {
testLine(t, "txna Accounts 0", AssemblerMaxVersion, "")
testLine(t, "txna Accounts 0", 2, "")
- testLine(t, "txna Accounts 0", 1, "txna opcode was introduced in TEAL v2")
+ testLine(t, "txna Accounts 0", 1, "txna opcode was introduced in v2")
}
func TestAssembleBalance(t *testing.T) {
@@ -1877,7 +1877,7 @@ func TestDisassembleLastLabel(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
- // starting from TEAL v2 branching to the last line are legal
+ // starting from v2 branching to the last line are legal
for v := uint64(2); v <= AssemblerMaxVersion; v++ {
t.Run(fmt.Sprintf("v=%d", v), func(t *testing.T) {
source := fmt.Sprintf(`#pragma version %d
@@ -2219,7 +2219,7 @@ int 1
require.NoError(t, err)
require.Equal(t, ops2.Program, ops.Program)
- // check if no version it defaults to TEAL v1
+ // check if no version it defaults to v1
text = `byte "test"
len
`
@@ -2479,8 +2479,8 @@ func TestBadInnerFields(t *testing.T) {
testProg(t, "itxn_begin; int 1000; itxn_field FirstValidTime", 5, Expect{3, "...is not allowed."})
testProg(t, "itxn_begin; int 1000; itxn_field LastValid", 5, Expect{3, "...is not allowed."})
testProg(t, "itxn_begin; int 32; bzero; itxn_field Lease", 5, Expect{4, "...is not allowed."})
- testProg(t, "itxn_begin; byte 0x7263; itxn_field Note", 5, Expect{3, "...Note field was introduced in TEAL v6..."})
- testProg(t, "itxn_begin; byte 0x7263; itxn_field VotePK", 5, Expect{3, "...VotePK field was introduced in TEAL v6..."})
+ testProg(t, "itxn_begin; byte 0x7263; itxn_field Note", 5, Expect{3, "...Note field was introduced in v6..."})
+ testProg(t, "itxn_begin; byte 0x7263; itxn_field VotePK", 5, Expect{3, "...VotePK field was introduced in v6..."})
testProg(t, "itxn_begin; int 32; bzero; itxn_field TxID", 5, Expect{4, "...is not allowed."})
testProg(t, "itxn_begin; int 1000; itxn_field FirstValid", 6, Expect{3, "...is not allowed."})
diff --git a/data/transactions/logic/backwardCompat_test.go b/data/transactions/logic/backwardCompat_test.go
index d21a989e0..83488aca8 100644
--- a/data/transactions/logic/backwardCompat_test.go
+++ b/data/transactions/logic/backwardCompat_test.go
@@ -29,7 +29,7 @@ import (
)
// This test ensures a program compiled with by pre-AVM v2 go-algorand
-// that includes all the opcodes from TEAL v1 runs in AVM v2 runModeSignature well
+// that includes all the opcodes from AVM v1 runs in AVM v2 runModeSignature well
var sourceV1 = `byte 0x41 // A
sha256
byte 0x559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd
@@ -278,7 +278,7 @@ func TestBackwardCompatTEALv1(t *testing.T) {
})
ep, tx, _ := makeSampleEnvWithVersion(1)
- // RekeyTo disallowed on TEAL v0/v1
+ // RekeyTo disallowed on AVM v0/v1
tx.RekeyTo = basics.Address{}
ep.TxnGroup[0].Lsig.Logic = program
@@ -343,7 +343,7 @@ func TestBackwardCompatTEALv1(t *testing.T) {
testLogicBytes(t, program, ep)
}
-// ensure v2 fields error on pre TEAL v2 logicsig version
+// ensure v2 fields error on pre v2 logicsig version
// ensure v2 fields error in v1 program
func TestBackwardCompatGlobalFields(t *testing.T) {
partitiontest.PartitionTest(t)
@@ -461,8 +461,8 @@ func TestBackwardCompatTxnFields(t *testing.T) {
func TestBackwardCompatAssemble(t *testing.T) {
partitiontest.PartitionTest(t)
- // TEAL v1 does not allow branching to the last line
- // TEAL v2 makes such programs legal
+ // v1 does not allow branching to the last line
+ // v2 makes such programs legal
t.Parallel()
source := "int 1; int 1; bnz done; done:"
diff --git a/data/transactions/logic/evalStateful_test.go b/data/transactions/logic/evalStateful_test.go
index 2a9f329c2..66afd02ef 100644
--- a/data/transactions/logic/evalStateful_test.go
+++ b/data/transactions/logic/evalStateful_test.go
@@ -69,7 +69,7 @@ func TestEvalModes(t *testing.T) {
t.Parallel()
// ed25519verify* and err are tested separately below
- // check modeAny (TEAL v1 + txna/gtxna) are available in RunModeSignature
+ // check modeAny (v1 + txna/gtxna) are available in RunModeSignature
// check all opcodes available in runModeApplication
opcodesRunModeAny := `intcblock 0 1 1 1 1 5 100
bytecblock 0x414c474f 0x1337 0x2001 0xdeadbeef 0x70077007
diff --git a/data/transactions/logic/eval_test.go b/data/transactions/logic/eval_test.go
index 289a1d369..bc89ad226 100644
--- a/data/transactions/logic/eval_test.go
+++ b/data/transactions/logic/eval_test.go
@@ -40,7 +40,7 @@ import (
)
// Note that most of the tests use makeTestProto/defaultEvalParams as evaluator version so that
-// we check that TEAL v1 and v2 programs are compatible with the latest evaluator
+// we check that v1 and v2 programs are compatible with the latest evaluator
func makeTestProto() *config.ConsensusParams {
return makeTestProtoV(LogicVersion)
}
@@ -1628,7 +1628,7 @@ func TestTxn(t *testing.T) {
txn.Txn.ClearStateProgram = clearOps.Program
txn.Lsig.Logic = ops.Program
txn.Txn.ExtraProgramPages = 2
- // RekeyTo not allowed in TEAL v1
+ // RekeyTo not allowed in v1
if v < rekeyingEnabledVersion {
txn.Txn.RekeyTo = basics.Address{}
}
@@ -1888,7 +1888,7 @@ gtxn 0 Sender
for v, source := range tests {
t.Run(fmt.Sprintf("v=%d", v), func(t *testing.T) {
txn := makeSampleTxn()
- // RekeyTo not allowed in TEAL v1
+ // RekeyTo not allowed in v1
if v < rekeyingEnabledVersion {
txn.Txn.RekeyTo = basics.Address{}
}
@@ -5192,7 +5192,7 @@ func TestOpJSONRef(t *testing.T) {
if fidoVersion <= AssemblerMaxVersion {
for i := range expectedErrs {
if strings.Contains(expectedErrs[i].s, "json_ref") {
- expectedErrs[i].s = fmt.Sprintf("json_ref opcode was introduced in TEAL v%d", fidoVersion)
+ expectedErrs[i].s = fmt.Sprintf("json_ref opcode was introduced in v%d", fidoVersion)
}
}
}
@@ -5403,7 +5403,7 @@ func TestOpJSONRef(t *testing.T) {
if fidoVersion <= AssemblerMaxVersion {
for i := range expectedErrs {
if strings.Contains(expectedErrs[i].s, "json_ref") {
- expectedErrs[i].s = fmt.Sprintf("json_ref opcode was introduced in TEAL v%d", fidoVersion)
+ expectedErrs[i].s = fmt.Sprintf("json_ref opcode was introduced in v%d", fidoVersion)
}
}
}
diff --git a/data/transactions/logic/fields.go b/data/transactions/logic/fields.go
index 79870e88c..6abc83abd 100644
--- a/data/transactions/logic/fields.go
+++ b/data/transactions/logic/fields.go
@@ -564,7 +564,7 @@ func (fs globalFieldSpec) Note() string {
}
var globalFieldSpecs = [...]globalFieldSpec{
- // version 0 is the same as TEAL v1 (initial TEAL release)
+ // version 0 is the same as v1 (initial release)
{MinTxnFee, StackUint64, modeAny, 0, "microalgos"},
{MinBalance, StackUint64, modeAny, 0, "microalgos"},
{MaxTxnLife, StackUint64, modeAny, 0, "rounds"},
diff --git a/data/transactions/logic/opcodes.go b/data/transactions/logic/opcodes.go
index 99cd6fccf..20d0772ac 100644
--- a/data/transactions/logic/opcodes.go
+++ b/data/transactions/logic/opcodes.go
@@ -653,15 +653,15 @@ var opsByOpcode [LogicVersion + 1][256]OpSpec
// OpsByName map for each version, mapping opcode name to OpSpec
var OpsByName [LogicVersion + 1]map[string]OpSpec
-// Migration from TEAL v1 to TEAL v2.
-// TEAL v1 allowed execution of program with version 0.
-// With TEAL v2 opcode versions are introduced and they are bound to every opcode.
-// There is no opcodes with version 0 so that TEAL v2 evaluator rejects any program with version 0.
-// To preserve backward compatibility version 0 array is populated with TEAL v1 opcodes
+// Migration from v1 to v2.
+// v1 allowed execution of program with version 0.
+// With v2 opcode versions are introduced and they are bound to every opcode.
+// There is no opcodes with version 0 so that v2 evaluator rejects any program with version 0.
+// To preserve backward compatibility version 0 array is populated with v1 opcodes
// with the version overwritten to 0.
func init() {
// First, initialize baseline v1 opcodes.
- // Zero (empty) version is an alias for TEAL v1 opcodes and needed for compatibility with v1 code.
+ // Zero (empty) version is an alias for v1 opcodes and needed for compatibility with v1 code.
OpsByName[0] = make(map[string]OpSpec, 256)
OpsByName[1] = make(map[string]OpSpec, 256)
for _, oi := range OpSpecs {
diff --git a/ledger/internal/eval_blackbox_test.go b/ledger/internal/eval_blackbox_test.go
index 21240467c..271f30589 100644
--- a/ledger/internal/eval_blackbox_test.go
+++ b/ledger/internal/eval_blackbox_test.go
@@ -708,7 +708,7 @@ func TestDeleteNonExistantKeys(t *testing.T) {
t.Parallel()
genBalances, addrs, _ := ledgertesting.NewTestGenesis()
- // teal v2 (apps)
+ // AVM v2 (apps)
testConsensusRange(t, 24, 0, func(t *testing.T, ver int) {
dl := NewDoubleLedger(t, genBalances, consensusByNumber[ver])
defer dl.Close()
@@ -870,14 +870,14 @@ var consensusByNumber = []protocol.ConsensusVersion{
protocol.ConsensusV21,
protocol.ConsensusV22,
protocol.ConsensusV23,
- protocol.ConsensusV24, // teal v2 (apps)
+ protocol.ConsensusV24, // AVM v2 (apps)
protocol.ConsensusV25,
protocol.ConsensusV26,
protocol.ConsensusV27,
protocol.ConsensusV28,
protocol.ConsensusV29,
- protocol.ConsensusV30, // teal v5 (inner txs)
- protocol.ConsensusV31, // teal v6 (inner txs with appls)
+ protocol.ConsensusV30, // AVM v5 (inner txs)
+ protocol.ConsensusV31, // AVM v6 (inner txs with appls)
protocol.ConsensusV32, // unlimited assets and apps
protocol.ConsensusFuture,
}
diff --git a/protocol/consensus.go b/protocol/consensus.go
index e37f2dbe6..14017385b 100644
--- a/protocol/consensus.go
+++ b/protocol/consensus.go
@@ -128,7 +128,7 @@ const ConsensusV23 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/e5f565421d720c6f75cdd186f7098495caf9101f",
)
-// ConsensusV24 include the applications, rekeying and teal v2
+// ConsensusV24 include the applications, rekeying and AVM v2
const ConsensusV24 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/3a83c4c743f8b17adfd73944b4319c25722a6782",
)
diff --git a/test/scripts/e2e_subs/rekey.sh b/test/scripts/e2e_subs/rekey.sh
index f89e73a61..5c1e06abe 100755
--- a/test/scripts/e2e_subs/rekey.sh
+++ b/test/scripts/e2e_subs/rekey.sh
@@ -48,7 +48,7 @@ cat "${TEMPDIR}/group0_split-0.stxn" "${TEMPDIR}/group0_split-1.txn" > "${TEMPDI
RES=$(${gcmd} clerk rawsend -f "${TEMPDIR}/group0_signed.stxn" 2>&1 || true)
EXPERROR='program version must be >= 2 for this transaction group'
if [[ $RES != *"${EXPERROR}"* ]]; then
- date "+${scriptname} FAIL txn group with rekey transaction should require teal version >= 2 %Y%m%d_%H%M%S"
+ date "+${scriptname} FAIL txn group with rekey transaction should require version >= 2 %Y%m%d_%H%M%S"
false
fi