1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[FunC] Deprecate pragma compute-asm-ltr

It changes all hashes, since the compiler needs to manipulate the stack
in a different way now.
This commit is contained in:
Aleksandr Kirsanov 2024-05-10 16:08:50 +03:00
parent aaf3ca335d
commit 1e4b20a061
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
11 changed files with 41 additions and 71 deletions

View file

@ -4,32 +4,26 @@
// and is parsed just using regexp ^\[\s*"(.*?)"\s*,\s*(.*?)\s*]
// Some tests can be commented out, or they can be multiline, it works.
// note, that deployed version of elector,config and multisig differ since it is compiled with func-0.1.0.
// Newer compilers optimize arithmetic and logic expression that can be calculated at the compile time
["elector/elector-code.fc", 115226404411715505328583639896096915745686314074575650766750648324043316883483]
["config/config-code.fc", 10913070768607625342121305745084703121685937915388357634624451844356456145601]
["eth-bridge-multisig/multisig-code.fc", 101509909129354488841890823627011033360100627957439967918234053299675481277954]
// Since pragma compute-asm-ltr became deprecated (and always on), it changed all hashes
["elector/elector-code.fc", 96915288474895095375636985346314354662782784860648058159878921867365312683154]
["config/config-code.fc", 22290399841823616942485152190379024190655691555189464909245612965253206016940]
["eth-bridge-multisig/multisig-code.fc", 61794576422183943960272839720117943378686303983578297509099019523440847170337]
["bsc-bridge-collector/votes-collector.fc", 62190447221288642706570413295807615918589884489514159926097051017036969900417]
["uni-lock-wallet/uni-lockup-wallet.fc", 61959738324779104851267145467044677651344601417998258530238254441977103654381]
["nft-collection/nft-collection-editable.fc", 45561997735512210616567774035540357815786262097548276229169737015839077731274]
["dns-collection/nft-collection.fc", 107999822699841936063083742021519765435859194241091312445235370766165379261859]
["bsc-bridge-collector/votes-collector.fc", 92944270384900724656771477263840139047476985690583064733832286422277180224175]
["uni-lock-wallet/uni-lockup-wallet.fc", 27323712737699566411771249412638860892056222617959925563185009479925143218351]
["nft-collection/nft-collection-editable.fc", 3265272879406938912616104900469474227258611213495548733729957432831667074606]
["dns-collection/nft-collection.fc", 50100285311144683401305558797522852568981620193836838830789475785944491291928]
// note, that deployed version of tele-nft-item differs since it is compiled with func-0.3.0.
// After introducing of try/catch construction, c2 register is not always the default one.
// Thus it is necessary to save it upon jumps, differences of deployed and below compiled is that
// "c2 SAVE" is added to the beginning of recv_internal. It does not change behavior.
["tele-nft-item/nft-item.fc", 69777543125381987786450436977742010705076866061362104025338034583422166453344]
["tele-nft-item/nft-item.fc", 112456603551352598193405120624678866030139400186800709562240012518003340977105]
["storage/storage-contract.fc", 91377830060355733016937375216020277778264560226873154627574229667513068328151]
["storage/storage-provider.fc", 13618336676213331164384407184540461509022654507176709588621016553953760588122]
["nominator-pool/pool.fc", 69767057279163099864792356875696330339149706521019810113334238732928422055375]
["jetton-minter/jetton-minter.fc", 9028309926287301331466371999814928201427184114165428257502393474125007156494]
["gg-marketplace/nft-marketplace-v2.fc", 92199806964112524639740773542356508485601908152150843819273107618799016205930]
["jetton-wallet/jetton-wallet.fc", 86251125787443633057458168028617933212663498001665054651523310772884328206542]
// (May 2024) reordered includes, they were in a wrong order
["whales-nominators/nominators.fc", 64989185004203073400683226767264384908045055609681310145961012819587514238303]
["storage/storage-contract.fc", 44542652015163304335966522853331133393011733370692441537470366854345658892851]
["storage/storage-provider.fc", 108677173951298337060746154977967122806502520160062519672276937694037317935577]
["nominator-pool/pool.fc", 113824867250406571749406540634759859835643042958487527298742314026185451318138]
["jetton-minter/jetton-minter.fc", 59172251235013928378816323931018560572240088017859486196396002876800156186183]
["gg-marketplace/nft-marketplace-v2.fc", 65550944551194537105854154716861234168502062117999272754502885031166440057836]
["jetton-wallet/jetton-wallet.fc", 26109413028643307141901410795152471606217725316052170190064118584402007124948]
["whales-nominators/nominators.fc", 32017040532734767645954674692768344406402364921654403435168703583553605058036]
// (April 2024) tact hashes changed, because '__tact_address_eq()' is now inlined as a wrapper

View file

@ -51,8 +51,6 @@ tuple test_tuple(int x) method_id(13) {
return asm_func(x, x += 1, x, x, x~inc(x / 20), x, x = x * 2);
}
#pragma compute-asm-ltr;
(int, int, int, int, int, int, int) test_call_asm_new(int x) method_id(18) {
return asm_func(x, x~incWrap(x / 20), x, x = x * 2, x, x += 1, x);
}
@ -83,11 +81,11 @@ TESTCASE | 13 | 100 | [ 100 50 105 210 210 211 211 ]
TESTCASE | 14 | 100 | 100 50 105 210 210 211 211
TESTCASE | 15 | 100 | 100 50 105 210 210 211 211
TESTCASE | 16 | 100 | 100 50 105 210 210 211 211
TESTCASE | 17 | 100 | 100 50 105 210 210 211 211
TESTCASE | 17 | 100 | 101 50 106 212 100 101 101
TESTCASE | 18 | 100 | 210 210 211 211 100 50 105
TESTCASE | 19 | 100 | 100 50 105 210 210 211 211
TESTCASE | 20 | 80 | 80 89 1 8 8
TESTCASE | 20 | 9 | 9 -40 -10 -1 13
@code_hash 67078680159561921827850021610104736412668316252257881932102553152922274405210
@code_hash 91381947614024372269097215913018978221053550615790649489637387647848569490128
-}

View file

@ -60,8 +60,6 @@ int foo(int x) {
return (t, t2);
}
#pragma compute-asm-ltr;
(tuple, tuple) test_new_1() method_id(21) {
t = empty_tuple();
tuple t2 = asmFunc1(foo(11), foo(22), foo(33));
@ -105,11 +103,11 @@ int foo(int x) {
{-
method_id | in | out
TESTCASE | 11 | | [ 11 22 33 ] [ 110 220 330 ]
TESTCASE | 12 | | [ 33 22 11 ] [ 330 220 110 ]
TESTCASE | 13 | | [ 22 33 11 ] [ 220 330 110 ]
TESTCASE | 12 | | [ 11 22 33 ] [ 330 220 110 ]
TESTCASE | 13 | | [ 11 22 33 ] [ 220 330 110 ]
TESTCASE | 14 | | [ 11 22 33 44 55 ] [ 220 330 440 110 550 ]
TESTCASE | 15 | | [ 33 22 ] [ 220 330 ]
TESTCASE | 16 | | [ 22 33 11 ] [ 220 330 110 ]
TESTCASE | 15 | | [ 22 33 ] [ 220 330 ]
TESTCASE | 16 | | [ 11 22 33 ] [ 220 330 110 ]
TESTCASE | 21 | | [ 11 22 33 ] [ 110 220 330 ]
TESTCASE | 22 | | [ 11 22 33 ] [ 330 220 110 ]
TESTCASE | 23 | | [ 11 22 33 ] [ 220 330 110 ]
@ -117,5 +115,5 @@ TESTCASE | 24 | | [ 11 22 33 44 55 ] [ 220 330 440 110 550 ]
TESTCASE | 25 | | [ 22 33 ] [ 220 330 ]
TESTCASE | 26 | | [ 11 22 33 ] [ 220 330 110 ]
@code_hash 53895312198338603934600244087571743055624960603383611438828666636202841531600
@code_hash 93068291567112337250118419287631047120002003622184251973082208096953112184588
-}

View file

@ -152,8 +152,9 @@ TESTCASE | 103 | | [ 12 [] 34 91 ]
//
NEWC // _5
ENDC // to_be_ref
123 PUSHINT // to_be_ref _8=123
NEWC // to_be_ref _8=123 _9
NEWC // to_be_ref _8
123 PUSHINT // to_be_ref _8 _9=123
SWAP // to_be_ref _9=123 _8
8 STU // to_be_ref in_c
STREF // in_c
ENDC // _16
@ -186,13 +187,12 @@ TESTCASE | 103 | | [ 12 [] 34 91 ]
16 PUSHINT // dict minv _57=16
SDSKIPFIRST // dict minv
...
32 PUSHINT // dict minv1 minv2 minv3 found123 _78=456 dict _79=32
32 PUSHINT // dict minv1 minv2 minv3 found123 found456 _83=32
789 PUSHINT // dict minv1 minv2 minv3 found123 found456 _83=32 _84=789
s0 s7 s7 XCHG3 // found456 minv1 minv2 minv3 found123 _84=789 dict _83=32
DICTIGET
NULLSWAPIFNOT // dict minv1 minv2 minv3 found123 _99 _100
789 PUSHINT
s2 POP
s0 s6 XCHG
32 PUSHINT // found456 minv1 minv2 minv3 found123 _83=789 dict _84=32
NULLSWAPIFNOT // found456 minv1 minv2 minv3 found123 _101 _102
NIP // found456 minv1 minv2 minv3 found123 found789
...
4 TUPLE // _86
}>

View file

@ -5,8 +5,6 @@
;; But swapping arguments may sometimes lead to bytecode changes (see test2),
;; both with compute-asm-ltr and without it.
#pragma compute-asm-ltr;
builder begin_cell() pure asm "NEWC";
cell end_cell(builder b) pure asm "ENDC";
slice begin_parse(cell c) pure asm "CTOS";

View file

@ -62,5 +62,5 @@ _ main() {
{-
TESTCASE | 0 | | 0
@code_hash 98157584761932576648981760908342408003231747902562138202913714302941716912743
@code_hash 61273295789179921867241079778489100375537711211918844448475493726205774530743
-}

View file

@ -52,5 +52,5 @@ _ main() {
{-
TESTCASE | 0 | | 0
@code_hash 35542701048549611407499491204004197688673151742407097578098250360682143458214
@code_hash 13830542019509784148027107880226447201604257839069192762244575629978154217223
-}