diff --git a/dev-docs/CHANGELOG.md b/dev-docs/CHANGELOG.md index 8e2cfbf8ed..fa2d328c6e 100644 --- a/dev-docs/CHANGELOG.md +++ b/dev-docs/CHANGELOG.md @@ -11,6 +11,7 @@ The documentation changelog is kept separately: [CHANGELOG-DOCS](./CHANGELOG-DOC ### Code generation +- Optimized opcode parsing for fallback and text receivers: PR [#3331](https://github.com/tact-lang/tact/pull/3331) - Reordered arguments of the `__tact_store_address_opt` function to optimize gas consumption: PR [#3333](https://github.com/tact-lang/tact/pull/3333) ## [1.6.13] - 2025-05-29 diff --git a/src/benchmarks/nft/gas.json b/src/benchmarks/nft/gas.json index c06d720304..3644c0a93e 100644 --- a/src/benchmarks/nft/gas.json +++ b/src/benchmarks/nft/gas.json @@ -199,6 +199,16 @@ "deploy nft": "10299", "batch deploy nft": "650666" } + }, + { + "label": "1.6.13 with optimized opcode parsing for fallback and text receivers", + "pr": "https://github.com/tact-lang/tact/pull/3331", + "gas": { + "transfer": "6907", + "get static data": "4388", + "deploy nft": "10263", + "batch deploy nft": "648848" + } } ] } diff --git a/src/benchmarks/nft/size.json b/src/benchmarks/nft/size.json index 70787df457..d28f6a260a 100644 --- a/src/benchmarks/nft/size.json +++ b/src/benchmarks/nft/size.json @@ -209,6 +209,16 @@ "item cells": "10", "item bits": "5185" } + }, + { + "label": "1.6.13 with optimized opcode parsing for fallback and text receivers", + "pr": "https://github.com/tact-lang/tact/pull/3331", + "size": { + "collection cells": "39", + "collection bits": "19564", + "item cells": "10", + "item bits": "5185" + } } ] } diff --git a/src/benchmarks/sbt/gas.json b/src/benchmarks/sbt/gas.json index a0681b7228..acc6a71955 100644 --- a/src/benchmarks/sbt/gas.json +++ b/src/benchmarks/sbt/gas.json @@ -181,6 +181,19 @@ "revoke": "3778", "take excess": "5577" } + }, + { + "label": "1.6.13 with optimized opcode parsing for fallback and text receivers", + "pr": "https://github.com/tact-lang/tact/pull/3331", + "gas": { + "deploy": "3940", + "request owner": "4848", + "prove ownership": "5026", + "get static data": "4678", + "destroy": "6125", + "revoke": "3742", + "take excess": "5541" + } } ] } diff --git a/src/generator/writers/writeRouter.ts b/src/generator/writers/writeRouter.ts index 3474b7860d..076b70a5c6 100644 --- a/src/generator/writers/writeRouter.ts +++ b/src/generator/writers/writeRouter.ts @@ -130,15 +130,15 @@ export function writeNonBouncedRouter( receivers.comment.length > 0 || typeof receivers.commentFallback !== "undefined"; - wCtx.append("int op = 0;"); wCtx.append("int in_msg_length = slice_bits(in_msg);"); - wCtx.inBlock("if (in_msg_length >= 32)", () => { - wCtx.append(`op = in_msg${opcodeReader}(32);`); - - if (doesHaveTextReceivers) { + wCtx.append( + `int op = (in_msg_length >= 32) ? in_msg${opcodeReader}(32) : 0;`, + ); + if (doesHaveTextReceivers) { + wCtx.inBlock("if (in_msg_length >= 32)", () => { writeBinaryReceivers(opcodeReader === "~load_uint"); - } - }); + }); + } // NOTE: It should be more efficient to write all binary receivers inside // `in_msg_length` length if-check regardless of text receivers, diff --git a/src/pipeline/__snapshots__/packaging.spec.ts.snap b/src/pipeline/__snapshots__/packaging.spec.ts.snap index 687f282074..bf4533ebc6 100644 --- a/src/pipeline/__snapshots__/packaging.spec.ts.snap +++ b/src/pipeline/__snapshots__/packaging.spec.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should correctly generate .pkg file: Windows uses Unix-like paths 1`] = `"{"name":"Echo","code":"te6ccgECCwEAAfwAAij/AI6I9KQT9LzyyAvtUyDjA+1D2QECAgN44AMEA/Qw7aLt+wHQctch0gDSAPpAIRA0UGZvBPhhAvhi7UTQ0gAwkW2RbeICkVvgcCHXSSDCH+MAAcAAjrnCH460gCDXIds8+EJ/cFADgEIBUDMEyM+FgMoAz4RAzgH6AoBqz0D0AMkB+wAwyH8BygDJ7VTbMeCRMOLIAc8WyQcICQEjudPu1E0NIAMJFtkW3iAds8MYBQEjuDYu1E0NIAMJFtkW3iAds8MYBgAKqgmAILACUshvAAFvjG1vjIt0hlbGxvLCCNs8Ads8byIByZMhbrOWAW8iWczJ6DHQCgoAoDEh1wsfIIIQe6INwbqOP18DbwDIATCCEHuiDcEByx/J+EJ/cFADgEIBUDMEyM+FgMoAz4RAzgH6AoBqz0D0AMkB+wAwyH8BygDJ7VTbMeABAULIcAHLH28AAW+MbW+MAds8byIByZMhbrOWAW8iWczJ6DEKAFj4Qn9wUAOAQgFQMwTIz4WAygDPhEDOAfoCgGrPQPQAyQH7ADDIfwHKAMntVAC2INdKIddJlyDCACLCALGOSANvIoB/Is8xqwKhBasCUVW2CCDCAJogqgIV1xgDzkAU3llvAlNBocIAmcgBbwJQRKGqAo4SMTPCAJnUMNAg10oh10mScCDi4uhfAw==","abi":"{\\"name\\":\\"Echo\\",\\"types\\":[{\\"name\\":\\"DataSize\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"cells\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"bits\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"refs\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}}]},{\\"name\\":\\"SignedBundle\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"signature\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"fixed-bytes\\",\\"optional\\":false,\\"format\\":64}},{\\"name\\":\\"signedData\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"slice\\",\\"optional\\":false,\\"format\\":\\"remainder\\"}}]},{\\"name\\":\\"StateInit\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"code\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":false}},{\\"name\\":\\"data\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":false}}]},{\\"name\\":\\"Context\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"bounceable\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}},{\\"name\\":\\"sender\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"address\\",\\"optional\\":false}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"raw\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"slice\\",\\"optional\\":false}}]},{\\"name\\":\\"SendParameters\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"mode\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"body\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"code\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"data\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"to\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"address\\",\\"optional\\":false}},{\\"name\\":\\"bounce\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}}]},{\\"name\\":\\"MessageParameters\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"mode\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"body\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"to\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"address\\",\\"optional\\":false}},{\\"name\\":\\"bounce\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}}]},{\\"name\\":\\"DeployParameters\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"mode\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"body\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"bounce\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}},{\\"name\\":\\"init\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"StateInit\\",\\"optional\\":false}}]},{\\"name\\":\\"StdAddress\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"workchain\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":8}},{\\"name\\":\\"address\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"uint\\",\\"optional\\":false,\\"format\\":256}}]},{\\"name\\":\\"VarAddress\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"workchain\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":32}},{\\"name\\":\\"address\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"slice\\",\\"optional\\":false}}]},{\\"name\\":\\"BasechainAddress\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"hash\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":true,\\"format\\":257}}]},{\\"name\\":\\"EchoMessage\\",\\"header\\":2074217921,\\"fields\\":[]},{\\"name\\":\\"Echo$Data\\",\\"header\\":null,\\"fields\\":[]}],\\"receivers\\":[{\\"receiver\\":\\"internal\\",\\"message\\":{\\"kind\\":\\"typed\\",\\"type\\":\\"EchoMessage\\"}},{\\"receiver\\":\\"internal\\",\\"message\\":{\\"kind\\":\\"text\\"}},{\\"receiver\\":\\"internal\\",\\"message\\":{\\"kind\\":\\"any\\"}}],\\"getters\\":[{\\"name\\":\\"hello\\",\\"methodId\\":115554,\\"arguments\\":[{\\"name\\":\\"src\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"string\\",\\"optional\\":false}}],\\"returnType\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"string\\",\\"optional\\":false}},{\\"name\\":\\"hello2\\",\\"methodId\\":105790,\\"arguments\\":[{\\"name\\":\\"src\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}}],\\"returnType\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}}],\\"errors\\":{\\"2\\":{\\"message\\":\\"Stack underflow\\"},\\"3\\":{\\"message\\":\\"Stack overflow\\"},\\"4\\":{\\"message\\":\\"Integer overflow\\"},\\"5\\":{\\"message\\":\\"Integer out of expected range\\"},\\"6\\":{\\"message\\":\\"Invalid opcode\\"},\\"7\\":{\\"message\\":\\"Type check error\\"},\\"8\\":{\\"message\\":\\"Cell overflow\\"},\\"9\\":{\\"message\\":\\"Cell underflow\\"},\\"10\\":{\\"message\\":\\"Dictionary error\\"},\\"11\\":{\\"message\\":\\"'Unknown' error\\"},\\"12\\":{\\"message\\":\\"Fatal error\\"},\\"13\\":{\\"message\\":\\"Out of gas error\\"},\\"14\\":{\\"message\\":\\"Virtualization error\\"},\\"32\\":{\\"message\\":\\"Action list is invalid\\"},\\"33\\":{\\"message\\":\\"Action list is too long\\"},\\"34\\":{\\"message\\":\\"Action is invalid or not supported\\"},\\"35\\":{\\"message\\":\\"Invalid source address in outbound message\\"},\\"36\\":{\\"message\\":\\"Invalid destination address in outbound message\\"},\\"37\\":{\\"message\\":\\"Not enough Toncoin\\"},\\"38\\":{\\"message\\":\\"Not enough extra currencies\\"},\\"39\\":{\\"message\\":\\"Outbound message does not fit into a cell after rewriting\\"},\\"40\\":{\\"message\\":\\"Cannot process a message\\"},\\"41\\":{\\"message\\":\\"Library reference is null\\"},\\"42\\":{\\"message\\":\\"Library change action error\\"},\\"43\\":{\\"message\\":\\"Exceeded maximum number of cells in the library or the maximum depth of the Merkle tree\\"},\\"50\\":{\\"message\\":\\"Account state size exceeded limits\\"},\\"128\\":{\\"message\\":\\"Null reference exception\\"},\\"129\\":{\\"message\\":\\"Invalid serialization prefix\\"},\\"130\\":{\\"message\\":\\"Invalid incoming message\\"},\\"131\\":{\\"message\\":\\"Constraints error\\"},\\"132\\":{\\"message\\":\\"Access denied\\"},\\"133\\":{\\"message\\":\\"Contract stopped\\"},\\"134\\":{\\"message\\":\\"Invalid argument\\"},\\"135\\":{\\"message\\":\\"Code of a contract was not found\\"},\\"136\\":{\\"message\\":\\"Invalid standard address\\"},\\"138\\":{\\"message\\":\\"Not a basechain address\\"}},\\"interfaces\\":[\\"org.ton.introspection.v0\\",\\"org.ton.abi.ipfs.v0\\",\\"org.ton.deploy.lazy.v0\\"]}","init":{"kind":"direct","args":[],"prefix":{"bits":1,"value":0},"deployment":{"kind":"system-cell","system":null}},"sources":{"packaging.tact":"bWVzc2FnZSgweDdiYTIwZGMxKSBFY2hvTWVzc2FnZSB7fQoKY29udHJhY3QgRWNobyB7CiAgICByZWNlaXZlKG1zZzogRWNob01lc3NhZ2UpIHsKICAgICAgICBzZWxmLnJlcGx5KG1zZy50b0NlbGwoKSk7CiAgICB9CiAgICAKICAgIHJlY2VpdmUobXNnOiBTdHJpbmcpIHsKICAgICAgICBzZWxmLnJlcGx5KG1zZy5hc0NvbW1lbnQoKSk7CiAgICB9CiAgICAKICAgIHJlY2VpdmUobXNnOiBTbGljZSkgewogICAgICAgIHNlbGYucmVwbHkobXNnLmFzQ2VsbCgpKTsKICAgIH0KCiAgICBnZXQgZnVuIGhlbGxvKHNyYzogU3RyaW5nKTogU3RyaW5nIHsKICAgICAgICBsZXQgYnVpbGRlcjogU3RyaW5nQnVpbGRlciA9IGJlZ2luU3RyaW5nKCk7CiAgICAgICAgYnVpbGRlci5hcHBlbmQoIkhlbGxvLCAiKTsKICAgICAgICBidWlsZGVyLmFwcGVuZChzcmMpOwogICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7CiAgICB9CgogICAgZ2V0IGZ1biBoZWxsbzIoc3JjOiBJbnQpOiBJbnQgewogICAgICAgIHJldHVybiBzcmMgPDwgMTAgJiAzMjsKICAgIH0KfQ=="},"compiler":{"name":"tact","version":"1.6.13","parameters":"{\\"entrypoint\\":\\"./packaging.tact\\",\\"options\\":{}}"}}"`; +exports[`should correctly generate .pkg file: Windows uses Unix-like paths 1`] = `"{"name":"Echo","code":"te6ccgECCwEAAf4AAij/AI6I9KQT9LzyyAvtUyDjA+1D2QECAgN44AMEAuow7aLt+wHQctch0gDSAPpAIRA0UGZvBPhhAvhi7UTQ0gAwkW2RbeICkVvgINdJIMIflCHXCx+RcOIhwh/jAMAAkTDjDcgBzxbJ+EJ/cFADgEIBUDMEyM+FgMoAz4RAzgH6AoBqz0D0AMkB+wAwyH8BygDJ7VQHCAEjudPu1E0NIAMJFtkW3iAds8MYBQEjuDYu1E0NIAMJFtkW3iAds8MYBgAKqgmAILACUshvAAFvjG1vjIt0hlbGxvLCCNs8Ads8byIByZMhbrOWAW8iWczJ6DHQCgoAlCCCEHuiDcG6jj9fA28AyAEwghB7og3BAcsfyfhCf3BQA4BCAVAzBMjPhYDKAM+EQM4B+gKAas9A9ADJAfsAMMh/AcoAye1U2zHgAXLCH460gCDXIds8+EJ/cFADgEIBUDMEyM+FgMoAz4RAzgH6AoBqz0D0AMkB+wAwyH8BygDJ7VTbMeAJAULIcAHLH28AAW+MbW+MAds8byIByZMhbrOWAW8iWczJ6DEKALYg10oh10mXIMIAIsIAsY5IA28igH8izzGrAqEFqwJRVbYIIMIAmiCqAhXXGAPOQBTeWW8CU0GhwgCZyAFvAlBEoaoCjhIxM8IAmdQw0CDXSiHXSZJwIOLi6F8D","abi":"{\\"name\\":\\"Echo\\",\\"types\\":[{\\"name\\":\\"DataSize\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"cells\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"bits\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"refs\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}}]},{\\"name\\":\\"SignedBundle\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"signature\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"fixed-bytes\\",\\"optional\\":false,\\"format\\":64}},{\\"name\\":\\"signedData\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"slice\\",\\"optional\\":false,\\"format\\":\\"remainder\\"}}]},{\\"name\\":\\"StateInit\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"code\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":false}},{\\"name\\":\\"data\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":false}}]},{\\"name\\":\\"Context\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"bounceable\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}},{\\"name\\":\\"sender\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"address\\",\\"optional\\":false}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"raw\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"slice\\",\\"optional\\":false}}]},{\\"name\\":\\"SendParameters\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"mode\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"body\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"code\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"data\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"to\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"address\\",\\"optional\\":false}},{\\"name\\":\\"bounce\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}}]},{\\"name\\":\\"MessageParameters\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"mode\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"body\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"to\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"address\\",\\"optional\\":false}},{\\"name\\":\\"bounce\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}}]},{\\"name\\":\\"DeployParameters\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"mode\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"body\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"cell\\",\\"optional\\":true}},{\\"name\\":\\"value\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}},{\\"name\\":\\"bounce\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"bool\\",\\"optional\\":false}},{\\"name\\":\\"init\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"StateInit\\",\\"optional\\":false}}]},{\\"name\\":\\"StdAddress\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"workchain\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":8}},{\\"name\\":\\"address\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"uint\\",\\"optional\\":false,\\"format\\":256}}]},{\\"name\\":\\"VarAddress\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"workchain\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":32}},{\\"name\\":\\"address\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"slice\\",\\"optional\\":false}}]},{\\"name\\":\\"BasechainAddress\\",\\"header\\":null,\\"fields\\":[{\\"name\\":\\"hash\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":true,\\"format\\":257}}]},{\\"name\\":\\"EchoMessage\\",\\"header\\":2074217921,\\"fields\\":[]},{\\"name\\":\\"Echo$Data\\",\\"header\\":null,\\"fields\\":[]}],\\"receivers\\":[{\\"receiver\\":\\"internal\\",\\"message\\":{\\"kind\\":\\"typed\\",\\"type\\":\\"EchoMessage\\"}},{\\"receiver\\":\\"internal\\",\\"message\\":{\\"kind\\":\\"text\\"}},{\\"receiver\\":\\"internal\\",\\"message\\":{\\"kind\\":\\"any\\"}}],\\"getters\\":[{\\"name\\":\\"hello\\",\\"methodId\\":115554,\\"arguments\\":[{\\"name\\":\\"src\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"string\\",\\"optional\\":false}}],\\"returnType\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"string\\",\\"optional\\":false}},{\\"name\\":\\"hello2\\",\\"methodId\\":105790,\\"arguments\\":[{\\"name\\":\\"src\\",\\"type\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}}],\\"returnType\\":{\\"kind\\":\\"simple\\",\\"type\\":\\"int\\",\\"optional\\":false,\\"format\\":257}}],\\"errors\\":{\\"2\\":{\\"message\\":\\"Stack underflow\\"},\\"3\\":{\\"message\\":\\"Stack overflow\\"},\\"4\\":{\\"message\\":\\"Integer overflow\\"},\\"5\\":{\\"message\\":\\"Integer out of expected range\\"},\\"6\\":{\\"message\\":\\"Invalid opcode\\"},\\"7\\":{\\"message\\":\\"Type check error\\"},\\"8\\":{\\"message\\":\\"Cell overflow\\"},\\"9\\":{\\"message\\":\\"Cell underflow\\"},\\"10\\":{\\"message\\":\\"Dictionary error\\"},\\"11\\":{\\"message\\":\\"'Unknown' error\\"},\\"12\\":{\\"message\\":\\"Fatal error\\"},\\"13\\":{\\"message\\":\\"Out of gas error\\"},\\"14\\":{\\"message\\":\\"Virtualization error\\"},\\"32\\":{\\"message\\":\\"Action list is invalid\\"},\\"33\\":{\\"message\\":\\"Action list is too long\\"},\\"34\\":{\\"message\\":\\"Action is invalid or not supported\\"},\\"35\\":{\\"message\\":\\"Invalid source address in outbound message\\"},\\"36\\":{\\"message\\":\\"Invalid destination address in outbound message\\"},\\"37\\":{\\"message\\":\\"Not enough Toncoin\\"},\\"38\\":{\\"message\\":\\"Not enough extra currencies\\"},\\"39\\":{\\"message\\":\\"Outbound message does not fit into a cell after rewriting\\"},\\"40\\":{\\"message\\":\\"Cannot process a message\\"},\\"41\\":{\\"message\\":\\"Library reference is null\\"},\\"42\\":{\\"message\\":\\"Library change action error\\"},\\"43\\":{\\"message\\":\\"Exceeded maximum number of cells in the library or the maximum depth of the Merkle tree\\"},\\"50\\":{\\"message\\":\\"Account state size exceeded limits\\"},\\"128\\":{\\"message\\":\\"Null reference exception\\"},\\"129\\":{\\"message\\":\\"Invalid serialization prefix\\"},\\"130\\":{\\"message\\":\\"Invalid incoming message\\"},\\"131\\":{\\"message\\":\\"Constraints error\\"},\\"132\\":{\\"message\\":\\"Access denied\\"},\\"133\\":{\\"message\\":\\"Contract stopped\\"},\\"134\\":{\\"message\\":\\"Invalid argument\\"},\\"135\\":{\\"message\\":\\"Code of a contract was not found\\"},\\"136\\":{\\"message\\":\\"Invalid standard address\\"},\\"138\\":{\\"message\\":\\"Not a basechain address\\"}},\\"interfaces\\":[\\"org.ton.introspection.v0\\",\\"org.ton.abi.ipfs.v0\\",\\"org.ton.deploy.lazy.v0\\"]}","init":{"kind":"direct","args":[],"prefix":{"bits":1,"value":0},"deployment":{"kind":"system-cell","system":null}},"sources":{"packaging.tact":"bWVzc2FnZSgweDdiYTIwZGMxKSBFY2hvTWVzc2FnZSB7fQoKY29udHJhY3QgRWNobyB7CiAgICByZWNlaXZlKG1zZzogRWNob01lc3NhZ2UpIHsKICAgICAgICBzZWxmLnJlcGx5KG1zZy50b0NlbGwoKSk7CiAgICB9CiAgICAKICAgIHJlY2VpdmUobXNnOiBTdHJpbmcpIHsKICAgICAgICBzZWxmLnJlcGx5KG1zZy5hc0NvbW1lbnQoKSk7CiAgICB9CiAgICAKICAgIHJlY2VpdmUobXNnOiBTbGljZSkgewogICAgICAgIHNlbGYucmVwbHkobXNnLmFzQ2VsbCgpKTsKICAgIH0KCiAgICBnZXQgZnVuIGhlbGxvKHNyYzogU3RyaW5nKTogU3RyaW5nIHsKICAgICAgICBsZXQgYnVpbGRlcjogU3RyaW5nQnVpbGRlciA9IGJlZ2luU3RyaW5nKCk7CiAgICAgICAgYnVpbGRlci5hcHBlbmQoIkhlbGxvLCAiKTsKICAgICAgICBidWlsZGVyLmFwcGVuZChzcmMpOwogICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7CiAgICB9CgogICAgZ2V0IGZ1biBoZWxsbzIoc3JjOiBJbnQpOiBJbnQgewogICAgICAgIHJldHVybiBzcmMgPDwgMTAgJiAzMjsKICAgIH0KfQ=="},"compiler":{"name":"tact","version":"1.6.13","parameters":"{\\"entrypoint\\":\\"./packaging.tact\\",\\"options\\":{}}"}}"`; diff --git a/src/test/codegen-check/__snapshots__/codegen.test.ts.snap b/src/test/codegen-check/__snapshots__/codegen.test.ts.snap index d7f423091a..4abba069c1 100644 --- a/src/test/codegen-check/__snapshots__/codegen.test.ts.snap +++ b/src/test/codegen-check/__snapshots__/codegen.test.ts.snap @@ -577,10 +577,9 @@ _ %asSlice() method_id(68231) { ;; Handle bounced messages if (msg_bounced) { return (); } - int op = 0; int in_msg_length = slice_bits(in_msg); + int op = (in_msg_length >= 32) ? in_msg~load_uint(32) : 0; if (in_msg_length >= 32) { - op = in_msg~load_uint(32); ;; Receive Bin message if (op == 0x2) { var $m = empty_tuple(); diff --git a/src/test/e2e-emulated/debug/__snapshots__/dump.spec.ts.snap b/src/test/e2e-emulated/debug/__snapshots__/dump.spec.ts.snap index 3c74954e84..e84c3fd570 100644 --- a/src/test/e2e-emulated/debug/__snapshots__/dump.spec.ts.snap +++ b/src/test/e2e-emulated/debug/__snapshots__/dump.spec.ts.snap @@ -3,7 +3,7 @@ exports[`dump should dump values correctly in a receiver 1`] = ` "#DEBUG#: File src/test/e2e-emulated/debug/dump.tact:2:5: #DEBUG#: dumpStack() -#DEBUG#: stack(1 values) : 10999604800 +#DEBUG#: stack(1 values) : 10999556400 #DEBUG#: File src/test/e2e-emulated/debug/dump.tact:3:5: #DEBUG#: dump("Hello world!") #DEBUG#: Hello world! @@ -21,13 +21,13 @@ exports[`dump should dump values correctly in a receiver 1`] = ` #DEBUG#: null #DEBUG#: File src/test/e2e-emulated/debug/dump.tact:8:5: #DEBUG#: dump(myAddress()) -#DEBUG#: EQBW6PMGWgu6Gmg_pFckrGpQxm2ImeVELrquQXN0FaneV9fj +#DEBUG#: EQAOdLgPqDU7Iakg-03LKk-3VfNPuNtiCnNLn9bpfYYCG-Tl #DEBUG#: File src/test/e2e-emulated/debug/dump.tact:10:5: #DEBUG#: dump(address) #DEBUG#: EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N #DEBUG#: File src/test/e2e-emulated/debug/dump.tact:11:5: #DEBUG#: dump(myBalance()) -#DEBUG#: 10999604800 +#DEBUG#: 10999556400 #DEBUG#: File src/test/e2e-emulated/debug/dump.tact:15:5: #DEBUG#: dump(maybeBool1) #DEBUG#: null diff --git a/src/test/gas-consumption/__snapshots__/gas.spec.ts.snap b/src/test/gas-consumption/__snapshots__/gas.spec.ts.snap index 240d1f8e8d..33adfad6e3 100644 --- a/src/test/gas-consumption/__snapshots__/gas.spec.ts.snap +++ b/src/test/gas-consumption/__snapshots__/gas.spec.ts.snap @@ -38,23 +38,23 @@ exports[`benchmarks benchmark readFwdFee: code size 1`] = `116`; exports[`benchmarks benchmark readFwdFee: gas used 1`] = `1968`; -exports[`benchmarks benchmark sha256: gas hash string big 1`] = `2154`; +exports[`benchmarks benchmark sha256: gas hash string big 1`] = `2126`; -exports[`benchmarks benchmark sha256: gas hash string big repeated 1`] = `2155`; +exports[`benchmarks benchmark sha256: gas hash string big repeated 1`] = `2127`; -exports[`benchmarks benchmark sha256: gas hash string big repeated more 1`] = `2157`; +exports[`benchmarks benchmark sha256: gas hash string big repeated more 1`] = `2129`; -exports[`benchmarks benchmark sha256: gas hash string slice 1`] = `2154`; +exports[`benchmarks benchmark sha256: gas hash string slice 1`] = `2126`; -exports[`benchmarks benchmark sha256: gas hash string slice repeated 1`] = `2155`; +exports[`benchmarks benchmark sha256: gas hash string slice repeated 1`] = `2127`; -exports[`benchmarks benchmark sha256: gas hash string slice repeated more 1`] = `2157`; +exports[`benchmarks benchmark sha256: gas hash string slice repeated more 1`] = `2129`; -exports[`benchmarks benchmark sha256: gas hash string small 1`] = `1975`; +exports[`benchmarks benchmark sha256: gas hash string small 1`] = `1947`; -exports[`benchmarks benchmark sha256: gas hash string small repeated 1`] = `1975`; +exports[`benchmarks benchmark sha256: gas hash string small repeated 1`] = `1947`; -exports[`benchmarks benchmark sha256: gas hash string small repeated more 1`] = `1975`; +exports[`benchmarks benchmark sha256: gas hash string small repeated more 1`] = `1947`; exports[`benchmarks benchmark sqrt via geom mean: code size 1`] = `265`;