opened 04:52PM - 23 Nov 21 UTC
new-bug
### Subject of the issue
Using `gloads` to load scratch space values from tr…ansactions in a group does not work in dryrun mode, it always return 0.
### Your environment
<!--
* Software version: `algod -v`
```
12884901889
3.0.1.stable [rel/stable] (commit #b619b940)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand
```
* Node status if applicable: `goal node status`
```
Last committed block: 18076728
Time since last block: 1.0s
Sync Time: 0.0s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c
Round for next consensus protocol: 18076729
Next consensus protocol supported: true
Last Catchpoint:
Genesis ID: testnet-v1.0
Genesis hash: SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=
```
* Operating System details.
```
Linux ad1fa94c5147 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 GNU/Linux
```
* In many cases log files and cadaver files are also useful to include. Since these files may be large, an Algorand developer may request them later. These files may include public addresses that you're participating with. If that is a concern please be sure to scrub that data.
-->
### Steps to reproduce
1. Use the following TEAL sources:
The intention is to save the group index in slot 254 for TX0, TX1 and TX2.
TX3 must check saved values with `gloads`.
```
#pragma version 5
txn GroupIndex
int 3
==
bnz checkgload
txn GroupIndex
store 254
b exit
checkgload:
int 0
gloads 254
int 0
==
int 1
gloads 254
int 1
==
int 2
gloads 254
int 2
==
&&
assert
exit:
int 1
```
Clear program is trivial:
```
#pragma version 5
int 1
```
2.
### Expected behaviour
`gloads` should load 0, 1 and 2, not zero.
### Actual behaviour
It always seems to retrieve zero value.
Dryrun dump follows:
```
root@ad1fa94c5147:~/testnetwork/Node/test# goal clerk dryrun-remote -D grouped.dr -v
tx[0] cost: 9
tx[0] messages:
ApprovalProgram
PASS
tx[0] trace:
1 (0001): #pragma version 5 []
2 (0006): intcblock 1 0 2 []
3 (0008): txn GroupIndex [0]
4 (000a): pushint 3 [0 3]
5 (000b): == [0]
6 (000e): bnz label1 []
7 (0010): txn GroupIndex [0]
8 (0012): store 254 []
25 (0026): label2: []
26 (0027): intc_0 // 1 [1]
tx[1] cost: 9
tx[1] messages:
ApprovalProgram
PASS
tx[1] trace:
1 (0001): #pragma version 5 []
2 (0006): intcblock 1 0 2 []
3 (0008): txn GroupIndex [1]
4 (000a): pushint 3 [1 3]
5 (000b): == [0]
6 (000e): bnz label1 []
7 (0010): txn GroupIndex [1]
8 (0012): store 254 []
25 (0026): label2: []
26 (0027): intc_0 // 1 [1]
tx[2] cost: 9
tx[2] messages:
ApprovalProgram
PASS
tx[2] trace:
1 (0001): #pragma version 5 []
2 (0006): intcblock 1 0 2 []
3 (0008): txn GroupIndex [2]
4 (000a): pushint 3 [2 3]
5 (000b): == [0]
6 (000e): bnz label1 []
7 (0010): txn GroupIndex [2]
8 (0012): store 254 []
25 (0026): label2: []
26 (0027): intc_0 // 1 [1]
tx[3] cost: 19
tx[3] messages:
ApprovalProgram
REJECT
logic eval error: assert failed pc=37
tx[3] trace:
1 (0001): #pragma version 5 []
2 (0006): intcblock 1 0 2 []
3 (0008): txn GroupIndex [3]
4 (000a): pushint 3 [3 3]
5 (000b): == [1]
10 (0015): label1: []
11 (0016): intc_1 // 0 [0]
12 (0018): gloads 254 [0]
13 (0019): intc_1 // 0 [0 0]
14 (001a): == [1]
15 (001b): intc_0 // 1 [1 1]
16 (001d): gloads 254 [1 0]
17 (001e): intc_0 // 1 [1 0 1]
18 (001f): == [1 0]
19 (0020): intc_2 // 2 [1 0 2]
20 (0022): gloads 254 [1 0 0]
21 (0023): intc_2 // 2 [1 0 0 2]
22 (0024): == [1 0 0]
23 (0025): && [1 0]
23 (0025): && [1 0]
```
Thanks.