algorand / algorand/pyteal

Source Mapper: possible conflict on Windows

オープン
#710 コメント 1 件 リアクション 1 件 担当者 1 名 @tzaffi が担当を希望しています GitHub で見る
new-bug
主要言語
Python
スター
288
フォーク
138
PR マージ指標
30日以内にマージされた PR はありません

説明

Reporting this on behalf of one of our users @ErikHasselWander.
Discord thread: https://discord.com/channels/491256308461207573/1143656409905504406
PyTeal source mapper seems to apparently generate incorrect mapping while on Windows but correct elsewhere.

### Your environment

Windows and WSL.

### Steps to reproduce

#### PyTeal code in both cases
```python
from feature_gates import FeatureGates
FeatureGates.set_sourcemap_enabled(True)

import pyteal as pt

def approval_program() -> pt.Expr:
def create() -> pt.Expr:
return pt.Return(pt.Int(1))

def call() -> pt.Expr:
return pt.Seq(
pt.Pop(pt.Sha256(pt.Txn.sender())),
pt.Return(pt.Int(1))
)

return pt.Cond(
[pt.Global.current_application_id() == pt.Int(0), create()],
[pt.Int(1), call()]
)

if __name__ == "__main__":
print(pt.Compilation(approval_program(), pt.Mode.Application, version=4).compile(
with_sourcemap=True,
annotate_teal=True,
pcs_in_sourcemap=True,
annotate_teal_headers=True,
annotate_teal_concise=True,
).sourcemap.annotated_teal)
```

```shell
python -m venv venv
./venv/bin/activate.ps1
pip install pyteal=0.25.0
python ./test.py
```

### Expected behaviour (captured on WSL)

```
// GENERATED TEAL // PC PYTEAL
#pragma version 4 // (0) pt.Compilation(approval_program(), pt.Mode.Application, version=4).compile(with_sourcemap=True, annotate_teal=True, pcs_in_sourcemap=True, annotate_teal_headers=True, annotate_teal_concise=True)
global CurrentApplicationID // (4) pt.Global.current_application_id()
int 0 // (6) pt.Int(0)
== // (8) pt.Global.current_application_id() == pt.Int(0)
bnz main_l4 // (9)
int 1 // (12) pt.Int(1)
bnz main_l3 // (13)
err // (16) pt.Cond([pt.Global.current_application_id() == pt.Int(0), create()], [pt.Int(1), call()])
main_l3: // pt.Int(1)
txn Sender // (17) pt.Txn.sender()
sha256 // (19) pt.Sha256(pt.Txn.sender())
pop // (20) pt.Pop(pt.Sha256(pt.Txn.sender()))
int 1 // (21) pt.Int(1)
return // (22) pt.Return(pt.Int(1))
main_l4: // pt.Global.current_application_id() == pt.Int(0)
int 1 // (23) pt.Int(1)
return // (24) pt.Return(pt.Int(1))
```

### Actual behaviour (captured on Windows)

```
// GENERATED TEAL // PC PYTEAL
#pragma version 4 // (0) super().__init__(None)
global CurrentApplicationID // (4) super().__init__()
int 0 // (6) super().__init__()
== // (8) super().__init__()
bnz main_l4 // (9)
int 1 // (12) super().__init__()
bnz main_l3 // (13)
err // (16) super().__init__()
main_l3: // super().__init__()
txn Sender // (17) super().__init__()
sha256 // (19) super().__init__()
pop // (20)
int 1 // (21) super().__init__()
return // (22) super().__init__()
main_l4: // super().__init__()
int 1 // (23) super().__init__()
return // (24) super().__init__()
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。