tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
374 stars 104 forks source link

Two compile failed for a large single smart contract #171

Closed xfhxfh2021 closed 5 months ago

xfhxfh2021 commented 6 months ago

1. compile error

$ tact --config ./tact.config.json
💼 Compiling project Test...
   > Test: tact compiler
   > Test: func compiler
[ 1][t 0][2024-03-11 03:00:00.770000][Fift.cpp:67]      top: <continuation 0x249dc38>
level 1: <continuation 0x249dcb8>
level 2: <text interpreter continuation>

main.fif:6054:  INL:-?
💥 Compilation failed. Skipping packaging

demo code:

contract Test {

    init() {

    }

    testMap0: map<Int, Int>;
    testMap1: map<Int, Int>;
    testMap2: map<Int, Int>;
    testMap3: map<Int, Int>;
    testMap4: map<Int, Int>;
    testMap5: map<Int, Int>;
    testMap6: map<Int, Int>;
    testMap7: map<Int, Int>;
    testMap8: map<Int, Int>;
    testMap9: map<Int, Int>;
    testMap10: map<Int, Int>;
    testMap11: map<Int, Int>;
    testMap12: map<Int, Int>;
    testMap13: map<Int, Int>;
    testMap14: map<Int, Int>;
    testMap15: map<Int, Int>;
    testMap16: map<Int, Int>;
    testMap17: map<Int, Int>;
    testMap18: map<Int, Int>;
    testMap19: map<Int, Int>;
    testMap20: map<Int, Int>;
    testMap21: map<Int, Int>;
    testMap22: map<Int, Int>;
    testMap23: map<Int, Int>;
    testMap24: map<Int, Int>;
    testMap25: map<Int, Int>;
    testMap26: map<Int, Int>;
    testMap27: map<Int, Int>;
    testMap28: map<Int, Int>;
    testMap29: map<Int, Int>;
    testMap30: map<Int, Int>;
    testMap31: map<Int, Int>;
    testMap32: map<Int, Int>;
    testMap33: map<Int, Int>;
    testMap34: map<Int, Int>;
    testMap35: map<Int, Int>;
    testMap36: map<Int, Int>;
    testMap37: map<Int, Int>;
    testMap38: map<Int, Int>;
    testMap39: map<Int, Int>;
    testMap40: map<Int, Int>;
    testMap41: map<Int, Int>;
    testMap42: map<Int, Int>;
    testMap43: map<Int, Int>;
    testMap44: map<Int, Int>;
    testMap45: map<Int, Int>;
    testMap46: map<Int, Int>;
    testMap47: map<Int, Int>;
    testMap48: map<Int, Int>;
    testMap49: map<Int, Int>; 
    testMap50: map<Int, Int>;
    testMap51: map<Int, Int>;
    testMap52: map<Int, Int>;
    testMap53: map<Int, Int>;
    testMap54: map<Int, Int>;
    testMap55: map<Int, Int>;
    testMap56: map<Int, Int>;
    testMap57: map<Int, Int>;
    testMap58: map<Int, Int>;
    testMap59: map<Int, Int>; 
    testMap60: map<Int, Int>;
    testMap61: map<Int, Int>;
    testMap62: map<Int, Int>;

    get fun getTest0(index: Int): Int? {
        let val: Int = self.testMap0.get(index)!!;
        val = val + self.testMap1.get(index)!!;
        val = val + self.testMap2.get(index)!!;
        val = val + self.testMap3.get(index)!!;
        val = val + self.testMap4.get(index)!!;
        val = val + self.testMap5.get(index)!!;
        val = val + self.testMap6.get(index)!!;
        val = val + self.testMap7.get(index)!!; // error
        // val = val + self.testMap8.get(index)!!;
        // val = val + self.testMap9.get(index)!!;
        // val = val + self.testMap10.get(index)!!;
        return val;
    }

    get fun getTest1(index: Int): Int? {
        let val: Int = self.testMap1.get(index)!!;
        return val;
    }

    get fun getTest2(index: Int): Int? {
        let val: Int = self.testMap2.get(index)!!;
        return val;
    }

    get fun getTest3(index: Int): Int? {
        let val: Int = self.testMap3.get(index)!!;
        return val;
    }

    get fun getTest4(index: Int): Int? {
        let val: Int = self.testMap4.get(index)!!;
        return val;
    }

    get fun getTest5(index: Int): Int? {
        let val: Int = self.testMap5.get(index)!!;
        return val;
    }

    get fun getTest6(index: Int): Int? {
        let val: Int = self.testMap6.get(index)!!;
        return val;
    }

    get fun getTest7(index: Int): Int? {
        let val: Int = self.testMap7.get(index)!!;
        return val;
    }

    get fun getTest8(index: Int): Int? {
        let val: Int = self.testMap8.get(index)!!;
        return val;
    }

    get fun getTest9(index: Int): Int? {
        let val: Int = self.testMap9.get(index)!!;
        return val;
    }

    get fun getTest10(index: Int): Int? {
        let val: Int = self.testMap10.get(index)!!;
        return val;
    }

    get fun getTest11(index: Int): Int? {
        let val: Int = self.testMap11.get(index)!!;
        return val;
    }

    get fun getTest12(index: Int): Int? {
        let val: Int = self.testMap12.get(index)!!;
        return val;
    }

    get fun getTest13(index: Int): Int? {
        let val: Int = self.testMap13.get(index)!!;
        return val;
    }

    get fun getTest14(index: Int): Int? {
        let val: Int = self.testMap14.get(index)!!;
        return val;
    }

    get fun getTest15(index: Int): Int? {
        let val: Int = self.testMap15.get(index)!!;
        return val;
    }

    get fun getTest16(index: Int): Int? {
        let val: Int = self.testMap16.get(index)!!;
        return val;
    }

    get fun getTest17(index: Int): Int? {
        let val: Int = self.testMap17.get(index)!!;
        return val;
    }

    get fun getTest18(index: Int): Int? {
        let val: Int = self.testMap18.get(index)!!;
        return val;
    }

    get fun getTest19(index: Int): Int? {
        let val: Int = self.testMap19.get(index)!!;
        return val;
    }

    get fun getTest20(index: Int): Int? {
        let val: Int = self.testMap20.get(index)!!;
        return val;
    }

    get fun getTest21(index: Int): Int? {
        let val: Int = self.testMap21.get(index)!!;
        return val;
    }

    get fun getTest22(index: Int): Int? {
        let val: Int = self.testMap22.get(index)!!;
        return val;
    }

    get fun getTest23(index: Int): Int? {
        let val: Int = self.testMap23.get(index)!!;
        return val;
    }

    get fun getTest24(index: Int): Int? {
        let val: Int = self.testMap24.get(index)!!;
        return val;
    }

    get fun getTest25(index: Int): Int? {
        let val: Int = self.testMap25.get(index)!!;
        return val;
    }

    get fun getTest26(index: Int): Int? {
        let val: Int = self.testMap26.get(index)!!;
        return val;
    }

    get fun getTest27(index: Int): Int? {
        let val: Int = self.testMap27.get(index)!!;
        return val;
    }

    get fun getTest28(index: Int): Int? {
        let val: Int = self.testMap28.get(index)!!;
        return val;
    }

    get fun getTest29(index: Int): Int? {
        let val: Int = self.testMap29.get(index)!!;
        return val;
    }

    get fun getTest30(index: Int): Int? {
        let val: Int = self.testMap30.get(index)!!;
        return val;
    }

    get fun getTest31(index: Int): Int? {
        let val: Int = self.testMap31.get(index)!!;
        return val;
    }

    get fun getTest32(index: Int): Int? {
        let val: Int = self.testMap32.get(index)!!;
        return val;
    }

    get fun getTest33(index: Int): Int? {
        let val: Int = self.testMap33.get(index)!!;
        return val;
    }

    get fun getTest34(index: Int): Int? {
        let val: Int = self.testMap34.get(index)!!;
        return val;
    }

    get fun getTest35(index: Int): Int? {
        let val: Int = self.testMap35.get(index)!!;
        return val;
    }

    get fun getTest36(index: Int): Int? {
        let val: Int = self.testMap36.get(index)!!;
        return val;
    }

    get fun getTest37(index: Int): Int? {
        let val: Int = self.testMap37.get(index)!!;
        return val;
    }

    get fun getTest38(index: Int): Int? {
        let val: Int = self.testMap38.get(index)!!;
        return val;
    }

    get fun getTest39(index: Int): Int? {
        let val: Int = self.testMap39.get(index)!!;
        return val;
    }

    get fun getTest40(index: Int): Int? {
        let val: Int = self.testMap40.get(index)!!;
        return val;
    }

    get fun getTest41(index: Int): Int? {
        let val: Int = self.testMap41.get(index)!!;
        return val;
    }

    get fun getTest42(index: Int): Int? {
        let val: Int = self.testMap42.get(index)!!;
        return val;
    }

    get fun getTest43(index: Int): Int? {
        let val: Int = self.testMap43.get(index)!!;
        return val;
    }

    get fun getTest44(index: Int): Int? {
        let val: Int = self.testMap44.get(index)!!;
        return val;
    }

    get fun getTest45(index: Int): Int? {
        let val: Int = self.testMap45.get(index)!!;
        return val;
    }

    get fun getTest46(index: Int): Int? {
        let val: Int = self.testMap46.get(index)!!;
        return val;
    }

    get fun getTest47(index: Int): Int? {
        let val: Int = self.testMap47.get(index)!!;
        return val;
    }

    get fun getTest48(index: Int): Int? {
        let val: Int = self.testMap48.get(index)!!;
        return val;
    }

    get fun getTest49(index: Int): Int? {
        let val: Int = self.testMap49.get(index)!!;
        return val;
    }

    get fun getTest50(index: Int): Int? {
        let val: Int = self.testMap50.get(index)!!;
        return val;
    }

    get fun getTest51(index: Int): Int? {
        let val: Int = self.testMap51.get(index)!!;
        return val;
    }

    get fun getTest52(index: Int): Int? {
        let val: Int = self.testMap52.get(index)!!;
        return val;
    }

    get fun getTest53(index: Int): Int? {
        let val: Int = self.testMap53.get(index)!!;
        return val;
    }

    get fun getTest54(index: Int): Int? {
        let val: Int = self.testMap54.get(index)!!;
        return val;
    }

    get fun getTest55(index: Int): Int? {
        let val: Int = self.testMap55.get(index)!!;
        return val;
    }

    get fun getTest56(index: Int): Int? {
        let val: Int = self.testMap56.get(index)!!;
        return val;
    }

    get fun getTest57(index: Int): Int? {
        let val: Int = self.testMap57.get(index)!!;
        return val;
    }

    get fun getTest58(index: Int): Int? {
        let val: Int = self.testMap58.get(index)!!;
        return val;
    }

    get fun getTest59(index: Int): Int? {
        let val: Int = self.testMap59.get(index)!!;
        return val;
    }

    get fun getTest60(index: Int): Int? {
        let val: Int = self.testMap0.get(index)!!;
        return val;
    }

    get fun getTest61(index: Int): Int? {
        let val: Int = self.testMap1.get(index)!!;
        return val;
    }

    get fun getTest62(index: Int): Int? {
        let val: Int = self.testMap2.get(index)!!;
        return val;
    }

    get fun getTest63(index: Int): Int? {
        let val: Int = self.testMap3.get(index)!!;
        return val;
    }

    get fun getTest64(index: Int): Int? {
        let val: Int = self.testMap4.get(index)!!;
        return val;
    }

    get fun getTest65(index: Int): Int? {
        let val: Int = self.testMap5.get(index)!!;
        return val;
    }

    get fun getTest66(index: Int): Int? {
        let val: Int = self.testMap6.get(index)!!;
        return val;
    }

    get fun getTest67(index: Int): Int? {
        let val: Int = self.testMap7.get(index)!!;
        return val;
    }

    get fun getTest68(index: Int): Int? {
        let val: Int = self.testMap8.get(index)!!;
        return val;
    }

    get fun getTest69(index: Int): Int? {
        let val: Int = self.testMap9.get(index)!!;
        return val;
    }

    get fun getTest70(index: Int): Int? {
        let val: Int = self.testMap0.get(index)!!;
        return val;
    }

    get fun getTest71(index: Int): Int? {
        let val: Int = self.testMap1.get(index)!!;
        return val;
    }

    get fun getTest72(index: Int): Int? {
        let val: Int = self.testMap2.get(index)!!;
        return val;
    }

    get fun getTest73(index: Int): Int? {
        let val: Int = self.testMap3.get(index)!!;
        return val;
    }

    get fun getTest74(index: Int): Int? {
        let val: Int = self.testMap4.get(index)!!;
        return val;
    }

    get fun getTest75(index: Int): Int? {
        let val: Int = self.testMap5.get(index)!!;
        return val;
    }
} 

2. another compile error "File not found" when update method getTest0

    get fun getTest0(index: Int): Int? {
        let val: Int = self.testMap0.get(index)!!;
        val = val + self.testMap1.get(index)!!;
        val = val + self.testMap2.get(index)!!;
        val = val + self.testMap3.get(index)!!;
        val = val + self.testMap4.get(index)!!;
        val = val + self.testMap5.get(index)!!;
        val = val + self.testMap6.get(index)!!;
        val = val + self.testMap7.get(index)!!;
        val = val + self.testMap8.get(index)!!;
        val = val + self.testMap9.get(index)!!;
        val = val + self.testMap10.get(index)!!;
        return val;
    }

error

$ tact --config ./tact.config.json
💼 Compiling project Test...
   > Test: tact compiler
   > Test: func compiler
File not found
💥 Compilation failed. Skipping packaging
howardpen9 commented 6 months ago

maybe need @anton-trunov to help with

howardpen9 commented 6 months ago

what do you want for this?

I think some limitation for the too many mapping, for example we can look into the FunC code we got when compiled successfully:

image

The output fif file also quite big.

image

Please explain what you exactly want to build here? Nonetheless, I think it's not a high priority at this moment to fix this.

xfhxfh2021 commented 6 months ago

I just make a simple demo to show the same problem what I met in my project. When I write a lot of code in one contract file, it compiles failed. But we find that our BOC is just 20k, far away from 2M.

howardpen9 commented 6 months ago

I see, maybe need to check your Tact code then.

xfhxfh2021 commented 6 months ago

Sent invitation to our tact project, please check.

xfhxfh2021 commented 6 months ago

Found that when the length of *.fif file exceed 6200, compile error will come out. So I must split single contract to many of them, design rollback, compensate and check gas. Too many difficulties.

anton-trunov commented 5 months ago

This looks very similar to #75