1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 19:22:37 +00:00
Commit graph

274 commits

Author SHA1 Message Date
SpyCheese
954a96a077
Accelerator: partial fullnodes (#1393)
* Accelerator: partial fullnodes

1) Node can monitor a subset of shards
2) New archive slice format (sharded)
3) Validators are still required to have all shards
4) Support partial liteservers in lite-client, blockchain explorer, tonlib
5) Proxy liteserver

* Fix compilation error
2024-11-26 14:46:58 +03:00
tolk-vm
f00ff75548
[FunC] Make Expr::VarApply always impure (#1381)
Expr::_VarApply is now always impure. It means, that
for `some_var()`, don't make any considerations about runtime value,
it's always called.
2024-11-14 18:32:04 +03:00
tolk-vm
89f136e670
[FunC] Add more tests for try/catch (#1380)
After fixing a bug with c1/c3 registers in #1332,
cover an issue with tests.
2024-11-14 18:31:21 +03:00
EmelyanenkoK
3ce6118c3f
Fix try-catch: save c1, c3 to catch continuation (#1332) 2024-11-02 18:23:08 +03:00
tolk-vm
d9dba320cc
[Tolk] Get rid of ~tilda with mutate and self methods
This is a very big change.
If FunC has `.methods()` and `~methods()`, Tolk has only dot,
one and only way to call a `.method()`.
A method may mutate an object, or may not.
It's a behavioral and semantic difference from FunC.

- `cs.loadInt(32)` modifies a slice and returns an integer
- `b.storeInt(x, 32)` modifies a builder
- `b = b.storeInt()` also works, since it not only modifies, but returns
- chained methods also work, they return `self`
- everything works exactly as expected, similar to JS
- no runtime overhead, exactly same Fift instructions
- custom methods are created with ease
- tilda `~` does not exist in Tolk at all
2024-11-02 03:44:14 +04:00
tolk-vm
12ff28ac94
[Tolk] Completely rework stdlib: multiple files and renaming
- split stdlib.tolk into multiple files (tolk-stdlib/ folder)
  (the "core" common.tolk is auto-imported, the rest are
  needed to be explicitly imported like "@stdlib/tvm-dicts.tolk")
- all functions were renamed to long and clear names
- new naming is camelCase
2024-11-02 03:44:13 +04:00
tolk-vm
e2edadba92
[Tolk] v0.6 syntax: fun, import, var, types on the right, etc.
Lots of changes, actually. Most noticeable are:
- traditional //comments
- #include -> import
- a rule "import what you use"
- ~ found -> !found (for -1/0)
- null() -> null
- is_null?(v) -> v == null
- throw is a keyword
- catch with swapped arguments
- throw_if, throw_unless -> assert
- do until -> do while
- elseif -> else if
- drop ifnot, elseifnot
- drop rarely used operators

A testing framework also appears here. All tests existed earlier,
but due to significant syntax changes, their history is useless.
2024-11-02 03:44:13 +04:00
tolk-vm
5a3e3595d6
[Tolk] Compilation pipeline, register global symbols in advance
Since I've implemented AST, now I can drop forward declarations.
Instead, I traverse AST of all files and register global symbols
(functions, constants, global vars) as a separate step, in advance.

That's why, while converting AST to Expr/Op, all available symbols are
already registered.
This greatly simplifies "intermediate state" of yet unknown functions
and checking them afterward.

Redeclaration of local variables (inside the same scope)
is now also prohibited.
2024-11-02 01:33:09 +04:00
tolk-vm
6c30e5a7eb
[Tolk] Embedded stdlib.tolk, CompilerState, strict includes
Several related changes:
- stdlib.tolk is embedded into a distribution (deb package or tolk-js),
  the user won't have to download it and store as a project file;
  it's an important step to maintain correct language versioning
- stdlib.tolk is auto-included, that's why all its functions are
  available out of the box
- strict includes: you can't use symbol `f` from another file
  unless you've #include'd this file
- drop all C++ global variables holding compilation state,
  merge them into a single struct CompilerState located at
  compiler-state.h; for instance, stdlib filename is also there
2024-11-02 01:33:08 +04:00
tolk-vm
f0e6470d0b
[Tolk] Rewrite lexer, spaces are not mandatory anymore
A new lexer is noticeably faster and memory efficient
(although splitting a file to tokens is negligible in a whole pipeline).

But the purpose of rewriting lexer was not just to speed up,
but to allow writing code without spaces:
`2+2` is now 4, not a valid identifier as earlier.

The variety of symbols allowed in identifier has greatly reduced
and is now similar to other languages.

SrcLocation became 8 bytes on stack everywhere.

Command-line flags were also reworked:
- the input for Tolk compiler is only a single file now, it's parsed, and parsing continues while new #include are resolved
- flags like -A -P and so on are no more needed, actually
2024-11-02 01:33:08 +04:00
tolk-vm
0bcc0b3c12
[Fift] Fix an issue of FunC/Tolk WASM which truncated long fif output
As it turned out, PSTRING() created a buffer of 128K.
If asm_code exceeded this buffer, it was truncated.
I've just dropped PSTRING() from there in favor of std::string.
2024-11-02 01:33:08 +04:00
tolk-vm
ebbab54cda
[Tolk] Tolk v0.5.0 as FunC v0.5.0 could have been like
All changes from PR "FunC v0.5.0":
https://github.com/ton-blockchain/ton/pull/1026

Instead of developing FunC, we decided to fork it.
BTW, the first Tolk release will be v0.6,
a metaphor of FunC v0.5 that missed a chance to occur.
2024-11-02 01:33:08 +04:00
tolk-vm
82648ebd6a
[Tolk] Initial commit of TOLK Language: fork all sources from FunC
The Tolk Language will be positioned as "next-generation FunC".
It's literally a fork of a FunC compiler,
introducing familiar syntax similar to TypeScript,
but leaving all low-level optimizations untouched.

Note, that FunC sources are partially stored
in the parser/ folder (shared with TL/B).
In Tolk, nothing is shared.
Everything from parser/ is copied into tolk/ folder.
2024-11-02 01:33:08 +04:00
Victor S.
c1ee18c902
Add state-init option to wallet-v3.fif script (#1282) 2024-10-19 12:34:08 +03:00
SpyCheese
603d1d14b9
More precise calculation of expected shard blocks in checkload (#1279)
* More precise calculation of expected shard blocks in checkload

* Fix monte-carlo checkload
2024-10-15 17:59:12 +03:00
SpyCheese
5920f800de
Improve gas consumption in VmState::jump_to (#1276) 2024-10-15 17:43:46 +03:00
SpyCheese
2ce2c8fc49
Count account_dict size in block size estimation (#1261)
* Count account_dict size in block size estimation

* Fix updating account dict estimator
2024-10-12 13:21:47 +03:00
EmelyanenkoK
d04cdfa0dc
Use parallel write to celldb (#1264)
* Parallel write in celldb

* Add TD_PERF_COUNTER to gc_cell and store_cell

* More error handling

* Tests for prepare_commit_async

* Install g++11 for ubuntu 20.04

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-10-11 15:31:59 +03:00
Aleksandr Kirsanov
fd1735f6ec
[FunC] Fix a bug with << operator to zero value (#1262) 2024-10-09 16:03:58 +03:00
SpyCheese
f94d1bee0c
Extra currencies (#1122)
* Support extra currencies in tonlib, blockchain-explorer, getAccountPrunned

* Fix dict_combine_with with non-zero mode
2024-10-01 10:22:49 +03:00
SpyCheese
257cd8cd9c
Fix estimating block size, repeat collation on error (#1178)
* Fix extimating block size, repeat collation on error

* Cancel collation when it is non needed
2024-10-01 10:22:15 +03:00
EmelyanenkoK
b78199370e
Merge pull request #1202 from ton-blockchain/tvm-patch
Fix transaction original_balance and VmState::jump_to
2024-09-23 21:10:57 +03:00
birydrad
72020c04c4
celldb in-memory mode, stats for actors, perf counters, minor fix in rldp2 (#1164)
* getactorstats query for validator-engine-console

* celldb in-memory mode (--celldb-in-memory option)

* rldp2: bugfix - do not estimate speed while nothing is sent

* add simple ed25519 benchmark

* fix compilation errors of different platforms and move to c++20

* fix some warnings

* turn on TON_USE_ABSEIL for glibc 2.27 nix build

---------

Co-authored-by: birydrad <>
2024-09-23 17:34:37 +03:00
neodix42
5f51d3d04f
Remove redundant linking dependencies (#1198)
* fixing compilation warning:
ld: warning: ignoring duplicate libraries: '../crypto/libton_block.a', '../crypto/libton_crypto.a'

* update upload-artifact version in TON Static Code Analysis GH action

* remove even more redundant linking dependencies

* remove even more redundant linking dependencies 2
2024-09-23 17:31:01 +03:00
SpyCheese
2cca7fddcc Consume gas in VmState::jump_to 2024-09-23 12:09:16 +03:00
SpyCheese
e04965c400 Fix setting original_balance in transaction.cpp 2024-09-20 15:16:46 +03:00
SpyCheese
b5734d2e30 Get rid of recursion in tvm continuations 2024-09-20 15:16:27 +03:00
EmelyanenkoK
9f203890f4 Merge branch 'SpyCheese-mintless-util' into testnet 2024-09-13 20:44:47 +03:00
SpyCheese
76cda01af9 mintless-proof-generator make_all_proofs 2024-09-13 10:09:03 +03:00
EmelyanenkoK
1a5bbf30f1
mintless-proof-generator (#1166)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-09-12 18:02:56 +03:00
SpyCheese
1e5d84a9d8 mintless-proof-generator 2024-09-12 11:50:34 +03:00
SpyCheese
908415d00b
Accelerator, part 1 (#1119)
This commit contains some parts of https://github.com/ton-blockchain/ton/tree/accelerator
This is auxiliary code that mostly does not change node behavior.

1) Semiprivate overlays and other improvements in overlays code
2) Rename actual_min_split -> monitor_min_split, fix building shard overlays
3) Loading block candidates by block id from DB, fix accept_block after validator restart
4) Cells: ProofStorageStat and changes in CellUsageTree
5) Remove some unused code, other minor changes
2024-08-23 11:46:40 +03:00
SpyCheese
0cff1c88f7
Fix UB in blst aggregate verify (#1107) 2024-08-15 12:53:05 +03:00
neodix42
679e6be294
Remove rocksdb usage from fift (#1064)
* add github action for macOS 14 (arm64, M1)

* add github action (portable) for macOS 14 (arm64, M1)

* rename macOS arm64 output artifact

* Update libsodium on windows

* Compile libsodium

* Update build-windows.bat

* use upgraded libsodium 1.0.20; use compiled static libsodium for Windows instead of precompiled;

* revert libsodium 1.0.20; use compiled static libsodium for Windows instead of precompiled;

* use upgraded libsodium 1.0.20; use compiled static libsodium for Windows instead of precompiled;

* fix libsodium version 1.0.19; use compiled static libsodium for Windows instead of precompiled;

* try 1.0.20 libsodium precompiled on github

* try 1.0.18 libsodium precompiled on github

* try windows build on win server 2019

* and use PlatformToolset=v142

* use cmake -G "Visual Studio 16 2019"

* fix path to msvc 2019 on github

* separate github windows build on win server 2019 and build on win server 2022

* Update assembly/native/build-windows-2019.bat

add retry mechanism

Co-authored-by: Dr. Awesome Doge <doge@ton.org>

* add test-emulator; disable test groovy pipeline

* trigger all gh actions

* fix win build

* call test-emulator

* remove usage of rocksdb in fift-lib

* put back some code for test-db

* fix test-emulator

* remove usage of db-path parameter in fift

* some func adjustments

* fix checkout of openssl in fift-func-wasm-build-ubuntu.sh

* typo

* improve wasm build script for quicker turn around

* remove sENVIRONMENT=web,worker for funcfiftlib. will be added later.

* remove sENVIRONMENT=web,worker for funcfiftlib. will be added later.

* remove sENVIRONMENT=web,worker for funcfiftlib. will be added later.

* minor adjustments

* remove -d option in fift; optimize fift-lib usage

* reduce tondb usage

---------

Co-authored-by: neodiX <neodix42@ton.org>
Co-authored-by: Dr. Awesome Doge <doge@ton.org>
Co-authored-by: ms <dungeon666master@protonmail.com>
2024-07-26 22:10:55 +03:00
SpyCheese
28f9a9b159
More verbose vm logs, fix parsing slice literals (#1076)
* More verbose VM logs

* Fix parsing slice literals in fift
2024-07-26 16:09:43 +03:00
Marat
a5521a60aa
Fix incorrect gas consumption with verbosity > 3 (#1077) 2024-07-26 15:08:52 +03:00
SpyCheese
b9e89d4c66
"getcollatoroptionsjson" command in validator console (#1059)
* "getcollatoroptionsjson" command in validator console

* Improve state serializer

Use previous persistent state to speed up reading
2024-07-17 15:10:55 +03:00
EmelyanenkoK
57f95cc282
Add collator options (#1052)
* Set collator options from validator console

* Fix compilation error in manager-disk

* Defer all messages if out msg queue is too big

* Fix checking queue size in collator

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-07-10 14:58:13 +03:00
SpyCheese
c54f095c1b
Don't use user-provided fees for internal messages (#1050) 2024-07-10 09:17:37 +03:00
EmelyanenkoK
0daee1d887
Merge message dispatch queue (#1030)
* Deferred messages and msg metadata

* Store out msg queue size in state

* Add checks for queue processing

1. Collator must process at least one message from AccountDispatchQueue (unless block is full)
2. The first message from a transaction is not counted, it cannot be deferred (unless AccountDispatchQueue is not empty)

* Return msg metadata from LS in listBlockTransactions[Ext]

* Enable new features by capabilities

* Changes in deferred messages

* Process deferred messages via new_msgs in collator
* Rework setting deferred_lt, bring back check_message_processing_order, check order of deferred_lt in validator

* Use have_unprocessed_account_dispatch_queue_ in collator

* Fix setting transaction lt for deferred messages

* Fix lite-client compilation error

* Changes in process_dispatch_queue, rename deferred_lt -> emitted_lt

* Fix compilation error

* Use uint64 for msg queue size

* Add liteServer.getBlockOutMsgQueueSize

* Fix compilation error

* Fix typos in comments

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-06-27 16:12:23 +03:00
Snoppy
2634e63e4f
chore: fix typos (#980)
Signed-off-by: snoppy <michaleli@foxmail.com>
2024-06-27 11:16:12 +03:00
Max Mercuriev
c56e65739b
Doclinks that refer to docs.ton.org domain (#1029)
* Correct documentation link

Update moved URL in comments

* Update all doc links
2024-06-27 11:03:16 +03:00
EmelyanenkoK
c2e7278fcd
Fix skipped action list order (#1036)
* nullify incorrect actions directly in skipped_action_list
2024-06-25 11:18:36 +03:00
EmelyanenkoK
bd23029d0a
Soft send message validation (#1021)
* check mode on invalid action_send_msg

* Fix random seed generation

* Explicitly skip invalid actions

* Count skipped valid messages, rename cfg option to message_skip_enabled

* Allow unfreeze via external messages

* Detect and handle bounce_on_fail mode for invalid messages

* Fix codestyle

* Adjust doc
2024-06-11 15:08:08 +03:00
neodix42
5186c4755c
Change fift path separator for FIFTPATH and -I argument (#1014)
* add github action for macOS 14 (arm64, M1)

* add github action (portable) for macOS 14 (arm64, M1)

* rename macOS arm64 output artifact

* Colon cannot be used as a path separator for FIFTPATH or -I argument in fift on Windows when absolute paths are used (e.g. C:\path\lib:C:\path\smartcont).
Suggestion to use @ as a new path separator on Windows.

---------

Co-authored-by: neodiX <neodix42@ton.org>
2024-06-07 18:50:11 +03:00
EmelyanenkoK
74801d00b8
Command to disable state serializer (#1011)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-31 20:50:31 +03:00
EmelyanenkoK
037053fffe
More verbose state serializer logs (#976)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-04-29 16:33:10 +03:00
EmelyanenkoK
a2bd695b89
Fix prepare_vm_c7 (#958)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-04-08 14:29:54 +03:00
EmelyanenkoK
b8111d8b5b
Fix setting due_payment in storage phase (#957)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-04-08 11:15:52 +03:00
EmelyanenkoK
f1592641de
Tonlib improvement fixes (#934)
* 3.6. Fix directory traversal in KeyValueDir

* 3.9. Fix buffer_to_hex reversing nibbles

* 3.5. Fix error handling at blocks.getBlockHeader

* 3.11. Fix query.forget

* 3.12. Fix error handling in RemoteRunSmcMethod

* 4.1. Delete unused files

* 3.10. Use named constants instead hardcoded constants

* 3.4. Fix response block header verification

* 3.1. Check proof of blocks.getShards response

* fix td::buffer_to_hex + test

* 3.2. Add proof check for listBlockTransactions response in RunEmulator actor

* 3.8. Add proof checking for getLibraries method

* fix regression tests

* 3.3 Add proof checking for lookupBlock method

* Add publishers to proof of getLibrariesWithProof response  (#25)

* fix missing return, fix requesting mc block

* Fix requesting lookupBlock with client mc blk == mc ref block

* Fix duplicating lib data in proof and data, add mode 2 for not including the data

* Migration of LastBlockStorage with fixed td::buffer_to_hex

---------

Co-authored-by: ms <dungeon666master@protonmail.com>
Co-authored-by: Marat <98183742+dungeon-master-666@users.noreply.github.com>
2024-03-19 15:31:29 +03:00