Skip to content

Commit

Permalink
feat: latest ARC56 will full source info
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-p committed Oct 23, 2024
1 parent 4467da9 commit 2ac332a
Show file tree
Hide file tree
Showing 198 changed files with 222,273 additions and 2,509 deletions.
4,862 changes: 4,764 additions & 98 deletions examples/amm/tealscript_artifacts/ConstantProductAMM.arc56_draft.json

Large diffs are not rendered by default.

4,903 changes: 4,813 additions & 90 deletions examples/arc58/artifacts/AbstractedAccount.arc56_draft.json

Large diffs are not rendered by default.

2,743 changes: 2,696 additions & 47 deletions examples/arc72/artifacts/ARC72.arc56_draft.json

Large diffs are not rendered by default.

3,271 changes: 3,228 additions & 43 deletions examples/arc75/artifacts/ARC75.arc56_draft.json

Large diffs are not rendered by default.

2,419 changes: 2,388 additions & 31 deletions examples/auction/tealscript_artifacts/Auction.arc56_draft.json

Large diffs are not rendered by default.

1,851 changes: 1,834 additions & 17 deletions examples/big_box/artifacts/BigBox.arc56_draft.json

Large diffs are not rendered by default.

635 changes: 627 additions & 8 deletions examples/calculator/artifacts/Calculator.arc56_draft.json

Large diffs are not rendered by default.

1,090 changes: 1,084 additions & 6 deletions examples/itxns/artifacts/FactoryCaller.arc56_draft.json

Large diffs are not rendered by default.

598 changes: 590 additions & 8 deletions examples/itxns/artifacts/NFTFactory.arc56_draft.json

Large diffs are not rendered by default.

713 changes: 699 additions & 14 deletions examples/lsig_with_app/artifacts/CreatorVerifier.arc56_draft.json

Large diffs are not rendered by default.

2,316 changes: 2,298 additions & 18 deletions examples/merkle/artifacts/MerkleTree.arc56_draft.json

Large diffs are not rendered by default.

556 changes: 552 additions & 4 deletions examples/non_abi/artifacts/NonABIExample.arc56_draft.json

Large diffs are not rendered by default.

20,397 changes: 20,219 additions & 178 deletions examples/reti/artifacts/StakingPool.arc56_draft.json

Large diffs are not rendered by default.

28,600 changes: 28,307 additions & 293 deletions examples/reti/artifacts/ValidatorRegistry.arc56_draft.json

Large diffs are not rendered by default.

1,142 changes: 1,124 additions & 18 deletions examples/simple/artifacts/Simple.arc56_draft.json

Large diffs are not rendered by default.

2,722 changes: 2,695 additions & 27 deletions examples/tuple_in_box/tealscript_artifacts/ContactsApp.arc56_draft.json

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions src/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7679,12 +7679,7 @@ declare type AssetFreezeTxn = Required<AssetFreezeParams>;
},
};

const arc56SourceInfo: { pc: number[]; errorMessage: string }[] = this.sourceInfo
.filter((s) => s.errorMessage)
.map((s) => ({
pc: s.pc as number[],
errorMessage: s.errorMessage as string,
}));
const sourceInfo = this.sourceInfo.filter((s) => s.pc !== undefined);

const arc56: ARC56Contract = {
...this.arc4Description(),
Expand All @@ -7694,7 +7689,11 @@ declare type AssetFreezeTxn = Required<AssetFreezeParams>;
bareActions: { create: [], call: [] },
// TODO: clear source mapping
sourceInfo: {
approval: { sourceInfo: arc56SourceInfo, pcOffsetMethod: this.hasDynamicTemplateVar ? 'cblocks' : 'none' },
approval: {
// @ts-expect-error Undefined PCs are filtered out above
sourceInfo,
pcOffsetMethod: this.hasDynamicTemplateVar ? 'cblocks' : 'none',
},
clear: { sourceInfo: [], pcOffsetMethod: 'none' },
},
source: {
Expand Down
14 changes: 9 additions & 5 deletions src/types/arc56.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,15 @@ export interface StorageMap {
prefix?: string;
}

export interface SourceInfo {
/** The program counter offset(s) that correspond to this line of TEAL */
pc?: Array<number>;
/** A human-readable string that describes the error when the program fails at this given line of TEAL */
errorMessage: string;
interface SourceInfo {
/** The program counter value(s). Could be offset if pcOffsetMethod is not "none" */
pc: Array<number>;
/** A human-readable string that describes the error when the program fails at the given PC */
errorMessage?: string;
/** The TEAL line number that corresponds to the given PC. RECOMMENDED to be used for development purposes, but not required for clients */
teal?: number;
/** The original source file and line number that corresponds to the given PC. RECOMMENDED to be used for development purposes, but not required for clients */
source?: string;
}

export interface ProgramSourceInfo {
Expand Down
244 changes: 238 additions & 6 deletions tests/contracts/artifacts/A.arc56_draft.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,254 @@
"approval": {
"sourceInfo": [
{
"teal": 1,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
0
]
},
{
"teal": 13,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
1,
2
]
},
{
"teal": 14,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
3
]
},
{
"teal": 15,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
4,
5
]
},
{
"teal": 16,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
6
]
},
{
"teal": 17,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
7,
8
]
},
{
"teal": 18,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
9
]
},
{
"teal": 19,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35
]
},
{
"teal": 23,
"source": "tests/contracts/inheritance.algo.ts:12",
"errorMessage": "The requested action is not implemented in this contract. Are you using the correct OnComplete? Did you set your app ID?",
"pc": [
36
],
"errorMessage": "The requested action is not implemented in this contract. Are you using the correct OnComplete? Did you set your app ID?"
]
},
{
"teal": 28,
"source": "tests/contracts/inheritance.algo.ts:15",
"pc": [
37,
38,
39
]
},
{
"teal": 29,
"source": "tests/contracts/inheritance.algo.ts:15",
"pc": [
40,
41
]
},
{
"teal": 30,
"source": "tests/contracts/inheritance.algo.ts:15",
"pc": [
42
]
},
{
"teal": 34,
"source": "tests/contracts/inheritance.algo.ts:15",
"pc": [
43,
44,
45
]
},
{
"teal": 38,
"source": "tests/contracts/inheritance.algo.ts:16",
"pc": [
46,
47,
48
]
},
{
"teal": 39,
"source": "tests/contracts/inheritance.algo.ts:16",
"pc": [
49,
50,
51
]
},
{
"teal": 40,
"source": "tests/contracts/inheritance.algo.ts:16",
"pc": [
52
]
},
{
"teal": 41,
"source": "tests/contracts/inheritance.algo.ts:15",
"pc": [
53
]
},
{
"teal": 44,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
54,
55
]
},
{
"teal": 45,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
56
]
},
{
"teal": 48,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
57,
58,
59,
60,
61,
62
]
},
{
"teal": 49,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
63,
64,
65
]
},
{
"teal": 50,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
66,
67,
68,
69
]
},
{
"teal": 53,
"source": "tests/contracts/inheritance.algo.ts:12",
"errorMessage": "this contract does not implement the given ABI method for create NoOp",
"pc": [
70
],
"errorMessage": "this contract does not implement the given ABI method for create NoOp"
]
},
{
"teal": 56,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
71,
72,
73,
74,
75,
76
]
},
{
"teal": 57,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
77,
78,
79
]
},
{
"teal": 58,
"source": "tests/contracts/inheritance.algo.ts:12",
"pc": [
80,
81,
82,
83
]
},
{
"teal": 61,
"source": "tests/contracts/inheritance.algo.ts:12",
"errorMessage": "this contract does not implement the given ABI method for call NoOp",
"pc": [
84
],
"errorMessage": "this contract does not implement the given ABI method for call NoOp"
]
}
],
"pcOffsetMethod": "none"
Expand Down
Loading

0 comments on commit 2ac332a

Please sign in to comment.