Hi everyone,
I’m writing my very first SC in algorand. Started with Teal3, since it has some new opcodes and global vars, but I got “version mismatch” error when debugging… Then, I switched to Teal2. But still, the same problem occurs when I try to debug the code.
Simple stateful Smart Contract in Teal2, which saves app creator:
#pragma version 2
int 0
txn ApplicationID
== //
bz not_creation
byte "Creator"
txn Sender
app_global_put
int 1
return
bz failed
not_creation:
byte "Creator"
app_global_get
txn Sender
== //
bz failed
int 1
return
failed:
int 0
return
Command creating the app: goal app create --creator <ACCOUNT> --approval-prog ./creator2.teal --global-byteslices 1 --global-ints 2 --local-byteslices 3 --local-ints 4 --clear-prog ./clear.teal --out=dump2.dr --dryrun-dump
Debug command: tealdbg debug creator2.teal -d dump2.dr
Results:
Debug error: 11 errors:
1: version mismatch: assembling v2 with v0 assembler
4: field ApplicationID available in version 2. Missed #pragma version?
5: == arg 0 wanted type any got None
6: bz opcode was introduced in TEAL v2
9: app_global_put opcode was introduced in TEAL v2
11: return opcode was introduced in TEAL v2
12: bz opcode was introduced in TEAL v2
15: app_global_get opcode was introduced in TEAL v2
18: bz opcode was introduced in TEAL v2
20: return opcode was introduced in TEAL v2
23: return opcode was introduced in TEAL v2
If I run creator SC for Teal3 (https://github.com/algorand/smart-contracts/blob/master/devrel/teal3/creator.teal), then I get this:
Debug error: 16 errors:
1: version mismatch: assembling v3 with v0 assembler
4: field ApplicationID available in version 2. Missed #pragma version?
5: == arg 0 wanted type any got None
6: bz opcode was introduced in TEAL v2
9: app_global_put opcode was introduced in TEAL v2
11: field GlobalNumUint available in version 3. Missed #pragma version?
14: field GlobalNumByteSlice available in version 3. Missed #pragma version?
17: && arg 0 wanted type uint64 got []byte
18: field LocalNumUint available in version 3. Missed #pragma version?
22: field LocalNumByteSlice available in version 3. Missed #pragma version?
25: && arg 0 wanted type uint64 got None
26: bz opcode was introduced in TEAL v2
31: global CreatorAddress available in version 3. Missed #pragma version?
33: bz opcode was introduced in TEAL v2
35: return opcode was introduced in TEAL v2
38: return opcode was introduced in TEAL v2
I guess the problem for both is that my algo node environment works for Teal V1. How do I change that, any ideas?
Thanks in advance!