Skip to content

Tun #1666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 100 commits into
base: testnet-tunnel
Choose a base branch
from
Open

Tun #1666

wants to merge 100 commits into from

Conversation

xssnick
Copy link
Contributor

@xssnick xssnick commented May 12, 2025

No description provided.

EmelyanenkoK and others added 30 commits March 5, 2025 17:21
* Ignore clangd .cache directory

With the in-tree build, clangd likes to put its cache files inside of
/.cache. Thus, put the directory to .gitignore.

* Remove redundant cmake_minimum_required calls

There is no need to repeat the same information in all subprojects, the
call in the root CMakeLists.txt is more than enough.

* Bump minimum CMake version to 3.16

This avoids deprecation warnings on newer CMake versions. 3.16 was
chosen as a version easily available on Ubuntu 20.04 -- the oldest
distributive we support.

* Do not automatically add -stdlib=libc++ when sanitizers are requested

In my experience, adding -stdlib=libc++ during compilation of a project
with C++ dependencies which are not consistently using libc++ never
works. In this particular case, modern enough stdlibc++ works just fine
when compiled with Clang and sanitizers, while using libc++ results in
obscure linker errors.

* Do not fall back to -O2 if CMAKE_BUILD_TYPE == RelWithDebInfo

* Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for enabling ccache

Additionally, if user has already specified either of these two
variables, don't override their choices.

As per documentation, RULE_LAUNCH_{COMPILE,LINK} are only supposed to be
used in internal CMake code. More importantly, the previous approach
appended ccache two times if CMAKE_CXX_COMPILER_LAUNCHER was provided in
command line or via an environment variable.

* Remove unused crypto/openssl/digest.h
Along with hex 0x, 0b is also parsed.
Example: 0b1010101010101010 == 43690.
Trailing comma is now allowed in:
* tensors
* tuples
* function calls
* function parameters

Note, that `(5)` is not a tensor, it's just integer `5`.
With a trailing comma `(5,)` it's still `(5)`.
Introduces fixed-size integer types:
* intN for signed integers (0 < N ≤ 256)
* uintN for unsigned integers (0 < N ≤ 257)

The generic `int` type remains unchanged and can be
implicitly cast to and from any `intN`.
* arithmetic operations on `intN` degrade to `int`
* numeric literals (like 0, 100) are just `int`
* direct assignment between `intN` and `intM`
  is disallowed (as a probable error)

There is no runtime overflow. A variable is declared as `int8`
can hold any 257-bit value during execution.
Overflow will occur when packing to a cell (in the future).
Constant evaluator has been rewritten to utilize
type inferring mechanism. Now,
> const a = 1 as int8;
is valid, and constants can not only be int/slice, but
also intN/uintN and bool.
A new compile-time function is introduced.
It converts a constant floating-point string to nanotoncoins.
Example: `ton("0.05")` is equal to 50000000.
It requires a constant string; `ton(some_var)` is an error.

Type of its return value is `coins`, not `int`.
Like `intN`, it's backed by a general int at TVM level,
all arithmetics (except addition) degrade to int.
Type `coins` will be serialized as varint16 in the future.
Their purpose is exactly like `intN`: future serialization,
to specify fixed-size binary fields (like TL/B bits256).

Note, that unlike intN, explicit casting is required.
> fun calcHash(raw: bits512) { }
> calcHash(someSlice); // error
> calcHash(someSlice as bits512); // ok
This commit reorganizes tests for the compiler.
Before, they all were places in a single folder.
Now, they negative tests are separated.
Negative tests are named just `err-XXXX`, for quick
file search in IDE.

Tolk-tester can now execute tests by "contains" pattern:
> tolk-tester tests catch
will find "tests/**/*catch*.tolk"
With the introduction function `ton("0.05")`, I decided to
remove old FunC-style string postfixes "..."c, "..."H, etc.
in favor of a clearer and more flexible approach.

"..."c -> stringCrc32("...")
no way -> stringCrc16("...")
"..."H -> stringSha256("...")
"..."h -> stringSha256_32("...")
"..."a -> stringAddressToSlice("...")
"..."s -> stringHexToSlice("...")
"..."u -> stringToBase256("...")

These functions are compile-time only.
They can be used in constant initialization.
Tolk v0.10: preparing for serialization; types `intN`, `bytesN`, `coins`
SHA256_* family avoids a (gigantic) overhead of OpenSSL's EVP interface.
Locally, this gives 6% performance boost for block verification.
Implement SHA256 hasher using the deprecated SHA256_* function family
…h for tonlib (ton-blockchain#1557)

* Update stack_limit

* Added external-in normalized hash and increased stack depth for tonlib

* Removed debug logs
Whenever git watcher decides that the git state has changed, it spends
multiple seconds trying to retrieve information about this changed
state. This is incredibly annoying as it slows down edit-compile-run
cycle for no reason.
* Update collator.cpp

* Update Stack.fif

* Update parse-func.cpp
…ain#1582)

* improve github actions by utilizing github cache and ccache.

* download libmicrohttpd from ftp

* minor fix

* no cache

* no cache 2

* no cache test 3

* with cache test 1

* with cache test 2

* test without gh cache

* test with gh cache
* celldb: version 2

- thread safe cache
- parallel commit
- multiple optimizations
- support of key-value merge operations
- improved tests and benchmarks
- in-memory version won't read from key value after start - uses vector in-memory table now
- use rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords - do not silently ignore errors during recovery

* celldb: add test for load nonexisting cell, test thread safeness of CellUsageTree, fixes

---------

Co-authored-by: birydrad <>
SpyCheese and others added 30 commits April 22, 2025 20:14
* not always gh mac runners have nproc utility

* deprecate Ubuntu 20.04

* fix linking issues of portable tonlibjson.dylib

* fix libemulator.dylib linking issues
Now, only VarDescr::int_const represents whether it's a constant,
without being combined (and potentially become unsync) val bit.
Support declaring structures with arbitrary fields
and creating objects very similar to TS syntax.
Structs are actually tensors on a stack, and accessing their
fields behave exactly as accessing tensor's elements by index.
As a consequence, recurring struct fields doesn't work;
it will lead to infinity size.

All features of type system (nullables, unions) seamlessly
work with structures. A struct with 1 field has no extra
overhead, it's just a field on a stack.
Now fields can have default values, even complex ones:
> tensor: (int, coins) = (2, ton("0.05"))
Initial value must be a constant expression.

Global constants can also now be of any type,
including tensors and nullables.
Constant evaluator was almost dropped off, evaluation
is now done at IR (Ops) level.
Until this MR, parsing any type from tokens immediately
resulted in TypePtr.
This MR introduces an intermediate AST representation for types,
which are resolved at a later step.
It's a necessary refactoring towards generics.
Now structures can be generic: Container<T> and similar.
The same goes for type aliases: type A<T> = Container<T>.

Like generic functions, every struct is instantiated,
"Container<int>" and "Container<slice>" become different
symbols, and on instantiation they walk though the pipeline.
Type inferring and checking are done only upon instantiation.
This update greatly enhances reading Fift output:
1) stack comments are aligned
2) original lines from .tolk files are output as comments,
   grouping asm instructions

Internally, every AsmOp now has SrcLocation.
When outputting them one by one, an original .tolk line is
inserted if locations differ.
This can be optimized later by storing an index
to fast mapping of location (offset) into a line in a file.
In FunC, any function could be called `f(arg)` or `arg.f()`.
You had to call `cell.cell_hash()` / `slice.slice_hash()`:
these were two different global-scope functions.

Now, Tolk, as other languages, separates functions from methods.
It drops the ability to call a function via dot;
you can only call a method (for an object type).

> fun cell.hash(self): int ...
> fun slice.hash(self): int ...

With methods, stdlib functions became short:
`t.size()` instead of `t.tupleSize()`, and so on.

Methods can be declared for any type, including generics.
Calling a method, the compiler does type matching to detect
the only method from many equally named. This could be
generalized to functions overloading some day.
This is now valid:
> struct Container<T = int?> { item: T = null }
> Container{}   // does Container<int?>

Defaults for Ts work both for functions and structs.
Their main purpose is to have the `never` default:
> struct WithOptField<T = never> { f: T; }
I've added a rule that if a struct has the `never` field,
it can be missed out from a literal while creation
(like it doesn't exist at all).
This will be used in stdlib later.
This partially "reverts" the behavior of pragma
'compute-asm-ltr' from FunC, which was always on in Tolk.
Now, if it's safe, for asm functions with arg_order,
arguments are evaluated and placed onto the stack
in a desired order. When it's unsafe (the purpose
of this pragma, actually), arguments are evaluated
left-to-right.
Tolk v0.12: structures, generics, and methods
* Remove AdnlStaticNodesManager

* Remove AdnlPeer

---------

Co-authored-by: EmelyanenkoK <emelyanenko.kirill@gmail.com>
…n#1690)

* Bugfix in AccountStorageStat::remove_cell

* Fix returning null as c4/c5 in RUNVM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.