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

1105 commits

Author SHA1 Message Date
SpyCheese
f1bc4c40e5 Merge branch 'testnet' into accelerator 2025-03-06 17:16:01 +03:00
SpyCheese
f92cdf327c Fix nullptr error in Collator::finalize_stats 2025-03-05 16:10:50 +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
2616535a0b Merge branch 'testnet' into accelerator 2025-02-27 15:53:05 +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
SpyCheese
bf884b5611 Merge branch 'testnet' into accelerator 2025-02-21 12:19:27 +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
45c0048ecc Merge branch 'testnet' into accelerator 2025-02-20 14:22:17 +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
SpyCheese
ea0d2808b8 Merge branch 'testnet' into accelerator 2025-01-31 14:12:22 +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
SpyCheese
af529f5b4c Merge branch 'testnet' into accelerator 2025-01-27 15:23:11 +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
SpyCheese
13a3622596 Merge branch 'testnet' into accelerator 2025-01-27 11:49:28 +03:00
SpyCheese
0763691f70 Simplify loading virtual states from collated data, fix message queue cleanup 2025-01-27 11:49:18 +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