From e4c7c121b6fbdacf501ba83f09ff864ce195525f Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Fri, 28 Feb 2025 13:00:53 +0100 Subject: [PATCH 01/12] tests: autogenerator for initof reachability tests. Still lacks spec file autogeneration. --- knip.json | 1 + .../contracts/initof-reachability.tact | 7983 +++++++++++++++++ .../autogenerated/gen-initof-reachability.ts | 1370 +++ 3 files changed, 9354 insertions(+) create mode 100644 src/test/autogenerated/contracts/initof-reachability.tact create mode 100644 src/test/autogenerated/gen-initof-reachability.ts diff --git a/knip.json b/knip.json index b0023ed31..ccb7bc49f 100644 --- a/knip.json +++ b/knip.json @@ -22,6 +22,7 @@ "src/test/utils/markdown.ts", "src/test/utils/with-log.ts", "src/utils/array.ts", + "src/test/autogenerated/gen-initof-reachability.ts", ".github/workflows/tact*.yml", ".github/actions/**/*.yml" ], diff --git a/src/test/autogenerated/contracts/initof-reachability.tact b/src/test/autogenerated/contracts/initof-reachability.tact new file mode 100644 index 000000000..6975d3452 --- /dev/null +++ b/src/test/autogenerated/contracts/initof-reachability.tact @@ -0,0 +1,7983 @@ + +fun fun_0(arg: Int): StateInit { + return initOf Deployer(); +} + +fun fun_9(arg: Int): StateInit { + let stateInit: StateInit = initOf Deployer(); + return stateInit; +} + +fun fun_10(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_11(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = initOf Deployer(); + } else { + stateInit = initOf Dummy2(); + } + return stateInit; +} + +fun fun_12(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_13(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = initOf Deployer(); + counter = counter + 1; + } + return stateInit; +} + +fun fun_14(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = initOf Deployer(); + counter = counter + 1; + } until (counter >= 2); + return stateInit; +} + +fun fun_15(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_16(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_1, v_2 in intMap) { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_17(arg: Int): StateInit { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: initOf Deployer()}; + return stateInit; +} + +fun fun_18(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_19(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_20(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_4) { + stateInit = initOf Deployer(); + } + return stateInit; +} + +fun fun_21(arg: Int): StateInit { + let stateInit: StateInit = fun_0(arg); + return stateInit; +} + +fun fun_22(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_0(arg); + } + return stateInit; +} + +fun fun_23(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_0(arg); + } else { + stateInit = initOf Dummy2(); + } + return stateInit; +} + +fun fun_24(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_0(arg); + } + return stateInit; +} + +fun fun_25(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_0(arg); + counter = counter + 1; + } + return stateInit; +} + +fun fun_26(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_0(arg); + counter = counter + 1; + } until (counter >= 2); + return stateInit; +} + +fun fun_27(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_0(arg); + } + return stateInit; +} + +fun fun_28(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_5, v_6 in intMap) { + stateInit = fun_0(arg); + } + return stateInit; +} + +fun fun_29(arg: Int): StateInit { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_0(arg)}; + return stateInit; +} + +fun fun_30(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_0(arg); + } + return stateInit; +} + +fun fun_31(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_0(arg); + } + return stateInit; +} + +fun fun_32(arg: Int): StateInit { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_8) { + stateInit = fun_0(arg); + } + return stateInit; +} + +contract Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Deployer(); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Deployer(); + } + + receive() { } +} + +contract Expr_InitOf_NoSend { + init(arg: Int) { + initOf Deployer(); + } + + receive() { } +} + +contract IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = initOf Deployer(); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = initOf Deployer(); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = initOf Deployer(); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = initOf Deployer(); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = initOf Deployer(); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = initOf Deployer(); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_33, v_34 in intMap) { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_33, v_34 in intMap) { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract Destruct_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: initOf Deployer()}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: initOf Deployer()}; + } + + receive() { } +} + +contract Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_36) { + stateInit = initOf Deployer(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_36) { + stateInit = initOf Deployer(); + } + } + + receive() { } +} + +contract Let_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_9(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_9(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + fun_9(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_9(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_9(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_9(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_9(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_9(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_9(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_37, v_38 in intMap) { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_37, v_38 in intMap) { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Let_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_9(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_9(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Let_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_40) { + stateInit = fun_9(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Let_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_40) { + stateInit = fun_9(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_10(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_10(arg); + } + + receive() { } +} + +contract Expr_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + fun_10(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_10(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_10(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract While_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_10(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_10(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_10(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_10(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_41, v_42 in intMap) { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_41, v_42 in intMap) { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_10(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_10(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_IfNoElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_44) { + stateInit = fun_10(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_IfNoElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_44) { + stateInit = fun_10(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_11(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_11(arg); + } + + receive() { } +} + +contract Expr_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + fun_11(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_11(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_11(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract While_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_11(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_11(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_11(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_11(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_45, v_46 in intMap) { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_45, v_46 in intMap) { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_IfThen_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_11(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_11(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_IfThen_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_48) { + stateInit = fun_11(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_IfThen_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_48) { + stateInit = fun_11(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_12(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_12(arg); + } + + receive() { } +} + +contract Expr_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + fun_12(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_12(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_12(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract While_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_12(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_12(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_12(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_12(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_49, v_50 in intMap) { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_49, v_50 in intMap) { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_IfElse_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_12(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_12(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_IfElse_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_52) { + stateInit = fun_12(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_IfElse_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_52) { + stateInit = fun_12(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_13(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_13(arg); + } + + receive() { } +} + +contract Expr_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + fun_13(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_13(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_13(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract While_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_13(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_13(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_13(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_13(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_53, v_54 in intMap) { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_53, v_54 in intMap) { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_While_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_13(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_13(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_While_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_56) { + stateInit = fun_13(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_While_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_56) { + stateInit = fun_13(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_14(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_14(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + fun_14(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_14(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_14(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_14(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_14(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_14(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_14(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_57, v_58 in intMap) { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_57, v_58 in intMap) { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Until_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_14(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_14(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Until_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_60) { + stateInit = fun_14(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Until_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_60) { + stateInit = fun_14(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_15(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_15(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + fun_15(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_15(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_15(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_15(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_15(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_15(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_15(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_61, v_62 in intMap) { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_61, v_62 in intMap) { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Repeat_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_15(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_15(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Repeat_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_64) { + stateInit = fun_15(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Repeat_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_64) { + stateInit = fun_15(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_16(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_16(arg); + } + + receive() { } +} + +contract Expr_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + fun_16(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_16(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_16(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract While_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_16(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_16(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_16(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_16(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_65, v_66 in intMap) { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_65, v_66 in intMap) { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_ForEach_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_16(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_16(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_ForEach_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_68) { + stateInit = fun_16(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_ForEach_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_68) { + stateInit = fun_16(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_17(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_17(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + fun_17(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_17(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_17(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_17(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_17(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_17(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_17(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_69, v_70 in intMap) { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_69, v_70 in intMap) { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Destruct_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_17(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_17(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Destruct_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_72) { + stateInit = fun_17(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Destruct_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_72) { + stateInit = fun_17(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_18(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_18(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + fun_18(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_18(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_18(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_18(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_18(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_18(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_18(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_73, v_74 in intMap) { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_73, v_74 in intMap) { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Block_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_18(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_18(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Block_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_76) { + stateInit = fun_18(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Block_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_76) { + stateInit = fun_18(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_19(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_19(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + fun_19(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_19(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_19(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_19(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_19(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_19(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_19(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_77, v_78 in intMap) { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_77, v_78 in intMap) { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Try_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_19(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_19(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Try_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_80) { + stateInit = fun_19(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Try_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_80) { + stateInit = fun_19(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = fun_20(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_20(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + fun_20(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_20(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_20(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_20(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_20(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_20(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_20(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_81, v_82 in intMap) { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_81, v_82 in intMap) { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Catch_InitOf { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_20(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_20(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Catch_InitOf { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_84) { + stateInit = fun_20(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Catch_InitOf_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_84) { + stateInit = fun_20(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_21(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_21(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + fun_21(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_21(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_21(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_21(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_21(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_21(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_21(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_85, v_86 in intMap) { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_85, v_86 in intMap) { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Let_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_21(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_21(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Let_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_88) { + stateInit = fun_21(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Let_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_88) { + stateInit = fun_21(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_22(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_22(arg); + } + + receive() { } +} + +contract Expr_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + fun_22(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_22(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_22(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract While_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_22(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_22(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_22(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_22(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_89, v_90 in intMap) { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_89, v_90 in intMap) { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_22(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_22(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_IfNoElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_92) { + stateInit = fun_22(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_IfNoElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_92) { + stateInit = fun_22(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_23(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_23(arg); + } + + receive() { } +} + +contract Expr_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + fun_23(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_23(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_23(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract While_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_23(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_23(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_23(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_23(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_93, v_94 in intMap) { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_93, v_94 in intMap) { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_23(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_23(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_IfThen_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_96) { + stateInit = fun_23(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_IfThen_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_96) { + stateInit = fun_23(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_24(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_24(arg); + } + + receive() { } +} + +contract Expr_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + fun_24(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_24(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_24(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract While_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_24(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_24(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_24(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_24(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_97, v_98 in intMap) { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_97, v_98 in intMap) { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_24(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_24(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_IfElse_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_100) { + stateInit = fun_24(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_IfElse_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_100) { + stateInit = fun_24(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_25(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_25(arg); + } + + receive() { } +} + +contract Expr_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + fun_25(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_25(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_25(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract While_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_25(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_25(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_25(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_25(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_101, v_102 in intMap) { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_101, v_102 in intMap) { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_While_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_25(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_25(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_While_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_104) { + stateInit = fun_25(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_While_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_104) { + stateInit = fun_25(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_26(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_26(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + fun_26(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_26(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_26(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_26(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_26(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_26(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_26(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_105, v_106 in intMap) { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_105, v_106 in intMap) { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Until_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_26(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_26(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Until_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_108) { + stateInit = fun_26(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Until_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_108) { + stateInit = fun_26(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_27(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_27(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + fun_27(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_27(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_27(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_27(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_27(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_27(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_27(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_109, v_110 in intMap) { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_109, v_110 in intMap) { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_27(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_27(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Repeat_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_112) { + stateInit = fun_27(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Repeat_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_112) { + stateInit = fun_27(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_28(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_28(arg); + } + + receive() { } +} + +contract Expr_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + fun_28(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_28(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_28(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract While_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_28(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_28(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_28(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_28(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_113, v_114 in intMap) { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_113, v_114 in intMap) { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_28(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_28(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_ForEach_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_116) { + stateInit = fun_28(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_ForEach_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_116) { + stateInit = fun_28(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_29(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_29(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + fun_29(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_29(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_29(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_29(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_29(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_29(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_29(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_117, v_118 in intMap) { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_117, v_118 in intMap) { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_29(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_29(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Destruct_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_120) { + stateInit = fun_29(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Destruct_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_120) { + stateInit = fun_29(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_30(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_30(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + fun_30(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_30(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_30(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_30(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_30(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_30(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_30(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_121, v_122 in intMap) { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_121, v_122 in intMap) { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Block_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_30(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_30(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Block_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_124) { + stateInit = fun_30(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Block_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_124) { + stateInit = fun_30(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_31(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_31(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + fun_31(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_31(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_31(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_31(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_31(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_31(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_31(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_125, v_126 in intMap) { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_125, v_126 in intMap) { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Try_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_31(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_31(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Try_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_128) { + stateInit = fun_31(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Try_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_128) { + stateInit = fun_31(arg); + } + } + + receive() { } +} + +contract Let_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = fun_32(arg); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Let_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = fun_32(arg); + } + + receive() { } +} + +contract Expr_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + fun_32(arg); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfNoElse_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +contract IfThen_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_32(arg); + } else { + stateInit = initOf Dummy2(); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfThen_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg == 0) { + stateInit = fun_32(arg); + } else { + stateInit = initOf Dummy2(); + } + } + + receive() { } +} + +contract IfElse_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract IfElse_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + if (arg - arg + 1 == 0) { + stateInit = initOf Dummy2(); + } else { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +contract While_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_32(arg); + counter = counter + 1; + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract While_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + while (counter <= 2) { + stateInit = fun_32(arg); + counter = counter + 1; + } + } + + receive() { } +} + +contract Until_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_32(arg); + counter = counter + 1; + } until (counter >= 2); + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Until_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = arg - arg; + do { + stateInit = fun_32(arg); + counter = counter + 1; + } until (counter >= 2); + } + + receive() { } +} + +contract Repeat_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Repeat_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let counter: Int = random(1, 3); + repeat (counter) { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +contract ForEach_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_129, v_130 in intMap) { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract ForEach_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + let intMap: map = null; + intMap.set(1, 3); + foreach (v_129, v_130 in intMap) { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +contract Destruct_StaticCall_Catch_StaticCall { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_32(arg)}; + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Destruct_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_32(arg)}; + } + + receive() { } +} + +contract Block_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Block_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +contract Try_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Try_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +contract Catch_StaticCall_Catch_StaticCall { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_132) { + stateInit = fun_32(arg); + } + let addr: Address = contractAddress(stateInit); + send(SendParameters{to: addr, value: ton("1")}); + } + + receive() { } +} + +contract Catch_StaticCall_Catch_StaticCall_NoSend { + init(arg: Int) { + let stateInit: StateInit = initOf Dummy1(); + try { + 1 / (arg - arg); + } catch (v_132) { + stateInit = fun_32(arg); + } + } + + receive() { } +} + +message DeployMessage { + addr: Address; + data: Cell; + code: Cell; +} + +struct StateInitWrapper { + init: StateInit; +} + +contract Dummy1 { } + +contract Dummy2 { } + +contract Deployer { + receive(msg: DeployMessage) { + let addr = msg.addr; + let data = msg.data; + let code = msg.code; + send(SendParameters{to: addr, bounce: false, value: ton("10"), data: data, code: code}); + } +} diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts new file mode 100644 index 000000000..c696bb45a --- /dev/null +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -0,0 +1,1370 @@ +import path from "path"; +import type * as A from "../../ast/ast"; +import { getAstFactory, idText } from "../../ast/ast-helpers"; +import type { FactoryAst } from "../../ast/ast-helpers"; +import { prettyPrint } from "../../ast/ast-printer"; +import { dummySrcInfo } from "../../grammar"; +import * as fs from "fs"; + +/* + | AstFieldAccess + | AstStaticCall + | AstId + | AstInitOf + | AstCodeOf + | AstString + | AstLiteral; +*/ + +type ExpressionWithName = { + name: string; + expression: A.AstExpression; +}; + +type StatementsWithName = { + name: string; + statements: A.AstStatement[]; + assignedStateInit: boolean; +}; + +type Test = { + // Will add other stuff here for the spec file + contract: A.AstContract; +}; + +interface Generator { + generate: () => T[]; +} + +interface GeneratorWithDeclarations { + generate: () => { + globalDeclarations: Map; + contractDeclarations: Map; + items: T[]; + }; +} + +function createTests(astF: FactoryAst, filename: string) { + let counter = 0; + const maxFunCallDepth = 2; + let currentFunDepth = 1; + + function generateInitOf( + contract: A.AstId, + args: A.AstExpression[], + ): A.AstInitOf { + return astF.createNode({ + kind: "init_of", + args, + contract, + loc: dummySrcInfo, + }) as A.AstInitOf; + } + + function generateId(name: string): A.AstId { + return astF.createNode({ + kind: "id", + text: name, + loc: dummySrcInfo, + }) as A.AstId; + } + + function generateTypeId(name: string): A.AstTypeId { + return astF.createNode({ + kind: "type_id", + text: name, + loc: dummySrcInfo, + }) as A.AstTypeId; + } + + function generateTypedParameter( + name: string, + type: string, + ): A.AstTypedParameter { + return astF.createNode({ + kind: "typed_parameter", + name: generateId(name), + type: generateTypeId(type), + loc: dummySrcInfo, + }) as A.AstTypedParameter; + } + + /* + function generateFunctionAttribute( + name: A.AstFunctionAttributeName, + ): A.AstFunctionAttribute { + return astF.createNode({ + kind: "function_attribute", + type: name, + loc: dummySrcInfo, + }) as A.AstFunctionAttribute; + } + + function generateBoolean(value: boolean): A.AstBoolean { + return astF.createNode({ kind: "boolean", value, loc: dummySrcInfo }) as A.AstBoolean; + } + */ + + function generateString(value: string): A.AstString { + return astF.createNode({ + kind: "string", + value, + loc: dummySrcInfo, + }) as A.AstString; + } + + function generateInt(value: bigint): A.AstNumber { + return astF.createNode({ + kind: "number", + value, + base: 10, + loc: dummySrcInfo, + }) as A.AstNumber; + } + + /* + function generateFreshFieldName(): A.AstId { + const newName = `field_${counter++}`; + return generateId(newName); + } + */ + + function generateFreshFunctionName(): A.AstId { + const newName = `fun_${counter++}`; + return generateId(newName); + } + + /* + function generateFreshConstantName(): A.AstId { + const newName = `CONS_${counter++}`; + return generateId(newName); + } + */ + + function generateFreshVarName(): A.AstId { + const newName = `v_${counter++}`; + return generateId(newName); + } + + function generateBinaryExpression( + op: A.AstBinaryOperation, + operand1: A.AstExpression, + operand2: A.AstExpression, + ): A.AstOpBinary { + return astF.createNode({ + kind: "op_binary", + op, + left: operand1, + right: operand2, + loc: dummySrcInfo, + }) as A.AstOpBinary; + } + + /* + function generateConditional(boolValue: boolean, exprT: A.AstExpression, exprF: A.AstExpression): A.AstConditional { + return astF.createNode({ kind: "conditional", condition: generateBoolean(boolValue), thenBranch: exprT, elseBranch: exprF, loc: dummySrcInfo }) as A.AstConditional; + } + */ + + function generateMethodCall( + name: A.AstId, + self: A.AstExpression, + args: A.AstExpression[], + ): A.AstMethodCall { + return astF.createNode({ + kind: "method_call", + self, + args, + method: name, + loc: dummySrcInfo, + }) as A.AstMethodCall; + } + + function generateStaticCall( + name: A.AstId, + args: A.AstExpression[], + ): A.AstStaticCall { + return astF.createNode({ + kind: "static_call", + args, + function: name, + loc: dummySrcInfo, + }) as A.AstStaticCall; + } + + function generateStructInstance( + type: A.AstId, + args: A.AstStructFieldInitializer[], + ): A.AstStructInstance { + return astF.createNode({ + kind: "struct_instance", + type, + args, + loc: dummySrcInfo, + }) as A.AstStructInstance; + } + + /* + function generateContractConstant(type: A.AstTypeId, expr: A.AstExpression): { constant: A.AstId, decl: A.AstConstantDef } { + const name = generateFreshConstantName(); + const decl = astF.createNode({ kind: "constant_def", name, type, initializer: expr, attributes: [], loc: dummySrcInfo }) as A.AstConstantDef; + return { constant: name, decl }; + } + + function generateContractField(type: A.AstTypeId, expr: A.AstExpression): { field: A.AstId, decl: A.AstFieldDecl } { + const name = generateFreshFieldName(); + const decl = astF.createNode({ kind: "field_decl", name, type, as: null, initializer: expr, loc: dummySrcInfo }) as A.AstFieldDecl; + return { field: name, decl }; + } + */ + + function generateLetStatement( + name: A.AstId, + type: A.AstTypeId, + expr: A.AstExpression, + ): A.AstStatementLet { + return astF.createNode({ + kind: "statement_let", + name, + type, + expression: expr, + loc: dummySrcInfo, + }) as A.AstStatementLet; + } + + function generateAssignStatement( + name: A.AstId, + expr: A.AstExpression, + ): A.AstStatementAssign { + return astF.createNode({ + kind: "statement_assign", + path: name, + expression: expr, + loc: dummySrcInfo, + }) as A.AstStatementAssign; + } + + function generateStructFieldInitializer( + name: A.AstId, + initializer: A.AstExpression, + ): A.AstStructFieldInitializer { + return astF.createNode({ + kind: "struct_field_initializer", + field: name, + initializer, + loc: dummySrcInfo, + }) as A.AstStructFieldInitializer; + } + + /* + function generateFieldAccess(aggregate: A.AstExpression, field: A.AstId): A.AstFieldAccess { + return astF.createNode({ kind: "field_access", aggregate, field, loc: dummySrcInfo }) as A.AstFieldAccess; + } + */ + + function generateExpressionStatement( + expr: A.AstExpression, + ): A.AstStatementExpression { + return astF.createNode({ + kind: "statement_expression", + expression: expr, + loc: dummySrcInfo, + }) as A.AstStatementExpression; + } + + function generateConditionStatement( + cond: A.AstExpression, + thenBranch: A.AstStatement[], + elseBranch: A.AstStatement[] | null, + ): A.AstStatementCondition { + return astF.createNode({ + kind: "statement_condition", + condition: cond, + trueStatements: thenBranch, + falseStatements: elseBranch, + loc: dummySrcInfo, + }) as A.AstStatementCondition; + } + + function generateWhileStatement( + cond: A.AstExpression, + body: A.AstStatement[], + ): A.AstStatementWhile { + return astF.createNode({ + kind: "statement_while", + condition: cond, + statements: body, + loc: dummySrcInfo, + }) as A.AstStatementWhile; + } + + function generateUntilStatement( + cond: A.AstExpression, + body: A.AstStatement[], + ): A.AstStatementUntil { + return astF.createNode({ + kind: "statement_until", + condition: cond, + statements: body, + loc: dummySrcInfo, + }) as A.AstStatementUntil; + } + + function generateRepeatStatement( + count: A.AstExpression, + body: A.AstStatement[], + ): A.AstStatementRepeat { + return astF.createNode({ + kind: "statement_repeat", + iterations: count, + statements: body, + loc: dummySrcInfo, + }) as A.AstStatementRepeat; + } + + function generateForEachStatement( + mapVar: A.AstExpression, + keyVar: A.AstId, + valueVar: A.AstId, + body: A.AstStatement[], + ): A.AstStatementForEach { + return astF.createNode({ + kind: "statement_foreach", + map: mapVar, + keyName: keyVar, + valueName: valueVar, + statements: body, + loc: dummySrcInfo, + }) as A.AstStatementForEach; + } + + function generateDestructStatement( + expr: A.AstExpression, + identifiers: Map, + type: A.AstTypeId, + ): A.AstStatementDestruct { + return astF.createNode({ + kind: "statement_destruct", + expression: expr, + identifiers, + ignoreUnspecifiedFields: false, + type, + loc: dummySrcInfo, + }) as A.AstStatementDestruct; + } + + function generateBlockStatement( + body: A.AstStatement[], + ): A.AstStatementBlock { + return astF.createNode({ + kind: "statement_block", + statements: body, + loc: dummySrcInfo, + }) as A.AstStatementBlock; + } + + function generateTryStatement( + catchName: A.AstId, + tryBody: A.AstStatement[], + catchBody: A.AstStatement[] | undefined, + ): A.AstStatementTry { + const catchBlock = + typeof catchBody !== "undefined" + ? generateCatchBlock(catchName, catchBody) + : undefined; + return astF.createNode({ + kind: "statement_try", + statements: tryBody, + catchBlock, + loc: dummySrcInfo, + }) as A.AstStatementTry; + } + + function generateCatchBlock( + catchName: A.AstId, + body: A.AstStatement[], + ): A.AstCatchBlock { + return { catchName, catchStatements: body }; + } + + function generateFunctionDefinition( + name: A.AstId, + params: A.AstTypedParameter[], + statements: A.AstStatement[], + attributes: A.AstFunctionAttribute[], + ret: A.AstTypeId, + ): A.AstFunctionDef { + return astF.createNode({ + kind: "function_def", + name, + params, + statements, + attributes, + return: ret, + loc: dummySrcInfo, + }) as A.AstFunctionDef; + } + + function generateReturnStatement( + expression: A.AstExpression, + ): A.AstStatementReturn { + return astF.createNode({ + kind: "statement_return", + expression, + loc: dummySrcInfo, + }) as A.AstStatementReturn; + } + + function generateContractInit(stmts: A.AstStatement[]): A.AstContractInit { + const addrExpr = generateStaticCall(generateId("contractAddress"), [ + generateId("stateInit"), + ]); + const addrVar = generateId("addr"); + const addrLet = generateLetStatement( + addrVar, + generateTypeId("Address"), + addrExpr, + ); + const tonExpr = generateStaticCall(generateId("ton"), [ + generateString("1"), + ]); + const sendParams = generateStructInstance( + generateId("SendParameters"), + [ + generateStructFieldInitializer(generateId("to"), addrVar), + generateStructFieldInitializer(generateId("value"), tonExpr), + ], + ); + const sendExpr = generateStaticCall(generateId("send"), [sendParams]); + const sendStmt = generateExpressionStatement(sendExpr); + return astF.createNode({ + kind: "contract_init", + params: [generateTypedParameter("arg", "Int")], + statements: [...stmts, addrLet, sendStmt], + loc: dummySrcInfo, + }) as A.AstContractInit; + } + + function generateContractInitNoSend( + stmts: A.AstStatement[], + ): A.AstContractInit { + return astF.createNode({ + kind: "contract_init", + params: [generateTypedParameter("arg", "Int")], + statements: stmts, + loc: dummySrcInfo, + }) as A.AstContractInit; + } + + function generateEmptyInternalReceiver(): A.AstReceiver { + const receiverKind = astF.createNode({ + kind: "fallback", + }) as A.AstReceiverFallback; + const internalSelector = astF.createNode({ + kind: "internal", + subKind: receiverKind, + loc: dummySrcInfo, + }) as A.AstReceiverInternal; + return astF.createNode({ + kind: "receiver", + selector: internalSelector, + statements: [], + loc: dummySrcInfo, + }) as A.AstReceiver; + } + + function generateContract( + name: A.AstId, + stmts: A.AstStatement[], + decls: A.AstContractDeclaration[], + ): A.AstContract { + const init = generateContractInit(stmts); + const receiver = generateEmptyInternalReceiver(); + const finalDecls = [...decls, init, receiver]; + return astF.createNode({ + kind: "contract", + name, + traits: [], + attributes: [], + params: [], + declarations: finalDecls, + loc: dummySrcInfo, + }) as A.AstContract; + } + + function generateContractNoSend( + name: A.AstId, + stmts: A.AstStatement[], + decls: A.AstContractDeclaration[], + ): A.AstContract { + const init = generateContractInitNoSend(stmts); + const receiver = generateEmptyInternalReceiver(); + const finalDecls = [...decls, init, receiver]; + return astF.createNode({ + kind: "contract", + name, + traits: [], + attributes: [], + params: [], + declarations: finalDecls, + loc: dummySrcInfo, + }) as A.AstContract; + } + + /* + function contractConstantGenerator(baseExpr: A.AstExpression): GeneratorWithDeclarations { + return { + generate: () => { + const globalDecl = generateContractConstant(generateTypeId("StateInit"), baseExpr); + const name = "ContractConstant"; + const finalDecls: Map = new Map(); + finalDecls.set(idText(globalDecl.constant), globalDecl.decl); + return { globalDeclarations: new Map(), contractDeclarations: finalDecls, items: [{name, expression: generateFieldAccess(generateId("self"), globalDecl.constant)}] }; + } + }; + } + + function contractFieldGenerator(baseExpr: A.AstExpression): GeneratorWithDeclarations { + return { generate: () => { + const globalDecl = generateContractField(generateTypeId("StateInit"), baseExpr); + const name = "ContractField"; + const finalDecls: Map = new Map(); + finalDecls.set(idText(globalDecl.field), globalDecl.decl); + return { globalDeclarations: new Map(), contractDeclarations: finalDecls, items: [{name, expression: generateFieldAccess(generateId("self"), globalDecl.field) }]}; + }}; + }*/ + + function identityGenerator( + baseExpr: A.AstExpression, + name: string, + ): GeneratorWithDeclarations { + return { + generate: () => { + return { + globalDeclarations: new Map(), + contractDeclarations: new Map(), + items: [{ name, expression: baseExpr }], + }; + }, + }; + } + + function staticCallGenerator(): GeneratorWithDeclarations { + return { + generate: () => { + const finalGlobalDecls: Map = + new Map(); + const finalItems: ExpressionWithName[] = []; + + // If we reached the max function call depth, then do not call the generators + // just generate a return statement with the initOf + if (currentFunDepth >= maxFunCallDepth) { + const funName = generateFreshFunctionName(); + const returnStmt = generateReturnStatement( + generateInitOf(generateId("Deployer"), []), + ); + const funDef = generateFunctionDefinition( + funName, + [generateTypedParameter("arg", "Int")], + [returnStmt], + [], + generateTypeId("StateInit"), + ); + const call = generateStaticCall(funName, [ + generateId("arg"), + ]); + const testName = `StaticCall`; + finalGlobalDecls.set(idText(funName), funDef); + finalItems.push({ name: testName, expression: call }); + return { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + items: finalItems, + }; + } + + // Increase the fun call depth + currentFunDepth++; + + const stmtGenResult = statementGenerator().generate(); + stmtGenResult.globalDeclarations.forEach((value, key) => { + finalGlobalDecls.set(key, value); + }); + + for (const stmtWithDecls of stmtGenResult.items) { + // We can only create a test that generated an assignment to stateInit (because we need to return it) + if (stmtWithDecls.assignedStateInit) { + const funName = generateFreshFunctionName(); + const returnStmt = generateReturnStatement( + generateId("stateInit"), + ); + const funDef = generateFunctionDefinition( + funName, + [generateTypedParameter("arg", "Int")], + [...stmtWithDecls.statements, returnStmt], + [], + generateTypeId("StateInit"), + ); + const call = generateStaticCall(funName, [ + generateId("arg"), + ]); + const testName = `StaticCall_${stmtWithDecls.name}`; + finalGlobalDecls.set(idText(funName), funDef); + finalItems.push({ name: testName, expression: call }); + } + } + + // decrease the fun call depth + currentFunDepth--; + + return { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + items: finalItems, + }; + }, + }; + } + + /* + function methodCallGenerator(): GeneratorWithDeclarations { + return { + generate: () => { + const finalGlobalDecls: Map = + new Map(); + const finalItems: ExpressionWithName[] = []; + + // If we reached the max function call depth, then do not call the generators + // just generate a return statement with the initOf + if (currentFunDepth >= maxFunCallDepth) { + const funName = generateFreshFunctionName(); + const returnStmt = generateReturnStatement( + generateInitOf(generateId("Deployer"), []), + ); + const funDef = generateFunctionDefinition( + funName, + [generateTypedParameter("self", "Int")], + [returnStmt], + [generateFunctionAttribute("extends")], + generateTypeId("StateInit"), + ); + const call = generateMethodCall( + funName, + generateId("arg"), + [], + ); + const testName = `StaticMethodCall`; + finalGlobalDecls.set(idText(funName), funDef); + finalItems.push({ name: testName, expression: call }); + return { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + items: finalItems, + }; + } + + // Increase the fun call depth + currentFunDepth++; + + const stmtGenResult = statementGenerator().generate(); + stmtGenResult.globalDeclarations.forEach((value, key) => { + finalGlobalDecls.set(key, value); + }); + + for (const stmtWithDecls of stmtGenResult.items) { + // We can only create a test that generated an assignment to stateInit (because we need to return it) + if (stmtWithDecls.assignedStateInit) { + const funName = generateFreshFunctionName(); + const returnStmt = generateReturnStatement( + generateId("stateInit"), + ); + const funDef = generateFunctionDefinition( + funName, + [generateTypedParameter("self", "Int")], + [returnStmt], + [generateFunctionAttribute("extends")], + generateTypeId("StateInit"), + ); + const call = generateMethodCall( + funName, + generateId("arg"), + [], + ); + const testName = `StaticMethodCall_${stmtWithDecls.name}`; + finalGlobalDecls.set(idText(funName), funDef); + finalItems.push({ name: testName, expression: call }); + } + } + + // decrease the fun call depth + currentFunDepth--; + + return { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + items: finalItems, + }; + }, + }; + } + */ + + function letStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const varName = generateId("stateInit"); + const varType = generateTypeId("StateInit"); + const stmtLet = generateLetStatement( + varName, + varType, + baseExpr, + ); + const newName = `Let_${name}`; + return [ + { + name: newName, + statements: [stmtLet], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function expressionStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const stmtExpr = generateExpressionStatement(baseExpr); + const newName = `Expr_${name}`; + return [ + { + name: newName, + statements: [stmtExpr], + assignedStateInit: false, + }, + ]; + }, + }; + } + + function conditionStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + const cond1Expr = generateBinaryExpression( + "==", + generateBinaryExpression( + "-", + generateId("arg"), + generateId("arg"), + ), + generateInt(0n), + ); + const cond2Expr = generateBinaryExpression( + "==", + generateBinaryExpression( + "+", + generateBinaryExpression( + "-", + generateId("arg"), + generateId("arg"), + ), + generateInt(1n), + ), + generateInt(0n), + ); + + const expr = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + const dummy2 = generateAssignStatement( + generateId("stateInit"), + generateInitOf(generateId("Dummy2"), []), + ); + const case1 = generateConditionStatement( + cond1Expr, + [expr], + null, + ); + const case2 = generateConditionStatement( + cond1Expr, + [expr], + [dummy2], + ); + const case3 = generateConditionStatement( + cond2Expr, + [dummy2], + [expr], + ); + + const case1Name = `IfNoElse_${name}`; + const case2Name = `IfThen_${name}`; + const case3Name = `IfElse_${name}`; + + return [ + { + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, + }, + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + { + name: case3Name, + statements: [initVarStmt, case3], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function whileStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + const countVarStmt = generateLetStatement( + generateId("counter"), + generateTypeId("Int"), + generateBinaryExpression( + "-", + generateId("arg"), + generateId("arg"), + ), + ); + const expr = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + const counterIncr = generateAssignStatement( + generateId("counter"), + generateBinaryExpression( + "+", + generateId("counter"), + generateInt(1n), + ), + ); + const cond = generateBinaryExpression( + "<=", + generateId("counter"), + generateInt(2n), + ); + const loop = generateWhileStatement(cond, [expr, counterIncr]); + + const newName = `While_${name}`; + + return [ + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function untilStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + const countVarStmt = generateLetStatement( + generateId("counter"), + generateTypeId("Int"), + generateBinaryExpression( + "-", + generateId("arg"), + generateId("arg"), + ), + ); + const expr = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + const counterIncr = generateAssignStatement( + generateId("counter"), + generateBinaryExpression( + "+", + generateId("counter"), + generateInt(1n), + ), + ); + const cond = generateBinaryExpression( + ">=", + generateId("counter"), + generateInt(2n), + ); + const loop = generateUntilStatement(cond, [expr, counterIncr]); + + const newName = `Until_${name}`; + + return [ + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function repeatStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + const countVarStmt = generateLetStatement( + generateId("counter"), + generateTypeId("Int"), + generateStaticCall(generateId("random"), [ + generateInt(1n), + generateInt(3n), + ]), + ); + const expr = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + const loop = generateRepeatStatement(generateId("counter"), [ + expr, + ]); + + const newName = `Repeat_${name}`; + + return [ + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function forEachStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + const mapVar = generateId("intMap"); + const mapVarStmt = generateLetStatement( + mapVar, + generateTypeId("map"), + generateId("null"), + ); + const mutateMap = generateExpressionStatement( + generateMethodCall(generateId("set"), mapVar, [ + generateInt(1n), + generateInt(3n), + ]), + ); + + const expr = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + const loop = generateForEachStatement( + mapVar, + generateFreshVarName(), + generateFreshVarName(), + [expr], + ); + + const newName = `ForEach_${name}`; + + return [ + { + name: newName, + statements: [initVarStmt, mapVarStmt, mutateMap, loop], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function destructStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const identifiers: Map = new Map(); + identifiers.set("init", [ + generateId("init"), + generateId("stateInit"), + ]); + + const wrapped = generateStructInstance( + generateId("StateInitWrapper"), + [ + generateStructFieldInitializer( + generateId("init"), + baseExpr, + ), + ], + ); + + const unwrapped = generateDestructStatement( + wrapped, + identifiers, + generateTypeId("StateInitWrapper"), + ); + + const newName = `Destruct_${name}`; + + return [ + { + name: newName, + statements: [unwrapped], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function blockStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + + const exprStmt = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + + const stmt = generateBlockStatement([exprStmt]); + + const newName = `Block_${name}`; + + return [ + { + name: newName, + statements: [initVarStmt, stmt], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function tryStatementGenerator( + baseExpr: A.AstExpression, + name: string, + ): Generator { + return { + generate: () => { + const initVarStmt = generateLetStatement( + generateId("stateInit"), + generateTypeId("StateInit"), + generateInitOf(generateId("Dummy1"), []), + ); + + const exprStmt = generateAssignStatement( + generateId("stateInit"), + baseExpr, + ); + const divByZeroStmt = generateExpressionStatement( + generateBinaryExpression( + "/", + generateInt(1n), + generateBinaryExpression( + "-", + generateId("arg"), + generateId("arg"), + ), + ), + ); + + const case1 = generateTryStatement( + generateFreshVarName(), + [exprStmt], + undefined, + ); + const case2 = generateTryStatement( + generateFreshVarName(), + [divByZeroStmt], + [exprStmt], + ); + + const case1Name = `Try_${name}`; + const case2Name = `Catch_${name}`; + + return [ + { + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, + }, + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + ]; + }, + }; + } + + function expressionGenerator(): GeneratorWithDeclarations { + return { + generate: () => { + const initOf = generateInitOf(generateId("Deployer"), []); + + const exprGens = [ + identityGenerator(initOf, "InitOf"), + staticCallGenerator(), + //methodCallGenerator(), + //contractConstantGenerator(initOf), + //contractFieldGenerator(initOf) + ]; + + const finalGlobalDecls: Map = + new Map(); + const finalContractDecls: Map< + string, + A.AstContractDeclaration + > = new Map(); + const finalItems: ExpressionWithName[] = []; + + for (const gen of exprGens) { + const genResult = gen.generate(); + genResult.globalDeclarations.forEach((value, key) => { + finalGlobalDecls.set(key, value); + }); + genResult.contractDeclarations.forEach((value, key) => { + finalContractDecls.set(key, value); + }); + finalItems.push(...genResult.items); + } + + return { + globalDeclarations: finalGlobalDecls, + contractDeclarations: finalContractDecls, + items: finalItems, + }; + }, + }; + } + + function statementGenerator(): GeneratorWithDeclarations { + return { + generate: () => { + const finalItems: StatementsWithName[] = []; + + const exprGenResult = expressionGenerator().generate(); + + for (const exprWithName of exprGenResult.items) { + const stmtGens = [ + letStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + expressionStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + conditionStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + whileStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + untilStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + repeatStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + forEachStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + destructStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + blockStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + tryStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + ]; + + for (const gen of stmtGens) { + for (const genResult of gen.generate()) { + finalItems.push({ + name: genResult.name, + statements: genResult.statements, + assignedStateInit: genResult.assignedStateInit, + }); + } + } + } + + return { + globalDeclarations: exprGenResult.globalDeclarations, + contractDeclarations: exprGenResult.contractDeclarations, + items: finalItems, + }; + }, + }; + } + + function contractGenerator(): GeneratorWithDeclarations { + return { + generate: () => { + const finalContracts: A.AstContract[] = []; + + const stmtGenResult = statementGenerator().generate(); + const contractDecls = Array.from( + stmtGenResult.contractDeclarations.values(), + ); + + for (const stmtWithDecls of stmtGenResult.items) { + if (stmtWithDecls.assignedStateInit) { + const contract1 = generateContract( + generateId(stmtWithDecls.name), + stmtWithDecls.statements, + contractDecls, + ); + finalContracts.push(contract1); + } + const contract2 = generateContractNoSend( + generateId(stmtWithDecls.name + "_NoSend"), + stmtWithDecls.statements, + contractDecls, + ); + finalContracts.push(contract2); + } + + return { + globalDeclarations: stmtGenResult.globalDeclarations, + contractDeclarations: new Map(), + items: finalContracts, + }; + }, + }; + } + + function createTest(res: A.AstContract): Test { + return { contract: res }; + } + + function serializeTests(tests: Test[], globalDecls: A.AstModuleItem[]) { + const allDecls: A.AstModuleItem[] = [...globalDecls]; + + for (const test of tests) { + allDecls.push(test.contract); + } + + const tactCode = prettyPrint( + astF.createNode({ kind: "module", imports: [], items: allDecls }), + ); + + // Attach Dummies and Deployer contracts, plus structs and messages for tests + const finalTactCode = ` +${tactCode} + +message DeployMessage { + addr: Address; + data: Cell; + code: Cell; +} + +struct StateInitWrapper { + init: StateInit; +} + +contract Dummy1 { } + +contract Dummy2 { } + +contract Deployer { + receive(msg: DeployMessage) { + let addr = msg.addr; + let data = msg.data; + let code = msg.code; + send(SendParameters{to: addr, bounce: false, value: ton("10"), data: data, code: code}); + } +} +`; + + fs.writeFileSync( + path.join(__dirname, "contracts", filename), + finalTactCode, + ); + } + + const tests: Test[] = []; + + const genResult = contractGenerator().generate(); + + for (const contract of genResult.items) { + tests.push(createTest(contract)); + } + + serializeTests(tests, Array.from(genResult.globalDeclarations.values())); +} + +createTests(getAstFactory(), "initof-reachability.tact"); From f010263b164267a163fb5d26b5e0165c3afc09f8 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Thu, 6 Mar 2025 01:05:06 +0100 Subject: [PATCH 02/12] test: ported to fast-check. Added compilation step. --- .../autogenerated/contracts/deployer.tact | 22 + .../contracts/initof-reachability.tact | 7973 +---------------- .../autogenerated/gen-initof-reachability.ts | 1440 ++- src/test/autogenerated/util.ts | 136 + 4 files changed, 856 insertions(+), 8715 deletions(-) create mode 100644 src/test/autogenerated/contracts/deployer.tact create mode 100644 src/test/autogenerated/util.ts diff --git a/src/test/autogenerated/contracts/deployer.tact b/src/test/autogenerated/contracts/deployer.tact new file mode 100644 index 000000000..71e507c8e --- /dev/null +++ b/src/test/autogenerated/contracts/deployer.tact @@ -0,0 +1,22 @@ +message DeployMessage { + addr: Address; + data: Cell; + code: Cell; +} + +struct StateInitWrapper { + init: StateInit; +} + +contract Dummy1 { } + +contract Dummy2 { } + +contract Deployer { + receive(msg: DeployMessage) { + let addr = msg.addr; + let data = msg.data; + let code = msg.code; + send(SendParameters{to: addr, bounce: false, value: ton("10"), data: data, code: code}); + } +} \ No newline at end of file diff --git a/src/test/autogenerated/contracts/initof-reachability.tact b/src/test/autogenerated/contracts/initof-reachability.tact index 6975d3452..df1e50656 100644 --- a/src/test/autogenerated/contracts/initof-reachability.tact +++ b/src/test/autogenerated/contracts/initof-reachability.tact @@ -1,7983 +1,24 @@ +import "deployer.tact"; fun fun_0(arg: Int): StateInit { - return initOf Deployer(); -} - -fun fun_9(arg: Int): StateInit { let stateInit: StateInit = initOf Deployer(); return stateInit; } -fun fun_10(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = initOf Deployer(); - } - return stateInit; -} - -fun fun_11(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = initOf Deployer(); - } else { - stateInit = initOf Dummy2(); - } - return stateInit; -} - -fun fun_12(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = initOf Deployer(); - } - return stateInit; -} - -fun fun_13(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = initOf Deployer(); - counter = counter + 1; - } - return stateInit; -} - -fun fun_14(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = initOf Deployer(); - counter = counter + 1; - } until (counter >= 2); - return stateInit; -} - -fun fun_15(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = initOf Deployer(); - } - return stateInit; -} - -fun fun_16(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_1, v_2 in intMap) { - stateInit = initOf Deployer(); - } - return stateInit; -} - -fun fun_17(arg: Int): StateInit { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: initOf Deployer()}; - return stateInit; -} - -fun fun_18(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = initOf Deployer(); - } - return stateInit; -} - -fun fun_19(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = initOf Deployer(); - } - return stateInit; -} - -fun fun_20(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_4) { - stateInit = initOf Deployer(); - } +fun fun_1(arg: Int): StateInit { + let stateInit: StateInit = initOf Deployer(); return stateInit; } -fun fun_21(arg: Int): StateInit { +fun fun_2(arg: Int): StateInit { let stateInit: StateInit = fun_0(arg); return stateInit; } -fun fun_22(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_0(arg); - } - return stateInit; -} - -fun fun_23(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_0(arg); - } else { - stateInit = initOf Dummy2(); - } - return stateInit; -} - -fun fun_24(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_0(arg); - } - return stateInit; -} - -fun fun_25(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_0(arg); - counter = counter + 1; - } - return stateInit; -} - -fun fun_26(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_0(arg); - counter = counter + 1; - } until (counter >= 2); - return stateInit; -} - -fun fun_27(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_0(arg); - } - return stateInit; -} - -fun fun_28(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_5, v_6 in intMap) { - stateInit = fun_0(arg); - } - return stateInit; -} - -fun fun_29(arg: Int): StateInit { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_0(arg)}; - return stateInit; -} - -fun fun_30(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_0(arg); - } - return stateInit; -} - -fun fun_31(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_0(arg); - } - return stateInit; -} - -fun fun_32(arg: Int): StateInit { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_8) { - stateInit = fun_0(arg); - } - return stateInit; -} - -contract Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Deployer(); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Deployer(); - } - - receive() { } -} - -contract Expr_InitOf_NoSend { - init(arg: Int) { - initOf Deployer(); - } - - receive() { } -} - -contract IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = initOf Deployer(); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = initOf Deployer(); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = initOf Deployer(); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = initOf Deployer(); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = initOf Deployer(); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = initOf Deployer(); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_33, v_34 in intMap) { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_33, v_34 in intMap) { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract Destruct_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: initOf Deployer()}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_InitOf_NoSend { +contract Expr_StaticCall_Let_StaticCall_Let_InitOf_NoSend { init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: initOf Deployer()}; + fun_2(arg); } receive() { } -} - -contract Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_36) { - stateInit = initOf Deployer(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_36) { - stateInit = initOf Deployer(); - } - } - - receive() { } -} - -contract Let_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_9(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_9(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - fun_9(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_9(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_9(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_9(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_9(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_9(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_9(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_37, v_38 in intMap) { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_37, v_38 in intMap) { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Let_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_9(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_9(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Let_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_40) { - stateInit = fun_9(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_40) { - stateInit = fun_9(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_10(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_10(arg); - } - - receive() { } -} - -contract Expr_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - fun_10(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_10(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_10(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract While_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_10(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_10(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_10(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_10(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_41, v_42 in intMap) { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_41, v_42 in intMap) { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_10(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_10(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_IfNoElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_44) { - stateInit = fun_10(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_IfNoElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_44) { - stateInit = fun_10(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_11(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_11(arg); - } - - receive() { } -} - -contract Expr_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - fun_11(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_11(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_11(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract While_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_11(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_11(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_11(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_11(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_45, v_46 in intMap) { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_45, v_46 in intMap) { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_IfThen_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_11(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_11(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_IfThen_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_48) { - stateInit = fun_11(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_IfThen_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_48) { - stateInit = fun_11(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_12(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_12(arg); - } - - receive() { } -} - -contract Expr_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - fun_12(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_12(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_12(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract While_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_12(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_12(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_12(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_12(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_49, v_50 in intMap) { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_49, v_50 in intMap) { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_IfElse_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_12(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_12(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_IfElse_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_52) { - stateInit = fun_12(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_IfElse_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_52) { - stateInit = fun_12(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_13(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_13(arg); - } - - receive() { } -} - -contract Expr_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - fun_13(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_13(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_13(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract While_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_13(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_13(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_13(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_13(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_53, v_54 in intMap) { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_53, v_54 in intMap) { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_While_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_13(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_13(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_While_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_56) { - stateInit = fun_13(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_While_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_56) { - stateInit = fun_13(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_14(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_14(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - fun_14(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_14(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_14(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_14(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_14(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_14(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_14(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_57, v_58 in intMap) { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_57, v_58 in intMap) { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Until_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_14(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_14(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Until_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_60) { - stateInit = fun_14(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Until_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_60) { - stateInit = fun_14(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_15(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_15(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - fun_15(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_15(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_15(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_15(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_15(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_15(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_15(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_61, v_62 in intMap) { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_61, v_62 in intMap) { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Repeat_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_15(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_15(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Repeat_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_64) { - stateInit = fun_15(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Repeat_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_64) { - stateInit = fun_15(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_16(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_16(arg); - } - - receive() { } -} - -contract Expr_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - fun_16(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_16(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_16(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract While_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_16(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_16(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_16(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_16(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_65, v_66 in intMap) { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_65, v_66 in intMap) { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_ForEach_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_16(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_16(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_ForEach_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_68) { - stateInit = fun_16(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_ForEach_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_68) { - stateInit = fun_16(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_17(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_17(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - fun_17(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_17(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_17(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_17(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_17(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_17(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_17(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_69, v_70 in intMap) { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_69, v_70 in intMap) { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Destruct_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_17(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_17(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Destruct_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_72) { - stateInit = fun_17(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Destruct_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_72) { - stateInit = fun_17(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_18(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_18(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - fun_18(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_18(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_18(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_18(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_18(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_18(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_18(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_73, v_74 in intMap) { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_73, v_74 in intMap) { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Block_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_18(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_18(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Block_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_76) { - stateInit = fun_18(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Block_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_76) { - stateInit = fun_18(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_19(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_19(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - fun_19(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_19(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_19(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_19(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_19(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_19(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_19(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_77, v_78 in intMap) { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_77, v_78 in intMap) { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Try_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_19(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_19(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Try_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_80) { - stateInit = fun_19(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Try_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_80) { - stateInit = fun_19(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = fun_20(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_20(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - fun_20(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_20(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_20(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_20(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_20(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_20(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_20(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_81, v_82 in intMap) { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_81, v_82 in intMap) { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Catch_InitOf { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_20(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_20(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Catch_InitOf { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_84) { - stateInit = fun_20(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Catch_InitOf_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_84) { - stateInit = fun_20(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_21(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_21(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - fun_21(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_21(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_21(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_21(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_21(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_21(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_21(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_85, v_86 in intMap) { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_85, v_86 in intMap) { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Let_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_21(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_21(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Let_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_88) { - stateInit = fun_21(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Let_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_88) { - stateInit = fun_21(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_22(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_22(arg); - } - - receive() { } -} - -contract Expr_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - fun_22(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_22(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_22(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract While_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_22(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_22(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_22(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_22(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_89, v_90 in intMap) { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_89, v_90 in intMap) { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_22(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_22(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_IfNoElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_92) { - stateInit = fun_22(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_IfNoElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_92) { - stateInit = fun_22(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_23(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_23(arg); - } - - receive() { } -} - -contract Expr_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - fun_23(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_23(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_23(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract While_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_23(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_23(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_23(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_23(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_93, v_94 in intMap) { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_93, v_94 in intMap) { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_23(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_23(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_IfThen_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_96) { - stateInit = fun_23(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_IfThen_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_96) { - stateInit = fun_23(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_24(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_24(arg); - } - - receive() { } -} - -contract Expr_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - fun_24(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_24(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_24(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract While_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_24(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_24(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_24(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_24(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_97, v_98 in intMap) { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_97, v_98 in intMap) { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_24(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_24(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_IfElse_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_100) { - stateInit = fun_24(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_IfElse_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_100) { - stateInit = fun_24(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_25(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_25(arg); - } - - receive() { } -} - -contract Expr_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - fun_25(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_25(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_25(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract While_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_25(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_25(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_25(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_25(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_101, v_102 in intMap) { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_101, v_102 in intMap) { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_While_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_25(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_25(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_While_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_104) { - stateInit = fun_25(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_While_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_104) { - stateInit = fun_25(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_26(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_26(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - fun_26(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_26(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_26(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_26(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_26(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_26(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_26(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_105, v_106 in intMap) { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_105, v_106 in intMap) { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Until_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_26(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_26(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Until_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_108) { - stateInit = fun_26(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Until_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_108) { - stateInit = fun_26(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_27(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_27(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - fun_27(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_27(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_27(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_27(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_27(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_27(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_27(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_109, v_110 in intMap) { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_109, v_110 in intMap) { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_27(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_27(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Repeat_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_112) { - stateInit = fun_27(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Repeat_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_112) { - stateInit = fun_27(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_28(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_28(arg); - } - - receive() { } -} - -contract Expr_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - fun_28(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_28(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_28(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract While_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_28(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_28(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_28(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_28(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_113, v_114 in intMap) { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_113, v_114 in intMap) { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_28(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_28(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_ForEach_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_116) { - stateInit = fun_28(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_ForEach_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_116) { - stateInit = fun_28(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_29(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_29(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - fun_29(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_29(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_29(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_29(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_29(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_29(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_29(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_117, v_118 in intMap) { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_117, v_118 in intMap) { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_29(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_29(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Destruct_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_120) { - stateInit = fun_29(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Destruct_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_120) { - stateInit = fun_29(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_30(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_30(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - fun_30(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_30(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_30(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_30(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_30(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_30(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_30(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_121, v_122 in intMap) { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_121, v_122 in intMap) { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Block_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_30(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_30(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Block_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_124) { - stateInit = fun_30(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Block_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_124) { - stateInit = fun_30(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_31(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_31(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - fun_31(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_31(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_31(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_31(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_31(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_31(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_31(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_125, v_126 in intMap) { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_125, v_126 in intMap) { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Try_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_31(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_31(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Try_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_128) { - stateInit = fun_31(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Try_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_128) { - stateInit = fun_31(arg); - } - } - - receive() { } -} - -contract Let_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = fun_32(arg); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Let_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = fun_32(arg); - } - - receive() { } -} - -contract Expr_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - fun_32(arg); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfNoElse_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -contract IfThen_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_32(arg); - } else { - stateInit = initOf Dummy2(); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfThen_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg == 0) { - stateInit = fun_32(arg); - } else { - stateInit = initOf Dummy2(); - } - } - - receive() { } -} - -contract IfElse_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract IfElse_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - if (arg - arg + 1 == 0) { - stateInit = initOf Dummy2(); - } else { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -contract While_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_32(arg); - counter = counter + 1; - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract While_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - while (counter <= 2) { - stateInit = fun_32(arg); - counter = counter + 1; - } - } - - receive() { } -} - -contract Until_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_32(arg); - counter = counter + 1; - } until (counter >= 2); - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Until_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = arg - arg; - do { - stateInit = fun_32(arg); - counter = counter + 1; - } until (counter >= 2); - } - - receive() { } -} - -contract Repeat_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Repeat_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let counter: Int = random(1, 3); - repeat (counter) { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -contract ForEach_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_129, v_130 in intMap) { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract ForEach_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - let intMap: map = null; - intMap.set(1, 3); - foreach (v_129, v_130 in intMap) { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -contract Destruct_StaticCall_Catch_StaticCall { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_32(arg)}; - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Destruct_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let StateInitWrapper {init: stateInit} = StateInitWrapper{init: fun_32(arg)}; - } - - receive() { } -} - -contract Block_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Block_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -contract Try_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Try_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -contract Catch_StaticCall_Catch_StaticCall { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_132) { - stateInit = fun_32(arg); - } - let addr: Address = contractAddress(stateInit); - send(SendParameters{to: addr, value: ton("1")}); - } - - receive() { } -} - -contract Catch_StaticCall_Catch_StaticCall_NoSend { - init(arg: Int) { - let stateInit: StateInit = initOf Dummy1(); - try { - 1 / (arg - arg); - } catch (v_132) { - stateInit = fun_32(arg); - } - } - - receive() { } -} - -message DeployMessage { - addr: Address; - data: Cell; - code: Cell; -} - -struct StateInitWrapper { - init: StateInit; -} - -contract Dummy1 { } - -contract Dummy2 { } - -contract Deployer { - receive(msg: DeployMessage) { - let addr = msg.addr; - let data = msg.data; - let code = msg.code; - send(SendParameters{to: addr, bounce: false, value: ton("10"), data: data, code: code}); - } -} +} \ No newline at end of file diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index c696bb45a..28aa1c783 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -3,53 +3,51 @@ import type * as A from "../../ast/ast"; import { getAstFactory, idText } from "../../ast/ast-helpers"; import type { FactoryAst } from "../../ast/ast-helpers"; import { prettyPrint } from "../../ast/ast-printer"; -import { dummySrcInfo } from "../../grammar"; +import { dummySrcInfo, getParser } from "../../grammar"; import * as fs from "fs"; +import fc from "fast-check"; +import { fromString } from "../../imports/path"; +import { buildModule } from "./util"; +import { defaultParser } from "../../grammar/grammar"; + +type ItemsWithDeclarations = { + items: T[]; + declarations: Declarations; +} -/* - | AstFieldAccess - | AstStaticCall - | AstId - | AstInitOf - | AstCodeOf - | AstString - | AstLiteral; -*/ +type Declarations = { + globalDeclarations: Map; + contractDeclarations: Map; +} type ExpressionWithName = { name: string; expression: A.AstExpression; -}; +} type StatementsWithName = { name: string; statements: A.AstStatement[]; assignedStateInit: boolean; -}; - -type Test = { - // Will add other stuff here for the spec file - contract: A.AstContract; -}; +} -interface Generator { - generate: () => T[]; +type GlobalConfig = { + maxFunCallDepth: number; } -interface GeneratorWithDeclarations { - generate: () => { - globalDeclarations: Map; - contractDeclarations: Map; - items: T[]; - }; +type Test = { + module: A.AstModule; + testName: string; } -function createTests(astF: FactoryAst, filename: string) { - let counter = 0; - const maxFunCallDepth = 2; - let currentFunDepth = 1; +function createTestModules(astF: FactoryAst): Test[] { + let idCounter = 0; - function generateInitOf( + const config: GlobalConfig = { + maxFunCallDepth: 2, + }; + + function makeInitOf( contract: A.AstId, args: A.AstExpression[], ): A.AstInitOf { @@ -61,7 +59,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstInitOf; } - function generateId(name: string): A.AstId { + function makeId(name: string): A.AstId { return astF.createNode({ kind: "id", text: name, @@ -69,7 +67,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstId; } - function generateTypeId(name: string): A.AstTypeId { + function makeTypeId(name: string): A.AstTypeId { return astF.createNode({ kind: "type_id", text: name, @@ -77,20 +75,20 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstTypeId; } - function generateTypedParameter( + function makeTypedParameter( name: string, type: string, ): A.AstTypedParameter { return astF.createNode({ kind: "typed_parameter", - name: generateId(name), - type: generateTypeId(type), + name: makeId(name), + type: makeTypeId(type), loc: dummySrcInfo, }) as A.AstTypedParameter; } - /* - function generateFunctionAttribute( + + function makeFunctionAttribute( name: A.AstFunctionAttributeName, ): A.AstFunctionAttribute { return astF.createNode({ @@ -100,12 +98,12 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstFunctionAttribute; } - function generateBoolean(value: boolean): A.AstBoolean { + function makeBoolean(value: boolean): A.AstBoolean { return astF.createNode({ kind: "boolean", value, loc: dummySrcInfo }) as A.AstBoolean; } - */ + - function generateString(value: string): A.AstString { + function makeString(value: string): A.AstString { return astF.createNode({ kind: "string", value, @@ -113,7 +111,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstString; } - function generateInt(value: bigint): A.AstNumber { + function makeInt(value: bigint): A.AstNumber { return astF.createNode({ kind: "number", value, @@ -122,31 +120,31 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstNumber; } - /* - function generateFreshFieldName(): A.AstId { - const newName = `field_${counter++}`; - return generateId(newName); + + function makeFreshFieldName(): A.AstId { + const newName = `field_${idCounter++}`; + return makeId(newName); } - */ + - function generateFreshFunctionName(): A.AstId { - const newName = `fun_${counter++}`; - return generateId(newName); + function makeFreshFunctionName(): A.AstId { + const newName = `fun_${idCounter++}`; + return makeId(newName); } - /* - function generateFreshConstantName(): A.AstId { - const newName = `CONS_${counter++}`; - return generateId(newName); + + function makeFreshConstantName(): A.AstId { + const newName = `CONS_${idCounter++}`; + return makeId(newName); } - */ + - function generateFreshVarName(): A.AstId { - const newName = `v_${counter++}`; - return generateId(newName); + function makeFreshVarName(): A.AstId { + const newName = `v_${idCounter++}`; + return makeId(newName); } - function generateBinaryExpression( + function makeBinaryExpression( op: A.AstBinaryOperation, operand1: A.AstExpression, operand2: A.AstExpression, @@ -160,13 +158,13 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstOpBinary; } - /* - function generateConditional(boolValue: boolean, exprT: A.AstExpression, exprF: A.AstExpression): A.AstConditional { - return astF.createNode({ kind: "conditional", condition: generateBoolean(boolValue), thenBranch: exprT, elseBranch: exprF, loc: dummySrcInfo }) as A.AstConditional; + + function makeConditional(boolValue: boolean, exprT: A.AstExpression, exprF: A.AstExpression): A.AstConditional { + return astF.createNode({ kind: "conditional", condition: makeBoolean(boolValue), thenBranch: exprT, elseBranch: exprF, loc: dummySrcInfo }) as A.AstConditional; } - */ + - function generateMethodCall( + function makeMethodCall( name: A.AstId, self: A.AstExpression, args: A.AstExpression[], @@ -180,7 +178,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstMethodCall; } - function generateStaticCall( + function makeStaticCall( name: A.AstId, args: A.AstExpression[], ): A.AstStaticCall { @@ -192,7 +190,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStaticCall; } - function generateStructInstance( + function makeStructInstance( type: A.AstId, args: A.AstStructFieldInitializer[], ): A.AstStructInstance { @@ -218,7 +216,7 @@ function createTests(astF: FactoryAst, filename: string) { } */ - function generateLetStatement( + function makeLetStatement( name: A.AstId, type: A.AstTypeId, expr: A.AstExpression, @@ -232,7 +230,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementLet; } - function generateAssignStatement( + function makeAssignStatement( name: A.AstId, expr: A.AstExpression, ): A.AstStatementAssign { @@ -244,7 +242,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementAssign; } - function generateStructFieldInitializer( + function makeStructFieldInitializer( name: A.AstId, initializer: A.AstExpression, ): A.AstStructFieldInitializer { @@ -256,13 +254,13 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStructFieldInitializer; } - /* - function generateFieldAccess(aggregate: A.AstExpression, field: A.AstId): A.AstFieldAccess { + + function makeFieldAccess(aggregate: A.AstExpression, field: A.AstId): A.AstFieldAccess { return astF.createNode({ kind: "field_access", aggregate, field, loc: dummySrcInfo }) as A.AstFieldAccess; } - */ + - function generateExpressionStatement( + function makeExpressionStatement( expr: A.AstExpression, ): A.AstStatementExpression { return astF.createNode({ @@ -272,7 +270,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementExpression; } - function generateConditionStatement( + function makeConditionStatement( cond: A.AstExpression, thenBranch: A.AstStatement[], elseBranch: A.AstStatement[] | null, @@ -286,7 +284,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementCondition; } - function generateWhileStatement( + function makeWhileStatement( cond: A.AstExpression, body: A.AstStatement[], ): A.AstStatementWhile { @@ -298,7 +296,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementWhile; } - function generateUntilStatement( + function makeUntilStatement( cond: A.AstExpression, body: A.AstStatement[], ): A.AstStatementUntil { @@ -310,7 +308,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementUntil; } - function generateRepeatStatement( + function makeRepeatStatement( count: A.AstExpression, body: A.AstStatement[], ): A.AstStatementRepeat { @@ -322,7 +320,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementRepeat; } - function generateForEachStatement( + function makeForEachStatement( mapVar: A.AstExpression, keyVar: A.AstId, valueVar: A.AstId, @@ -338,7 +336,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementForEach; } - function generateDestructStatement( + function makeDestructStatement( expr: A.AstExpression, identifiers: Map, type: A.AstTypeId, @@ -353,7 +351,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementDestruct; } - function generateBlockStatement( + function makeBlockStatement( body: A.AstStatement[], ): A.AstStatementBlock { return astF.createNode({ @@ -363,14 +361,14 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementBlock; } - function generateTryStatement( + function makeTryStatement( catchName: A.AstId, tryBody: A.AstStatement[], catchBody: A.AstStatement[] | undefined, ): A.AstStatementTry { const catchBlock = typeof catchBody !== "undefined" - ? generateCatchBlock(catchName, catchBody) + ? makeCatchBlock(catchName, catchBody) : undefined; return astF.createNode({ kind: "statement_try", @@ -380,14 +378,14 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementTry; } - function generateCatchBlock( + function makeCatchBlock( catchName: A.AstId, body: A.AstStatement[], ): A.AstCatchBlock { return { catchName, catchStatements: body }; } - function generateFunctionDefinition( + function makeFunctionDefinition( name: A.AstId, params: A.AstTypedParameter[], statements: A.AstStatement[], @@ -405,7 +403,7 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstFunctionDef; } - function generateReturnStatement( + function makeReturnStatement( expression: A.AstExpression, ): A.AstStatementReturn { return astF.createNode({ @@ -415,48 +413,48 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstStatementReturn; } - function generateContractInit(stmts: A.AstStatement[]): A.AstContractInit { - const addrExpr = generateStaticCall(generateId("contractAddress"), [ - generateId("stateInit"), + function makeContractInit(stmts: A.AstStatement[]): A.AstContractInit { + const addrExpr = makeStaticCall(makeId("contractAddress"), [ + makeId("stateInit"), ]); - const addrVar = generateId("addr"); - const addrLet = generateLetStatement( + const addrVar = makeId("addr"); + const addrLet = makeLetStatement( addrVar, - generateTypeId("Address"), + makeTypeId("Address"), addrExpr, ); - const tonExpr = generateStaticCall(generateId("ton"), [ - generateString("1"), + const tonExpr = makeStaticCall(makeId("ton"), [ + makeString("1"), ]); - const sendParams = generateStructInstance( - generateId("SendParameters"), + const sendParams = makeStructInstance( + makeId("SendParameters"), [ - generateStructFieldInitializer(generateId("to"), addrVar), - generateStructFieldInitializer(generateId("value"), tonExpr), + makeStructFieldInitializer(makeId("to"), addrVar), + makeStructFieldInitializer(makeId("value"), tonExpr), ], ); - const sendExpr = generateStaticCall(generateId("send"), [sendParams]); - const sendStmt = generateExpressionStatement(sendExpr); + const sendExpr = makeStaticCall(makeId("send"), [sendParams]); + const sendStmt = makeExpressionStatement(sendExpr); return astF.createNode({ kind: "contract_init", - params: [generateTypedParameter("arg", "Int")], + params: [makeTypedParameter("arg", "Int")], statements: [...stmts, addrLet, sendStmt], loc: dummySrcInfo, }) as A.AstContractInit; } - function generateContractInitNoSend( + function makeContractInitNoSend( stmts: A.AstStatement[], ): A.AstContractInit { return astF.createNode({ kind: "contract_init", - params: [generateTypedParameter("arg", "Int")], + params: [makeTypedParameter("arg", "Int")], statements: stmts, loc: dummySrcInfo, }) as A.AstContractInit; } - function generateEmptyInternalReceiver(): A.AstReceiver { + function makeEmptyInternalReceiver(): A.AstReceiver { const receiverKind = astF.createNode({ kind: "fallback", }) as A.AstReceiverFallback; @@ -473,13 +471,13 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstReceiver; } - function generateContract( + function makeContract( name: A.AstId, stmts: A.AstStatement[], decls: A.AstContractDeclaration[], ): A.AstContract { - const init = generateContractInit(stmts); - const receiver = generateEmptyInternalReceiver(); + const init = makeContractInit(stmts); + const receiver = makeEmptyInternalReceiver(); const finalDecls = [...decls, init, receiver]; return astF.createNode({ kind: "contract", @@ -492,13 +490,13 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstContract; } - function generateContractNoSend( + function makeContractNoSend( name: A.AstId, stmts: A.AstStatement[], decls: A.AstContractDeclaration[], ): A.AstContract { - const init = generateContractInitNoSend(stmts); - const receiver = generateEmptyInternalReceiver(); + const init = makeContractInitNoSend(stmts); + const receiver = makeEmptyInternalReceiver(); const finalDecls = [...decls, init, receiver]; return astF.createNode({ kind: "contract", @@ -511,6 +509,61 @@ function createTests(astF: FactoryAst, filename: string) { }) as A.AstContract; } + function withEmptyDeclarations(items: T[]): fc.Arbitrary> { + return fc.constant({ + items: items, + declarations: { + globalDeclarations: new Map(), + contractDeclarations: new Map() + } + }); + } + + function chainGenerators(gens: fc.Arbitrary>[], initialDecls: Declarations): fc.Arbitrary> { + const join: (d1: ItemsWithDeclarations, d2: ItemsWithDeclarations) => ItemsWithDeclarations = (d1, d2) => { + const finalGlobalDecls: Map = + new Map(d1.declarations.globalDeclarations); + const finalContractDecls: Map< + string, + A.AstContractDeclaration + > = new Map(d1.declarations.contractDeclarations); + const finalItems: T[] = [...d1.items, ...d2.items]; + d2.declarations.globalDeclarations.forEach((value, key) => { + finalGlobalDecls.set(key, value); + }); + d2.declarations.contractDeclarations.forEach((value, key) => { + finalContractDecls.set(key, value); + }); + return { + items: finalItems, + declarations: { + globalDeclarations: finalGlobalDecls, + contractDeclarations: finalContractDecls + } + }; + }; + return chainGeneratorsAux( + { + items: [], + declarations: initialDecls + }, + gens, + join + ); + } + + function chainGeneratorsAux(accum: T, gens: fc.Arbitrary[], join: (d1: T, d2: T) => T): fc.Arbitrary { + if (gens.length === 0) { + return fc.constant(accum); + } + // First element is ensured to exist + const gen = gens[0]!; + return gen.chain(currData => { + return chainGeneratorsAux(join(accum, currData), gens.slice(1), join); + } + ); + } + /* function contractConstantGenerator(baseExpr: A.AstExpression): GeneratorWithDeclarations { return { @@ -534,96 +587,57 @@ function createTests(astF: FactoryAst, filename: string) { }}; }*/ - function identityGenerator( - baseExpr: A.AstExpression, - name: string, - ): GeneratorWithDeclarations { - return { - generate: () => { - return { - globalDeclarations: new Map(), - contractDeclarations: new Map(), - items: [{ name, expression: baseExpr }], - }; - }, - }; + function initOfGenerator(): fc.Arbitrary> { + return withEmptyDeclarations([{ + name: "InitOf", + expression: makeInitOf(makeId("Deployer"), []) + }]); } - function staticCallGenerator(): GeneratorWithDeclarations { - return { - generate: () => { - const finalGlobalDecls: Map = - new Map(); - const finalItems: ExpressionWithName[] = []; + function staticCallGenerator(currentFunCallDepth: number): fc.Arbitrary> { + if (currentFunCallDepth >= config.maxFunCallDepth) { + return withEmptyDeclarations([]); + } - // If we reached the max function call depth, then do not call the generators - // just generate a return statement with the initOf - if (currentFunDepth >= maxFunCallDepth) { - const funName = generateFreshFunctionName(); - const returnStmt = generateReturnStatement( - generateInitOf(generateId("Deployer"), []), + return statementGenerator(currentFunCallDepth + 1).chain(genStmts => { + + const finalGlobalDecls: Map = + new Map(genStmts.declarations.globalDeclarations); + const finalItems: ExpressionWithName[] = []; + + for (const stmsWithName of genStmts.items) { + + if (stmsWithName.assignedStateInit) { + const funName = makeFreshFunctionName(); + const returnStmt = makeReturnStatement( + makeId("stateInit"), ); - const funDef = generateFunctionDefinition( + const funDef = makeFunctionDefinition( funName, - [generateTypedParameter("arg", "Int")], - [returnStmt], + [makeTypedParameter("arg", "Int")], + [...stmsWithName.statements, returnStmt], [], - generateTypeId("StateInit"), + makeTypeId("StateInit"), ); - const call = generateStaticCall(funName, [ - generateId("arg"), + const call = makeStaticCall(funName, [ + makeId("arg"), ]); - const testName = `StaticCall`; + const testName = `StaticCall_${stmsWithName.name}`; finalGlobalDecls.set(idText(funName), funDef); finalItems.push({ name: testName, expression: call }); - return { - globalDeclarations: finalGlobalDecls, - contractDeclarations: new Map(), - items: finalItems, - }; } + } - // Increase the fun call depth - currentFunDepth++; - - const stmtGenResult = statementGenerator().generate(); - stmtGenResult.globalDeclarations.forEach((value, key) => { - finalGlobalDecls.set(key, value); - }); - - for (const stmtWithDecls of stmtGenResult.items) { - // We can only create a test that generated an assignment to stateInit (because we need to return it) - if (stmtWithDecls.assignedStateInit) { - const funName = generateFreshFunctionName(); - const returnStmt = generateReturnStatement( - generateId("stateInit"), - ); - const funDef = generateFunctionDefinition( - funName, - [generateTypedParameter("arg", "Int")], - [...stmtWithDecls.statements, returnStmt], - [], - generateTypeId("StateInit"), - ); - const call = generateStaticCall(funName, [ - generateId("arg"), - ]); - const testName = `StaticCall_${stmtWithDecls.name}`; - finalGlobalDecls.set(idText(funName), funDef); - finalItems.push({ name: testName, expression: call }); - } + return fc.constant({ + items: finalItems, + declarations: { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map() } + }) + } - // decrease the fun call depth - currentFunDepth--; - - return { - globalDeclarations: finalGlobalDecls, - contractDeclarations: new Map(), - items: finalItems, - }; - }, - }; + ); } /* @@ -712,659 +726,587 @@ function createTests(astF: FactoryAst, filename: string) { function letStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const varName = generateId("stateInit"); - const varType = generateTypeId("StateInit"); - const stmtLet = generateLetStatement( - varName, - varType, - baseExpr, - ); - const newName = `Let_${name}`; - return [ - { - name: newName, - statements: [stmtLet], - assignedStateInit: true, - }, - ]; - }, - }; + ): fc.Arbitrary> { + const varName = makeId("stateInit"); + const varType = makeTypeId("StateInit"); + const stmtLet = makeLetStatement( + varName, + varType, + baseExpr, + ); + const newName = `Let_${name}`; + + return withEmptyDeclarations([{ + name: newName, + statements: [stmtLet], + assignedStateInit: true, + }]); } function expressionStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const stmtExpr = generateExpressionStatement(baseExpr); - const newName = `Expr_${name}`; - return [ - { - name: newName, - statements: [stmtExpr], - assignedStateInit: false, - }, - ]; + ): fc.Arbitrary> { + const stmtExpr = makeExpressionStatement(baseExpr); + const newName = `Expr_${name}`; + return withEmptyDeclarations([ + { + name: newName, + statements: [stmtExpr], + assignedStateInit: false, }, - }; + ]); } function conditionStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - const cond1Expr = generateBinaryExpression( - "==", - generateBinaryExpression( - "-", - generateId("arg"), - generateId("arg"), - ), - generateInt(0n), - ); - const cond2Expr = generateBinaryExpression( - "==", - generateBinaryExpression( - "+", - generateBinaryExpression( - "-", - generateId("arg"), - generateId("arg"), - ), - generateInt(1n), - ), - generateInt(0n), - ); + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const cond1Expr = makeBinaryExpression( + "==", + makeBinaryExpression( + "-", + makeId("arg"), + makeId("arg"), + ), + makeInt(0n), + ); + const cond2Expr = makeBinaryExpression( + "==", + makeBinaryExpression( + "+", + makeBinaryExpression( + "-", + makeId("arg"), + makeId("arg"), + ), + makeInt(1n), + ), + makeInt(0n), + ); - const expr = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); - const dummy2 = generateAssignStatement( - generateId("stateInit"), - generateInitOf(generateId("Dummy2"), []), - ); - const case1 = generateConditionStatement( - cond1Expr, - [expr], - null, - ); - const case2 = generateConditionStatement( - cond1Expr, - [expr], - [dummy2], - ); - const case3 = generateConditionStatement( - cond2Expr, - [dummy2], - [expr], - ); - - const case1Name = `IfNoElse_${name}`; - const case2Name = `IfThen_${name}`; - const case3Name = `IfElse_${name}`; - - return [ - { - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, - { - name: case2Name, - statements: [initVarStmt, case2], - assignedStateInit: true, - }, - { - name: case3Name, - statements: [initVarStmt, case3], - assignedStateInit: true, - }, - ]; - }, - }; + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); + const dummy2 = makeAssignStatement( + makeId("stateInit"), + makeInitOf(makeId("Dummy2"), []), + ); + const case1 = makeConditionStatement( + cond1Expr, + [expr], + null, + ); + const case2 = makeConditionStatement( + cond1Expr, + [expr], + [dummy2], + ); + const case3 = makeConditionStatement( + cond2Expr, + [dummy2], + [expr], + ); + + const case1Name = `IfNoElse_${name}`; + const case2Name = `IfThen_${name}`; + const case3Name = `IfElse_${name}`; + + return withEmptyDeclarations([{ + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, + }, + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + { + name: case3Name, + statements: [initVarStmt, case3], + assignedStateInit: true, + }, + ]); } function whileStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - const countVarStmt = generateLetStatement( - generateId("counter"), - generateTypeId("Int"), - generateBinaryExpression( - "-", - generateId("arg"), - generateId("arg"), - ), - ); - const expr = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); - const counterIncr = generateAssignStatement( - generateId("counter"), - generateBinaryExpression( - "+", - generateId("counter"), - generateInt(1n), - ), - ); - const cond = generateBinaryExpression( - "<=", - generateId("counter"), - generateInt(2n), - ); - const loop = generateWhileStatement(cond, [expr, counterIncr]); - - const newName = `While_${name}`; - - return [ - { - name: newName, - statements: [initVarStmt, countVarStmt, loop], - assignedStateInit: true, - }, - ]; - }, - }; + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const countVarStmt = makeLetStatement( + makeId("counter"), + makeTypeId("Int"), + makeBinaryExpression( + "-", + makeId("arg"), + makeId("arg"), + ), + ); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); + const counterIncr = makeAssignStatement( + makeId("counter"), + makeBinaryExpression( + "+", + makeId("counter"), + makeInt(1n), + ), + ); + const cond = makeBinaryExpression( + "<=", + makeId("counter"), + makeInt(2n), + ); + const loop = makeWhileStatement(cond, [expr, counterIncr]); + + const newName = `While_${name}`; + + return withEmptyDeclarations([ + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }] + ); } function untilStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - const countVarStmt = generateLetStatement( - generateId("counter"), - generateTypeId("Int"), - generateBinaryExpression( - "-", - generateId("arg"), - generateId("arg"), - ), - ); - const expr = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); - const counterIncr = generateAssignStatement( - generateId("counter"), - generateBinaryExpression( - "+", - generateId("counter"), - generateInt(1n), - ), - ); - const cond = generateBinaryExpression( - ">=", - generateId("counter"), - generateInt(2n), - ); - const loop = generateUntilStatement(cond, [expr, counterIncr]); - - const newName = `Until_${name}`; - - return [ - { - name: newName, - statements: [initVarStmt, countVarStmt, loop], - assignedStateInit: true, - }, - ]; + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const countVarStmt = makeLetStatement( + makeId("counter"), + makeTypeId("Int"), + makeBinaryExpression( + "-", + makeId("arg"), + makeId("arg"), + ), + ); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); + const counterIncr = makeAssignStatement( + makeId("counter"), + makeBinaryExpression( + "+", + makeId("counter"), + makeInt(1n), + ), + ); + const cond = makeBinaryExpression( + ">=", + makeId("counter"), + makeInt(2n), + ); + const loop = makeUntilStatement(cond, [expr, counterIncr]); + + const newName = `Until_${name}`; + + return withEmptyDeclarations([ + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, }, - }; + ]); } function repeatStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - const countVarStmt = generateLetStatement( - generateId("counter"), - generateTypeId("Int"), - generateStaticCall(generateId("random"), [ - generateInt(1n), - generateInt(3n), - ]), - ); - const expr = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); - const loop = generateRepeatStatement(generateId("counter"), [ - expr, - ]); - - const newName = `Repeat_${name}`; - - return [ - { - name: newName, - statements: [initVarStmt, countVarStmt, loop], - assignedStateInit: true, - }, - ]; + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const countVarStmt = makeLetStatement( + makeId("counter"), + makeTypeId("Int"), + makeStaticCall(makeId("random"), [ + makeInt(1n), + makeInt(3n), + ]), + ); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); + const loop = makeRepeatStatement(makeId("counter"), [ + expr, + ]); + + const newName = `Repeat_${name}`; + + return withEmptyDeclarations([ + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, }, - }; + ]); } function forEachStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - const mapVar = generateId("intMap"); - const mapVarStmt = generateLetStatement( - mapVar, - generateTypeId("map"), - generateId("null"), - ); - const mutateMap = generateExpressionStatement( - generateMethodCall(generateId("set"), mapVar, [ - generateInt(1n), - generateInt(3n), - ]), - ); - - const expr = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); - const loop = generateForEachStatement( - mapVar, - generateFreshVarName(), - generateFreshVarName(), - [expr], - ); - - const newName = `ForEach_${name}`; - - return [ - { - name: newName, - statements: [initVarStmt, mapVarStmt, mutateMap, loop], - assignedStateInit: true, - }, - ]; + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const mapVar = makeId("intMap"); + const mapVarStmt = makeLetStatement( + mapVar, + makeTypeId("map"), + makeId("null"), + ); + const mutateMap = makeExpressionStatement( + makeMethodCall(makeId("set"), mapVar, [ + makeInt(1n), + makeInt(3n), + ]), + ); + + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); + const loop = makeForEachStatement( + mapVar, + makeFreshVarName(), + makeFreshVarName(), + [expr], + ); + + const newName = `ForEach_${name}`; + + return withEmptyDeclarations([ + { + name: newName, + statements: [initVarStmt, mapVarStmt, mutateMap, loop], + assignedStateInit: true, }, - }; + ]); } function destructStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const identifiers: Map = new Map(); - identifiers.set("init", [ - generateId("init"), - generateId("stateInit"), - ]); - - const wrapped = generateStructInstance( - generateId("StateInitWrapper"), - [ - generateStructFieldInitializer( - generateId("init"), - baseExpr, - ), - ], - ); - - const unwrapped = generateDestructStatement( - wrapped, - identifiers, - generateTypeId("StateInitWrapper"), - ); - - const newName = `Destruct_${name}`; - - return [ - { - name: newName, - statements: [unwrapped], - assignedStateInit: true, - }, - ]; + ): fc.Arbitrary> { + const identifiers: Map = new Map(); + identifiers.set("init", [ + makeId("init"), + makeId("stateInit"), + ]); + + const wrapped = makeStructInstance( + makeId("StateInitWrapper"), + [ + makeStructFieldInitializer( + makeId("init"), + baseExpr, + ), + ], + ); + + const unwrapped = makeDestructStatement( + wrapped, + identifiers, + makeTypeId("StateInitWrapper"), + ); + + const newName = `Destruct_${name}`; + + return withEmptyDeclarations([ + { + name: newName, + statements: [unwrapped], + assignedStateInit: true, }, - }; + ]); } function blockStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - - const exprStmt = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); - const stmt = generateBlockStatement([exprStmt]); + const exprStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); - const newName = `Block_${name}`; + const stmt = makeBlockStatement([exprStmt]); - return [ - { - name: newName, - statements: [initVarStmt, stmt], - assignedStateInit: true, - }, - ]; + const newName = `Block_${name}`; + + return withEmptyDeclarations([ + { + name: newName, + statements: [initVarStmt, stmt], + assignedStateInit: true, }, - }; + ]); } function tryStatementGenerator( baseExpr: A.AstExpression, name: string, - ): Generator { - return { - generate: () => { - const initVarStmt = generateLetStatement( - generateId("stateInit"), - generateTypeId("StateInit"), - generateInitOf(generateId("Dummy1"), []), - ); - - const exprStmt = generateAssignStatement( - generateId("stateInit"), - baseExpr, - ); - const divByZeroStmt = generateExpressionStatement( - generateBinaryExpression( - "/", - generateInt(1n), - generateBinaryExpression( - "-", - generateId("arg"), - generateId("arg"), - ), - ), - ); - - const case1 = generateTryStatement( - generateFreshVarName(), - [exprStmt], - undefined, - ); - const case2 = generateTryStatement( - generateFreshVarName(), - [divByZeroStmt], - [exprStmt], - ); - - const case1Name = `Try_${name}`; - const case2Name = `Catch_${name}`; - - return [ - { - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, - { - name: case2Name, - statements: [initVarStmt, case2], - assignedStateInit: true, - }, - ]; - }, - }; - } + ): fc.Arbitrary> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); - function expressionGenerator(): GeneratorWithDeclarations { - return { - generate: () => { - const initOf = generateInitOf(generateId("Deployer"), []); - - const exprGens = [ - identityGenerator(initOf, "InitOf"), - staticCallGenerator(), - //methodCallGenerator(), - //contractConstantGenerator(initOf), - //contractFieldGenerator(initOf) - ]; + const exprStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr, + ); + const divByZeroStmt = makeExpressionStatement( + makeBinaryExpression( + "/", + makeInt(1n), + makeBinaryExpression( + "-", + makeId("arg"), + makeId("arg"), + ), + ), + ); - const finalGlobalDecls: Map = - new Map(); - const finalContractDecls: Map< - string, - A.AstContractDeclaration - > = new Map(); - const finalItems: ExpressionWithName[] = []; + const case1 = makeTryStatement( + makeFreshVarName(), + [exprStmt], + undefined, + ); + const case2 = makeTryStatement( + makeFreshVarName(), + [divByZeroStmt], + [exprStmt], + ); - for (const gen of exprGens) { - const genResult = gen.generate(); - genResult.globalDeclarations.forEach((value, key) => { - finalGlobalDecls.set(key, value); - }); - genResult.contractDeclarations.forEach((value, key) => { - finalContractDecls.set(key, value); - }); - finalItems.push(...genResult.items); - } + const case1Name = `Try_${name}`; + const case2Name = `Catch_${name}`; - return { - globalDeclarations: finalGlobalDecls, - contractDeclarations: finalContractDecls, - items: finalItems, - }; + return withEmptyDeclarations([ + { + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, }, - }; + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + ]); } - function statementGenerator(): GeneratorWithDeclarations { - return { - generate: () => { - const finalItems: StatementsWithName[] = []; - - const exprGenResult = expressionGenerator().generate(); - - for (const exprWithName of exprGenResult.items) { - const stmtGens = [ - letStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - expressionStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - conditionStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - whileStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - untilStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - repeatStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - forEachStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - destructStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - blockStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - tryStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - ]; - - for (const gen of stmtGens) { - for (const genResult of gen.generate()) { - finalItems.push({ - name: genResult.name, - statements: genResult.statements, - assignedStateInit: genResult.assignedStateInit, - }); - } - } - } + function expressionGenerator(currentFunCallDepth: number): fc.Arbitrary> { - return { - globalDeclarations: exprGenResult.globalDeclarations, - contractDeclarations: exprGenResult.contractDeclarations, - items: finalItems, - }; - }, - }; + const exprGens = [ + initOfGenerator(), + staticCallGenerator(currentFunCallDepth), + //methodCallGenerator(), + //contractConstantGenerator(initOf), + //contractFieldGenerator(initOf) + ]; + + // Chain all the above generators + return chainGenerators(exprGens, {globalDeclarations: new Map(), contractDeclarations: new Map()}); } - function contractGenerator(): GeneratorWithDeclarations { - return { - generate: () => { - const finalContracts: A.AstContract[] = []; + function statementGenerator(currentFunCallDepth: number): fc.Arbitrary> { - const stmtGenResult = statementGenerator().generate(); - const contractDecls = Array.from( - stmtGenResult.contractDeclarations.values(), - ); + return expressionGenerator(currentFunCallDepth).chain(genExprs => { - for (const stmtWithDecls of stmtGenResult.items) { - if (stmtWithDecls.assignedStateInit) { - const contract1 = generateContract( - generateId(stmtWithDecls.name), - stmtWithDecls.statements, - contractDecls, - ); - finalContracts.push(contract1); - } - const contract2 = generateContractNoSend( - generateId(stmtWithDecls.name + "_NoSend"), - stmtWithDecls.statements, - contractDecls, - ); - finalContracts.push(contract2); - } + const generators: fc.Arbitrary>[] = []; - return { - globalDeclarations: stmtGenResult.globalDeclarations, - contractDeclarations: new Map(), - items: finalContracts, - }; - }, - }; - } + for (const exprWithName of genExprs.items) { + const stmtGens = [ + letStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + expressionStatementGenerator( + exprWithName.expression, + exprWithName.name, + ),/* + conditionStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + whileStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + untilStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + repeatStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + forEachStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + destructStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + blockStatementGenerator( + exprWithName.expression, + exprWithName.name, + ), + tryStatementGenerator( + exprWithName.expression, + exprWithName.name, + ),*/ + ]; - function createTest(res: A.AstContract): Test { - return { contract: res }; + generators.push(...stmtGens); + } + + return chainGenerators(generators, genExprs.declarations); + } + + ); } - function serializeTests(tests: Test[], globalDecls: A.AstModuleItem[]) { - const allDecls: A.AstModuleItem[] = [...globalDecls]; + function contractWithInitGenerator(stmtsData: StatementsWithName, contractDecls: A.AstContractDeclaration[]): fc.Arbitrary> { + const finalContracts: A.AstContract[] = []; - for (const test of tests) { - allDecls.push(test.contract); + if (stmtsData.assignedStateInit) { + finalContracts.push(makeContract( + makeId(stmtsData.name), + stmtsData.statements, + contractDecls, + )); } - - const tactCode = prettyPrint( - astF.createNode({ kind: "module", imports: [], items: allDecls }), + finalContracts.push( + makeContractNoSend( + makeId(stmtsData.name + "_NoSend"), + stmtsData.statements, + contractDecls, + ) ); + return withEmptyDeclarations(finalContracts); + } - // Attach Dummies and Deployer contracts, plus structs and messages for tests - const finalTactCode = ` -${tactCode} + function contractGenerator(currentFunCallDepth: number): fc.Arbitrary> { + return statementGenerator(currentFunCallDepth).chain(genStmts => { -message DeployMessage { - addr: Address; - data: Cell; - code: Cell; -} + const generators: fc.Arbitrary>[] = []; -struct StateInitWrapper { - init: StateInit; -} + for (const stmsWithName of genStmts.items) { + const contractGens = [ + contractWithInitGenerator( + stmsWithName, + Array.from( + genStmts.declarations.contractDeclarations.values(), + ) + ), + ]; -contract Dummy1 { } + generators.push(...contractGens); + } -contract Dummy2 { } + return chainGenerators(generators, {globalDeclarations: genStmts.declarations.globalDeclarations, contractDeclarations: new Map()}); + } -contract Deployer { - receive(msg: DeployMessage) { - let addr = msg.addr; - let data = msg.data; - let code = msg.code; - send(SendParameters{to: addr, bounce: false, value: ton("10"), data: data, code: code}); + ); } -} -`; - fs.writeFileSync( - path.join(__dirname, "contracts", filename), - finalTactCode, - ); + /* + function makeImport(path: string): A.AstImport { + return astF.createNode({kind: "import", importPath: {path: fromString(path), type: "relative", language: "tact"}, loc: dummySrcInfo}) as A.AstImport; + }*/ + + function makeModule(contract: A.AstContract, globalDecls: A.AstModuleItem[]): A.AstModule { + return astF.createNode({ kind: "module", imports: [], items: [...globalDecls, contract]}) as A.AstModule; } + const genResult = fc.sample(contractGenerator(0), 1); + if (genResult.length !== 1) { + throw new Error("Generator should return exactly one element, which is an array containing all the test cases."); + } + // The unique element in the array is ensured to exist + const allCases = genResult[0]!; const tests: Test[] = []; - const genResult = contractGenerator().generate(); + // Add the Deployer contract and Dummies neccesary for tests. + const parser = getParser(astF, defaultParser); + const extraModule = parser.parse({path: ".", code: fs.readFileSync(path.join(__dirname, "contracts/deployer.tact")).toString(), origin: "user"}); + const finalGlobalDecls = [...allCases.declarations.globalDeclarations.values(), ...extraModule.items]; - for (const contract of genResult.items) { - tests.push(createTest(contract)); + for (const contract of allCases.items) { + tests.push({ + module: makeModule(contract, finalGlobalDecls), + testName: idText(contract.name) + }); } - serializeTests(tests, Array.from(genResult.globalDeclarations.values())); + return tests; +} + +function testContracts(contractBocs: Map) { + +} + +async function main() { + const astF = getAstFactory(); + + const tests = createTestModules(astF); + + console.log(`Generated ${tests.lastIndexOf} tests.`); + + for (const test of tests) { + console.log(`Compiling test ${test.testName}`); + + try { + // Compile the module + const contractBocs = await buildModule(astF, test.module); + console.log("Testing..."); + testContracts(contractBocs); + console.log("Passed."); + } catch(e) { + console.log("Test:"); + console.log(prettyPrint(test.module)); + console.log("failed with error:"); + console.log(e); + } + } } -createTests(getAstFactory(), "initof-reachability.tact"); +main(); diff --git a/src/test/autogenerated/util.ts b/src/test/autogenerated/util.ts new file mode 100644 index 000000000..419a3dc0f --- /dev/null +++ b/src/test/autogenerated/util.ts @@ -0,0 +1,136 @@ +import * as A from "../../ast/ast"; +import { FactoryAst } from "../../ast/ast-helpers"; +import { featureEnable } from "../../config/features"; +import { CompilerContext } from "../../context/context"; +import { Logger } from "../../context/logger"; +import { openContext } from "../../context/store"; +import { funcCompile } from "../../func/funcCompile"; +import { getParser } from "../../grammar"; +import { defaultParser, Parser } from "../../grammar/grammar"; +import { compile } from "../../pipeline/compile"; +import { topSortContracts } from "../../pipeline/utils"; +import files from "../../stdlib/stdlib"; +import { resolveAllocations } from "../../storage/resolveAllocation"; +import { computeReceiversEffects } from "../../types/effects"; +import { getAllTypes, resolveDescriptors } from "../../types/resolveDescriptors"; +import { resolveErrors } from "../../types/resolveErrors"; +import { resolveSignatures } from "../../types/resolveSignatures"; +import { resolveStatements } from "../../types/resolveStatements"; + +import { posixNormalize } from "../../utils/filePath"; +import { createVirtualFileSystem } from "../../vfs/createVirtualFileSystem"; + +export async function buildModule(astF: FactoryAst, module: A.AstModule): Promise> { + let ctx = new CompilerContext(); + const parser = getParser(astF, defaultParser); + const project = createVirtualFileSystem("/", {}, false); + const stdlib = createVirtualFileSystem("@stdlib", files); + const config = { + name: "", + output: "." + }; + const contractCodes = new Map(); + + ctx = precompile(ctx, parser, astF, [module]); + + // Compile contracts + const allContracts = getAllTypes(ctx).filter((v) => v.kind === "contract"); + + // Sort contracts in topological order + // If a cycle is found, return undefined + const sortedContracts = topSortContracts(allContracts); + if (sortedContracts !== undefined) { + ctx = featureEnable(ctx, "optimizedChildCode"); + } + for (const contract of sortedContracts ?? allContracts) { + const contractName = contract.name; + + let codeFc: { path: string; content: string }[]; + + // Compiling contract to func + + const res = await compile( + ctx, + contractName, + config.name + "_" + contractName, + {}, + ); + for (const files of res.output.files) { + const ffc = project.resolve(config.output, files.name); + project.writeFile(ffc, files.code); + } + codeFc = res.output.files.map((v) => ({ + path: posixNormalize(project.resolve(config.output, v.name)), + content: v.code, + })); + const codeEntrypoint = res.output.entrypoint; + + // Compiling contract to TVM + const stdlibPath = stdlib.resolve("std/stdlib.fc"); + const stdlibCode = stdlib.readFile(stdlibPath).toString(); + const stdlibExPath = stdlib.resolve("std/stdlib_ex.fc"); + const stdlibExCode = stdlib.readFile(stdlibExPath).toString(); + const c = await funcCompile({ + entries: [ + stdlibPath, + stdlibExPath, + posixNormalize( + project.resolve(config.output, codeEntrypoint), + ), + ], + sources: [ + { + path: stdlibPath, + content: stdlibCode, + }, + { + path: stdlibExPath, + content: stdlibExCode, + }, + ...codeFc, + ], + logger: new Logger(), + }); + if (!c.ok) { + throw new Error(c.log); + } + contractCodes.set(contractName, c.output); + } + + return contractCodes; +} + +// Like precompile in the main pipeline, but skipping resolveImports + +export function precompile( + ctx: CompilerContext, + parser: Parser, + ast: FactoryAst, + parsedModules: A.AstModule[], +) { + // Add information about all the source code entries to the context + ctx = openContext(ctx, [], [], parser, parsedModules); + + // First load type descriptors and check that + // they all have valid signatures + ctx = resolveDescriptors(ctx, ast); + + // This creates TLB-style type definitions + ctx = resolveSignatures(ctx, ast); + + // This checks and resolves all statements + ctx = resolveStatements(ctx, ast); + + // This extracts error messages + ctx = resolveErrors(ctx, ast); + + // This creates allocations for all defined types + ctx = resolveAllocations(ctx); + + // To use in code generation to decide if a receiver needs to call the contract storage function + computeReceiversEffects(ctx); + + // Prepared context + return ctx; +} + From 0d603a82b09544e265c3b332d37c0b53bfaa4e0b Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Fri, 7 Mar 2025 04:33:23 +0100 Subject: [PATCH 03/12] tests: added Sandbox testing. --- knip.json | 1 - package.json | 1 + src/context/store.ts | 6 +- .../autogenerated/contracts/deployer.tact | 2 +- src/test/autogenerated/contracts/empty.tact | 0 .../contracts/initof-reachability.tact | 24 - .../autogenerated/gen-initof-reachability.ts | 738 ++++++++++-------- src/test/autogenerated/util.ts | 125 +-- 8 files changed, 503 insertions(+), 394 deletions(-) create mode 100644 src/test/autogenerated/contracts/empty.tact delete mode 100644 src/test/autogenerated/contracts/initof-reachability.tact diff --git a/knip.json b/knip.json index ccb7bc49f..b0023ed31 100644 --- a/knip.json +++ b/knip.json @@ -22,7 +22,6 @@ "src/test/utils/markdown.ts", "src/test/utils/with-log.ts", "src/utils/array.ts", - "src/test/autogenerated/gen-initof-reachability.ts", ".github/workflows/tact*.yml", ".github/actions/**/*.yml" ], diff --git a/package.json b/package.json index b6febf384..de97149d0 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "postpack": "pinst --enable", "next-version": "ts-node version.build.ts", "random-ast": "ts-node ./src/ast/random-ast.ts", + "gen-initof-tests": "ts-node ./src/test/autogenerated/gen-initof-reachability.ts", "top10": "find . -type f -exec du -h {} + | sort -rh | head -n 10" }, "files": [ diff --git a/src/context/store.ts b/src/context/store.ts index 43b9d89df..a3907c1af 100644 --- a/src/context/store.ts +++ b/src/context/store.ts @@ -63,7 +63,11 @@ export function openContext( parser: Parser, parsedModules?: A.AstModule[], ): CompilerContext { - const modules = parsedModules ?? parseModules(sources, parser); + const parsedSources = parseModules(sources, parser); + const modules = + typeof parsedModules === "undefined" + ? parsedSources + : [...parsedSources, ...parsedModules]; const types: A.AstTypeDecl[] = []; const functions: ( | A.AstNativeFunctionDecl diff --git a/src/test/autogenerated/contracts/deployer.tact b/src/test/autogenerated/contracts/deployer.tact index 71e507c8e..0aa12d6ca 100644 --- a/src/test/autogenerated/contracts/deployer.tact +++ b/src/test/autogenerated/contracts/deployer.tact @@ -1,4 +1,4 @@ -message DeployMessage { +message(100) DeployMessage { addr: Address; data: Cell; code: Cell; diff --git a/src/test/autogenerated/contracts/empty.tact b/src/test/autogenerated/contracts/empty.tact new file mode 100644 index 000000000..e69de29bb diff --git a/src/test/autogenerated/contracts/initof-reachability.tact b/src/test/autogenerated/contracts/initof-reachability.tact deleted file mode 100644 index df1e50656..000000000 --- a/src/test/autogenerated/contracts/initof-reachability.tact +++ /dev/null @@ -1,24 +0,0 @@ -import "deployer.tact"; - -fun fun_0(arg: Int): StateInit { - let stateInit: StateInit = initOf Deployer(); - return stateInit; -} - -fun fun_1(arg: Int): StateInit { - let stateInit: StateInit = initOf Deployer(); - return stateInit; -} - -fun fun_2(arg: Int): StateInit { - let stateInit: StateInit = fun_0(arg); - return stateInit; -} - -contract Expr_StaticCall_Let_StaticCall_Let_InitOf_NoSend { - init(arg: Int) { - fun_2(arg); - } - - receive() { } -} \ No newline at end of file diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 28aa1c783..3f93a63b2 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -3,45 +3,51 @@ import type * as A from "../../ast/ast"; import { getAstFactory, idText } from "../../ast/ast-helpers"; import type { FactoryAst } from "../../ast/ast-helpers"; import { prettyPrint } from "../../ast/ast-printer"; -import { dummySrcInfo, getParser } from "../../grammar"; +import { getParser } from "../../grammar"; import * as fs from "fs"; import fc from "fast-check"; -import { fromString } from "../../imports/path"; -import { buildModule } from "./util"; +import { buildModule, ProxyContract } from "./util"; import { defaultParser } from "../../grammar/grammar"; +import { getSrcInfo } from "../../grammar/src-info"; +import { Blockchain } from "@ton/sandbox"; +import type { BlockchainTransaction } from "@ton/sandbox"; +import type { CommonMessageInfoInternal, Message, StateInit } from "@ton/core"; +import { Cell, beginCell, toNano } from "@ton/core"; +import { findTransaction } from "@ton/test-utils"; type ItemsWithDeclarations = { items: T[]; declarations: Declarations; -} +}; type Declarations = { globalDeclarations: Map; contractDeclarations: Map; -} +}; type ExpressionWithName = { name: string; expression: A.AstExpression; -} +}; type StatementsWithName = { name: string; statements: A.AstStatement[]; assignedStateInit: boolean; -} +}; type GlobalConfig = { maxFunCallDepth: number; -} +}; type Test = { module: A.AstModule; testName: string; -} +}; function createTestModules(astF: FactoryAst): Test[] { let idCounter = 0; + const emptySrcInfo = getSrcInfo(" ", 0, 0, null, "user"); const config: GlobalConfig = { maxFunCallDepth: 2, @@ -55,7 +61,7 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "init_of", args, contract, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstInitOf; } @@ -63,7 +69,7 @@ function createTestModules(astF: FactoryAst): Test[] { return astF.createNode({ kind: "id", text: name, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstId; } @@ -71,7 +77,7 @@ function createTestModules(astF: FactoryAst): Test[] { return astF.createNode({ kind: "type_id", text: name, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstTypeId; } @@ -83,31 +89,35 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "typed_parameter", name: makeId(name), type: makeTypeId(type), - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstTypedParameter; } - + /* function makeFunctionAttribute( name: A.AstFunctionAttributeName, ): A.AstFunctionAttribute { return astF.createNode({ kind: "function_attribute", type: name, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstFunctionAttribute; } - + function makeBoolean(value: boolean): A.AstBoolean { - return astF.createNode({ kind: "boolean", value, loc: dummySrcInfo }) as A.AstBoolean; + return astF.createNode({ + kind: "boolean", + value, + loc: emptySrcInfo, + }) as A.AstBoolean; } - + */ function makeString(value: string): A.AstString { return astF.createNode({ kind: "string", value, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstString; } @@ -116,28 +126,35 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "number", value, base: 10, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstNumber; } - + /* + function makeNull(): A.AstNull { + return astF.createNode({ + kind: "null", + loc: emptySrcInfo, + }) as A.AstNull; + } + function makeFreshFieldName(): A.AstId { const newName = `field_${idCounter++}`; return makeId(newName); } - + */ function makeFreshFunctionName(): A.AstId { const newName = `fun_${idCounter++}`; return makeId(newName); } - + /* function makeFreshConstantName(): A.AstId { const newName = `CONS_${idCounter++}`; return makeId(newName); } - + */ function makeFreshVarName(): A.AstId { const newName = `v_${idCounter++}`; @@ -154,15 +171,24 @@ function createTestModules(astF: FactoryAst): Test[] { op, left: operand1, right: operand2, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstOpBinary; } - - function makeConditional(boolValue: boolean, exprT: A.AstExpression, exprF: A.AstExpression): A.AstConditional { - return astF.createNode({ kind: "conditional", condition: makeBoolean(boolValue), thenBranch: exprT, elseBranch: exprF, loc: dummySrcInfo }) as A.AstConditional; + /* + function makeConditional( + boolValue: boolean, + exprT: A.AstExpression, + exprF: A.AstExpression, + ): A.AstConditional { + return astF.createNode({ + kind: "conditional", + condition: makeBoolean(boolValue), + thenBranch: exprT, + elseBranch: exprF, + loc: emptySrcInfo, + }) as A.AstConditional; } - function makeMethodCall( name: A.AstId, @@ -174,9 +200,10 @@ function createTestModules(astF: FactoryAst): Test[] { self, args, method: name, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstMethodCall; } + */ function makeStaticCall( name: A.AstId, @@ -186,7 +213,7 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "static_call", args, function: name, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStaticCall; } @@ -198,20 +225,20 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "struct_instance", type, args, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStructInstance; } /* function generateContractConstant(type: A.AstTypeId, expr: A.AstExpression): { constant: A.AstId, decl: A.AstConstantDef } { const name = generateFreshConstantName(); - const decl = astF.createNode({ kind: "constant_def", name, type, initializer: expr, attributes: [], loc: dummySrcInfo }) as A.AstConstantDef; + const decl = astF.createNode({ kind: "constant_def", name, type, initializer: expr, attributes: [], loc: emptySrcInfo }) as A.AstConstantDef; return { constant: name, decl }; } function generateContractField(type: A.AstTypeId, expr: A.AstExpression): { field: A.AstId, decl: A.AstFieldDecl } { const name = generateFreshFieldName(); - const decl = astF.createNode({ kind: "field_decl", name, type, as: null, initializer: expr, loc: dummySrcInfo }) as A.AstFieldDecl; + const decl = astF.createNode({ kind: "field_decl", name, type, as: null, initializer: expr, loc: emptySrcInfo }) as A.AstFieldDecl; return { field: name, decl }; } */ @@ -226,7 +253,7 @@ function createTestModules(astF: FactoryAst): Test[] { name, type, expression: expr, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementLet; } @@ -238,7 +265,7 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "statement_assign", path: name, expression: expr, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementAssign; } @@ -250,15 +277,23 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "struct_field_initializer", field: name, initializer, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStructFieldInitializer; } - - function makeFieldAccess(aggregate: A.AstExpression, field: A.AstId): A.AstFieldAccess { - return astF.createNode({ kind: "field_access", aggregate, field, loc: dummySrcInfo }) as A.AstFieldAccess; + /* + function makeFieldAccess( + aggregate: A.AstExpression, + field: A.AstId, + ): A.AstFieldAccess { + return astF.createNode({ + kind: "field_access", + aggregate, + field, + loc: emptySrcInfo, + }) as A.AstFieldAccess; } - + */ function makeExpressionStatement( expr: A.AstExpression, @@ -266,21 +301,21 @@ function createTestModules(astF: FactoryAst): Test[] { return astF.createNode({ kind: "statement_expression", expression: expr, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementExpression; } function makeConditionStatement( cond: A.AstExpression, thenBranch: A.AstStatement[], - elseBranch: A.AstStatement[] | null, + elseBranch: A.AstStatement[] | undefined, ): A.AstStatementCondition { return astF.createNode({ kind: "statement_condition", condition: cond, trueStatements: thenBranch, falseStatements: elseBranch, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementCondition; } @@ -292,7 +327,7 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "statement_while", condition: cond, statements: body, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementWhile; } @@ -304,7 +339,7 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "statement_until", condition: cond, statements: body, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementUntil; } @@ -316,10 +351,11 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "statement_repeat", iterations: count, statements: body, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementRepeat; } + /* function makeForEachStatement( mapVar: A.AstExpression, keyVar: A.AstId, @@ -332,9 +368,10 @@ function createTestModules(astF: FactoryAst): Test[] { keyName: keyVar, valueName: valueVar, statements: body, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementForEach; } + */ function makeDestructStatement( expr: A.AstExpression, @@ -347,17 +384,15 @@ function createTestModules(astF: FactoryAst): Test[] { identifiers, ignoreUnspecifiedFields: false, type, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementDestruct; } - function makeBlockStatement( - body: A.AstStatement[], - ): A.AstStatementBlock { + function makeBlockStatement(body: A.AstStatement[]): A.AstStatementBlock { return astF.createNode({ kind: "statement_block", statements: body, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementBlock; } @@ -374,7 +409,7 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "statement_try", statements: tryBody, catchBlock, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementTry; } @@ -399,7 +434,7 @@ function createTestModules(astF: FactoryAst): Test[] { statements, attributes, return: ret, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstFunctionDef; } @@ -409,7 +444,7 @@ function createTestModules(astF: FactoryAst): Test[] { return astF.createNode({ kind: "statement_return", expression, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstStatementReturn; } @@ -423,26 +458,22 @@ function createTestModules(astF: FactoryAst): Test[] { makeTypeId("Address"), addrExpr, ); - const tonExpr = makeStaticCall(makeId("ton"), [ - makeString("1"), + const tonExpr = makeStaticCall(makeId("ton"), [makeString("1")]); + const sendParams = makeStructInstance(makeId("SendParameters"), [ + makeStructFieldInitializer(makeId("to"), addrVar), + makeStructFieldInitializer(makeId("value"), tonExpr), ]); - const sendParams = makeStructInstance( - makeId("SendParameters"), - [ - makeStructFieldInitializer(makeId("to"), addrVar), - makeStructFieldInitializer(makeId("value"), tonExpr), - ], - ); const sendExpr = makeStaticCall(makeId("send"), [sendParams]); const sendStmt = makeExpressionStatement(sendExpr); return astF.createNode({ kind: "contract_init", params: [makeTypedParameter("arg", "Int")], statements: [...stmts, addrLet, sendStmt], - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstContractInit; } + /* function makeContractInitNoSend( stmts: A.AstStatement[], ): A.AstContractInit { @@ -450,9 +481,10 @@ function createTestModules(astF: FactoryAst): Test[] { kind: "contract_init", params: [makeTypedParameter("arg", "Int")], statements: stmts, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstContractInit; } + */ function makeEmptyInternalReceiver(): A.AstReceiver { const receiverKind = astF.createNode({ @@ -461,13 +493,13 @@ function createTestModules(astF: FactoryAst): Test[] { const internalSelector = astF.createNode({ kind: "internal", subKind: receiverKind, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstReceiverInternal; return astF.createNode({ kind: "receiver", selector: internalSelector, statements: [], - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstReceiver; } @@ -484,12 +516,13 @@ function createTestModules(astF: FactoryAst): Test[] { name, traits: [], attributes: [], - params: [], + params: undefined, declarations: finalDecls, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstContract; } + /* function makeContractNoSend( name: A.AstId, stmts: A.AstStatement[], @@ -503,30 +536,38 @@ function createTestModules(astF: FactoryAst): Test[] { name, traits: [], attributes: [], - params: [], + params: undefined, declarations: finalDecls, - loc: dummySrcInfo, + loc: emptySrcInfo, }) as A.AstContract; } + */ - function withEmptyDeclarations(items: T[]): fc.Arbitrary> { + function withEmptyDeclarations( + items: T[], + ): fc.Arbitrary> { return fc.constant({ items: items, declarations: { globalDeclarations: new Map(), - contractDeclarations: new Map() - } + contractDeclarations: new Map(), + }, }); } - function chainGenerators(gens: fc.Arbitrary>[], initialDecls: Declarations): fc.Arbitrary> { - const join: (d1: ItemsWithDeclarations, d2: ItemsWithDeclarations) => ItemsWithDeclarations = (d1, d2) => { - const finalGlobalDecls: Map = - new Map(d1.declarations.globalDeclarations); - const finalContractDecls: Map< - string, - A.AstContractDeclaration - > = new Map(d1.declarations.contractDeclarations); + function chainGenerators( + gens: fc.Arbitrary>[], + initialDecls: Declarations, + ): fc.Arbitrary> { + const join: ( + d1: ItemsWithDeclarations, + d2: ItemsWithDeclarations, + ) => ItemsWithDeclarations = (d1, d2) => { + const finalGlobalDecls: Map = new Map( + d1.declarations.globalDeclarations, + ); + const finalContractDecls: Map = + new Map(d1.declarations.contractDeclarations); const finalItems: T[] = [...d1.items, ...d2.items]; d2.declarations.globalDeclarations.forEach((value, key) => { finalGlobalDecls.set(key, value); @@ -538,30 +579,37 @@ function createTestModules(astF: FactoryAst): Test[] { items: finalItems, declarations: { globalDeclarations: finalGlobalDecls, - contractDeclarations: finalContractDecls - } + contractDeclarations: finalContractDecls, + }, }; }; return chainGeneratorsAux( { items: [], - declarations: initialDecls + declarations: initialDecls, }, gens, - join + join, ); } - function chainGeneratorsAux(accum: T, gens: fc.Arbitrary[], join: (d1: T, d2: T) => T): fc.Arbitrary { + function chainGeneratorsAux( + accumulator: T, + gens: fc.Arbitrary[], + join: (d1: T, d2: T) => T, + ): fc.Arbitrary { if (gens.length === 0) { - return fc.constant(accum); + return fc.constant(accumulator); } // First element is ensured to exist const gen = gens[0]!; - return gen.chain(currData => { - return chainGeneratorsAux(join(accum, currData), gens.slice(1), join); - } - ); + return gen.chain((currData) => { + return chainGeneratorsAux( + join(accumulator, currData), + gens.slice(1), + join, + ); + }); } /* @@ -587,42 +635,43 @@ function createTestModules(astF: FactoryAst): Test[] { }}; }*/ - function initOfGenerator(): fc.Arbitrary> { - return withEmptyDeclarations([{ - name: "InitOf", - expression: makeInitOf(makeId("Deployer"), []) - }]); + function initOfGenerator(): fc.Arbitrary< + ItemsWithDeclarations + > { + return withEmptyDeclarations([ + { + name: "InitOf", + expression: makeInitOf(makeId("Deployer"), []), + }, + ]); } - function staticCallGenerator(currentFunCallDepth: number): fc.Arbitrary> { + function staticCallGenerator( + currentFunCallDepth: number, + ): fc.Arbitrary> { if (currentFunCallDepth >= config.maxFunCallDepth) { return withEmptyDeclarations([]); } - return statementGenerator(currentFunCallDepth + 1).chain(genStmts => { - - const finalGlobalDecls: Map = - new Map(genStmts.declarations.globalDeclarations); + return statementGenerator(currentFunCallDepth + 1).chain((genStmts) => { + const finalGlobalDecls: Map = new Map( + genStmts.declarations.globalDeclarations, + ); const finalItems: ExpressionWithName[] = []; - for (const stmsWithName of genStmts.items) { - - if (stmsWithName.assignedStateInit) { + for (const stmtsWithName of genStmts.items) { + if (stmtsWithName.assignedStateInit) { const funName = makeFreshFunctionName(); - const returnStmt = makeReturnStatement( - makeId("stateInit"), - ); + const returnStmt = makeReturnStatement(makeId("stateInit")); const funDef = makeFunctionDefinition( funName, [makeTypedParameter("arg", "Int")], - [...stmsWithName.statements, returnStmt], + [...stmtsWithName.statements, returnStmt], [], makeTypeId("StateInit"), ); - const call = makeStaticCall(funName, [ - makeId("arg"), - ]); - const testName = `StaticCall_${stmsWithName.name}`; + const call = makeStaticCall(funName, [makeId("arg")]); + const testName = `StaticCall_${stmtsWithName.name}`; finalGlobalDecls.set(idText(funName), funDef); finalItems.push({ name: testName, expression: call }); } @@ -632,12 +681,10 @@ function createTestModules(astF: FactoryAst): Test[] { items: finalItems, declarations: { globalDeclarations: finalGlobalDecls, - contractDeclarations: new Map() - } - }) - } - - ); + contractDeclarations: new Map(), + }, + }); + }); } /* @@ -729,18 +776,16 @@ function createTestModules(astF: FactoryAst): Test[] { ): fc.Arbitrary> { const varName = makeId("stateInit"); const varType = makeTypeId("StateInit"); - const stmtLet = makeLetStatement( - varName, - varType, - baseExpr, - ); + const stmtLet = makeLetStatement(varName, varType, baseExpr); const newName = `Let_${name}`; - return withEmptyDeclarations([{ - name: newName, - statements: [stmtLet], - assignedStateInit: true, - }]); + return withEmptyDeclarations([ + { + name: newName, + statements: [stmtLet], + assignedStateInit: true, + }, + ]); } function expressionStatementGenerator( @@ -769,70 +814,48 @@ function createTestModules(astF: FactoryAst): Test[] { ); const cond1Expr = makeBinaryExpression( "==", - makeBinaryExpression( - "-", - makeId("arg"), - makeId("arg"), - ), + makeBinaryExpression("-", makeId("arg"), makeId("arg")), makeInt(0n), ); const cond2Expr = makeBinaryExpression( "==", makeBinaryExpression( "+", - makeBinaryExpression( - "-", - makeId("arg"), - makeId("arg"), - ), + makeBinaryExpression("-", makeId("arg"), makeId("arg")), makeInt(1n), ), makeInt(0n), ); - const expr = makeAssignStatement( - makeId("stateInit"), - baseExpr, - ); + const expr = makeAssignStatement(makeId("stateInit"), baseExpr); const dummy2 = makeAssignStatement( makeId("stateInit"), makeInitOf(makeId("Dummy2"), []), ); - const case1 = makeConditionStatement( - cond1Expr, - [expr], - null, - ); - const case2 = makeConditionStatement( - cond1Expr, - [expr], - [dummy2], - ); - const case3 = makeConditionStatement( - cond2Expr, - [dummy2], - [expr], - ); + const case1 = makeConditionStatement(cond1Expr, [expr], undefined); + const case2 = makeConditionStatement(cond1Expr, [expr], [dummy2]); + const case3 = makeConditionStatement(cond2Expr, [dummy2], [expr]); const case1Name = `IfNoElse_${name}`; const case2Name = `IfThen_${name}`; const case3Name = `IfElse_${name}`; - return withEmptyDeclarations([{ - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, - { - name: case2Name, - statements: [initVarStmt, case2], - assignedStateInit: true, - }, - { - name: case3Name, - statements: [initVarStmt, case3], - assignedStateInit: true, - }, + return withEmptyDeclarations([ + { + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, + }, + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + { + name: case3Name, + statements: [initVarStmt, case3], + assignedStateInit: true, + }, ]); } @@ -848,29 +871,14 @@ function createTestModules(astF: FactoryAst): Test[] { const countVarStmt = makeLetStatement( makeId("counter"), makeTypeId("Int"), - makeBinaryExpression( - "-", - makeId("arg"), - makeId("arg"), - ), - ); - const expr = makeAssignStatement( - makeId("stateInit"), - baseExpr, + makeBinaryExpression("-", makeId("arg"), makeId("arg")), ); + const expr = makeAssignStatement(makeId("stateInit"), baseExpr); const counterIncr = makeAssignStatement( makeId("counter"), - makeBinaryExpression( - "+", - makeId("counter"), - makeInt(1n), - ), - ); - const cond = makeBinaryExpression( - "<=", - makeId("counter"), - makeInt(2n), + makeBinaryExpression("+", makeId("counter"), makeInt(1n)), ); + const cond = makeBinaryExpression("<=", makeId("counter"), makeInt(2n)); const loop = makeWhileStatement(cond, [expr, counterIncr]); const newName = `While_${name}`; @@ -880,8 +888,8 @@ function createTestModules(astF: FactoryAst): Test[] { name: newName, statements: [initVarStmt, countVarStmt, loop], assignedStateInit: true, - }] - ); + }, + ]); } function untilStatementGenerator( @@ -896,29 +904,14 @@ function createTestModules(astF: FactoryAst): Test[] { const countVarStmt = makeLetStatement( makeId("counter"), makeTypeId("Int"), - makeBinaryExpression( - "-", - makeId("arg"), - makeId("arg"), - ), - ); - const expr = makeAssignStatement( - makeId("stateInit"), - baseExpr, + makeBinaryExpression("-", makeId("arg"), makeId("arg")), ); + const expr = makeAssignStatement(makeId("stateInit"), baseExpr); const counterIncr = makeAssignStatement( makeId("counter"), - makeBinaryExpression( - "+", - makeId("counter"), - makeInt(1n), - ), - ); - const cond = makeBinaryExpression( - ">=", - makeId("counter"), - makeInt(2n), + makeBinaryExpression("+", makeId("counter"), makeInt(1n)), ); + const cond = makeBinaryExpression(">=", makeId("counter"), makeInt(2n)); const loop = makeUntilStatement(cond, [expr, counterIncr]); const newName = `Until_${name}`; @@ -944,18 +937,10 @@ function createTestModules(astF: FactoryAst): Test[] { const countVarStmt = makeLetStatement( makeId("counter"), makeTypeId("Int"), - makeStaticCall(makeId("random"), [ - makeInt(1n), - makeInt(3n), - ]), + makeStaticCall(makeId("random"), [makeInt(1n), makeInt(3n)]), ); - const expr = makeAssignStatement( - makeId("stateInit"), - baseExpr, - ); - const loop = makeRepeatStatement(makeId("counter"), [ - expr, - ]); + const expr = makeAssignStatement(makeId("stateInit"), baseExpr); + const loop = makeRepeatStatement(makeId("counter"), [expr]); const newName = `Repeat_${name}`; @@ -968,6 +953,7 @@ function createTestModules(astF: FactoryAst): Test[] { ]); } + /* function forEachStatementGenerator( baseExpr: A.AstExpression, name: string, @@ -981,19 +967,13 @@ function createTestModules(astF: FactoryAst): Test[] { const mapVarStmt = makeLetStatement( mapVar, makeTypeId("map"), - makeId("null"), + makeNull(), ); const mutateMap = makeExpressionStatement( - makeMethodCall(makeId("set"), mapVar, [ - makeInt(1n), - makeInt(3n), - ]), + makeMethodCall(makeId("set"), mapVar, [makeInt(1n), makeInt(3n)]), ); - const expr = makeAssignStatement( - makeId("stateInit"), - baseExpr, - ); + const expr = makeAssignStatement(makeId("stateInit"), baseExpr); const loop = makeForEachStatement( mapVar, makeFreshVarName(), @@ -1011,26 +991,18 @@ function createTestModules(astF: FactoryAst): Test[] { }, ]); } + */ function destructStatementGenerator( baseExpr: A.AstExpression, name: string, ): fc.Arbitrary> { const identifiers: Map = new Map(); - identifiers.set("init", [ - makeId("init"), - makeId("stateInit"), - ]); + identifiers.set("init", [makeId("init"), makeId("stateInit")]); - const wrapped = makeStructInstance( - makeId("StateInitWrapper"), - [ - makeStructFieldInitializer( - makeId("init"), - baseExpr, - ), - ], - ); + const wrapped = makeStructInstance(makeId("StateInitWrapper"), [ + makeStructFieldInitializer(makeId("init"), baseExpr), + ]); const unwrapped = makeDestructStatement( wrapped, @@ -1059,10 +1031,7 @@ function createTestModules(astF: FactoryAst): Test[] { makeInitOf(makeId("Dummy1"), []), ); - const exprStmt = makeAssignStatement( - makeId("stateInit"), - baseExpr, - ); + const exprStmt = makeAssignStatement(makeId("stateInit"), baseExpr); const stmt = makeBlockStatement([exprStmt]); @@ -1087,19 +1056,12 @@ function createTestModules(astF: FactoryAst): Test[] { makeInitOf(makeId("Dummy1"), []), ); - const exprStmt = makeAssignStatement( - makeId("stateInit"), - baseExpr, - ); + const exprStmt = makeAssignStatement(makeId("stateInit"), baseExpr); const divByZeroStmt = makeExpressionStatement( makeBinaryExpression( "/", makeInt(1n), - makeBinaryExpression( - "-", - makeId("arg"), - makeId("arg"), - ), + makeBinaryExpression("-", makeId("arg"), makeId("arg")), ), ); @@ -1131,8 +1093,9 @@ function createTestModules(astF: FactoryAst): Test[] { ]); } - function expressionGenerator(currentFunCallDepth: number): fc.Arbitrary> { - + function expressionGenerator( + currentFunCallDepth: number, + ): fc.Arbitrary> { const exprGens = [ initOfGenerator(), staticCallGenerator(currentFunCallDepth), @@ -1142,14 +1105,19 @@ function createTestModules(astF: FactoryAst): Test[] { ]; // Chain all the above generators - return chainGenerators(exprGens, {globalDeclarations: new Map(), contractDeclarations: new Map()}); + return chainGenerators(exprGens, { + globalDeclarations: new Map(), + contractDeclarations: new Map(), + }); } - function statementGenerator(currentFunCallDepth: number): fc.Arbitrary> { - - return expressionGenerator(currentFunCallDepth).chain(genExprs => { - - const generators: fc.Arbitrary>[] = []; + function statementGenerator( + currentFunCallDepth: number, + ): fc.Arbitrary> { + return expressionGenerator(currentFunCallDepth).chain((genExprs) => { + const generators: fc.Arbitrary< + ItemsWithDeclarations + >[] = []; for (const exprWithName of genExprs.items) { const stmtGens = [ @@ -1160,7 +1128,7 @@ function createTestModules(astF: FactoryAst): Test[] { expressionStatementGenerator( exprWithName.expression, exprWithName.name, - ),/* + ), conditionStatementGenerator( exprWithName.expression, exprWithName.name, @@ -1176,11 +1144,11 @@ function createTestModules(astF: FactoryAst): Test[] { repeatStatementGenerator( exprWithName.expression, exprWithName.name, - ), + ) /* forEachStatementGenerator( exprWithName.expression, exprWithName.name, - ), + ),*/, destructStatementGenerator( exprWithName.expression, exprWithName.name, @@ -1192,96 +1160,214 @@ function createTestModules(astF: FactoryAst): Test[] { tryStatementGenerator( exprWithName.expression, exprWithName.name, - ),*/ + ), ]; generators.push(...stmtGens); } return chainGenerators(generators, genExprs.declarations); - } - - ); + }); } - function contractWithInitGenerator(stmtsData: StatementsWithName, contractDecls: A.AstContractDeclaration[]): fc.Arbitrary> { + function contractWithInitGenerator( + stmtsData: StatementsWithName, + contractDecls: A.AstContractDeclaration[], + ): fc.Arbitrary> { const finalContracts: A.AstContract[] = []; if (stmtsData.assignedStateInit) { - finalContracts.push(makeContract( - makeId(stmtsData.name), - stmtsData.statements, - contractDecls, - )); + finalContracts.push( + makeContract( + makeId(stmtsData.name), + stmtsData.statements, + contractDecls, + ), + ); } - finalContracts.push( + /*finalContracts.push( makeContractNoSend( makeId(stmtsData.name + "_NoSend"), stmtsData.statements, contractDecls, ) - ); + );*/ return withEmptyDeclarations(finalContracts); } - function contractGenerator(currentFunCallDepth: number): fc.Arbitrary> { - return statementGenerator(currentFunCallDepth).chain(genStmts => { + function contractGenerator( + currentFunCallDepth: number, + ): fc.Arbitrary> { + return statementGenerator(currentFunCallDepth).chain((genStmts) => { + const generators: fc.Arbitrary< + ItemsWithDeclarations + >[] = []; - const generators: fc.Arbitrary>[] = []; - - for (const stmsWithName of genStmts.items) { + for (const stmtsWithName of genStmts.items) { const contractGens = [ contractWithInitGenerator( - stmsWithName, + stmtsWithName, Array.from( genStmts.declarations.contractDeclarations.values(), - ) + ), ), ]; generators.push(...contractGens); } - return chainGenerators(generators, {globalDeclarations: genStmts.declarations.globalDeclarations, contractDeclarations: new Map()}); - } - - ); + return chainGenerators(generators, { + globalDeclarations: genStmts.declarations.globalDeclarations, + contractDeclarations: new Map(), + }); + }); } /* function makeImport(path: string): A.AstImport { - return astF.createNode({kind: "import", importPath: {path: fromString(path), type: "relative", language: "tact"}, loc: dummySrcInfo}) as A.AstImport; + return astF.createNode({kind: "import", importPath: {path: fromString(path), type: "relative", language: "tact"}, loc: emptySrcInfo}) as A.AstImport; }*/ - function makeModule(contract: A.AstContract, globalDecls: A.AstModuleItem[]): A.AstModule { - return astF.createNode({ kind: "module", imports: [], items: [...globalDecls, contract]}) as A.AstModule; + function makeModule( + contract: A.AstContract, + globalDecls: A.AstModuleItem[], + ): A.AstModule { + return astF.createNode({ + kind: "module", + imports: [], + items: [...globalDecls, contract], + }) as A.AstModule; } const genResult = fc.sample(contractGenerator(0), 1); if (genResult.length !== 1) { - throw new Error("Generator should return exactly one element, which is an array containing all the test cases."); + throw new Error( + "Generator should return exactly one element, which is an array containing all the test cases.", + ); } // The unique element in the array is ensured to exist const allCases = genResult[0]!; const tests: Test[] = []; - // Add the Deployer contract and Dummies neccesary for tests. + // Add the Deployer contract and Dummies necessary for tests. const parser = getParser(astF, defaultParser); - const extraModule = parser.parse({path: ".", code: fs.readFileSync(path.join(__dirname, "contracts/deployer.tact")).toString(), origin: "user"}); - const finalGlobalDecls = [...allCases.declarations.globalDeclarations.values(), ...extraModule.items]; + const extraModule = parser.parse({ + path: ".", + code: fs + .readFileSync(path.join(__dirname, "contracts/deployer.tact")) + .toString(), + origin: "user", + }); + const finalGlobalDecls = [ + ...allCases.declarations.globalDeclarations.values(), + ...extraModule.items, + ]; for (const contract of allCases.items) { tests.push({ module: makeModule(contract, finalGlobalDecls), - testName: idText(contract.name) + testName: idText(contract.name), }); } return tests; } -function testContracts(contractBocs: Map) { +async function testContracts( + testName: string, + contractCodes: Map, +) { + const blockchain = await Blockchain.create(); + const deployerStateInit = getDeployerStateInit(contractCodes); + const contractToTestStateInit = getTestedContractStateInit( + testName, + 0n, + contractCodes, + ); + const deployer = blockchain.openContract( + new ProxyContract(deployerStateInit), + ); + const contractToTest = blockchain.openContract( + new ProxyContract(contractToTestStateInit), + ); + const treasure = await blockchain.treasury("treasure"); + + const { transactions } = await deployer.send( + treasure.getSender(), + { value: toNano("100") }, + beginCell() + .storeUint(100, 32) + .storeAddress(contractToTest.address) + .storeRef(contractToTestStateInit.data!) + .storeRef(contractToTestStateInit.code!) + .endCell(), + ); + + // The deployer must have sent a message to the tested contract, which changed the status + // of the tested contract from uninitialized to active. + // The tested contract must have returned with exit code 0 from its computation phase, + // and result code 0 from its action phase + const trans1 = ensureTransactionExists( + findTransaction(transactions, { + from: deployer.address, + to: contractToTest.address, + oldStatus: "uninitialized", + endStatus: "active", + exitCode: 0, + actionResultCode: 0, + }), + ); + // The tested contract must have sent 1 message, with bounced flag set to false, + // and destination the deployer + ensure(trans1.outMessagesCount).is(1); + const outMessage = getOutMessageInfo(trans1.outMessages.get(0)); + ensure(outMessage.bounced).is(false); + ensure(outMessage.dest.toRawString()).is(deployer.address.toRawString()); + + // The deployer must have received a message from the tested contract, + // with bounced flag set to false + ensureTransactionExists( + findTransaction(transactions, { + from: contractToTest.address, + to: deployer.address, + inMessageBounced: false, + }), + ); +} + +function getDeployerStateInit(contractCodes: Map): StateInit { + const deployerCode = contractCodes.get("Deployer"); + if (typeof deployerCode === "undefined") { + throw new Error("Deployer was expected to exist in contracts boc map"); + } + const data = beginCell().storeUint(0, 1).endCell(); + const code = Cell.fromBoc(deployerCode)[0]; + if (typeof code === "undefined") { + throw new Error("Code cell expected"); + } + return { code, data }; +} +function getTestedContractStateInit( + name: string, + initialArg: bigint, + contractCodes: Map, +): StateInit { + const contractCode = contractCodes.get(name); + if (typeof contractCode === "undefined") { + throw new Error( + `Boc for contract ${name} was expected to exist in contracts boc map`, + ); + } + const data = beginCell() + .storeUint(0, 1) + .storeInt(initialArg, 257) + .endCell(); + const code = Cell.fromBoc(contractCode)[0]; + if (typeof code === "undefined") { + throw new Error("Code cell expected"); + } + return { code, data }; } async function main() { @@ -1289,18 +1375,18 @@ async function main() { const tests = createTestModules(astF); - console.log(`Generated ${tests.lastIndexOf} tests.`); + console.log(`Generated ${tests.length} tests.`); for (const test of tests) { console.log(`Compiling test ${test.testName}`); try { // Compile the module - const contractBocs = await buildModule(astF, test.module); + const contractCodes = await buildModule(astF, test.module); console.log("Testing..."); - testContracts(contractBocs); + await testContracts(test.testName, contractCodes); console.log("Passed."); - } catch(e) { + } catch (e) { console.log("Test:"); console.log(prettyPrint(test.module)); console.log("failed with error:"); @@ -1309,4 +1395,38 @@ async function main() { } } -main(); +function ensureTransactionExists( + tsx: BlockchainTransaction | undefined, +): BlockchainTransaction { + if (typeof tsx === "undefined") { + throw new Error("Transaction was expected to exist"); + } + return tsx; +} + +function getOutMessageInfo( + msg: Message | undefined, +): CommonMessageInfoInternal { + if (typeof msg === "undefined") { + throw new Error("Message was expected to exist"); + } + if (msg.info.type !== "internal") { + throw new Error("Message kind was expected to be internal"); + } + return msg.info; +} + +function ensure(data: string | number | boolean): { + is: (expected: string | number | boolean) => void; +} { + return { + is: (expected: string | number | boolean) => { + const res = data === expected; + if (!res) { + throw new Error(`${data} was expected to be ${expected}`); + } + }, + }; +} + +void main(); diff --git a/src/test/autogenerated/util.ts b/src/test/autogenerated/util.ts index 419a3dc0f..1f5b4a767 100644 --- a/src/test/autogenerated/util.ts +++ b/src/test/autogenerated/util.ts @@ -1,39 +1,61 @@ -import * as A from "../../ast/ast"; -import { FactoryAst } from "../../ast/ast-helpers"; +import path from "path"; +import type * as A from "../../ast/ast"; +import type { FactoryAst } from "../../ast/ast-helpers"; import { featureEnable } from "../../config/features"; import { CompilerContext } from "../../context/context"; import { Logger } from "../../context/logger"; -import { openContext } from "../../context/store"; import { funcCompile } from "../../func/funcCompile"; import { getParser } from "../../grammar"; -import { defaultParser, Parser } from "../../grammar/grammar"; +import { defaultParser } from "../../grammar/grammar"; import { compile } from "../../pipeline/compile"; +import { precompile } from "../../pipeline/precompile"; import { topSortContracts } from "../../pipeline/utils"; import files from "../../stdlib/stdlib"; -import { resolveAllocations } from "../../storage/resolveAllocation"; -import { computeReceiversEffects } from "../../types/effects"; -import { getAllTypes, resolveDescriptors } from "../../types/resolveDescriptors"; -import { resolveErrors } from "../../types/resolveErrors"; -import { resolveSignatures } from "../../types/resolveSignatures"; -import { resolveStatements } from "../../types/resolveStatements"; - +import * as fs from "fs"; +import { getAllTypes } from "../../types/resolveDescriptors"; import { posixNormalize } from "../../utils/filePath"; import { createVirtualFileSystem } from "../../vfs/createVirtualFileSystem"; - -export async function buildModule(astF: FactoryAst, module: A.AstModule): Promise> { +import type { + Address, + Cell, + Contract, + ContractProvider, + Sender, + StateInit, +} from "@ton/core"; +import { contractAddress } from "@ton/core"; + +export async function buildModule( + astF: FactoryAst, + module: A.AstModule, +): Promise> { let ctx = new CompilerContext(); const parser = getParser(astF, defaultParser); - const project = createVirtualFileSystem("/", {}, false); + const fileSystem = { + [`contracts/empty.tact`]: fs + .readFileSync(path.join(__dirname, `contracts/empty.tact`)) + .toString("base64"), + }; + const project = createVirtualFileSystem("/", fileSystem, false); const stdlib = createVirtualFileSystem("@stdlib", files); const config = { - name: "", - output: "." + name: "test", + path: "contracts/empty.tact", + output: ".", }; const contractCodes = new Map(); - ctx = precompile(ctx, parser, astF, [module]); + ctx = precompile(ctx, project, stdlib, config.path, parser, astF, [module]); + + const built: Record< + string, + | { + codeBoc: Buffer; + abi: string; + } + | undefined + > = {}; - // Compile contracts const allContracts = getAllTypes(ctx).filter((v) => v.kind === "contract"); // Sort contracts in topological order @@ -45,21 +67,19 @@ export async function buildModule(astF: FactoryAst, module: A.AstModule): Promis for (const contract of sortedContracts ?? allContracts) { const contractName = contract.name; - let codeFc: { path: string; content: string }[]; - // Compiling contract to func - const res = await compile( ctx, contractName, - config.name + "_" + contractName, - {}, + `${config.name}_${contractName}`, + built, ); for (const files of res.output.files) { const ffc = project.resolve(config.output, files.name); project.writeFile(ffc, files.code); } - codeFc = res.output.files.map((v) => ({ + //project.writeFile(pathAbi, res.output.abi); + const codeFc = res.output.files.map((v) => ({ path: posixNormalize(project.resolve(config.output, v.name)), content: v.code, })); @@ -74,9 +94,7 @@ export async function buildModule(astF: FactoryAst, module: A.AstModule): Promis entries: [ stdlibPath, stdlibExPath, - posixNormalize( - project.resolve(config.output, codeEntrypoint), - ), + posixNormalize(project.resolve(config.output, codeEntrypoint)), ], sources: [ { @@ -94,43 +112,34 @@ export async function buildModule(astF: FactoryAst, module: A.AstModule): Promis if (!c.ok) { throw new Error(c.log); } + + // Add to built map + built[contractName] = { + codeBoc: c.output, + abi: "", + }; + contractCodes.set(contractName, c.output); } return contractCodes; } -// Like precompile in the main pipeline, but skipping resolveImports - -export function precompile( - ctx: CompilerContext, - parser: Parser, - ast: FactoryAst, - parsedModules: A.AstModule[], -) { - // Add information about all the source code entries to the context - ctx = openContext(ctx, [], [], parser, parsedModules); +export class ProxyContract implements Contract { + address: Address; + init: StateInit; - // First load type descriptors and check that - // they all have valid signatures - ctx = resolveDescriptors(ctx, ast); - - // This creates TLB-style type definitions - ctx = resolveSignatures(ctx, ast); - - // This checks and resolves all statements - ctx = resolveStatements(ctx, ast); - - // This extracts error messages - ctx = resolveErrors(ctx, ast); - - // This creates allocations for all defined types - ctx = resolveAllocations(ctx); - - // To use in code generation to decide if a receiver needs to call the contract storage function - computeReceiversEffects(ctx); + constructor(stateInit: StateInit) { + this.address = contractAddress(0, stateInit); + this.init = stateInit; + } - // Prepared context - return ctx; + async send( + provider: ContractProvider, + via: Sender, + args: { value: bigint; bounce?: boolean | null | undefined }, + body: Cell, + ) { + await provider.internal(via, { ...args, body: body }); + } } - From 53d47c372809f6125b74eb27c815c12b4a9c3928 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Fri, 7 Mar 2025 13:49:50 +0100 Subject: [PATCH 04/12] tests: changed "try" generator to use "require" to throw an error, because it is hard to tell when FunC will optimize away division by zero. --- src/test/autogenerated/gen-initof-reachability.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 3f93a63b2..3e5e90f61 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -1057,12 +1057,13 @@ function createTestModules(astF: FactoryAst): Test[] { ); const exprStmt = makeAssignStatement(makeId("stateInit"), baseExpr); - const divByZeroStmt = makeExpressionStatement( - makeBinaryExpression( - "/", - makeInt(1n), - makeBinaryExpression("-", makeId("arg"), makeId("arg")), - ), + const requireArg = makeBinaryExpression( + "!=", + makeBinaryExpression("-", makeId("arg"), makeId("arg")), + makeInt(0n), + ); + const requireStatement = makeExpressionStatement( + makeStaticCall(makeId("require"), [requireArg, makeString("")]), ); const case1 = makeTryStatement( @@ -1072,7 +1073,7 @@ function createTestModules(astF: FactoryAst): Test[] { ); const case2 = makeTryStatement( makeFreshVarName(), - [divByZeroStmt], + [requireStatement], [exprStmt], ); From 00deed2574033df79b53869b57a6f3683058ce55 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Mon, 10 Mar 2025 00:59:58 +0100 Subject: [PATCH 05/12] refactor: further simplifications in generators. --- .../autogenerated/gen-initof-reachability.ts | 543 +++++++++--------- 1 file changed, 268 insertions(+), 275 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 3e5e90f61..a7b8975ec 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -15,8 +15,8 @@ import type { CommonMessageInfoInternal, Message, StateInit } from "@ton/core"; import { Cell, beginCell, toNano } from "@ton/core"; import { findTransaction } from "@ton/test-utils"; -type ItemsWithDeclarations = { - items: T[]; +type ItemWithDeclarations = { + item: T; declarations: Declarations; }; @@ -25,12 +25,12 @@ type Declarations = { contractDeclarations: Map; }; -type ExpressionWithName = { +type ExpressionWrapper = { name: string; expression: A.AstExpression; }; -type StatementsWithName = { +type StatementsWrapper = { name: string; statements: A.AstStatement[]; assignedStateInit: boolean; @@ -543,61 +543,34 @@ function createTestModules(astF: FactoryAst): Test[] { } */ - function withEmptyDeclarations( - items: T[], - ): fc.Arbitrary> { - return fc.constant({ - items: items, + function withEmptyDeclarations(item: T): ItemWithDeclarations { + return { + item: item, declarations: { globalDeclarations: new Map(), contractDeclarations: new Map(), }, - }); + }; } - function chainGenerators( - gens: fc.Arbitrary>[], - initialDecls: Declarations, - ): fc.Arbitrary> { - const join: ( - d1: ItemsWithDeclarations, - d2: ItemsWithDeclarations, - ) => ItemsWithDeclarations = (d1, d2) => { - const finalGlobalDecls: Map = new Map( - d1.declarations.globalDeclarations, - ); - const finalContractDecls: Map = - new Map(d1.declarations.contractDeclarations); - const finalItems: T[] = [...d1.items, ...d2.items]; - d2.declarations.globalDeclarations.forEach((value, key) => { - finalGlobalDecls.set(key, value); - }); - d2.declarations.contractDeclarations.forEach((value, key) => { - finalContractDecls.set(key, value); - }); - return { - items: finalItems, - declarations: { - globalDeclarations: finalGlobalDecls, - contractDeclarations: finalContractDecls, - }, - }; + function withDeclarations( + item: T, + declarations: Declarations, + ): ItemWithDeclarations { + return { + item, + declarations, }; - return chainGeneratorsAux( - { - items: [], - declarations: initialDecls, - }, - gens, - join, - ); + } + + function chainGenerators(gens: fc.Arbitrary[]): fc.Arbitrary { + return chainGeneratorsAux([], gens); } function chainGeneratorsAux( - accumulator: T, - gens: fc.Arbitrary[], - join: (d1: T, d2: T) => T, - ): fc.Arbitrary { + accumulator: T[], + gens: fc.Arbitrary[], + ): fc.Arbitrary { if (gens.length === 0) { return fc.constant(accumulator); } @@ -605,9 +578,8 @@ function createTestModules(astF: FactoryAst): Test[] { const gen = gens[0]!; return gen.chain((currData) => { return chainGeneratorsAux( - join(accumulator, currData), + [...accumulator, ...currData], gens.slice(1), - join, ); }); } @@ -636,54 +608,57 @@ function createTestModules(astF: FactoryAst): Test[] { }*/ function initOfGenerator(): fc.Arbitrary< - ItemsWithDeclarations + ItemWithDeclarations[] > { - return withEmptyDeclarations([ - { + return fc.constant([ + withEmptyDeclarations({ name: "InitOf", expression: makeInitOf(makeId("Deployer"), []), - }, + }), ]); } function staticCallGenerator( currentFunCallDepth: number, - ): fc.Arbitrary> { + ): fc.Arbitrary[]> { if (currentFunCallDepth >= config.maxFunCallDepth) { - return withEmptyDeclarations([]); + return fc.constant([]); } return statementGenerator(currentFunCallDepth + 1).chain((genStmts) => { - const finalGlobalDecls: Map = new Map( - genStmts.declarations.globalDeclarations, - ); - const finalItems: ExpressionWithName[] = []; + const finalItems: ItemWithDeclarations[] = []; - for (const stmtsWithName of genStmts.items) { - if (stmtsWithName.assignedStateInit) { + for (const stmtsWithName of genStmts) { + const finalGlobalDecls: Map = new Map( + stmtsWithName.declarations.globalDeclarations, + ); + + if (stmtsWithName.item.assignedStateInit) { const funName = makeFreshFunctionName(); const returnStmt = makeReturnStatement(makeId("stateInit")); const funDef = makeFunctionDefinition( funName, [makeTypedParameter("arg", "Int")], - [...stmtsWithName.statements, returnStmt], + [...stmtsWithName.item.statements, returnStmt], [], makeTypeId("StateInit"), ); const call = makeStaticCall(funName, [makeId("arg")]); - const testName = `StaticCall_${stmtsWithName.name}`; + const testName = `StaticCall_${stmtsWithName.item.name}`; finalGlobalDecls.set(idText(funName), funDef); - finalItems.push({ name: testName, expression: call }); + finalItems.push( + withDeclarations( + { name: testName, expression: call }, + { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + }, + ), + ); } } - return fc.constant({ - items: finalItems, - declarations: { - globalDeclarations: finalGlobalDecls, - contractDeclarations: new Map(), - }, - }); + return fc.constant(finalItems); }); } @@ -771,42 +746,49 @@ function createTestModules(astF: FactoryAst): Test[] { */ function letStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const varName = makeId("stateInit"); const varType = makeTypeId("StateInit"); - const stmtLet = makeLetStatement(varName, varType, baseExpr); - const newName = `Let_${name}`; - - return withEmptyDeclarations([ - { - name: newName, - statements: [stmtLet], - assignedStateInit: true, - }, + const stmtLet = makeLetStatement( + varName, + varType, + baseExpr.item.expression, + ); + const newName = `Let_${baseExpr.item.name}`; + + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [stmtLet], + assignedStateInit: true, + }, + baseExpr.declarations, + ), ]); } function expressionStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { - const stmtExpr = makeExpressionStatement(baseExpr); - const newName = `Expr_${name}`; - return withEmptyDeclarations([ - { - name: newName, - statements: [stmtExpr], - assignedStateInit: false, - }, + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { + const stmtExpr = makeExpressionStatement(baseExpr.item.expression); + const newName = `Expr_${baseExpr.item.name}`; + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [stmtExpr], + assignedStateInit: false, + }, + baseExpr.declarations, + ), ]); } function conditionStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -827,7 +809,10 @@ function createTestModules(astF: FactoryAst): Test[] { makeInt(0n), ); - const expr = makeAssignStatement(makeId("stateInit"), baseExpr); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); const dummy2 = makeAssignStatement( makeId("stateInit"), makeInitOf(makeId("Dummy2"), []), @@ -836,33 +821,34 @@ function createTestModules(astF: FactoryAst): Test[] { const case2 = makeConditionStatement(cond1Expr, [expr], [dummy2]); const case3 = makeConditionStatement(cond2Expr, [dummy2], [expr]); - const case1Name = `IfNoElse_${name}`; - const case2Name = `IfThen_${name}`; - const case3Name = `IfElse_${name}`; + const case1Name = `IfNoElse_${baseExpr.item.name}`; + const case2Name = `IfThen_${baseExpr.item.name}`; + const case3Name = `IfElse_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, - { - name: case2Name, - statements: [initVarStmt, case2], - assignedStateInit: true, - }, - { - name: case3Name, - statements: [initVarStmt, case3], - assignedStateInit: true, - }, - ]); + return fc.constant( + [ + { + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, + }, + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + { + name: case3Name, + statements: [initVarStmt, case3], + assignedStateInit: true, + }, + ].map((item) => withDeclarations(item, baseExpr.declarations)), + ); } function whileStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -873,7 +859,10 @@ function createTestModules(astF: FactoryAst): Test[] { makeTypeId("Int"), makeBinaryExpression("-", makeId("arg"), makeId("arg")), ); - const expr = makeAssignStatement(makeId("stateInit"), baseExpr); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); const counterIncr = makeAssignStatement( makeId("counter"), makeBinaryExpression("+", makeId("counter"), makeInt(1n)), @@ -881,21 +870,23 @@ function createTestModules(astF: FactoryAst): Test[] { const cond = makeBinaryExpression("<=", makeId("counter"), makeInt(2n)); const loop = makeWhileStatement(cond, [expr, counterIncr]); - const newName = `While_${name}`; + const newName = `While_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: newName, - statements: [initVarStmt, countVarStmt, loop], - assignedStateInit: true, - }, + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }, + baseExpr.declarations, + ), ]); } function untilStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -906,7 +897,10 @@ function createTestModules(astF: FactoryAst): Test[] { makeTypeId("Int"), makeBinaryExpression("-", makeId("arg"), makeId("arg")), ); - const expr = makeAssignStatement(makeId("stateInit"), baseExpr); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); const counterIncr = makeAssignStatement( makeId("counter"), makeBinaryExpression("+", makeId("counter"), makeInt(1n)), @@ -914,21 +908,23 @@ function createTestModules(astF: FactoryAst): Test[] { const cond = makeBinaryExpression(">=", makeId("counter"), makeInt(2n)); const loop = makeUntilStatement(cond, [expr, counterIncr]); - const newName = `Until_${name}`; + const newName = `Until_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: newName, - statements: [initVarStmt, countVarStmt, loop], - assignedStateInit: true, - }, + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }, + baseExpr.declarations, + ), ]); } function repeatStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -939,17 +935,23 @@ function createTestModules(astF: FactoryAst): Test[] { makeTypeId("Int"), makeStaticCall(makeId("random"), [makeInt(1n), makeInt(3n)]), ); - const expr = makeAssignStatement(makeId("stateInit"), baseExpr); + const expr = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); const loop = makeRepeatStatement(makeId("counter"), [expr]); - const newName = `Repeat_${name}`; + const newName = `Repeat_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: newName, - statements: [initVarStmt, countVarStmt, loop], - assignedStateInit: true, - }, + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [initVarStmt, countVarStmt, loop], + assignedStateInit: true, + }, + baseExpr.declarations, + ), ]); } @@ -994,14 +996,16 @@ function createTestModules(astF: FactoryAst): Test[] { */ function destructStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const identifiers: Map = new Map(); identifiers.set("init", [makeId("init"), makeId("stateInit")]); const wrapped = makeStructInstance(makeId("StateInitWrapper"), [ - makeStructFieldInitializer(makeId("init"), baseExpr), + makeStructFieldInitializer( + makeId("init"), + baseExpr.item.expression, + ), ]); const unwrapped = makeDestructStatement( @@ -1010,53 +1014,63 @@ function createTestModules(astF: FactoryAst): Test[] { makeTypeId("StateInitWrapper"), ); - const newName = `Destruct_${name}`; + const newName = `Destruct_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: newName, - statements: [unwrapped], - assignedStateInit: true, - }, + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [unwrapped], + assignedStateInit: true, + }, + baseExpr.declarations, + ), ]); } function blockStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), makeInitOf(makeId("Dummy1"), []), ); - const exprStmt = makeAssignStatement(makeId("stateInit"), baseExpr); + const exprStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); const stmt = makeBlockStatement([exprStmt]); - const newName = `Block_${name}`; + const newName = `Block_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: newName, - statements: [initVarStmt, stmt], - assignedStateInit: true, - }, + return fc.constant([ + withDeclarations( + { + name: newName, + statements: [initVarStmt, stmt], + assignedStateInit: true, + }, + baseExpr.declarations, + ), ]); } function tryStatementGenerator( - baseExpr: A.AstExpression, - name: string, - ): fc.Arbitrary> { + baseExpr: ItemWithDeclarations, + ): fc.Arbitrary[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), makeInitOf(makeId("Dummy1"), []), ); - const exprStmt = makeAssignStatement(makeId("stateInit"), baseExpr); + const exprStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); const requireArg = makeBinaryExpression( "!=", makeBinaryExpression("-", makeId("arg"), makeId("arg")), @@ -1077,26 +1091,28 @@ function createTestModules(astF: FactoryAst): Test[] { [exprStmt], ); - const case1Name = `Try_${name}`; - const case2Name = `Catch_${name}`; + const case1Name = `Try_${baseExpr.item.name}`; + const case2Name = `Catch_${baseExpr.item.name}`; - return withEmptyDeclarations([ - { - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, - { - name: case2Name, - statements: [initVarStmt, case2], - assignedStateInit: true, - }, - ]); + return fc.constant( + [ + { + name: case1Name, + statements: [initVarStmt, case1], + assignedStateInit: true, + }, + { + name: case2Name, + statements: [initVarStmt, case2], + assignedStateInit: true, + }, + ].map((item) => withDeclarations(item, baseExpr.declarations)), + ); } function expressionGenerator( currentFunCallDepth: number, - ): fc.Arbitrary> { + ): fc.Arbitrary[]> { const exprGens = [ initOfGenerator(), staticCallGenerator(currentFunCallDepth), @@ -1106,83 +1122,53 @@ function createTestModules(astF: FactoryAst): Test[] { ]; // Chain all the above generators - return chainGenerators(exprGens, { - globalDeclarations: new Map(), - contractDeclarations: new Map(), - }); + return chainGenerators(exprGens); } function statementGenerator( currentFunCallDepth: number, - ): fc.Arbitrary> { + ): fc.Arbitrary[]> { return expressionGenerator(currentFunCallDepth).chain((genExprs) => { const generators: fc.Arbitrary< - ItemsWithDeclarations + ItemWithDeclarations[] >[] = []; - for (const exprWithName of genExprs.items) { + for (const exprWithName of genExprs) { const stmtGens = [ - letStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - expressionStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - conditionStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - whileStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - untilStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - repeatStatementGenerator( - exprWithName.expression, - exprWithName.name, - ) /* + letStatementGenerator(exprWithName), + expressionStatementGenerator(exprWithName), + conditionStatementGenerator(exprWithName), + whileStatementGenerator(exprWithName), + untilStatementGenerator(exprWithName), + repeatStatementGenerator(exprWithName) /* forEachStatementGenerator( - exprWithName.expression, - exprWithName.name, + exprWithName ),*/, - destructStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - blockStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), - tryStatementGenerator( - exprWithName.expression, - exprWithName.name, - ), + destructStatementGenerator(exprWithName), + blockStatementGenerator(exprWithName), + tryStatementGenerator(exprWithName), ]; generators.push(...stmtGens); } - return chainGenerators(generators, genExprs.declarations); + return chainGenerators(generators); }); } function contractWithInitGenerator( - stmtsData: StatementsWithName, - contractDecls: A.AstContractDeclaration[], - ): fc.Arbitrary> { + stmtsData: ItemWithDeclarations, + ): fc.Arbitrary[]> { const finalContracts: A.AstContract[] = []; - if (stmtsData.assignedStateInit) { + if (stmtsData.item.assignedStateInit) { finalContracts.push( makeContract( - makeId(stmtsData.name), - stmtsData.statements, - contractDecls, + makeId(stmtsData.item.name), + stmtsData.item.statements, + Array.from( + stmtsData.declarations.contractDeclarations.values(), + ), ), ); } @@ -1193,34 +1179,32 @@ function createTestModules(astF: FactoryAst): Test[] { contractDecls, ) );*/ - return withEmptyDeclarations(finalContracts); + return fc.constant( + finalContracts.map((item) => + withDeclarations(item, { + globalDeclarations: + stmtsData.declarations.globalDeclarations, + contractDeclarations: new Map(), + }), + ), + ); } function contractGenerator( currentFunCallDepth: number, - ): fc.Arbitrary> { + ): fc.Arbitrary[]> { return statementGenerator(currentFunCallDepth).chain((genStmts) => { const generators: fc.Arbitrary< - ItemsWithDeclarations + ItemWithDeclarations[] >[] = []; - for (const stmtsWithName of genStmts.items) { - const contractGens = [ - contractWithInitGenerator( - stmtsWithName, - Array.from( - genStmts.declarations.contractDeclarations.values(), - ), - ), - ]; + for (const stmtsWithName of genStmts) { + const contractGens = [contractWithInitGenerator(stmtsWithName)]; generators.push(...contractGens); } - return chainGenerators(generators, { - globalDeclarations: genStmts.declarations.globalDeclarations, - contractDeclarations: new Map(), - }); + return chainGenerators(generators); }); } @@ -1259,15 +1243,15 @@ function createTestModules(astF: FactoryAst): Test[] { .toString(), origin: "user", }); - const finalGlobalDecls = [ - ...allCases.declarations.globalDeclarations.values(), - ...extraModule.items, - ]; - for (const contract of allCases.items) { + for (const contract of allCases) { + const finalGlobalDecls = [ + ...contract.declarations.globalDeclarations.values(), + ...extraModule.items, + ]; tests.push({ - module: makeModule(contract, finalGlobalDecls), - testName: idText(contract.name), + module: makeModule(contract.item, finalGlobalDecls), + testName: idText(contract.item.name), }); } @@ -1377,10 +1361,10 @@ async function main() { const tests = createTestModules(astF); console.log(`Generated ${tests.length} tests.`); + const fileDescriptor = fs.openSync(path.join(__dirname, "error.log"), "w"); for (const test of tests) { console.log(`Compiling test ${test.testName}`); - try { // Compile the module const contractCodes = await buildModule(astF, test.module); @@ -1388,10 +1372,19 @@ async function main() { await testContracts(test.testName, contractCodes); console.log("Passed."); } catch (e) { - console.log("Test:"); - console.log(prettyPrint(test.module)); - console.log("failed with error:"); - console.log(e); + console.log("Failed. See error.log"); + const tactCode = prettyPrint(test.module); + fs.writeSync(fileDescriptor, `${tactCode}\nfailed with error:\n`); + if (e instanceof Error) { + fs.writeSync(fileDescriptor, e.stack ?? ""); + fs.writeSync( + fileDescriptor, + "\n----------------------------------\n\n", + ); + } else { + // Cannot handle this error. Stop the entire process since this is something unexpected. + throw e; + } } } } From 838ecca9f9296772c371eae45958ea09be472343 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Wed, 12 Mar 2025 11:02:20 +0100 Subject: [PATCH 06/12] tests: Added custom tact stdlib and custom func stdlib --- cspell.json | 1 + .../autogenerated/gen-initof-reachability.ts | 71 ++++++- .../autogenerated/minimal-fc-stdlib/stdlib.fc | 38 ++++ src/test/autogenerated/util.ts | 186 ++++++++++++++++-- 4 files changed, 281 insertions(+), 15 deletions(-) create mode 100644 src/test/autogenerated/minimal-fc-stdlib/stdlib.fc diff --git a/cspell.json b/cspell.json index 2bc4569c1..bdc219258 100644 --- a/cspell.json +++ b/cspell.json @@ -56,6 +56,7 @@ "src/test/exit-codes/contracts/compute-phase-errors.tact", "src/test/e2e-emulated/map-tests/build", "src/test/e2e-emulated/map-tests/map-properties-key-value-types.ts", + "src/test/autogenerated/minimal-fc-stdlib/stdlib.fc", "/docs", "src/benchmarks/contracts/func/notcoin/stdlib-custom.fc", "src/benchmarks/contracts/func/notcoin/gas.fc" diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index a7b8975ec..92370cb62 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -6,7 +6,13 @@ import { prettyPrint } from "../../ast/ast-printer"; import { getParser } from "../../grammar"; import * as fs from "fs"; import fc from "fast-check"; -import { buildModule, ProxyContract } from "./util"; +import { + buildModule, + filterGlobalDeclarations, + loadCustomStdlibFc, + parseStandardLibrary, + ProxyContract, +} from "./util"; import { defaultParser } from "../../grammar/grammar"; import { getSrcInfo } from "../../grammar/src-info"; import { Blockchain } from "@ton/sandbox"; @@ -930,10 +936,15 @@ function createTestModules(astF: FactoryAst): Test[] { makeTypeId("StateInit"), makeInitOf(makeId("Dummy1"), []), ); + const counterExpr = makeBinaryExpression( + "+", + makeBinaryExpression("-", makeId("arg"), makeId("arg")), + makeInt(1n), + ); const countVarStmt = makeLetStatement( makeId("counter"), makeTypeId("Int"), - makeStaticCall(makeId("random"), [makeInt(1n), makeInt(3n)]), + counterExpr, ); const expr = makeAssignStatement( makeId("stateInit"), @@ -1363,11 +1374,65 @@ async function main() { console.log(`Generated ${tests.length} tests.`); const fileDescriptor = fs.openSync(path.join(__dirname, "error.log"), "w"); + // Parse the stdlib and filter it with the minimal definitions we need + const stdlibModule = filterGlobalDeclarations( + parseStandardLibrary(astF), + astF, + new Set([ + "Int", + "Bool", + "Address", + "Cell", + "Context", + "Slice", + "Builder", + "String", + "StateInit", + "SendParameters", + "BaseTrait", + "SendDefaultMode", + "SendRemainingValue", + "SendIgnoreErrors", + "SendRemainingBalance", + "ReserveExact", + "sender", + "context", + "myBalance", + "nativeReserve", + "contractAddress", + "contractAddressExt", + "storeUint", + "storeInt", + "contractHash", + "newAddress", + "beginCell", + "endCell", + "send", + "asSlice", + "asAddressUnsafe", + "beginParse", + ]), + ); + + const customStdlibFc = loadCustomStdlibFc(); + + // Create the custom stdlib, with the loaded custom FunC stdlib + const customStdlib = { + modules: [stdlibModule], + stdlib_fc: customStdlibFc.stdlib_fc, + stdlib_ex_fc: customStdlibFc.stdlib_ex_fc, + }; + for (const test of tests) { console.log(`Compiling test ${test.testName}`); try { // Compile the module - const contractCodes = await buildModule(astF, test.module); + const contractCodes = await buildModule( + astF, + test.module, + customStdlib, + true, + ); console.log("Testing..."); await testContracts(test.testName, contractCodes); console.log("Passed."); diff --git a/src/test/autogenerated/minimal-fc-stdlib/stdlib.fc b/src/test/autogenerated/minimal-fc-stdlib/stdlib.fc new file mode 100644 index 000000000..3d374e992 --- /dev/null +++ b/src/test/autogenerated/minimal-fc-stdlib/stdlib.fc @@ -0,0 +1,38 @@ +;;; Returns the persistent contract storage cell. It can be parsed or modified with slice and builder primitives later. +cell get_data() asm "c4 PUSH"; + +;;; Converts a `cell` [c] into a `slice`. Notice that [c] must be either an ordinary cell, +;;; or an exotic cell (see [TVM.pdf](https://ton-blockchain.github.io/docs/tvm.pdf), 3.1.2) +;;; which is automatically loaded to yield an ordinary cell `c'`, converted into a `slice` afterwards. +slice begin_parse(cell c) asm "CTOS"; + +;;; Checks if [s] is empty. If not, throws an exception. +() end_parse(slice s) impure asm "ENDS"; + +;;; Returns all but the first `0 ≤ len ≤ 1023` bits of `slice` [s]. +slice skip_bits(slice s, int len) asm "SDSKIPFIRST"; +(slice, ()) ~skip_bits(slice s, int len) asm "SDSKIPFIRST"; + +;;; Returns the number of data bits in `slice` [s]. +int slice_bits(slice s) asm "SBITS"; + +;;; Loads from slice [s] the only prefix that is a valid `MsgAddress`, +;;; and returns both this prefix `s'` and the remainder `s''` of [s] as slices. +(slice, slice) load_msg_addr(slice s) asm(-> 1 0) "LDMSGADDR"; + +;;; Push null element (casted to given type) +;;; By the TVM type `Null` FunC represents absence of a value of some atomic type. +;;; So `null` can actually have any atomic type. +forall X -> X null() asm "PUSHNULL"; + +;;; Loads the first reference from the slice. +(slice, cell) load_ref(slice s) asm(-> 1 0) "LDREF"; + +;;; Creates a new empty `builder`. +builder begin_cell() asm "NEWC"; + +;;; Sets `cell` [c] as persistent contract data. You can update persistent contract storage with this primitive. +() set_data(cell c) impure asm "c4 POP"; + +;;; Converts a `builder` into an ordinary `cell`. +cell end_cell(builder b) asm "ENDC"; diff --git a/src/test/autogenerated/util.ts b/src/test/autogenerated/util.ts index 1f5b4a767..e60c05c64 100644 --- a/src/test/autogenerated/util.ts +++ b/src/test/autogenerated/util.ts @@ -1,6 +1,5 @@ -import path from "path"; import type * as A from "../../ast/ast"; -import type { FactoryAst } from "../../ast/ast-helpers"; +import { idText, type FactoryAst } from "../../ast/ast-helpers"; import { featureEnable } from "../../config/features"; import { CompilerContext } from "../../context/context"; import { Logger } from "../../context/logger"; @@ -12,7 +11,6 @@ import { precompile } from "../../pipeline/precompile"; import { topSortContracts } from "../../pipeline/utils"; import files from "../../stdlib/stdlib"; import * as fs from "fs"; -import { getAllTypes } from "../../types/resolveDescriptors"; import { posixNormalize } from "../../utils/filePath"; import { createVirtualFileSystem } from "../../vfs/createVirtualFileSystem"; import type { @@ -24,20 +22,118 @@ import type { StateInit, } from "@ton/core"; import { contractAddress } from "@ton/core"; +import { resolveImports } from "../../imports/resolveImports"; +import { getRawAST, openContext } from "../../context/store"; +import path from "path"; +import { getAllTypes } from "../../types/resolveDescriptors"; + +export function parseStandardLibrary(astF: FactoryAst): CompilerContext { + let ctx = new CompilerContext(); + const parser = getParser(astF, defaultParser); + const fileSystem = { + [`contracts/empty.tact`]: "", + }; + const project = createVirtualFileSystem("/", fileSystem, false); + const stdlib = createVirtualFileSystem("@stdlib", files); + + const imported = resolveImports({ + entrypoint: "contracts/empty.tact", + project, + stdlib, + parser, + }); + + // Add information about all the source code entries to the context + ctx = openContext(ctx, imported.tact, imported.func, parser); + + return ctx; +} + +export function filterGlobalDeclarations( + ctx: CompilerContext, + astF: FactoryAst, + names: Set, +): A.AstModule { + const result: A.AstModuleItem[] = []; + + const rawAst = getRawAST(ctx); + + for (const c of rawAst.constants) { + if (names.has(idText(c.name))) { + result.push(c); + } + } + + for (const f of rawAst.functions) { + if (names.has(idText(f.name))) { + result.push(f); + } + } + + for (const t of rawAst.types) { + if (names.has(idText(t.name))) { + result.push(t); + } + } + return astF.createNode({ + kind: "module", + imports: [], + items: result, + }) as A.AstModule; +} + +export function loadCustomStdlibFc(): { + stdlib_fc: string; + stdlib_ex_fc: string; +} { + const stdlib_fc = fs + .readFileSync(path.join(__dirname, "minimal-fc-stdlib", "stdlib.fc")) + .toString("base64"); + return { + stdlib_fc: stdlib_fc, + stdlib_ex_fc: "", + }; +} + +type CustomStdlib = { + // Parsed modules of Tact stdlib + modules: A.AstModule[]; + // Contents of the stdlib.fc file + stdlib_fc: string; + // Contents of the stdlib_ex.fc file + stdlib_ex_fc: string; +}; + +// If flag useCustomStdlib is false, it will parse the entire stdlib. Otherwise, +// it will use the provided data in CustomStdlib. export async function buildModule( astF: FactoryAst, module: A.AstModule, + customStdlib: CustomStdlib, + useCustomStdlib: boolean, ): Promise> { let ctx = new CompilerContext(); const parser = getParser(astF, defaultParser); + // We need an entrypoint for precompile, even if it is empty const fileSystem = { - [`contracts/empty.tact`]: fs - .readFileSync(path.join(__dirname, `contracts/empty.tact`)) - .toString("base64"), + [`contracts/empty.tact`]: "", + }; + const minimalStdlib = { + // Needed by precompile, but we set its contents to be empty + ["std/stdlib.tact"]: "", + // These two func files are needed during tvm compilation + ["std/stdlib_ex.fc"]: customStdlib.stdlib_ex_fc, + ["std/stdlib.fc"]: customStdlib.stdlib_fc, }; + const project = createVirtualFileSystem("/", fileSystem, false); - const stdlib = createVirtualFileSystem("@stdlib", files); + // If the provided stdlib modules are empty, prepare the full stdlib. + // Otherwise, just include the minimal stdlib + const stdlib = useCustomStdlib + ? createVirtualFileSystem("@stdlib", minimalStdlib) + : createVirtualFileSystem("@stdlib", files); + const config = { name: "test", path: "contracts/empty.tact", @@ -45,7 +141,16 @@ export async function buildModule( }; const contractCodes = new Map(); - ctx = precompile(ctx, project, stdlib, config.path, parser, astF, [module]); + if (useCustomStdlib) { + ctx = precompile(ctx, project, stdlib, config.path, parser, astF, [ + module, + ...customStdlib.modules, + ]); + } else { + ctx = precompile(ctx, project, stdlib, config.path, parser, astF, [ + module, + ]); + } const built: Record< string, @@ -74,10 +179,10 @@ export async function buildModule( `${config.name}_${contractName}`, built, ); - for (const files of res.output.files) { - const ffc = project.resolve(config.output, files.name); - project.writeFile(ffc, files.code); - } + //for (const files of res.output.files) { + // const ffc = project.resolve(config.output, files.name); + // project.writeFile(ffc, files.code); + //} //project.writeFile(pathAbi, res.output.abi); const codeFc = res.output.files.map((v) => ({ path: posixNormalize(project.resolve(config.output, v.name)), @@ -125,6 +230,63 @@ export async function buildModule( return contractCodes; } +// export function precompile( +// ctx: CompilerContext, +// project: VirtualFileSystem, +// stdlib: VirtualFileSystem, +// entrypoint: string, +// parser: Parser, +// ast: FactoryAst, +// parsedModules?: AstModule[], +// ) { +// // Load all sources +// const imported = resolveImports({ entrypoint, project, stdlib, parser }); + +// // Add information about all the source code entries to the context +// ctx = openContext(ctx, imported.tact, imported.func, parser, parsedModules); + +// // First load type descriptors and check that +// // they all have valid signatures +// ctx = resolveDescriptors(ctx, ast); + +// // This checks and resolves all statements +// ctx = resolveStatements(ctx); + +// // From this point onwards, it is safe to call evalConstantExpression. + +// /* Evaluate all comp-time expressions: +// constants, default contract fields, default struct fields, method Ids + +// The original code inside constant, field and method id initialization actually mutated the CompilerContext object, +// while the rest of the typechecker's code built a new CompilerContext every time it changed something. +// Hence the reason of why this line is not written as: + +// ctx = evalComptimeExpressions(ctx, ast); + +// The code mutates fields in ConstantDescription, FieldDescription and FunctionDescription. + +// Evaluation of Message op-codes is done later in resolveSignatures. It was left there because +// the computation of those op-codes is more involved than the computation of method ids, and so +// it is hard to extract the call to evalConstantExpression in resolveSignatures. +// */ +// evalComptimeExpressions(ctx, ast); + +// // This creates TLB-style type definitions +// ctx = resolveSignatures(ctx, ast); + +// // This extracts error messages +// ctx = resolveErrors(ctx, ast); + +// // This creates allocations for all defined types +// ctx = resolveAllocations(ctx); + +// // To use in code generation to decide if a receiver needs to call the contract storage function +// computeReceiversEffects(ctx); + +// // Prepared context +// return ctx; +// } + export class ProxyContract implements Contract { address: Address; init: StateInit; From 6b3951dcdcd715a8b91744679f8ee99a4ca2bbcb Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Wed, 12 Mar 2025 13:40:58 +0100 Subject: [PATCH 07/12] tests: Added batch compilation of contracts (i.e., compiling various contracts at once before passing to Sandbox). This accelerated the test!! --- .../autogenerated/gen-initof-reachability.ts | 119 +++++++++++++----- src/test/autogenerated/util.ts | 4 + 2 files changed, 89 insertions(+), 34 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 92370cb62..e43e15954 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -48,7 +48,7 @@ type GlobalConfig = { type Test = { module: A.AstModule; - testName: string; + contractNames: string[]; }; function createTestModules(astF: FactoryAst): Test[] { @@ -1224,17 +1224,64 @@ function createTestModules(astF: FactoryAst): Test[] { return astF.createNode({kind: "import", importPath: {path: fromString(path), type: "relative", language: "tact"}, loc: emptySrcInfo}) as A.AstImport; }*/ - function makeModule( - contract: A.AstContract, - globalDecls: A.AstModuleItem[], - ): A.AstModule { + function makeModule(decls: A.AstModuleItem[]): A.AstModule { return astF.createNode({ kind: "module", imports: [], - items: [...globalDecls, contract], + items: decls, }) as A.AstModule; } + function createTestsAndGroupBy( + items: ItemWithDeclarations[], + extraModule: A.AstModule, + groupBy: number, + ): Test[] { + const tests: Test[] = []; + + let moduleItemAccumulator: Map = new Map(); + let contractNamesAccumulator: string[] = []; + + let counter = 0; + + for (const item of items) { + for (const [name, decl] of item.declarations.globalDeclarations) { + moduleItemAccumulator.set(name, decl); + } + const contractName = idText(item.item.name); + moduleItemAccumulator.set(contractName, item.item); + contractNamesAccumulator.push(contractName); + counter++; + + if (counter >= groupBy) { + tests.push({ + module: makeModule([ + ...moduleItemAccumulator.values(), + ...extraModule.items, + ]), + contractNames: contractNamesAccumulator, + }); + counter = 0; + moduleItemAccumulator = new Map(); + contractNamesAccumulator = []; + } + } + + // if there are elements in the accumulator arrays, it means that the last group + // did not fill completely, we need to create a test with the leftovers + if (contractNamesAccumulator.length > 0) { + tests.push({ + module: makeModule([ + ...moduleItemAccumulator.values(), + ...extraModule.items, + ]), + contractNames: contractNamesAccumulator, + }); + } + + return tests; + } + const genResult = fc.sample(contractGenerator(0), 1); if (genResult.length !== 1) { throw new Error( @@ -1243,9 +1290,8 @@ function createTestModules(astF: FactoryAst): Test[] { } // The unique element in the array is ensured to exist const allCases = genResult[0]!; - const tests: Test[] = []; - // Add the Deployer contract and Dummies necessary for tests. + // Prepare the Deployer contract and Dummies necessary for tests. const parser = getParser(astF, defaultParser); const extraModule = parser.parse({ path: ".", @@ -1255,18 +1301,7 @@ function createTestModules(astF: FactoryAst): Test[] { origin: "user", }); - for (const contract of allCases) { - const finalGlobalDecls = [ - ...contract.declarations.globalDeclarations.values(), - ...extraModule.items, - ]; - tests.push({ - module: makeModule(contract.item, finalGlobalDecls), - testName: idText(contract.item.name), - }); - } - - return tests; + return createTestsAndGroupBy(allCases, extraModule, 30); } async function testContracts( @@ -1304,6 +1339,7 @@ async function testContracts( // The tested contract must have returned with exit code 0 from its computation phase, // and result code 0 from its action phase const trans1 = ensureTransactionExists( + testName, findTransaction(transactions, { from: deployer.address, to: contractToTest.address, @@ -1315,14 +1351,17 @@ async function testContracts( ); // The tested contract must have sent 1 message, with bounced flag set to false, // and destination the deployer - ensure(trans1.outMessagesCount).is(1); - const outMessage = getOutMessageInfo(trans1.outMessages.get(0)); - ensure(outMessage.bounced).is(false); - ensure(outMessage.dest.toRawString()).is(deployer.address.toRawString()); + ensure(testName, trans1.outMessagesCount).is(1); + const outMessage = getOutMessageInfo(testName, trans1.outMessages.get(0)); + ensure(testName, outMessage.bounced).is(false); + ensure(testName, outMessage.dest.toRawString()).is( + deployer.address.toRawString(), + ); // The deployer must have received a message from the tested contract, // with bounced flag set to false ensureTransactionExists( + testName, findTransaction(transactions, { from: contractToTest.address, to: deployer.address, @@ -1361,7 +1400,7 @@ function getTestedContractStateInit( .endCell(); const code = Cell.fromBoc(contractCode)[0]; if (typeof code === "undefined") { - throw new Error("Code cell expected"); + throw new Error(`Code cell expected for contract ${name}`); } return { code, data }; } @@ -1372,6 +1411,7 @@ async function main() { const tests = createTestModules(astF); console.log(`Generated ${tests.length} tests.`); + const fileDescriptor = fs.openSync(path.join(__dirname, "error.log"), "w"); // Parse the stdlib and filter it with the minimal definitions we need @@ -1424,7 +1464,7 @@ async function main() { }; for (const test of tests) { - console.log(`Compiling test ${test.testName}`); + console.log(`Compiling next batch...`); try { // Compile the module const contractCodes = await buildModule( @@ -1433,9 +1473,11 @@ async function main() { customStdlib, true, ); - console.log("Testing..."); - await testContracts(test.testName, contractCodes); - console.log("Passed."); + for (const contractName of test.contractNames) { + console.log(`Testing contract ${contractName}...`); + await testContracts(contractName, contractCodes); + console.log("Passed."); + } } catch (e) { console.log("Failed. See error.log"); const tactCode = prettyPrint(test.module); @@ -1455,34 +1497,43 @@ async function main() { } function ensureTransactionExists( + testName: string, tsx: BlockchainTransaction | undefined, ): BlockchainTransaction { if (typeof tsx === "undefined") { - throw new Error("Transaction was expected to exist"); + throw new Error(`Test ${testName}: Transaction was expected to exist`); } return tsx; } function getOutMessageInfo( + testName: string, msg: Message | undefined, ): CommonMessageInfoInternal { if (typeof msg === "undefined") { - throw new Error("Message was expected to exist"); + throw new Error(`Test ${testName}: Message was expected to exist`); } if (msg.info.type !== "internal") { - throw new Error("Message kind was expected to be internal"); + throw new Error( + `Test ${testName}: Message kind was expected to be internal`, + ); } return msg.info; } -function ensure(data: string | number | boolean): { +function ensure( + testName: string, + data: string | number | boolean, +): { is: (expected: string | number | boolean) => void; } { return { is: (expected: string | number | boolean) => { const res = data === expected; if (!res) { - throw new Error(`${data} was expected to be ${expected}`); + throw new Error( + `Test ${testName}: ${data} was expected to be ${expected}`, + ); } }, }; diff --git a/src/test/autogenerated/util.ts b/src/test/autogenerated/util.ts index e60c05c64..f7748cabe 100644 --- a/src/test/autogenerated/util.ts +++ b/src/test/autogenerated/util.ts @@ -195,6 +195,8 @@ export async function buildModule( const stdlibCode = stdlib.readFile(stdlibPath).toString(); const stdlibExPath = stdlib.resolve("std/stdlib_ex.fc"); const stdlibExCode = stdlib.readFile(stdlibExPath).toString(); + + //console.profile(); const c = await funcCompile({ entries: [ stdlibPath, @@ -214,6 +216,8 @@ export async function buildModule( ], logger: new Logger(), }); + //console.profileEnd(); + if (!c.ok) { throw new Error(c.log); } From 5ddaed43e85e58a87dd298fe6e74b0d8068043b4 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Thu, 13 Mar 2025 16:20:14 +0100 Subject: [PATCH 08/12] tests: Added feature sets (swarm testing). However, the script still does exhaustive search. Next I will create a random version of generators. --- .../autogenerated/gen-initof-reachability.ts | 410 ++++++++++++++---- src/test/autogenerated/util.ts | 71 +-- 2 files changed, 329 insertions(+), 152 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index e43e15954..7daabd5e8 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -13,7 +13,7 @@ import { parseStandardLibrary, ProxyContract, } from "./util"; -import { defaultParser } from "../../grammar/grammar"; +import type { CustomStdlib } from "./util"; import { getSrcInfo } from "../../grammar/src-info"; import { Blockchain } from "@ton/sandbox"; import type { BlockchainTransaction } from "@ton/sandbox"; @@ -51,7 +51,38 @@ type Test = { contractNames: string[]; }; -function createTestModules(astF: FactoryAst): Test[] { +const GeneratorFeature = { + LET_STATEMENT: "LET", + EXPRESSION_STATEMENT: "EXPRESSION", + CONDITION_STATEMENT: "CONDITION", + WHILE_STATEMENT: "WHILE", + UNTIL_STATEMENT: "UNTIL", + REPEAT_STATEMENT: "REPEAT", + DESTRUCT_STATEMENT: "DESTRUCT", + BLOCK_STATEMENT: "BLOCK", + TRY_STATEMENT: "TRY", + + STATIC_CALL_EXPRESSION: "STATIC_CALL", + INIT_OF_EXPRESSION: "INIT_OF", +} as const; + +type GeneratorFeatureType = + (typeof GeneratorFeature)[keyof typeof GeneratorFeature]; + +type GeneratorDescriptor = { + feature: GeneratorFeatureType; + // Setting the flag to true, forces the feature to always be included, + // independently of the constructed feature set. + // If the flag is set to false, then the feature set will be taken into account. + ignoreFeatureSet: boolean; + generator: fc.Arbitrary; +}; + +function createTestModules( + astF: FactoryAst, + allowedFeatures: Set, + compilationBatchSize: number, +): { tests: Test[]; numberOfContracts: number } { let idCounter = 0; const emptySrcInfo = getSrcInfo(" ", 0, 0, null, "user"); @@ -569,13 +600,15 @@ function createTestModules(astF: FactoryAst): Test[] { }; } - function chainGenerators(gens: fc.Arbitrary[]): fc.Arbitrary { + function chainGenerators( + gens: fc.Arbitrary[], + ): fc.Arbitrary { return chainGeneratorsAux([], gens); } function chainGeneratorsAux( accumulator: T[], - gens: fc.Arbitrary[], + gens: fc.Arbitrary[], ): fc.Arbitrary { if (gens.length === 0) { return fc.constant(accumulator); @@ -613,59 +646,79 @@ function createTestModules(astF: FactoryAst): Test[] { }}; }*/ - function initOfGenerator(): fc.Arbitrary< - ItemWithDeclarations[] + function initOfGenerator(): GeneratorDescriptor< + readonly ItemWithDeclarations[] > { - return fc.constant([ + const generator = fc.constant([ withEmptyDeclarations({ name: "InitOf", expression: makeInitOf(makeId("Deployer"), []), }), ]); + + return { + feature: GeneratorFeature.INIT_OF_EXPRESSION, + ignoreFeatureSet: true, + generator, + }; } function staticCallGenerator( currentFunCallDepth: number, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { if (currentFunCallDepth >= config.maxFunCallDepth) { - return fc.constant([]); + return { + feature: GeneratorFeature.STATIC_CALL_EXPRESSION, + ignoreFeatureSet: false, + generator: fc.constant([]), + }; } - return statementGenerator(currentFunCallDepth + 1).chain((genStmts) => { - const finalItems: ItemWithDeclarations[] = []; + const generator = statementGenerator(currentFunCallDepth + 1).chain( + (genStmts) => { + const finalItems: ItemWithDeclarations[] = + []; - for (const stmtsWithName of genStmts) { - const finalGlobalDecls: Map = new Map( - stmtsWithName.declarations.globalDeclarations, - ); + for (const stmtsWithName of genStmts) { + const finalGlobalDecls: Map = + new Map(stmtsWithName.declarations.globalDeclarations); - if (stmtsWithName.item.assignedStateInit) { - const funName = makeFreshFunctionName(); - const returnStmt = makeReturnStatement(makeId("stateInit")); - const funDef = makeFunctionDefinition( - funName, - [makeTypedParameter("arg", "Int")], - [...stmtsWithName.item.statements, returnStmt], - [], - makeTypeId("StateInit"), - ); - const call = makeStaticCall(funName, [makeId("arg")]); - const testName = `StaticCall_${stmtsWithName.item.name}`; - finalGlobalDecls.set(idText(funName), funDef); - finalItems.push( - withDeclarations( - { name: testName, expression: call }, - { - globalDeclarations: finalGlobalDecls, - contractDeclarations: new Map(), - }, - ), - ); + if (stmtsWithName.item.assignedStateInit) { + const funName = makeFreshFunctionName(); + const returnStmt = makeReturnStatement( + makeId("stateInit"), + ); + const funDef = makeFunctionDefinition( + funName, + [makeTypedParameter("arg", "Int")], + [...stmtsWithName.item.statements, returnStmt], + [], + makeTypeId("StateInit"), + ); + const call = makeStaticCall(funName, [makeId("arg")]); + const testName = `StaticCall_${stmtsWithName.item.name}`; + finalGlobalDecls.set(idText(funName), funDef); + finalItems.push( + withDeclarations( + { name: testName, expression: call }, + { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + }, + ), + ); + } } - } - return fc.constant(finalItems); - }); + return fc.constant(finalItems); + }, + ); + + return { + feature: GeneratorFeature.STATIC_CALL_EXPRESSION, + ignoreFeatureSet: false, + generator, + }; } /* @@ -753,7 +806,7 @@ function createTestModules(astF: FactoryAst): Test[] { function letStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const varName = makeId("stateInit"); const varType = makeTypeId("StateInit"); const stmtLet = makeLetStatement( @@ -763,7 +816,7 @@ function createTestModules(astF: FactoryAst): Test[] { ); const newName = `Let_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -773,14 +826,20 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + + return { + feature: GeneratorFeature.LET_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function expressionStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const stmtExpr = makeExpressionStatement(baseExpr.item.expression); const newName = `Expr_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -790,11 +849,17 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + + return { + feature: GeneratorFeature.EXPRESSION_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function conditionStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -831,7 +896,7 @@ function createTestModules(astF: FactoryAst): Test[] { const case2Name = `IfThen_${baseExpr.item.name}`; const case3Name = `IfElse_${baseExpr.item.name}`; - return fc.constant( + const generator = fc.constant( [ { name: case1Name, @@ -850,11 +915,17 @@ function createTestModules(astF: FactoryAst): Test[] { }, ].map((item) => withDeclarations(item, baseExpr.declarations)), ); + + return { + feature: GeneratorFeature.CONDITION_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function whileStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -878,7 +949,7 @@ function createTestModules(astF: FactoryAst): Test[] { const newName = `While_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -888,11 +959,17 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + + return { + feature: GeneratorFeature.WHILE_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function untilStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -916,7 +993,7 @@ function createTestModules(astF: FactoryAst): Test[] { const newName = `Until_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -926,11 +1003,17 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + + return { + feature: GeneratorFeature.UNTIL_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function repeatStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -954,7 +1037,7 @@ function createTestModules(astF: FactoryAst): Test[] { const newName = `Repeat_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -964,6 +1047,12 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + + return { + feature: GeneratorFeature.REPEAT_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } /* @@ -1008,7 +1097,7 @@ function createTestModules(astF: FactoryAst): Test[] { function destructStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const identifiers: Map = new Map(); identifiers.set("init", [makeId("init"), makeId("stateInit")]); @@ -1027,7 +1116,7 @@ function createTestModules(astF: FactoryAst): Test[] { const newName = `Destruct_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -1037,11 +1126,17 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + + return { + feature: GeneratorFeature.DESTRUCT_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function blockStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -1057,7 +1152,7 @@ function createTestModules(astF: FactoryAst): Test[] { const newName = `Block_${baseExpr.item.name}`; - return fc.constant([ + const generator = fc.constant([ withDeclarations( { name: newName, @@ -1067,11 +1162,16 @@ function createTestModules(astF: FactoryAst): Test[] { baseExpr.declarations, ), ]); + return { + feature: GeneratorFeature.BLOCK_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function tryStatementGenerator( baseExpr: ItemWithDeclarations, - ): fc.Arbitrary[]> { + ): GeneratorDescriptor[]> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -1105,7 +1205,7 @@ function createTestModules(astF: FactoryAst): Test[] { const case1Name = `Try_${baseExpr.item.name}`; const case2Name = `Catch_${baseExpr.item.name}`; - return fc.constant( + const generator = fc.constant( [ { name: case1Name, @@ -1119,6 +1219,11 @@ function createTestModules(astF: FactoryAst): Test[] { }, ].map((item) => withDeclarations(item, baseExpr.declarations)), ); + return { + feature: GeneratorFeature.TRY_STATEMENT, + ignoreFeatureSet: false, + generator, + }; } function expressionGenerator( @@ -1132,8 +1237,17 @@ function createTestModules(astF: FactoryAst): Test[] { //contractFieldGenerator(initOf) ]; + // Keep only those generators allowed by the features + const finalGens = exprGens + .filter( + (genDesc) => + genDesc.ignoreFeatureSet || + allowedFeatures.has(genDesc.feature), + ) + .map((genDesc) => genDesc.generator); + // Chain all the above generators - return chainGenerators(exprGens); + return chainGenerators(finalGens); } function statementGenerator( @@ -1141,7 +1255,7 @@ function createTestModules(astF: FactoryAst): Test[] { ): fc.Arbitrary[]> { return expressionGenerator(currentFunCallDepth).chain((genExprs) => { const generators: fc.Arbitrary< - ItemWithDeclarations[] + readonly ItemWithDeclarations[] >[] = []; for (const exprWithName of genExprs) { @@ -1160,7 +1274,16 @@ function createTestModules(astF: FactoryAst): Test[] { tryStatementGenerator(exprWithName), ]; - generators.push(...stmtGens); + // Keep only those generators allowed by the features + const finalGens = stmtGens + .filter( + (genDesc) => + genDesc.ignoreFeatureSet || + allowedFeatures.has(genDesc.feature), + ) + .map((genDesc) => genDesc.generator); + + generators.push(...finalGens); } return chainGenerators(generators); @@ -1232,10 +1355,10 @@ function createTestModules(astF: FactoryAst): Test[] { }) as A.AstModule; } - function createTestsAndGroupBy( + function createTestsInBatches( items: ItemWithDeclarations[], extraModule: A.AstModule, - groupBy: number, + compilationBatchSize: number, ): Test[] { const tests: Test[] = []; @@ -1253,7 +1376,7 @@ function createTestModules(astF: FactoryAst): Test[] { contractNamesAccumulator.push(contractName); counter++; - if (counter >= groupBy) { + if (counter >= compilationBatchSize) { tests.push({ module: makeModule([ ...moduleItemAccumulator.values(), @@ -1291,8 +1414,10 @@ function createTestModules(astF: FactoryAst): Test[] { // The unique element in the array is ensured to exist const allCases = genResult[0]!; + const numberOfGeneratedContracts = allCases.length; + // Prepare the Deployer contract and Dummies necessary for tests. - const parser = getParser(astF, defaultParser); + const parser = getParser(astF); const extraModule = parser.parse({ path: ".", code: fs @@ -1301,7 +1426,14 @@ function createTestModules(astF: FactoryAst): Test[] { origin: "user", }); - return createTestsAndGroupBy(allCases, extraModule, 30); + return { + tests: createTestsInBatches( + allCases, + extraModule, + compilationBatchSize, + ), + numberOfContracts: numberOfGeneratedContracts, + }; } async function testContracts( @@ -1405,14 +1537,32 @@ function getTestedContractStateInit( return { code, data }; } -async function main() { - const astF = getAstFactory(); +// Create a collection of feature sets. The number of feature sets will be random in the closed interval [minNum, maxNum]. +// Each feature set is randomly generated by throwing a coin at each feature. +function createFeatureSets( + minNum: number, + maxNum: number, +): Set[] { + const numberOfSets = Math.floor( + Math.random() * (maxNum - minNum + 1) + minNum, + ); + const result: Set[] = []; - const tests = createTestModules(astF); + for (let i = 1; i <= numberOfSets; i++) { + result.push( + new Set( + Object.values(GeneratorFeature).filter( + (_) => Math.random() >= 0.5, + ), + ), + ); + } - console.log(`Generated ${tests.length} tests.`); + return result; +} - const fileDescriptor = fs.openSync(path.join(__dirname, "error.log"), "w"); +async function main() { + const astF = getAstFactory(); // Parse the stdlib and filter it with the minimal definitions we need const stdlibModule = filterGlobalDeclarations( @@ -1463,10 +1613,67 @@ async function main() { stdlib_ex_fc: customStdlibFc.stdlib_ex_fc, }; - for (const test of tests) { - console.log(`Compiling next batch...`); + const featureSets = createFeatureSets(2, 2); + + console.log(`Generated ${featureSets.length} feature sets.`); + + const compilationBatchSize = 20; + + const reports = await Promise.all( + featureSets.map((featureSet, idx) => + executeTestsOnFeatures( + featureSet, + idx + 1, + astF, + compilationBatchSize, + customStdlib, + ), + ), + ); + + const numberOfErrors = reports.reduce((prev, curr) => prev + curr, 0); + + if (numberOfErrors > 0) { + console.log( + `There were a total of ${numberOfErrors} errors. See the following log files:`, + ); + reports.forEach((errorCount, idx) => { + if (errorCount > 0) { + console.log(`error-${idx + 1}.log`); + } + }); + } else { + console.log("There were no errors."); + } +} + +async function executeTestsOnFeatures( + featureSet: Set, + idx: number, + astF: FactoryAst, + compilationBatchSize: number, + customStdlib: CustomStdlib, +): Promise { + let errorCount = 0; + + const errorFilename = `error-${idx}.log`; + const fileDescriptor = fs.openSync( + path.join(__dirname, errorFilename), + "w", + ); + + const featureSetString = `{${Array.from(featureSet).join(", ")}}`; + console.log(`#${idx}: Using feature set: ${featureSetString}`); + + const tests = createTestModules(astF, featureSet, compilationBatchSize); + + console.log( + `#${idx}: Generated ${tests.numberOfContracts} contracts, grouped in ${tests.tests.length} compilation batches.`, + ); + + nextTest: for (const test of tests.tests) { + console.log(`#${idx}: Compiling next batch...`); try { - // Compile the module const contractCodes = await buildModule( astF, test.module, @@ -1474,26 +1681,61 @@ async function main() { true, ); for (const contractName of test.contractNames) { - console.log(`Testing contract ${contractName}...`); - await testContracts(contractName, contractCodes); - console.log("Passed."); + try { + console.log(`#${idx}: Testing contract ${contractName}...`); + await testContracts(contractName, contractCodes); + console.log(`#${idx}: ${contractName} passed.`); + } catch (e) { + if (e instanceof Error) { + errorCount++; + console.log( + `#${idx}: ${contractName} failed. See ${errorFilename}.`, + ); + handleError( + e, + fileDescriptor, + featureSetString, + test.module, + ); + continue nextTest; + } else { + // Cannot handle this error. Stop the entire process since this is something unexpected. + throw e; + } + } } } catch (e) { - console.log("Failed. See error.log"); - const tactCode = prettyPrint(test.module); - fs.writeSync(fileDescriptor, `${tactCode}\nfailed with error:\n`); if (e instanceof Error) { - fs.writeSync(fileDescriptor, e.stack ?? ""); - fs.writeSync( - fileDescriptor, - "\n----------------------------------\n\n", + errorCount++; + const batchString = `[${test.contractNames.join(", ")}]`; + console.log( + `#${idx}: Batch ${batchString} failed compilation. See ${errorFilename}.`, ); + handleError(e, fileDescriptor, featureSetString, test.module); + continue nextTest; } else { // Cannot handle this error. Stop the entire process since this is something unexpected. throw e; } } } + + return errorCount; +} + +function handleError( + e: Error, + fileDescriptor: number, + featureSetString: string, + module: A.AstModule, +) { + const tactCode = prettyPrint(module); + fs.writeSync( + fileDescriptor, + `With features: ${featureSetString}, code:\n${tactCode}\nfailed with error:\n`, + ); + fs.writeSync(fileDescriptor, e.stack ?? ""); + fs.writeSync(fileDescriptor, "\n----------------------------------\n\n"); } function ensureTransactionExists( diff --git a/src/test/autogenerated/util.ts b/src/test/autogenerated/util.ts index f7748cabe..b15c56711 100644 --- a/src/test/autogenerated/util.ts +++ b/src/test/autogenerated/util.ts @@ -5,7 +5,6 @@ import { CompilerContext } from "../../context/context"; import { Logger } from "../../context/logger"; import { funcCompile } from "../../func/funcCompile"; import { getParser } from "../../grammar"; -import { defaultParser } from "../../grammar/grammar"; import { compile } from "../../pipeline/compile"; import { precompile } from "../../pipeline/precompile"; import { topSortContracts } from "../../pipeline/utils"; @@ -29,7 +28,7 @@ import { getAllTypes } from "../../types/resolveDescriptors"; export function parseStandardLibrary(astF: FactoryAst): CompilerContext { let ctx = new CompilerContext(); - const parser = getParser(astF, defaultParser); + const parser = getParser(astF); const fileSystem = { [`contracts/empty.tact`]: "", }; @@ -96,7 +95,7 @@ export function loadCustomStdlibFc(): { }; } -type CustomStdlib = { +export type CustomStdlib = { // Parsed modules of Tact stdlib modules: A.AstModule[]; // Contents of the stdlib.fc file @@ -114,7 +113,7 @@ export async function buildModule( useCustomStdlib: boolean, ): Promise> { let ctx = new CompilerContext(); - const parser = getParser(astF, defaultParser); + const parser = getParser(astF); // We need an entrypoint for precompile, even if it is empty const fileSystem = { [`contracts/empty.tact`]: "", @@ -179,11 +178,6 @@ export async function buildModule( `${config.name}_${contractName}`, built, ); - //for (const files of res.output.files) { - // const ffc = project.resolve(config.output, files.name); - // project.writeFile(ffc, files.code); - //} - //project.writeFile(pathAbi, res.output.abi); const codeFc = res.output.files.map((v) => ({ path: posixNormalize(project.resolve(config.output, v.name)), content: v.code, @@ -196,7 +190,6 @@ export async function buildModule( const stdlibExPath = stdlib.resolve("std/stdlib_ex.fc"); const stdlibExCode = stdlib.readFile(stdlibExPath).toString(); - //console.profile(); const c = await funcCompile({ entries: [ stdlibPath, @@ -216,7 +209,6 @@ export async function buildModule( ], logger: new Logger(), }); - //console.profileEnd(); if (!c.ok) { throw new Error(c.log); @@ -234,63 +226,6 @@ export async function buildModule( return contractCodes; } -// export function precompile( -// ctx: CompilerContext, -// project: VirtualFileSystem, -// stdlib: VirtualFileSystem, -// entrypoint: string, -// parser: Parser, -// ast: FactoryAst, -// parsedModules?: AstModule[], -// ) { -// // Load all sources -// const imported = resolveImports({ entrypoint, project, stdlib, parser }); - -// // Add information about all the source code entries to the context -// ctx = openContext(ctx, imported.tact, imported.func, parser, parsedModules); - -// // First load type descriptors and check that -// // they all have valid signatures -// ctx = resolveDescriptors(ctx, ast); - -// // This checks and resolves all statements -// ctx = resolveStatements(ctx); - -// // From this point onwards, it is safe to call evalConstantExpression. - -// /* Evaluate all comp-time expressions: -// constants, default contract fields, default struct fields, method Ids - -// The original code inside constant, field and method id initialization actually mutated the CompilerContext object, -// while the rest of the typechecker's code built a new CompilerContext every time it changed something. -// Hence the reason of why this line is not written as: - -// ctx = evalComptimeExpressions(ctx, ast); - -// The code mutates fields in ConstantDescription, FieldDescription and FunctionDescription. - -// Evaluation of Message op-codes is done later in resolveSignatures. It was left there because -// the computation of those op-codes is more involved than the computation of method ids, and so -// it is hard to extract the call to evalConstantExpression in resolveSignatures. -// */ -// evalComptimeExpressions(ctx, ast); - -// // This creates TLB-style type definitions -// ctx = resolveSignatures(ctx, ast); - -// // This extracts error messages -// ctx = resolveErrors(ctx, ast); - -// // This creates allocations for all defined types -// ctx = resolveAllocations(ctx); - -// // To use in code generation to decide if a receiver needs to call the contract storage function -// computeReceiversEffects(ctx); - -// // Prepared context -// return ctx; -// } - export class ProxyContract implements Contract { address: Address; init: StateInit; From bb266aee8e12f62d68a30f4bc3d4a0d91548edef Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Thu, 13 Mar 2025 16:22:25 +0100 Subject: [PATCH 09/12] fix: limits in feature set sizes. --- src/test/autogenerated/gen-initof-reachability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 7daabd5e8..43486dec6 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -1613,7 +1613,7 @@ async function main() { stdlib_ex_fc: customStdlibFc.stdlib_ex_fc, }; - const featureSets = createFeatureSets(2, 2); + const featureSets = createFeatureSets(10, 15); console.log(`Generated ${featureSets.length} feature sets.`); From 3ade25f5cde07f22e08068475875b6ab480ce4e6 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Fri, 14 Mar 2025 12:31:05 +0100 Subject: [PATCH 10/12] tests: added randomized swarm testing. --- .../autogenerated/gen-initof-reachability.ts | 205 ++++++++++-------- 1 file changed, 117 insertions(+), 88 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 43486dec6..ed0edbbf2 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -78,16 +78,22 @@ type GeneratorDescriptor = { generator: fc.Arbitrary; }; -function createTestModules( +function getGeneratorFactory( astF: FactoryAst, allowedFeatures: Set, - compilationBatchSize: number, -): { tests: Test[]; numberOfContracts: number } { +): { + generator: fc.Arbitrary[]>; + batchBuilder: ( + items: ItemWithDeclarations[], + extraModule: A.AstModule, + compilationBatchSize: number, + ) => Test[]; +} { let idCounter = 0; const emptySrcInfo = getSrcInfo(" ", 0, 0, null, "user"); const config: GlobalConfig = { - maxFunCallDepth: 2, + maxFunCallDepth: 10, }; function makeInitOf( @@ -1228,7 +1234,7 @@ function createTestModules( function expressionGenerator( currentFunCallDepth: number, - ): fc.Arbitrary[]> { + ): fc.Arbitrary[]> { const exprGens = [ initOfGenerator(), staticCallGenerator(currentFunCallDepth), @@ -1246,13 +1252,14 @@ function createTestModules( ) .map((genDesc) => genDesc.generator); - // Chain all the above generators - return chainGenerators(finalGens); + return finalGens.length === 0 + ? fc.constant([]) + : fc.oneof(...finalGens); } function statementGenerator( currentFunCallDepth: number, - ): fc.Arbitrary[]> { + ): fc.Arbitrary[]> { return expressionGenerator(currentFunCallDepth).chain((genExprs) => { const generators: fc.Arbitrary< readonly ItemWithDeclarations[] @@ -1283,9 +1290,14 @@ function createTestModules( ) .map((genDesc) => genDesc.generator); - generators.push(...finalGens); + generators.push( + finalGens.length === 0 + ? fc.constant([]) + : fc.oneof(...finalGens), + ); } + // This will ensure that for every generated expression, we will choose at least one statement return chainGenerators(generators); }); } @@ -1296,9 +1308,10 @@ function createTestModules( const finalContracts: A.AstContract[] = []; if (stmtsData.item.assignedStateInit) { + const newName = `${stmtsData.item.name}_${idCounter++}`; finalContracts.push( makeContract( - makeId(stmtsData.item.name), + makeId(newName), stmtsData.item.statements, Array.from( stmtsData.declarations.contractDeclarations.values(), @@ -1328,17 +1341,19 @@ function createTestModules( currentFunCallDepth: number, ): fc.Arbitrary[]> { return statementGenerator(currentFunCallDepth).chain((genStmts) => { - const generators: fc.Arbitrary< + const finalGens: fc.Arbitrary< ItemWithDeclarations[] >[] = []; for (const stmtsWithName of genStmts) { const contractGens = [contractWithInitGenerator(stmtsWithName)]; - generators.push(...contractGens); + finalGens.push(...contractGens); } - return chainGenerators(generators); + return finalGens.length === 0 + ? fc.constant([]) + : fc.oneof(...finalGens); }); } @@ -1405,34 +1420,9 @@ function createTestModules( return tests; } - const genResult = fc.sample(contractGenerator(0), 1); - if (genResult.length !== 1) { - throw new Error( - "Generator should return exactly one element, which is an array containing all the test cases.", - ); - } - // The unique element in the array is ensured to exist - const allCases = genResult[0]!; - - const numberOfGeneratedContracts = allCases.length; - - // Prepare the Deployer contract and Dummies necessary for tests. - const parser = getParser(astF); - const extraModule = parser.parse({ - path: ".", - code: fs - .readFileSync(path.join(__dirname, "contracts/deployer.tact")) - .toString(), - origin: "user", - }); - return { - tests: createTestsInBatches( - allCases, - extraModule, - compilationBatchSize, - ), - numberOfContracts: numberOfGeneratedContracts, + generator: contractGenerator(0), + batchBuilder: createTestsInBatches, }; } @@ -1613,6 +1603,16 @@ async function main() { stdlib_ex_fc: customStdlibFc.stdlib_ex_fc, }; + // Prepare the Deployer contract and Dummies necessary for tests. + const parser = getParser(astF); + const extraModule = parser.parse({ + path: ".", + code: fs + .readFileSync(path.join(__dirname, "contracts/deployer.tact")) + .toString(), + origin: "user", + }); + const featureSets = createFeatureSets(10, 15); console.log(`Generated ${featureSets.length} feature sets.`); @@ -1627,6 +1627,7 @@ async function main() { astF, compilationBatchSize, customStdlib, + extraModule, ), ), ); @@ -1653,6 +1654,7 @@ async function executeTestsOnFeatures( astF: FactoryAst, compilationBatchSize: number, customStdlib: CustomStdlib, + extraModule: A.AstModule, ): Promise { let errorCount = 0; @@ -1665,60 +1667,87 @@ async function executeTestsOnFeatures( const featureSetString = `{${Array.from(featureSet).join(", ")}}`; console.log(`#${idx}: Using feature set: ${featureSetString}`); - const tests = createTestModules(astF, featureSet, compilationBatchSize); + const testFactory = getGeneratorFactory(astF, featureSet); - console.log( - `#${idx}: Generated ${tests.numberOfContracts} contracts, grouped in ${tests.tests.length} compilation batches.`, - ); + await fc.assert( + fc.asyncProperty( + fc.array(testFactory.generator, { + minLength: compilationBatchSize, + }), + async (genResult) => { + const allCases = genResult.flat(); + const numberOfGeneratedContracts = allCases.length; + const tests = testFactory.batchBuilder( + allCases, + extraModule, + compilationBatchSize, + ); - nextTest: for (const test of tests.tests) { - console.log(`#${idx}: Compiling next batch...`); - try { - const contractCodes = await buildModule( - astF, - test.module, - customStdlib, - true, - ); - for (const contractName of test.contractNames) { - try { - console.log(`#${idx}: Testing contract ${contractName}...`); - await testContracts(contractName, contractCodes); - console.log(`#${idx}: ${contractName} passed.`); - } catch (e) { - if (e instanceof Error) { - errorCount++; - console.log( - `#${idx}: ${contractName} failed. See ${errorFilename}.`, - ); - handleError( - e, - fileDescriptor, - featureSetString, + console.log( + `#${idx}: Generated ${numberOfGeneratedContracts} contracts, grouped in ${tests.length} compilation batches.`, + ); + + nextTest: for (const test of tests) { + console.log(`#${idx}: Compiling next batch...`); + try { + const contractCodes = await buildModule( + astF, test.module, + customStdlib, + true, ); - continue nextTest; - } else { - // Cannot handle this error. Stop the entire process since this is something unexpected. - throw e; + for (const contractName of test.contractNames) { + try { + console.log( + `#${idx}: Testing contract ${contractName}...`, + ); + await testContracts( + contractName, + contractCodes, + ); + console.log(`#${idx}: ${contractName} passed.`); + } catch (e) { + if (e instanceof Error) { + errorCount++; + console.log( + `#${idx}: ${contractName} failed. See ${errorFilename}.`, + ); + handleError( + e, + fileDescriptor, + featureSetString, + test.module, + ); + continue nextTest; + } else { + // Cannot handle this error. Stop the entire process since this is something unexpected. + throw e; + } + } + } + } catch (e) { + if (e instanceof Error) { + errorCount++; + const batchString = `[${test.contractNames.join(", ")}]`; + console.log( + `#${idx}: Batch ${batchString} failed compilation. See ${errorFilename}.`, + ); + handleError( + e, + fileDescriptor, + featureSetString, + test.module, + ); + continue nextTest; + } else { + // Cannot handle this error. Stop the entire process since this is something unexpected. + throw e; + } } } - } - } catch (e) { - if (e instanceof Error) { - errorCount++; - const batchString = `[${test.contractNames.join(", ")}]`; - console.log( - `#${idx}: Batch ${batchString} failed compilation. See ${errorFilename}.`, - ); - handleError(e, fileDescriptor, featureSetString, test.module); - continue nextTest; - } else { - // Cannot handle this error. Stop the entire process since this is something unexpected. - throw e; - } - } - } + }, + ), + ); return errorCount; } From 8f7b503621e8eab99fffccafdf410db0f4c3b492 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Tue, 18 Mar 2025 01:08:15 +0100 Subject: [PATCH 11/12] tests: simplification of generators. Addition of generator traces. Added statistics (though I need to improve the script on how to call them). --- .../autogenerated/gen-initof-reachability.ts | 710 ++++++++++++------ 1 file changed, 466 insertions(+), 244 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index ed0edbbf2..978c01f3d 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -24,6 +24,7 @@ import { findTransaction } from "@ton/test-utils"; type ItemWithDeclarations = { item: T; declarations: Declarations; + featuresTrace: GeneratorFeatureType[]; }; type Declarations = { @@ -54,16 +55,21 @@ type Test = { const GeneratorFeature = { LET_STATEMENT: "LET", EXPRESSION_STATEMENT: "EXPRESSION", - CONDITION_STATEMENT: "CONDITION", + IF_NO_ELSE_STATEMENT: "IF_NO_ELSE", + IF_THEN_STATEMENT: "IF_THEN", + IF_ELSE_STATEMENT: "IF_ELSE", WHILE_STATEMENT: "WHILE", UNTIL_STATEMENT: "UNTIL", REPEAT_STATEMENT: "REPEAT", DESTRUCT_STATEMENT: "DESTRUCT", BLOCK_STATEMENT: "BLOCK", TRY_STATEMENT: "TRY", + CATCH_STATEMENT: "CATCH", STATIC_CALL_EXPRESSION: "STATIC_CALL", INIT_OF_EXPRESSION: "INIT_OF", + + CONTRACT_WITH_INIT: "CONTRACT_WITH_INIT", } as const; type GeneratorFeatureType = @@ -82,7 +88,7 @@ function getGeneratorFactory( astF: FactoryAst, allowedFeatures: Set, ): { - generator: fc.Arbitrary[]>; + generator: fc.Arbitrary>; batchBuilder: ( items: ItemWithDeclarations[], extraModule: A.AstModule, @@ -586,26 +592,33 @@ function getGeneratorFactory( } */ - function withEmptyDeclarations(item: T): ItemWithDeclarations { + function withEmptyDeclarations( + item: T, + featuresTrace: GeneratorFeatureType[], + ): ItemWithDeclarations { return { item: item, declarations: { globalDeclarations: new Map(), contractDeclarations: new Map(), }, + featuresTrace, }; } function withDeclarations( item: T, declarations: Declarations, + featuresTrace: GeneratorFeatureType[], ): ItemWithDeclarations { return { item, declarations, + featuresTrace, }; } + /* function chainGenerators( gens: fc.Arbitrary[], ): fc.Arbitrary { @@ -627,7 +640,7 @@ function getGeneratorFactory( gens.slice(1), ); }); - } + }*/ /* function contractConstantGenerator(baseExpr: A.AstExpression): GeneratorWithDeclarations { @@ -653,14 +666,17 @@ function getGeneratorFactory( }*/ function initOfGenerator(): GeneratorDescriptor< - readonly ItemWithDeclarations[] + ItemWithDeclarations > { - const generator = fc.constant([ - withEmptyDeclarations({ - name: "InitOf", - expression: makeInitOf(makeId("Deployer"), []), - }), - ]); + const generator = fc.constant( + withEmptyDeclarations( + { + name: "InitOf", + expression: makeInitOf(makeId("Deployer"), []), + }, + [GeneratorFeature.INIT_OF_EXPRESSION], + ), + ); return { feature: GeneratorFeature.INIT_OF_EXPRESSION, @@ -671,52 +687,67 @@ function getGeneratorFactory( function staticCallGenerator( currentFunCallDepth: number, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { if (currentFunCallDepth >= config.maxFunCallDepth) { - return { - feature: GeneratorFeature.STATIC_CALL_EXPRESSION, - ignoreFeatureSet: false, - generator: fc.constant([]), - }; + // At the maximum depth, we do not recurse more, but generate + // the base initOf Deployer() + return initOfGenerator(); } + const buildGenerator = ( + returnStmt: A.AstStatementReturn, + genStmt: ItemWithDeclarations, + ) => { + const finalGlobalDecls: Map = new Map( + genStmt.declarations.globalDeclarations, + ); + + const funName = makeFreshFunctionName(); + const funDef = makeFunctionDefinition( + funName, + [makeTypedParameter("arg", "Int")], + [...genStmt.item.statements, returnStmt], + [], + makeTypeId("StateInit"), + ); + const call = makeStaticCall(funName, [makeId("arg")]); + const testName = `StaticCall_${genStmt.item.name}`; + finalGlobalDecls.set(idText(funName), funDef); + return fc.constant( + withDeclarations( + { name: testName, expression: call }, + { + globalDeclarations: finalGlobalDecls, + contractDeclarations: new Map(), + }, + [ + ...genStmt.featuresTrace, + GeneratorFeature.STATIC_CALL_EXPRESSION, + ], + ), + ); + }; + const generator = statementGenerator(currentFunCallDepth + 1).chain( - (genStmts) => { - const finalItems: ItemWithDeclarations[] = - []; - - for (const stmtsWithName of genStmts) { - const finalGlobalDecls: Map = - new Map(stmtsWithName.declarations.globalDeclarations); - - if (stmtsWithName.item.assignedStateInit) { - const funName = makeFreshFunctionName(); - const returnStmt = makeReturnStatement( - makeId("stateInit"), - ); - const funDef = makeFunctionDefinition( - funName, - [makeTypedParameter("arg", "Int")], - [...stmtsWithName.item.statements, returnStmt], - [], - makeTypeId("StateInit"), - ); - const call = makeStaticCall(funName, [makeId("arg")]); - const testName = `StaticCall_${stmtsWithName.item.name}`; - finalGlobalDecls.set(idText(funName), funDef); - finalItems.push( - withDeclarations( - { name: testName, expression: call }, - { - globalDeclarations: finalGlobalDecls, - contractDeclarations: new Map(), - }, - ), - ); - } + (genStmt) => { + if (!genStmt.item.assignedStateInit) { + // If the statement did not assign the stateInit variable, + // then if we use the statement as such, it would + // result in an invalid function. In this case, default into using + // "return initOf Deployer()" + return initOfGenerator().generator.chain((initOfExpr) => + buildGenerator( + makeReturnStatement(initOfExpr.item.expression), + genStmt, + ), + ); } - return fc.constant(finalItems); + // The statement assigned the stateInit variable, just return it + return buildGenerator( + makeReturnStatement(makeId("stateInit")), + genStmt, + ); }, ); @@ -812,7 +843,7 @@ function getGeneratorFactory( function letStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const varName = makeId("stateInit"); const varType = makeTypeId("StateInit"); const stmtLet = makeLetStatement( @@ -822,7 +853,7 @@ function getGeneratorFactory( ); const newName = `Let_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -830,8 +861,9 @@ function getGeneratorFactory( assignedStateInit: true, }, baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.LET_STATEMENT], ), - ]); + ); return { feature: GeneratorFeature.LET_STATEMENT, @@ -842,10 +874,10 @@ function getGeneratorFactory( function expressionStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const stmtExpr = makeExpressionStatement(baseExpr.item.expression); const newName = `Expr_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -853,8 +885,12 @@ function getGeneratorFactory( assignedStateInit: false, }, baseExpr.declarations, + [ + ...baseExpr.featuresTrace, + GeneratorFeature.EXPRESSION_STATEMENT, + ], ), - ]); + ); return { feature: GeneratorFeature.EXPRESSION_STATEMENT, @@ -863,67 +899,140 @@ function getGeneratorFactory( }; } - function conditionStatementGenerator( + function ifNoElseStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), makeInitOf(makeId("Dummy1"), []), ); - const cond1Expr = makeBinaryExpression( + const condExpr = makeBinaryExpression( "==", makeBinaryExpression("-", makeId("arg"), makeId("arg")), makeInt(0n), ); - const cond2Expr = makeBinaryExpression( - "==", - makeBinaryExpression( - "+", - makeBinaryExpression("-", makeId("arg"), makeId("arg")), - makeInt(1n), + const thenStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); + const stmt = makeConditionStatement(condExpr, [thenStmt], undefined); + + const newName = `IfNoElse_${baseExpr.item.name}`; + + const generator = fc.constant( + withDeclarations( + { + name: newName, + statements: [initVarStmt, stmt], + assignedStateInit: true, + }, + baseExpr.declarations, + [ + ...baseExpr.featuresTrace, + GeneratorFeature.IF_NO_ELSE_STATEMENT, + ], ), + ); + + return { + feature: GeneratorFeature.IF_NO_ELSE_STATEMENT, + ignoreFeatureSet: false, + generator, + }; + } + + function ifThenStatementGenerator( + baseExpr: ItemWithDeclarations, + ): GeneratorDescriptor> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const condExpr = makeBinaryExpression( + "==", + makeBinaryExpression("-", makeId("arg"), makeId("arg")), makeInt(0n), ); - const expr = makeAssignStatement( + const thenStmt = makeAssignStatement( makeId("stateInit"), baseExpr.item.expression, ); - const dummy2 = makeAssignStatement( + const elseStmt = makeAssignStatement( makeId("stateInit"), makeInitOf(makeId("Dummy2"), []), ); - const case1 = makeConditionStatement(cond1Expr, [expr], undefined); - const case2 = makeConditionStatement(cond1Expr, [expr], [dummy2]); - const case3 = makeConditionStatement(cond2Expr, [dummy2], [expr]); + const stmt = makeConditionStatement(condExpr, [thenStmt], [elseStmt]); - const case1Name = `IfNoElse_${baseExpr.item.name}`; - const case2Name = `IfThen_${baseExpr.item.name}`; - const case3Name = `IfElse_${baseExpr.item.name}`; + const newName = `IfThen_${baseExpr.item.name}`; const generator = fc.constant( - [ - { - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, + withDeclarations( { - name: case2Name, - statements: [initVarStmt, case2], + name: newName, + statements: [initVarStmt, stmt], assignedStateInit: true, }, + baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.IF_THEN_STATEMENT], + ), + ); + + return { + feature: GeneratorFeature.IF_THEN_STATEMENT, + ignoreFeatureSet: false, + generator, + }; + } + + function ifElseStatementGenerator( + baseExpr: ItemWithDeclarations, + ): GeneratorDescriptor> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + const condExpr = makeBinaryExpression( + "==", + makeBinaryExpression( + "+", + makeBinaryExpression("-", makeId("arg"), makeId("arg")), + makeInt(1n), + ), + makeInt(0n), + ); + + const thenStmt = makeAssignStatement( + makeId("stateInit"), + makeInitOf(makeId("Dummy2"), []), + ); + + const elseStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); + + const stmt = makeConditionStatement(condExpr, [thenStmt], [elseStmt]); + + const newName = `IfElse_${baseExpr.item.name}`; + + const generator = fc.constant( + withDeclarations( { - name: case3Name, - statements: [initVarStmt, case3], + name: newName, + statements: [initVarStmt, stmt], assignedStateInit: true, }, - ].map((item) => withDeclarations(item, baseExpr.declarations)), + baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.IF_ELSE_STATEMENT], + ), ); return { - feature: GeneratorFeature.CONDITION_STATEMENT, + feature: GeneratorFeature.IF_ELSE_STATEMENT, ignoreFeatureSet: false, generator, }; @@ -931,7 +1040,7 @@ function getGeneratorFactory( function whileStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -955,7 +1064,7 @@ function getGeneratorFactory( const newName = `While_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -963,8 +1072,9 @@ function getGeneratorFactory( assignedStateInit: true, }, baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.WHILE_STATEMENT], ), - ]); + ); return { feature: GeneratorFeature.WHILE_STATEMENT, @@ -975,7 +1085,7 @@ function getGeneratorFactory( function untilStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -999,7 +1109,7 @@ function getGeneratorFactory( const newName = `Until_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -1007,8 +1117,9 @@ function getGeneratorFactory( assignedStateInit: true, }, baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.UNTIL_STATEMENT], ), - ]); + ); return { feature: GeneratorFeature.UNTIL_STATEMENT, @@ -1019,7 +1130,7 @@ function getGeneratorFactory( function repeatStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -1043,7 +1154,7 @@ function getGeneratorFactory( const newName = `Repeat_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -1051,8 +1162,9 @@ function getGeneratorFactory( assignedStateInit: true, }, baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.REPEAT_STATEMENT], ), - ]); + ); return { feature: GeneratorFeature.REPEAT_STATEMENT, @@ -1103,7 +1215,7 @@ function getGeneratorFactory( function destructStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const identifiers: Map = new Map(); identifiers.set("init", [makeId("init"), makeId("stateInit")]); @@ -1122,7 +1234,7 @@ function getGeneratorFactory( const newName = `Destruct_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -1130,8 +1242,12 @@ function getGeneratorFactory( assignedStateInit: true, }, baseExpr.declarations, + [ + ...baseExpr.featuresTrace, + GeneratorFeature.DESTRUCT_STATEMENT, + ], ), - ]); + ); return { feature: GeneratorFeature.DESTRUCT_STATEMENT, @@ -1142,7 +1258,7 @@ function getGeneratorFactory( function blockStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -1158,7 +1274,7 @@ function getGeneratorFactory( const newName = `Block_${baseExpr.item.name}`; - const generator = fc.constant([ + const generator = fc.constant( withDeclarations( { name: newName, @@ -1166,8 +1282,9 @@ function getGeneratorFactory( assignedStateInit: true, }, baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.BLOCK_STATEMENT], ), - ]); + ); return { feature: GeneratorFeature.BLOCK_STATEMENT, ignoreFeatureSet: false, @@ -1177,7 +1294,47 @@ function getGeneratorFactory( function tryStatementGenerator( baseExpr: ItemWithDeclarations, - ): GeneratorDescriptor[]> { + ): GeneratorDescriptor> { + const initVarStmt = makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Dummy1"), []), + ); + + const exprStmt = makeAssignStatement( + makeId("stateInit"), + baseExpr.item.expression, + ); + + const tryStmt = makeTryStatement( + makeFreshVarName(), + [exprStmt], + undefined, + ); + + const newName = `Try_${baseExpr.item.name}`; + + const generator = fc.constant( + withDeclarations( + { + name: newName, + statements: [initVarStmt, tryStmt], + assignedStateInit: true, + }, + baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.TRY_STATEMENT], + ), + ); + return { + feature: GeneratorFeature.TRY_STATEMENT, + ignoreFeatureSet: false, + generator, + }; + } + + function catchStatementGenerator( + baseExpr: ItemWithDeclarations, + ): GeneratorDescriptor> { const initVarStmt = makeLetStatement( makeId("stateInit"), makeTypeId("StateInit"), @@ -1197,36 +1354,27 @@ function getGeneratorFactory( makeStaticCall(makeId("require"), [requireArg, makeString("")]), ); - const case1 = makeTryStatement( - makeFreshVarName(), - [exprStmt], - undefined, - ); - const case2 = makeTryStatement( + const catchStmt = makeTryStatement( makeFreshVarName(), [requireStatement], [exprStmt], ); - const case1Name = `Try_${baseExpr.item.name}`; const case2Name = `Catch_${baseExpr.item.name}`; const generator = fc.constant( - [ - { - name: case1Name, - statements: [initVarStmt, case1], - assignedStateInit: true, - }, + withDeclarations( { name: case2Name, - statements: [initVarStmt, case2], + statements: [initVarStmt, catchStmt], assignedStateInit: true, }, - ].map((item) => withDeclarations(item, baseExpr.declarations)), + baseExpr.declarations, + [...baseExpr.featuresTrace, GeneratorFeature.CATCH_STATEMENT], + ), ); return { - feature: GeneratorFeature.TRY_STATEMENT, + feature: GeneratorFeature.CATCH_STATEMENT, ignoreFeatureSet: false, generator, }; @@ -1234,127 +1382,167 @@ function getGeneratorFactory( function expressionGenerator( currentFunCallDepth: number, - ): fc.Arbitrary[]> { - const exprGens = [ + ): fc.Arbitrary> { + const baseGens = [ initOfGenerator(), - staticCallGenerator(currentFunCallDepth), - //methodCallGenerator(), //contractConstantGenerator(initOf), //contractFieldGenerator(initOf) ]; + const recursiveGens = [ + staticCallGenerator(currentFunCallDepth), + //methodCallGenerator(), + ]; + // Keep only those generators allowed by the features - const finalGens = exprGens - .filter( - (genDesc) => - genDesc.ignoreFeatureSet || - allowedFeatures.has(genDesc.feature), - ) - .map((genDesc) => genDesc.generator); + const finalBaseGenDesc = baseGens.filter( + (genDesc) => + genDesc.ignoreFeatureSet || + allowedFeatures.has(genDesc.feature), + ); + + const finalRecursiveGenDesc = recursiveGens.filter( + (genDesc) => + genDesc.ignoreFeatureSet || + allowedFeatures.has(genDesc.feature), + ); + + if ( + finalBaseGenDesc.length === 0 || + finalRecursiveGenDesc.length === 0 + ) { + // Uniformly choose + const finalBaseGens = finalBaseGenDesc.map( + (genDesc) => genDesc.generator, + ); + const finalRecursiveGens = finalRecursiveGenDesc.map( + (genDesc) => genDesc.generator, + ); + return fc.oneof(...finalBaseGens, ...finalRecursiveGens); + } - return finalGens.length === 0 - ? fc.constant([]) - : fc.oneof(...finalGens); + // Assign weights proportional to the current function call depth: + // Bigger weight to recursive generators when the function call depth is shallow + const desiredRecursiveProb = + ((0.1 - 0.9) / config.maxFunCallDepth) * currentFunCallDepth + 0.9; + + // Fix a weight for the base generators + const baseWeight = 10; + const totalBaseWeight = baseWeight * finalBaseGenDesc.length; + + const totalRecursiveWeight = + (desiredRecursiveProb * totalBaseWeight) / + (1 - desiredRecursiveProb); + const recursiveWeight = Math.ceil( + totalRecursiveWeight / finalRecursiveGenDesc.length, + ); + + const finalBaseGens = finalBaseGenDesc.map((genDesc) => { + return { arbitrary: genDesc.generator, weight: baseWeight }; + }); + const finalRecursiveGens = finalRecursiveGenDesc.map((genDesc) => { + return { arbitrary: genDesc.generator, weight: recursiveWeight }; + }); + + return fc.oneof(...finalBaseGens, ...finalRecursiveGens); } function statementGenerator( currentFunCallDepth: number, - ): fc.Arbitrary[]> { - return expressionGenerator(currentFunCallDepth).chain((genExprs) => { - const generators: fc.Arbitrary< - readonly ItemWithDeclarations[] - >[] = []; - - for (const exprWithName of genExprs) { - const stmtGens = [ - letStatementGenerator(exprWithName), - expressionStatementGenerator(exprWithName), - conditionStatementGenerator(exprWithName), - whileStatementGenerator(exprWithName), - untilStatementGenerator(exprWithName), - repeatStatementGenerator(exprWithName) /* + ): fc.Arbitrary> { + return expressionGenerator(currentFunCallDepth).chain((genExpr) => { + const stmtGens = [ + letStatementGenerator(genExpr), + expressionStatementGenerator(genExpr), + ifNoElseStatementGenerator(genExpr), + ifThenStatementGenerator(genExpr), + ifElseStatementGenerator(genExpr), + whileStatementGenerator(genExpr), + untilStatementGenerator(genExpr), + repeatStatementGenerator(genExpr) /* forEachStatementGenerator( - exprWithName + genExpr ),*/, - destructStatementGenerator(exprWithName), - blockStatementGenerator(exprWithName), - tryStatementGenerator(exprWithName), - ]; - - // Keep only those generators allowed by the features - const finalGens = stmtGens - .filter( - (genDesc) => - genDesc.ignoreFeatureSet || - allowedFeatures.has(genDesc.feature), - ) - .map((genDesc) => genDesc.generator); - - generators.push( - finalGens.length === 0 - ? fc.constant([]) - : fc.oneof(...finalGens), - ); - } - - // This will ensure that for every generated expression, we will choose at least one statement - return chainGenerators(generators); + destructStatementGenerator(genExpr), + blockStatementGenerator(genExpr), + tryStatementGenerator(genExpr), + catchStatementGenerator(genExpr), + ]; + + // Keep only those generators allowed by the features + const finalGens = stmtGens + .filter( + (genDesc) => + genDesc.ignoreFeatureSet || + allowedFeatures.has(genDesc.feature), + ) + .map((genDesc) => genDesc.generator); + + return fc.oneof(...finalGens); }); } function contractWithInitGenerator( stmtsData: ItemWithDeclarations, - ): fc.Arbitrary[]> { - const finalContracts: A.AstContract[] = []; - - if (stmtsData.item.assignedStateInit) { - const newName = `${stmtsData.item.name}_${idCounter++}`; - finalContracts.push( - makeContract( - makeId(newName), - stmtsData.item.statements, - Array.from( - stmtsData.declarations.contractDeclarations.values(), - ), - ), - ); - } - /*finalContracts.push( - makeContractNoSend( - makeId(stmtsData.name + "_NoSend"), - stmtsData.statements, - contractDecls, - ) - );*/ - return fc.constant( - finalContracts.map((item) => - withDeclarations(item, { + ): GeneratorDescriptor> { + const newName = `${stmtsData.item.name}_${idCounter++}`; + const stmtsToUse = stmtsData.item.assignedStateInit + ? stmtsData.item.statements + : [ + ...stmtsData.item.statements, + makeLetStatement( + makeId("stateInit"), + makeTypeId("StateInit"), + makeInitOf(makeId("Deployer"), []), + ), + ]; + + const contract = makeContract( + makeId(newName), + stmtsToUse, + Array.from(stmtsData.declarations.contractDeclarations.values()), + ); + + const generator = fc.constant( + withDeclarations( + contract, + { globalDeclarations: stmtsData.declarations.globalDeclarations, contractDeclarations: new Map(), - }), + }, + [ + ...stmtsData.featuresTrace, + GeneratorFeature.CONTRACT_WITH_INIT, + ], ), ); + + return { + feature: GeneratorFeature.CONTRACT_WITH_INIT, + ignoreFeatureSet: true, + generator, + }; } function contractGenerator( currentFunCallDepth: number, - ): fc.Arbitrary[]> { - return statementGenerator(currentFunCallDepth).chain((genStmts) => { - const finalGens: fc.Arbitrary< - ItemWithDeclarations[] - >[] = []; - - for (const stmtsWithName of genStmts) { + ): fc.Arbitrary> { + return statementGenerator(currentFunCallDepth).chain( + (stmtsWithName) => { const contractGens = [contractWithInitGenerator(stmtsWithName)]; - finalGens.push(...contractGens); - } + const finalGens = contractGens + .filter( + (genDesc) => + genDesc.ignoreFeatureSet || + allowedFeatures.has(genDesc.feature), + ) + .map((genDesc) => genDesc.generator); - return finalGens.length === 0 - ? fc.constant([]) - : fc.oneof(...finalGens); - }); + return fc.oneof(...finalGens); + }, + ); } /* @@ -1619,7 +1807,7 @@ async function main() { const compilationBatchSize = 20; - const reports = await Promise.all( + await Promise.all( featureSets.map((featureSet, idx) => executeTestsOnFeatures( featureSet, @@ -1631,21 +1819,6 @@ async function main() { ), ), ); - - const numberOfErrors = reports.reduce((prev, curr) => prev + curr, 0); - - if (numberOfErrors > 0) { - console.log( - `There were a total of ${numberOfErrors} errors. See the following log files:`, - ); - reports.forEach((errorCount, idx) => { - if (errorCount > 0) { - console.log(`error-${idx + 1}.log`); - } - }); - } else { - console.log("There were no errors."); - } } async function executeTestsOnFeatures( @@ -1655,9 +1828,7 @@ async function executeTestsOnFeatures( compilationBatchSize: number, customStdlib: CustomStdlib, extraModule: A.AstModule, -): Promise { - let errorCount = 0; - +) { const errorFilename = `error-${idx}.log`; const fileDescriptor = fs.openSync( path.join(__dirname, errorFilename), @@ -1674,8 +1845,7 @@ async function executeTestsOnFeatures( fc.array(testFactory.generator, { minLength: compilationBatchSize, }), - async (genResult) => { - const allCases = genResult.flat(); + async (allCases) => { const numberOfGeneratedContracts = allCases.length; const tests = testFactory.batchBuilder( allCases, @@ -1687,7 +1857,7 @@ async function executeTestsOnFeatures( `#${idx}: Generated ${numberOfGeneratedContracts} contracts, grouped in ${tests.length} compilation batches.`, ); - nextTest: for (const test of tests) { + for (const test of tests) { console.log(`#${idx}: Compiling next batch...`); try { const contractCodes = await buildModule( @@ -1708,7 +1878,6 @@ async function executeTestsOnFeatures( console.log(`#${idx}: ${contractName} passed.`); } catch (e) { if (e instanceof Error) { - errorCount++; console.log( `#${idx}: ${contractName} failed. See ${errorFilename}.`, ); @@ -1718,19 +1887,16 @@ async function executeTestsOnFeatures( featureSetString, test.module, ); - continue nextTest; - } else { - // Cannot handle this error. Stop the entire process since this is something unexpected. - throw e; } + // Interrupt the entire process + throw e; } } } catch (e) { if (e instanceof Error) { - errorCount++; const batchString = `[${test.contractNames.join(", ")}]`; console.log( - `#${idx}: Batch ${batchString} failed compilation. See ${errorFilename}.`, + `#${idx}: Batch ${batchString} failed processing. See ${errorFilename}.`, ); handleError( e, @@ -1738,18 +1904,14 @@ async function executeTestsOnFeatures( featureSetString, test.module, ); - continue nextTest; - } else { - // Cannot handle this error. Stop the entire process since this is something unexpected. - throw e; } + // Interrupt the entire process + throw e; } } }, ), ); - - return errorCount; } function handleError( @@ -1810,4 +1972,64 @@ function ensure( }; } +/* +function statistics() { + const astF = getAstFactory(); + + const featureSet = new Set(Object.values(GeneratorFeature)); + + const testFactory = getGeneratorFactory(astF, featureSet); + + const featureCount: Map = new Map(); + const depthCount: Map = new Map(); + + const samples = fc.sample(testFactory.generator, 100000); + + for (const sample of samples) { + for (const feature of sample.featuresTrace) { + const count = featureCount.get(feature); + if (typeof count === "undefined") { + featureCount.set(feature, 1); + } else { + featureCount.set(feature, count + 1); + } + } + + // Now count the function call depth + const callDepth = sample.featuresTrace.filter( + (feature) => feature === GeneratorFeature.STATIC_CALL_EXPRESSION, + ).length; + const count = depthCount.get(callDepth); + if (typeof count === "undefined") { + depthCount.set(callDepth, 1); + } else { + depthCount.set(callDepth, count + 1); + } + } + + const totalFeatureCount = featureCount + .values() + .reduce((prev, curr) => prev + curr, 0); + const totalDepthCount = depthCount + .values() + .reduce((prev, curr) => prev + curr, 0); + + for (const [feature, count] of featureCount) { + console.log(`${feature}: ${count / totalFeatureCount}`); + } + + for (const [depth, count] of depthCount) { + console.log(`${depth}: ${count / totalDepthCount}`); + } + + fc.statistics( + testFactory.generator, + (sample) => sample.featuresTrace, + 100000, + ); +} + +statistics(); +*/ + void main(); From b3ac57662d9fbae3d02bd6239317eccf940db842 Mon Sep 17 00:00:00 2001 From: jeshecdom Date: Wed, 19 Mar 2025 02:30:36 +0100 Subject: [PATCH 12/12] tests: further simplifications to generators. Stats can now be invoked from command line. Added stats for function call depths (they are mostly uniform as well). --- .../autogenerated/gen-initof-reachability.ts | 255 ++++++++---------- 1 file changed, 115 insertions(+), 140 deletions(-) diff --git a/src/test/autogenerated/gen-initof-reachability.ts b/src/test/autogenerated/gen-initof-reachability.ts index 978c01f3d..0364a9c66 100644 --- a/src/test/autogenerated/gen-initof-reachability.ts +++ b/src/test/autogenerated/gen-initof-reachability.ts @@ -43,10 +43,6 @@ type StatementsWrapper = { assignedStateInit: boolean; }; -type GlobalConfig = { - maxFunCallDepth: number; -}; - type Test = { module: A.AstModule; contractNames: string[]; @@ -77,16 +73,13 @@ type GeneratorFeatureType = type GeneratorDescriptor = { feature: GeneratorFeatureType; - // Setting the flag to true, forces the feature to always be included, - // independently of the constructed feature set. - // If the flag is set to false, then the feature set will be taken into account. - ignoreFeatureSet: boolean; generator: fc.Arbitrary; }; function getGeneratorFactory( astF: FactoryAst, allowedFeatures: Set, + maxFunCallDepth: number, ): { generator: fc.Arbitrary>; batchBuilder: ( @@ -98,10 +91,6 @@ function getGeneratorFactory( let idCounter = 0; const emptySrcInfo = getSrcInfo(" ", 0, 0, null, "user"); - const config: GlobalConfig = { - maxFunCallDepth: 10, - }; - function makeInitOf( contract: A.AstId, args: A.AstExpression[], @@ -680,20 +669,14 @@ function getGeneratorFactory( return { feature: GeneratorFeature.INIT_OF_EXPRESSION, - ignoreFeatureSet: true, generator, }; } function staticCallGenerator( currentFunCallDepth: number, + desiredFunCallDepth: number, ): GeneratorDescriptor> { - if (currentFunCallDepth >= config.maxFunCallDepth) { - // At the maximum depth, we do not recurse more, but generate - // the base initOf Deployer() - return initOfGenerator(); - } - const buildGenerator = ( returnStmt: A.AstStatementReturn, genStmt: ItemWithDeclarations, @@ -728,32 +711,32 @@ function getGeneratorFactory( ); }; - const generator = statementGenerator(currentFunCallDepth + 1).chain( - (genStmt) => { - if (!genStmt.item.assignedStateInit) { - // If the statement did not assign the stateInit variable, - // then if we use the statement as such, it would - // result in an invalid function. In this case, default into using - // "return initOf Deployer()" - return initOfGenerator().generator.chain((initOfExpr) => - buildGenerator( - makeReturnStatement(initOfExpr.item.expression), - genStmt, - ), - ); - } - - // The statement assigned the stateInit variable, just return it - return buildGenerator( - makeReturnStatement(makeId("stateInit")), - genStmt, + const generator = statementGenerator( + currentFunCallDepth + 1, + desiredFunCallDepth, + ).chain((genStmt) => { + if (!genStmt.item.assignedStateInit) { + // If the statement did not assign the stateInit variable, + // then if we use the statement as such, it would + // result in an invalid function. In this case, default into using + // "return initOf Deployer()" + return initOfGenerator().generator.chain((initOfExpr) => + buildGenerator( + makeReturnStatement(initOfExpr.item.expression), + genStmt, + ), ); - }, - ); + } + + // The statement assigned the stateInit variable, just return it + return buildGenerator( + makeReturnStatement(makeId("stateInit")), + genStmt, + ); + }); return { feature: GeneratorFeature.STATIC_CALL_EXPRESSION, - ignoreFeatureSet: false, generator, }; } @@ -867,7 +850,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.LET_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -894,7 +876,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.EXPRESSION_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -937,7 +918,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.IF_NO_ELSE_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -982,7 +962,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.IF_THEN_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1033,7 +1012,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.IF_ELSE_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1078,7 +1056,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.WHILE_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1123,7 +1100,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.UNTIL_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1168,7 +1144,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.REPEAT_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1251,7 +1226,6 @@ function getGeneratorFactory( return { feature: GeneratorFeature.DESTRUCT_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1287,7 +1261,6 @@ function getGeneratorFactory( ); return { feature: GeneratorFeature.BLOCK_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1327,7 +1300,6 @@ function getGeneratorFactory( ); return { feature: GeneratorFeature.TRY_STATEMENT, - ignoreFeatureSet: false, generator, }; } @@ -1375,13 +1347,13 @@ function getGeneratorFactory( ); return { feature: GeneratorFeature.CATCH_STATEMENT, - ignoreFeatureSet: false, generator, }; } function expressionGenerator( currentFunCallDepth: number, + desiredFunCallDepth: number, ): fc.Arbitrary> { const baseGens = [ initOfGenerator(), @@ -1389,68 +1361,49 @@ function getGeneratorFactory( //contractFieldGenerator(initOf) ]; - const recursiveGens = [ - staticCallGenerator(currentFunCallDepth), - //methodCallGenerator(), - ]; - // Keep only those generators allowed by the features - const finalBaseGenDesc = baseGens.filter( - (genDesc) => - genDesc.ignoreFeatureSet || - allowedFeatures.has(genDesc.feature), - ); - - const finalRecursiveGenDesc = recursiveGens.filter( - (genDesc) => - genDesc.ignoreFeatureSet || - allowedFeatures.has(genDesc.feature), - ); - - if ( - finalBaseGenDesc.length === 0 || - finalRecursiveGenDesc.length === 0 - ) { - // Uniformly choose - const finalBaseGens = finalBaseGenDesc.map( - (genDesc) => genDesc.generator, - ); - const finalRecursiveGens = finalRecursiveGenDesc.map( - (genDesc) => genDesc.generator, - ); - return fc.oneof(...finalBaseGens, ...finalRecursiveGens); + const finalBaseGens = baseGens + .filter((genDesc) => allowedFeatures.has(genDesc.feature)) + .map((genDesc) => genDesc.generator); + + if (currentFunCallDepth >= desiredFunCallDepth) { + // Use base generators + if (finalBaseGens.length === 0) { + // Default to use initof generator + return initOfGenerator().generator; + } else { + return fc.oneof(...finalBaseGens); + } } - // Assign weights proportional to the current function call depth: - // Bigger weight to recursive generators when the function call depth is shallow - const desiredRecursiveProb = - ((0.1 - 0.9) / config.maxFunCallDepth) * currentFunCallDepth + 0.9; + // We haven't reached the desired function call depth, use + // the recursive generators - // Fix a weight for the base generators - const baseWeight = 10; - const totalBaseWeight = baseWeight * finalBaseGenDesc.length; - - const totalRecursiveWeight = - (desiredRecursiveProb * totalBaseWeight) / - (1 - desiredRecursiveProb); - const recursiveWeight = Math.ceil( - totalRecursiveWeight / finalRecursiveGenDesc.length, - ); + const recursiveGens = [ + staticCallGenerator(currentFunCallDepth, desiredFunCallDepth), + //methodCallGenerator(), + ]; - const finalBaseGens = finalBaseGenDesc.map((genDesc) => { - return { arbitrary: genDesc.generator, weight: baseWeight }; - }); - const finalRecursiveGens = finalRecursiveGenDesc.map((genDesc) => { - return { arbitrary: genDesc.generator, weight: recursiveWeight }; - }); + const finalRecursiveGens = recursiveGens + .filter((genDesc) => allowedFeatures.has(genDesc.feature)) + .map((genDesc) => genDesc.generator); - return fc.oneof(...finalBaseGens, ...finalRecursiveGens); + if (finalRecursiveGens.length === 0) { + // Default to use initof generator + return initOfGenerator().generator; + } else { + return fc.oneof(...finalRecursiveGens); + } } function statementGenerator( currentFunCallDepth: number, + desiredFunCallDepth: number, ): fc.Arbitrary> { - return expressionGenerator(currentFunCallDepth).chain((genExpr) => { + return expressionGenerator( + currentFunCallDepth, + desiredFunCallDepth, + ).chain((genExpr) => { const stmtGens = [ letStatementGenerator(genExpr), expressionStatementGenerator(genExpr), @@ -1471,14 +1424,15 @@ function getGeneratorFactory( // Keep only those generators allowed by the features const finalGens = stmtGens - .filter( - (genDesc) => - genDesc.ignoreFeatureSet || - allowedFeatures.has(genDesc.feature), - ) + .filter((genDesc) => allowedFeatures.has(genDesc.feature)) .map((genDesc) => genDesc.generator); - return fc.oneof(...finalGens); + if (finalGens.length === 0) { + // Default to use let statement generator + return letStatementGenerator(genExpr).generator; + } else { + return fc.oneof(...finalGens); + } }); } @@ -1520,29 +1474,31 @@ function getGeneratorFactory( return { feature: GeneratorFeature.CONTRACT_WITH_INIT, - ignoreFeatureSet: true, generator, }; } function contractGenerator( currentFunCallDepth: number, + desiredFunCallDepth: number, ): fc.Arbitrary> { - return statementGenerator(currentFunCallDepth).chain( - (stmtsWithName) => { - const contractGens = [contractWithInitGenerator(stmtsWithName)]; - - const finalGens = contractGens - .filter( - (genDesc) => - genDesc.ignoreFeatureSet || - allowedFeatures.has(genDesc.feature), - ) - .map((genDesc) => genDesc.generator); + return statementGenerator( + currentFunCallDepth, + desiredFunCallDepth, + ).chain((stmtsWithName) => { + const contractGens = [contractWithInitGenerator(stmtsWithName)]; + + const finalGens = contractGens + .filter((genDesc) => allowedFeatures.has(genDesc.feature)) + .map((genDesc) => genDesc.generator); + if (finalGens.length === 0) { + // Default to use let contractWithInitGenerator generator + return contractWithInitGenerator(stmtsWithName).generator; + } else { return fc.oneof(...finalGens); - }, - ); + } + }); } /* @@ -1608,8 +1564,12 @@ function getGeneratorFactory( return tests; } + const generator = fc + .nat(maxFunCallDepth) + .chain((depth) => contractGenerator(0, depth)); + return { - generator: contractGenerator(0), + generator, batchBuilder: createTestsInBatches, }; } @@ -1740,6 +1700,13 @@ function createFeatureSets( } async function main() { + const args = process.argv.slice(2); + + if (args.includes("stats")) { + statistics(); + return; + } + const astF = getAstFactory(); // Parse the stdlib and filter it with the minimal definitions we need @@ -1806,6 +1773,7 @@ async function main() { console.log(`Generated ${featureSets.length} feature sets.`); const compilationBatchSize = 20; + const maxFunCallDepth = 10; await Promise.all( featureSets.map((featureSet, idx) => @@ -1816,6 +1784,7 @@ async function main() { compilationBatchSize, customStdlib, extraModule, + maxFunCallDepth, ), ), ); @@ -1828,6 +1797,7 @@ async function executeTestsOnFeatures( compilationBatchSize: number, customStdlib: CustomStdlib, extraModule: A.AstModule, + maxFunCallDepth: number, ) { const errorFilename = `error-${idx}.log`; const fileDescriptor = fs.openSync( @@ -1838,7 +1808,7 @@ async function executeTestsOnFeatures( const featureSetString = `{${Array.from(featureSet).join(", ")}}`; console.log(`#${idx}: Using feature set: ${featureSetString}`); - const testFactory = getGeneratorFactory(astF, featureSet); + const testFactory = getGeneratorFactory(astF, featureSet, maxFunCallDepth); await fc.assert( fc.asyncProperty( @@ -1972,18 +1942,28 @@ function ensure( }; } -/* function statistics() { + const samplesNumber = 50000; + const maxFunctionCallDepth = 10; + const astF = getAstFactory(); const featureSet = new Set(Object.values(GeneratorFeature)); - const testFactory = getGeneratorFactory(astF, featureSet); + const testFactory = getGeneratorFactory( + astF, + featureSet, + maxFunctionCallDepth, + ); const featureCount: Map = new Map(); const depthCount: Map = new Map(); - const samples = fc.sample(testFactory.generator, 100000); + console.log( + `Generating a sample of ${samplesNumber} contracts, with maximum function call depth of ${maxFunctionCallDepth}...`, + ); + + const samples = fc.sample(testFactory.generator, samplesNumber); for (const sample of samples) { for (const feature of sample.featuresTrace) { @@ -2014,22 +1994,17 @@ function statistics() { .values() .reduce((prev, curr) => prev + curr, 0); + console.log("\nDistribution of features:"); + for (const [feature, count] of featureCount) { - console.log(`${feature}: ${count / totalFeatureCount}`); + console.log(`${feature}: ${(count / totalFeatureCount) * 100}%`); } + console.log("\nDistribution of function call depths:"); + for (const [depth, count] of depthCount) { - console.log(`${depth}: ${count / totalDepthCount}`); + console.log(`${depth}: ${(count / totalDepthCount) * 100}%`); } - - fc.statistics( - testFactory.generator, - (sample) => sample.featuresTrace, - 100000, - ); } -statistics(); -*/ - void main();