Skip to content

Commit

Permalink
restore general test
Browse files Browse the repository at this point in the history
joe-p committed Sep 20, 2024
1 parent dd2aef8 commit e2d1e43
Showing 18 changed files with 11,457 additions and 6,983 deletions.
4 changes: 2 additions & 2 deletions src/lib/compiler.ts
Original file line number Diff line number Diff line change
@@ -2948,7 +2948,7 @@ export default class Compiler {
Object.keys(this.templateVars).forEach((propName, i) => {
const { name, type } = this.templateVars[propName];

let op = 'bytes';
let op = 'byte';

if (isNumeric(type)) {
op = 'int';
@@ -6007,7 +6007,7 @@ export default class Compiler {
const propName = chain[0].getNameNode().getText();
const { name, type } = this.templateVars[propName];

let op = 'bytes';
let op = 'byte';
if (isNumeric(type)) op = 'int';

this.push(chain[0], `${op} TMPL_${name}`, type);
4 changes: 2 additions & 2 deletions src/lib/optimize.ts
Original file line number Diff line number Diff line change
@@ -462,7 +462,7 @@ function constantBlocks(inputTeal: TEALInfo[]): TEALInfo[] {
oldTeal.forEach((t) => {
const { teal } = t;

if (teal.startsWith('bytes ')) {
if (teal.startsWith('byte ')) {
const value = teal.split(' ')[1];
if (value.startsWith('TMPL_')) {
bytecblock.add(value);
@@ -473,7 +473,7 @@ function constantBlocks(inputTeal: TEALInfo[]): TEALInfo[] {
}
}

if (teal.startsWith('int')) {
if (teal.startsWith('int ')) {
const value = teal.split(' ')[1];
if (value.startsWith('TMPL_')) {
intcblock.add(value);
4 changes: 3 additions & 1 deletion tests/contracts/artifacts/DummyContract.approval.teal
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma version 10
intcblock 1 6
bytecblock 0xb8447b36

// This TEAL was generated by TEALScript v0.102.0
// https://github.com/algorandfoundation/TEALScript
@@ -27,7 +29,7 @@ switch *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_
return

*create_NoOp:
method "createApplication()void"
byte 0xb8447b36 // method "createApplication()void"
txna ApplicationArgs 0
match *abi_route_createApplication

2 changes: 1 addition & 1 deletion tests/contracts/artifacts/DummyContract.arc32.json
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
}
},
"source": {
"approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgovLyBUaGlzIFRFQUwgd2FzIGdlbmVyYXRlZCBieSBURUFMU2NyaXB0IHYwLjEwMi4wCi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9hbGdvcmFuZGZvdW5kYXRpb24vVEVBTFNjcmlwdAoKLy8gVGhpcyBjb250cmFjdCBpcyBjb21wbGlhbnQgd2l0aCBhbmQvb3IgaW1wbGVtZW50cyB0aGUgZm9sbG93aW5nIEFSQ3M6IFsgQVJDNCBdCgovLyBUaGUgZm9sbG93aW5nIHRlbiBsaW5lcyBvZiBURUFMIGhhbmRsZSBpbml0aWFsIHByb2dyYW0gZmxvdwovLyBUaGlzIHBhdHRlcm4gaXMgdXNlZCB0byBtYWtlIGl0IGVhc3kgZm9yIGFueW9uZSB0byBwYXJzZSB0aGUgc3RhcnQgb2YgdGhlIHByb2dyYW0gYW5kIGRldGVybWluZSBpZiBhIHNwZWNpZmljIGFjdGlvbiBpcyBhbGxvd2VkCi8vIEhlcmUsIGFjdGlvbiByZWZlcnMgdG8gdGhlIE9uQ29tcGxldGUgaW4gY29tYmluYXRpb24gd2l0aCB3aGV0aGVyIHRoZSBhcHAgaXMgYmVpbmcgY3JlYXRlZCBvciBjYWxsZWQKLy8gRXZlcnkgcG9zc2libGUgYWN0aW9uIGZvciB0aGlzIGNvbnRyYWN0IGlzIHJlcHJlc2VudGVkIGluIHRoZSBzd2l0Y2ggc3RhdGVtZW50Ci8vIElmIHRoZSBhY3Rpb24gaXMgbm90IGltcGxlbWVudGVkIGluIHRoZSBjb250cmFjdCwgaXRzIHJlc3BlY3RpdmUgYnJhbmNoIHdpbGwgYmUgIipOT1RfSU1QTEVNRU5URUQiIHdoaWNoIGp1c3QgY29udGFpbnMgImVyciIKdHhuIEFwcGxpY2F0aW9uSUQKIQppbnQgNgoqCnR4biBPbkNvbXBsZX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U1FTlRFRAoKKk5PVF9JTVBMRU1FTlRFRDoKCS8vIFRoZSByZXF1ZXN0ZWQgYWN0aW9uIGlzIG5vdCBpbXBsZW1lbnRlZCBpbiB0aGlzIGNvbnRyYWN0LiBBcmUgeW91IHVzaW5nIHRoZSBjb3JyZWN0IE9uQ29tcGxldGU/IERpZCB5b3Ugc2V0IHlvdXIgYXBwIElEPwoJZXJyCgoqYWJpX3JvdXRlX2NyZWF0ZUFwcGxpY2F0aW9uOgoJaW50IDEKCXJldHVybgoKKmNyZWF0ZV9Ob09wOgoJYnl0ZSAweGI4NDQ3YjM2IC8vIG1ldGhvZCAiY3JlYXRlQXBwbGljYXRpb24oKXZvaWQiCgl0eG5hIEFwcGxpY2F0aW9uQXJncyAwCgltYXRjaCAqYWJpX3JvdXRlX2NyZWF0ZUFwcGxpY2F0aW9uCgoJLy8gdGhpcyBjb250cmFjdCBkb2VzIG5vdCBpbXBsZW1lbnQgdGhlIGdpdmVuIEFCSSBtZXRob2QgZm9yIGNyZWF0ZSBOb09wCgllcnI=",
"clear": "I3ByYWdtYSB2ZXJzaW9uIDEw"
},
"contract": {
119 changes: 71 additions & 48 deletions tests/contracts/artifacts/DummyContract.arc56_draft.json
Original file line number Diff line number Diff line change
@@ -57,65 +57,77 @@
]
},
{
"teal": 13,
"teal": 2,
"source": 5,
"pc": [
1,
2
2,
3,
4
]
},
{
"teal": 14,
"teal": 3,
"source": 5,
"pc": [
3
5,
6,
7,
8,
9,
10,
11
]
},
{
"teal": 15,
"source": 5,
"pc": [
4,
5
12,
13
]
},
{
"teal": 16,
"source": 5,
"pc": [
6
14
]
},
{
"teal": 17,
"source": 5,
"pc": [
7,
8
15,
16
]
},
{
"teal": 18,
"source": 5,
"pc": [
9
17
]
},
{
"teal": 19,
"source": 5,
"pc": [
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
19
]
},
{
"teal": 20,
"source": 5,
"pc": [
20
]
},
{
"teal": 21,
"source": 5,
"pc": [
21,
22,
23,
@@ -130,80 +142,91 @@
32,
33,
34,
35
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46
]
},
{
"teal": 23,
"teal": 25,
"source": 5,
"errorMessage": "The requested action is not implemented in this contract. Are you using the correct OnComplete? Did you set your app ID?",
"pc": [
36
47
]
},
{
"teal": 26,
"teal": 28,
"source": 5,
"pc": [
37,
38
48,
49
]
},
{
"teal": 27,
"teal": 29,
"source": 5,
"pc": [
39
50
]
},
{
"teal": 30,
"teal": 32,
"source": 5,
"pc": [
40,
41,
42,
43,
44,
45
51,
52,
53,
54,
55,
56
]
},
{
"teal": 31,
"teal": 33,
"source": 5,
"pc": [
46,
47,
48
57,
58,
59
]
},
{
"teal": 32,
"teal": 34,
"source": 5,
"pc": [
49,
50,
51,
52
60,
61,
62,
63
]
},
{
"teal": 35,
"teal": 37,
"source": 5,
"errorMessage": "this contract does not implement the given ABI method for create NoOp",
"pc": [
53
64
]
}
],
"clear": []
},
"source": {
"approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgovLyBUaGlzIFRFQUwgd2FzIGdlbmVyYXRlZCBieSBURUFMU2NyaXB0IHYwLjEwMi4wCi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9hbGdvcmFuZGZvdW5kYXRpb24vVEVBTFNjcmlwdAoKLy8gVGhpcyBjb250cmFjdCBpcyBjb21wbGlhbnQgd2l0aCBhbmQvb3IgaW1wbGVtZW50cyB0aGUgZm9sbG93aW5nIEFSQ3M6IFsgQVJDNCBdCgovLyBUaGUgZm9sbG93aW5nIHRlbiBsaW5lcyBvZiBURUFMIGhhbmRsZSBpbml0aWFsIHByb2dyYW0gZmxvdwovLyBUaGlzIHBhdHRlcm4gaXMgdXNlZCB0byBtYWtlIGl0IGVhc3kgZm9yIGFueW9uZSB0byBwYXJzZSB0aGUgc3RhcnQgb2YgdGhlIHByb2dyYW0gYW5kIGRldGVybWluZSBpZiBhIHNwZWNpZmljIGFjdGlvbiBpcyBhbGxvd2VkCi8vIEhlcmUsI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jEYFIEGCzEZCI0MAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAIEBQ4AEuER7NjYaAI4B//AA",
"approval": "CiACAQYmAQS4RHs2MRgUgQYLMRkIjQwAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAgQFDgAS4RHs2NhoAjgH/8AA=",
"clear": "Cg=="
},
"compilerInfo": {
Loading

0 comments on commit e2d1e43

Please sign in to comment.