Skip to content

Commit

Permalink
feat: TVM instructions from 2023-07 and 2024-04 upgrades in stdlib (t…
Browse files Browse the repository at this point in the history
…act-lang#331)

- https://docs.ton.org/learn/tvm-instructions/tvm-upgrade-2023-07
- https://docs.ton.org/learn/tvm-instructions/fee-calculation-instructions

* feat: `send` function now returns forward fee

* feat: add `SendOnlyEstimateFee` constant

* rename: `equal_slice_bits` -> `equal_slices_bits`
  • Loading branch information
Gusarich authored Sep 4, 2024
1 parent e132278 commit 2d041a1
Show file tree
Hide file tree
Showing 11 changed files with 533 additions and 445 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Wider range of serialization options for integers — `uint1` through `uint256` and `int1` through `int257`: PR [#558](https://github.com/tact-lang/tact/pull/558)
- The `deepEquals` method for the `Map` type: PR [#637](https://github.com/tact-lang/tact/pull/637)
- `asm` bodies for module-level functions: PR [#769](https://github.com/tact-lang/tact/pull/769)
- Corresponding stdlib functions for new TVM instructions from 2023.07 and 2024.04 upgrades: PR [#331](https://github.com/tact-lang/tact/pull/331)

### Changed

Expand Down
12 changes: 12 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"alnum",
"assgn",
"augmentedassign",
"basechain",
"BBITS",
"blockstore",
"bounceable",
Expand All @@ -29,6 +30,7 @@
"disasm",
"divmod",
"dnsresolve",
"DUEPAYMENT",
"elseifnot",
"ENDC",
"Fift",
Expand All @@ -38,6 +40,13 @@
"funcid",
"funs",
"gettest",
"GASCONSUMED",
"GETGASFEE",
"GETSTORAGEFEE",
"GETFORWARDFEE",
"GETGASFEESIMPLE",
"GETFORWARDFEESIMPLE",
"GETORIGINALFWDFEE",
"HASHCU",
"HASHEXT",
"HASHSU",
Expand Down Expand Up @@ -71,6 +80,7 @@
"mktemp",
"multiformats",
"MYADDR",
"nanotons",
"Neovim",
"NEWC",
"nocheck",
Expand Down Expand Up @@ -103,12 +113,14 @@
"SDSKIPFIRST",
"SEMPTY",
"SENDRAWMSG",
"SENDMSG",
"seqno",
"SETINDEXVARQ",
"shiki",
"SREFS",
"SREMPTY",
"Stateinit",
"STBR",
"STDICT",
"stdlib",
"STIX",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ if (flag) {
},
{
"code": {
"code": "return equal_slice_bits(a, b);",
"code": "return equal_slices_bits(a, b);",
"kind": "generic",
},
"comment": null,
Expand All @@ -1596,7 +1596,7 @@ if (flag) {
},
{
"code": {
"code": "return (null?(a)) ? (false) : (equal_slice_bits(a, b));",
"code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));",
"kind": "generic",
},
"comment": null,
Expand All @@ -1612,7 +1612,7 @@ if (flag) {
"code": {
"code": "var a_is_null = null?(a);
var b_is_null = null?(b);
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slice_bits(a, b) ) : ( false ) );",
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );",
"kind": "generic",
},
"comment": null,
Expand Down Expand Up @@ -5141,7 +5141,7 @@ if (flag) {
},
{
"code": {
"code": "return equal_slice_bits(a, b);",
"code": "return equal_slices_bits(a, b);",
"kind": "generic",
},
"comment": null,
Expand All @@ -5155,7 +5155,7 @@ if (flag) {
},
{
"code": {
"code": "return (null?(a)) ? (false) : (equal_slice_bits(a, b));",
"code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));",
"kind": "generic",
},
"comment": null,
Expand All @@ -5171,7 +5171,7 @@ if (flag) {
"code": {
"code": "var a_is_null = null?(a);
var b_is_null = null?(b);
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slice_bits(a, b) ) : ( false ) );",
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );",
"kind": "generic",
},
"comment": null,
Expand Down Expand Up @@ -8700,7 +8700,7 @@ if (flag) {
},
{
"code": {
"code": "return equal_slice_bits(a, b);",
"code": "return equal_slices_bits(a, b);",
"kind": "generic",
},
"comment": null,
Expand All @@ -8714,7 +8714,7 @@ if (flag) {
},
{
"code": {
"code": "return (null?(a)) ? (false) : (equal_slice_bits(a, b));",
"code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));",
"kind": "generic",
},
"comment": null,
Expand All @@ -8730,7 +8730,7 @@ if (flag) {
"code": {
"code": "var a_is_null = null?(a);
var b_is_null = null?(b);
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slice_bits(a, b) ) : ( false ) );",
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );",
"kind": "generic",
},
"comment": null,
Expand Down
6 changes: 3 additions & 3 deletions src/generator/writers/writeStdlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ export function writeStdlib(ctx: WriterContext) {
ctx.context("stdlib");
ctx.body(() => {
ctx.write(`
return equal_slice_bits(a, b);
return equal_slices_bits(a, b);
`);
});
});
Expand All @@ -1379,7 +1379,7 @@ export function writeStdlib(ctx: WriterContext) {
ctx.context("stdlib");
ctx.body(() => {
ctx.write(`
return (null?(a)) ? (false) : (equal_slice_bits(a, b));
return (null?(a)) ? (false) : (equal_slices_bits(a, b));
`);
});
});
Expand All @@ -1392,7 +1392,7 @@ export function writeStdlib(ctx: WriterContext) {
ctx.write(`
var a_is_null = null?(a);
var b_is_null = null?(b);
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slice_bits(a, b) ) : ( false ) );
return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );
`);
});
});
Expand Down
Loading

0 comments on commit 2d041a1

Please sign in to comment.