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

883 commits

Author SHA1 Message Date
EmelyanenkoK
0439613bff
Merge pull request #1543 from ton-blockchain/testnet
Merge developer branch
2025-03-05 17:21:19 +03:00
EmelyanenkoK
cf50b4b5da Update changelogs 2025-03-05 09:51:34 +03:00
EmelyanenkoK
6eeae5d78b
Merge pull request #1545 from ton-blockchain/tolk-v0.9
Tolk v0.9: nullable types `T?`, null safety, control flow, smart casts
2025-03-05 09:30:05 +03:00
neodix42
faf58118a4
Fix failing docker build - arm64 (#1541)
* fix docker github build (Segmentation fault (core dumped) dpkg: error processing package libc-bin (--configure))

* fix docker github build (Segmentation fault (core dumped) dpkg: error processing package libc-bin (--configure))

* update gh qemu actions

* run on ubuntu 24.04

* try driver-opts: image=moby/buildkit:v0.11.0

* split docker images for amd64 and arm64

* Revert "split docker images for amd64 and arm64"

This reverts commit 609617f005.

* clean libc-bin
2025-03-05 09:29:49 +03:00
tolk-vm
f67e9f4b6f
[Tolk] Bump version to v0.9 2025-02-28 16:44:18 +03:00
tolk-vm
ef0328837f
[Tolk] throw interrupts control flow; never type
In FunC (and in Tolk before) throwing an exception is just
calling a built-in function:
> throw 123; // actually, __throw(123)
Since it's a regular function, the compiler was not aware
that execution will stop, and all following code is unreachable.
For instance, `throw` in the end on function needed to be
followed by `return` statement.

Now, `throw` interrupts control flow, all statements after
it are considered unreachable. At IR level, code Ops are
also not produced.

This works because a built-in __throw() now has `never` type.
It can also be applied to custom functions:
> fun alwaysThrow(): never { throw 123; }
The code after alwaysThrow() call will also be unreachable.
2025-02-28 16:44:18 +03:00
tolk-vm
7bcb8b895f
[Tolk] Smart casts and control flow graph
With the introduction of nullable types, we want the
compiler to be smart in cases like
> if (x == null) return;
> // x is int now
or
> if (x == null) x = 0;
> // x is int now

These are called smart casts: when the type of variable
at particular usage might differ from its declaration.

Implementing smart casts is very challenging. They are based
on building control-flow graph and handling every AST vertex
with care. Actually, I represent cfg not a as a "graph with
edges". Instead, it's a "structured DFS" for the AST:
1) at every point of inferring, we have "current flow facts"
2) when we see an `if (...)`, we create two derived contexts
3) after `if`, finalize them at the end and unify
4) if we detect unreachable code, we mark that context
In other words, we get the effect of a CFG but in a more direct
approach. That's enough for AST-level data-flow.

Smart casts work for local variables and tensor/tuple indices.
Compilation errors have been reworked and now are more friendly.
There are also compilation warnings for always true/false
conditions inside if, assert, etc.
2025-02-28 16:44:15 +03:00
tolk-vm
f3e620f48c
[Tolk] Nullable types T? and null safety
This commit introduces nullable types `T?` that are
distinct from non-nullable `T`.
Example: `int?` (int or null) and `int` are different now.
Previously, `null` could be assigned to any primitive type.
Now, it can be assigned only to `T?`.

A non-null assertion operator `!` was also introduced,
similar to `!` in TypeScript and `!!` in Kotlin.

If `int?` still occupies 1 stack slot, `(int,int)?` and
other nullable tensors occupy N+1 slots, the last for
"null precedence". `v == null` actually compares that slot.
Assigning `(int,int)` to `(int,int)?` implicitly creates
a null presence slot. Assigning `null` to `(int,int)?` widens
this null value to 3 slots. This is called "type transitioning".

All stdlib functions prototypes have been updated to reflect
whether they return/accept a nullable or a strict value.

This commit also contains refactoring from `const FunctionData*`
to `FunctionPtr` and similar.
2025-02-28 16:41:41 +03:00
SpyCheese
44e7e091b2
Use HashSet/HashMap in storage stat (#1540) 2025-02-27 15:41:21 +03:00
SpyCheese
b3b2bd1c3c
New extra currency behavior (#1539) 2025-02-27 15:18:59 +03:00
tolk-vm
1389ff6789
[Tolk] Change order of assignment evaluation, lhs first
In FunC (and in Tolk before), the assignment
> lhs = rhs
evaluation order (at IR level) was "rhs first, lhs second".
In practice, this did not matter, because lhs could only
be a primitive:
> (v1, v2) = getValue()
Left side of assignment actually has no "evaluation".
Since Tolk implemented indexed access, there could be
> getTensor().0 = getValue()
or (in the future)
> getObject().field = getValue()
where evaluation order becomes significant.

Now evaluation order will be to "lhs first, rhs second"
(more expected from user's point of view), which will become
significant when building control flow graph.
2025-02-24 20:11:13 +03:00
Marat
1b70e48327
Add option to build static tonlibjson and emulator (#1527)
* add option to build static tonlibjson and emulator

* do not export cmake project in case of static tonlibjson
2025-02-23 15:01:33 +03:00
EmelyanenkoK
3ff951c225
Merge pull request #1530 from ton-blockchain/node-patch
Node patch
2025-02-21 11:50:15 +03:00
EmelyanenkoK
901467f424
Merge pull request #1529 from ton-blockchain/master
Merge master
2025-02-21 11:27:28 +03:00
SpyCheese
1e8fdc0561
Fix updateInit offset in storage (#1525) 2025-02-21 10:52:23 +03:00
Sild
61b9155d15
dont use instance after std::move (#1528)
Co-authored-by: Dmitrii Korchagin <d.korchagin@ston.fi>
2025-02-21 10:46:33 +03:00
SpyCheese
8a08bf67a2 Experimental flags for speeding up broadcasts 2025-02-20 17:32:24 +03:00
SpyCheese
04f2bc1360 Fix downloading persistent states in WaitBlockState 2025-02-19 12:44:50 +03:00
SpyCheese
aca51a8dae Don't check external messages if out of sync 2025-02-17 10:14:12 +03:00
SpyCheese
9d94e04d20 Add more stats to validator getstats
1) Liteserver queries count
2) Collated/validated blocks count, number of active sessions
3) Persistent state sizes
4) Initial sync progress
2025-02-17 10:13:17 +03:00
SpyCheese
ce6c29941e Get rid of std::cerr logs in collator/validator 2025-02-13 14:25:04 +03:00
EmelyanenkoK
2a68c8610b
Merge pull request #1516 from ton-blockchain/fix-ls-capabilities
Fix get_prev_blocks_info() at LS getConfigParams [does not affect validators]
2025-02-06 11:32:01 +03:00
Marat S
aef538114a Fix get_prev_blocks_info() at LS getConfigParams 2025-02-06 11:29:55 +03:00
EmelyanenkoK
050a984163
Merge pull request #1512 from ton-blockchain/testnet
Merge developer branch
2025-02-04 12:27:03 +03:00
EmelyanenkoK
3c245c6146
Add forgotten highload-v2 to unlock (#1511) 2025-02-03 11:16:44 +03:00
neodix42
c7271d97ae
Add smartcont+lib folders to release (#1508)
* add folders smartcont and lib only to release for having a small download link

* allow usage of patter in file name

* upgrade upload-release-action@v2 to v3

* Revert "upgrade upload-release-action@v2 to v3"

This reverts commit 516126084a.

* use gh cli for upload smartcont_lib

* use gh cli for upload smartcont_lib

* gh requires gh_token

* clean up
2025-02-03 11:16:11 +03:00
EmelyanenkoK
e5feb76b90
Merge pull request #1503 from ton-blockchain/tolk-v0.8
Tolk v0.8: preparation for structures; indexed access `var.0`
2025-02-03 11:15:38 +03:00
tolk-vm
b1c9466df4
Suppress clang warning "ATOMIC_FLAG_INIT marked deprecated" (#1502)
In C++20, macro 'ATOMIC_FLAG_INIT' has been marked as deprecated.
We need still to use it to be able to compile for C++17.
For now, just suppress this warning.
2025-01-27 17:09:21 +03:00
tolk-vm
e9d8f1611b
[Tolk] Bump version to v0.8 2025-01-27 15:30:21 +03:00
tolk-vm
5b44e01455
[Tolk] Allow cell and slice be valid identifiers
They are not keywords anymore.
> var cell = ...;
> var cell: cell = ...;
Motivation: in the future, when structures are implemented, this obviously should be valid:
> struct a { ... }
> var a = ...;
Struct fields will also be allowed to have names int/slice/cell.
2025-01-27 15:30:21 +03:00
tolk-vm
7a1602f591
[Tolk] Support syntax tensorVar.0 and tupleVar.0
It works both for reading and writing:
> var t = (1, 2);
> t.0;      // 1
> t.0 = 5;
> t;        // (5, 2)

It also works for typed/untyped tuples, producing INDEX and SETINDEX.

Global tensors and tuples works. Nesting `t.0.1.2` works. `mutate` works.
Even mixing tuples inside tensors inside a global for writing works.
2025-01-27 15:30:21 +03:00
tolk-vm
565bc59735
[Tolk] Refactor: get rid of split_vars, construct valid LET ops
In FunC (and in Tolk before), tensor vars (actually occupying
several stack slots) were represented as a single var in terms
or IR vars (Ops):
> var a = (1, 2);
> LET (_i) = (_1, _2)

Now, every tensor of N stack slots is represented as N IR vars.
> LET (_i, _j) = (_1, _2)

This will give an ability to control access to parts of a tensor
when implementing `tensorVar.0` syntax.
2025-01-27 15:30:21 +03:00
tolk-vm
989629a832
[Tolk] Compiler built-in __expect_type() for testing purposes
Currently, tolk-tester can test various "output" of the compiler:
pass input and check output, validate fif codegen, etc.
But it can not test compiler internals and AST representation.

I've added an ability to have special functions to check/expose
internal compiler state. The first (and the only now) is:
> __expect_type(some_expr, "<type>");
Such a call has special treatment in a compilation process.
Compilation fails if this expression doesn't have requested type.

It's intended to be used in tests only. Not present in stdlib.
2025-01-27 15:30:21 +03:00
Marat
c720204199
Fix BUILD_SHARED_LIBS issue (#1496) 2025-01-27 14:34:21 +03:00
EmelyanenkoK
294db69227 Fix typos in changelog 2025-01-27 14:33:52 +03:00
EmelyanenkoK
6f1feb43d5 Update Changelogs 2025-01-27 12:58:54 +03:00
SpyCheese
8ffa3dd9dc
Fix printing TLB NatWidth (#1501) 2025-01-27 12:55:00 +03:00
Andrey Tvorozhkov
2a02b54786
Fix advance_ext (#746) 2025-01-27 12:22:00 +03:00
tuminzee
ed88f55a3d
fix broken link (#1497) 2025-01-27 10:35:56 +03:00
EmelyanenkoK
818a254126 Merge branch 'master' into testnet 2025-01-27 10:33:58 +03:00
Marat
99b78f78d7
build fix (#1495) 2025-01-27 10:20:20 +03:00
neodix42
7d9ef6e0bf
Fix wasm artifacts (#1499)
* put back emscripten 3.1.19

* add create-tolk-release.yml

* filter out master branch only
2025-01-27 10:18:51 +03:00
neodix42
59a8cf0ae5
create tolk release github action (#1490)
* add create-tolk-release.yml

* adjust create-tolk-release for old workflows

* use custom tag

* use old names

* use old names
2025-01-26 16:41:17 +03:00
Marat
e7e57f8e6d
add extra currencies support to emulator (#1494) 2025-01-26 16:39:05 +03:00
SpyCheese
da5644e758
Enable VmState::jump_to bugfix in version 9 (#1491) 2025-01-24 17:48:05 +03:00
Ivan Kalinin
0f6cf13d45
fix(vm): fix saving ret on deep jump (#1487) 2025-01-24 17:41:43 +03:00
EmelyanenkoK
fe46f0e238
Merge pull request #1482 from ton-blockchain/tvm-v9
Tvm v9
2025-01-22 11:13:49 +03:00
neodix42
e0605156de
Reworked TON portable artifacts (#1486)
* improve windows builds

* install nasm for openssl compilation on win

* install nasm for openssl compilation on win for github

* add create-state, proxy-liteserver, rldp-http-proxy, http-proxy, adnl-proxy, dht-server, libtonlibjson.so and libemulator.so to docker image

* build new artifacts inside Docker

* add files smartcont/auto/* to docker image

* build arm64 in docker branch build

* improve secp256k1 build

* adding natively portable binaries (all statically linked with libc++, without nixpkgs help) for x86-64 linux

* install missing headers on ubuntu 20.04

* use clang-16 on ubuntu 20.04

* remove gsl for portable artifacts; add -f key to generate-random-id in order to read addr_list from file;

* typo

* decode json

* decode json

* add github workflow for appimages creation

* add missing dependencies

* use libc++ for appimages artifacts

* typo

* appimages wihtout libc++

* appimages with libc++ and some checks

* add appimages to release (for testing)

* add appimages to release (for testing)

* add appimages to release (for testing)

* add appimages to release (for testing) 2

* add appimages to release (for testing) 3

* appimages only on ubuntu 22 with ssl-3 for now

* appimages only on ubuntu 20 with ssl-3 for now

* appimages only on ubuntu 20 with ssl-3 for now

* add export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}" to appimage AppRun

* create release

* appimages without jemalloc

* bind specific libraries to appimages

* add libreadline

* add plain portable libs

* add proper /lib/x86_64-linux-gnu/libreadline.so.8

* app images build with libc

* try to ensure ABI compatibility with older glibc

* try to ensure ABI compatibility with older glibc for shared libraries

* shared lib without libc but with D_GLIBCXX_USE_CXX11_ABI and -static-libgcc -static-libstdc++

* add -fPIC -fcommon

* add /lib/x86_64-linux-gnu/libstdc++.so.6 to static binaries

* add -static-libgcc -static-libstdc++ to libtonlibjson and emulator when PORTABLE=1

* add -static-libgcc -static-libstdc++ to libtonlibjson and emulator when PORTABLE=1

* update emulator portable

* Update CMakeLists.txt

* test portable macos binaries

* do not use -static-libgcc -static-libstdc++ on mac for shared libs

* do not use -static-libgcc -static-libstdc++ on mac for shared libs

* adjust create-release.yml

* minor fixes, typos

* minor fixes

* linux apps double check

* avoid infinite loop when place in system bin dir

* avoid infinite loop when place in system bin dir 2

* test compilation on linux arm64

* test appimages on arm64 linux

* test appimages on arm64 linux 2

* add portable linux arm64 to release

* clean up

* update README.md
2025-01-21 11:27:25 +03:00
SpyCheese
e42b0cba26 Merge branch 'testnet' into tvm-v9 2025-01-20 13:59:59 +03:00
EmelyanenkoK
1b7c46f496
Merge pull request #1477 from ton-blockchain/tolk-v0.7
Tolk v0.7: overhaul compiler internals and the type system; `bool` type
2025-01-20 12:31:03 +03:00