Skip to content

Commit 38b08a0

Browse files
authored
tealdbg: use associated group index instead of global (#3111)
setting group index to be the one associated with the run
1 parent c2054e5 commit 38b08a0

File tree

3 files changed

+103
-3
lines changed

3 files changed

+103
-3
lines changed

cmd/tealdbg/local.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ func (r *LocalRunner) RunAll() error {
540540
ep := logic.EvalParams{
541541
Proto: &r.proto,
542542
Debugger: r.debugger,
543-
Txn: &r.txnGroup[groupIndex],
543+
Txn: &r.txnGroup[run.groupIndex],
544544
TxnGroup: r.txnGroup,
545545
GroupIndex: run.groupIndex,
546546
PastSideEffects: run.pastSideEffects,
@@ -588,7 +588,7 @@ func (r *LocalRunner) Run() (bool, error) {
588588
}
589589
ep := logic.EvalParams{
590590
Proto: &r.proto,
591-
Txn: &r.txnGroup[groupIndex],
591+
Txn: &r.txnGroup[run.groupIndex],
592592
TxnGroup: r.txnGroup,
593593
GroupIndex: run.groupIndex,
594594
PastSideEffects: run.pastSideEffects,

cmd/tealdbg/local_test.go

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,3 +1350,103 @@ byte 0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12e // addr
13501350
})
13511351
}
13521352
}
1353+
1354+
func TestGroupTxnIdx(t *testing.T) {
1355+
1356+
partitiontest.PartitionTest(t)
1357+
a := require.New(t)
1358+
1359+
ddrBlob := `{
1360+
"accounts": [
1361+
{
1362+
"address": "FPVVJ7N42QRVP2OWBGZ3XPTQAZFQNBYHJGZ2CJFOATAQNWFA5NWB4MPWBQ",
1363+
"amount": 3999999999497000,
1364+
"amount-without-pending-rewards": 3999999999497000,
1365+
"created-apps": [
1366+
{
1367+
"id": 1,
1368+
"params": {
1369+
"approval-program": "BSABATEQIhJAABExEIEGEkAAByJAAAEAIkMiQ4EAQw==",
1370+
"clear-state-program": "BYEBQw==",
1371+
"creator": "FPVVJ7N42QRVP2OWBGZ3XPTQAZFQNBYHJGZ2CJFOATAQNWFA5NWB4MPWBQ"
1372+
}
1373+
}
1374+
],
1375+
"pending-rewards": 0,
1376+
"rewards": 0,
1377+
"round": 2,
1378+
"status": "Online"
1379+
},
1380+
{
1381+
"address": "WCS6TVPJRBSARHLN2326LRU5BYVJZUKI2VJ53CAWKYYHDE455ZGKANWMGM",
1382+
"amount": 500000,
1383+
"amount-without-pending-rewards": 500000,
1384+
"pending-rewards": 0,
1385+
"rewards": 0,
1386+
"round": 2,
1387+
"status": "Offline"
1388+
}
1389+
],
1390+
"apps": [
1391+
{
1392+
"id": 1,
1393+
"params": {
1394+
"approval-program": "BSABATEQIhJAABExEIEGEkAAByJAAAEAIkMiQ4EAQw==",
1395+
"clear-state-program": "BYEBQw==",
1396+
"creator": "FPVVJ7N42QRVP2OWBGZ3XPTQAZFQNBYHJGZ2CJFOATAQNWFA5NWB4MPWBQ"
1397+
}
1398+
}
1399+
],
1400+
"latest-timestamp": 1634765269,
1401+
"protocol-version": "future",
1402+
"round": 2,
1403+
"sources": null,
1404+
"txns": [
1405+
{
1406+
"sig": "8Z/ECart3vFBSKp5sFuNRN4coliea4TE+xttZNn9E15DJ8GZ++kgtZKhG4Tiopv7r61Lqh8VBuyuTf9AC3uQBQ==",
1407+
"txn": {
1408+
"amt": 5000,
1409+
"fee": 1000,
1410+
"fv": 3,
1411+
"gen": "sandnet-v1",
1412+
"gh": "pjM5GFR9MpNkWIibcfqtu/a2OIZTBy/mSQc++sF1r0Q=",
1413+
"grp": "2ca4sSb5aGab0k065qIT3J3AcB5YWYezrRh6bLB0ve8=",
1414+
"lv": 1003,
1415+
"note": "V+GSPgDmLQo=",
1416+
"rcv": "WCS6TVPJRBSARHLN2326LRU5BYVJZUKI2VJ53CAWKYYHDE455ZGKANWMGM",
1417+
"snd": "FPVVJ7N42QRVP2OWBGZ3XPTQAZFQNBYHJGZ2CJFOATAQNWFA5NWB4MPWBQ",
1418+
"type": "pay"
1419+
}
1420+
},
1421+
{
1422+
"sig": "4/gj+6rllN/Uc55kAJ0BOKTzoUJKJ7gExE3vp7cr5vC9XVStx0QNZq1DFXLhpTZnTQAl3zOrGzIxfS5HOpSyCg==",
1423+
"txn": {
1424+
"apid": 1,
1425+
"fee": 1000,
1426+
"fv": 3,
1427+
"gh": "pjM5GFR9MpNkWIibcfqtu/a2OIZTBy/mSQc++sF1r0Q=",
1428+
"grp": "2ca4sSb5aGab0k065qIT3J3AcB5YWYezrRh6bLB0ve8=",
1429+
"lv": 1003,
1430+
"note": "+fl8jkXqyFc=",
1431+
"snd": "FPVVJ7N42QRVP2OWBGZ3XPTQAZFQNBYHJGZ2CJFOATAQNWFA5NWB4MPWBQ",
1432+
"type": "appl"
1433+
}
1434+
}
1435+
]
1436+
}`
1437+
1438+
ds := DebugParams{
1439+
Proto: string(protocol.ConsensusCurrentVersion),
1440+
DdrBlob: []byte(ddrBlob),
1441+
GroupIndex: 0,
1442+
RunMode: "application",
1443+
}
1444+
1445+
local := MakeLocalRunner(nil)
1446+
err := local.Setup(&ds)
1447+
a.NoError(err)
1448+
1449+
pass, err := local.Run()
1450+
a.NoError(err)
1451+
a.True(pass)
1452+
}

cmd/tealdbg/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func debugLocal(args []string) {
240240
if len(txnFile) > 0 {
241241
txnBlob, err = ioutil.ReadFile(txnFile)
242242
if err != nil {
243-
log.Fatalf("Error txn reading %s: %s", balanceFile, err)
243+
log.Fatalf("Error txn reading %s: %s", txnFile, err)
244244
}
245245
}
246246

0 commit comments

Comments
 (0)