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

694 commits

Author SHA1 Message Date
Aleksandr Kirsanov
e2467b8ba4
[FunC] Reserve '!' for the future, identifiers can't start with it 2024-06-24 14:32:12 +03:00
Aleksandr Kirsanov
79721d230e
[FunC] Require parenthesis in tricky bitwise precedence cases
Example: "flags & 0xFF != 0" is equivalent to "flags & 1",
most likely it's unexpected.
Example: "a << 2 + 1" (equal to "a << 3", probably unexpected).

The only way to suppress this error for the programmer
is to use parenthesis.
2024-06-22 01:49:27 +03:00
Aleksandr Kirsanov
5867d52926
[FunC] Bump FunC version to v0.5.0 2024-06-21 15:41:03 +03:00
Aleksandr Kirsanov
3520184553
[FunC] Fix a bug with << operator to zero value 2024-06-21 15:40:39 +03:00
Aleksandr Kirsanov
49a0d32c1b
[FunC] Drop a folder crypto/func/test, it's unused 2024-06-14 15:22:59 +03:00
Aleksandr Kirsanov
2da85a646c
[FunC] Fix an issue of funcfiftlib.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-06-14 15:22:59 +03:00
Aleksandr Kirsanov
8932c515c9
[FunC] Produce an error on get methods hash (method_id) collision 2024-06-14 15:22:59 +03:00
Aleksandr Kirsanov
7b8268d99f
[FunC] Deprecate method_id specifier, introduce get keyword
`get` keyword behaves exactly like `method_id` (auto-calc hash),
but it's placed on the left, similar to Tact: `get T name()`.

`method_id(n)` is still valid, considering it can't be invoked by name,
since a client will compute another hash.
It's supposed it will be still used in tests and in low-level code
(not to be called externally, but to be called after replacing c3).

`get(hash)` is invalid, this keyword does not accept anything.
2024-06-14 15:22:59 +03:00
Aleksandr Kirsanov
7afa9292c3
[FunC] Change priority of & | ^ operators to a more intuitive one
Before, such code `if (slices_equal() & status == 1)` was parsed
as `if( (slices_equal()&status) == 1 )`.
Note, that this change leads to hash changes of some verified contracts,
but a new priority is more expected from the user experience.
2024-06-14 15:22:59 +03:00
Aleksandr Kirsanov
aee51731ce
[FunC] Refactor allow-post-modification, stop producing disabled Op::_Let
Before, #pragma allow-post-modification produced Op::_Let for every
tensor entity (which became non-disabled if modification really happened).
Although they are stripped off by the compiler and don't affect fif output,
they pollute intermediate "AST" representation (ops).
Now, Op::_Let is added only if var modification actually happens
(which is very uncommon for real-wise code)
2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
1e4b20a061
[FunC] Deprecate pragma compute-asm-ltr
It changes all hashes, since the compiler needs to manipulate the stack
in a different way now.
2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
aaf3ca335d
[FunC] Deprecate pragma allow-post-modification
All tests pass: it does not affect hashes (since modifying
variables in a single expression was an error)
2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
bb86dc0f96
[FunC] Add an ability to deprecate pragmas 2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
de570873d7
[FunC] Add builtin functions to stdlib.fc
Note, that I have not added all builtin functions.
I filtered out strange and actually unused in practice,
like "int_at()" and similar, or "run_method0()" and similar.
(Probably, they should be dropped off even from builtins)

Also, I've modified some stdlib.fc legacy tests just to ensure
that a resulting hash doesn't change.
2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
cdef8302b0
[FunC] Add builtin keyword to be used in stdlib later on 2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
acf0043342
[FunC] Add pragma remove-unused-functions for simple dead code elimination 2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
0628e17c7d
[FunC] Use td::OptionParser in func-main.cpp 2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
ef5719d7e6
[FunC] Forbid impure operations inside pure functions
In stdlib, all existing pure functions are asm-implemented.
But since we introduced a `pure` keyword applicable to user-defined functions,
we need to check that they won't have any side effects
(exceptions, globals modification, etc.)
2024-06-14 15:22:58 +03:00
Aleksandr Kirsanov
85c60d1263
[FunC] Make all functions impure by default, add "pure" specifier 2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
a3e9e03019
[FunC] Fixed some impure specifiers in stdlib.fc 2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
f217a7d312
[FunC] Forbid auto-creating undefined symbols 2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
4994ae8edd
[FunC] Convert stdlib.fc to traditional-style //comments 2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
30572c77d6
[FunC] Support traditional // and /**/ comments
They work alongside Lisp-style ;; and {--}, without any #pragma.
Conceptually, a new syntax should be disabled by default
and activated using a special compiler option.
But now, we don't have an easy way to provide compiler options
in func-js, blueprint, etc.
Note, that introducing per-file #pragma is a wrong approach here,
since if we want to fire human-readable error on using '//' without pragma,
lexer should nevertheless work differently.
(this could be controlled by a launch option, but see above)
2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
a174f858be
[FunC] Apply camelCase to some tests to ensure code_hash remains unchanged
In auto-tests, @code_hash controls bytecode stability.
In legacy tests, expected hashes are specified in a separate file.
2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
c74e49d467
[FunC] Enrich testing framework, add code hash checking
@code_hash to match (boc) hash of compiled.fif against expected.
While being much less flexible than @fif_codegen, it nevertheless
gives a guarantee of bytecode stability on compiler modifications.
2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
18050a7591
[FunC] Auto-inline functions-wrappers T f(...args) { return anotherF(...args); }
This will allow to easily implement camelCase wrappers aside stdlib,
even without changing hashes of existing contracts.
Also, stdlib renamings could be easily performed in the same manner,
even with arguments reordered.
2024-06-14 15:22:57 +03:00
Aleksandr Kirsanov
bac4e3df97
[FunC] Enrich testing framework, add fif output patterns
* @fif_codegen to match compiled.fif against an expected pattern
* @fif_codegen_avoid to ensure compiled.fif doesn't contain a substring
* both in Python and JS run_tests
* consider tests/codegen_check_demo.fc for examples
2024-06-14 15:22:56 +03:00
Aleksandr Kirsanov
cbd78964c5
[FunC] CMake option -DFUNC_DEBUG for development purposes
Seeing function name in debugger
makes it much easier to delve into FunC sources
2024-06-14 15:22:56 +03:00
Aleksandr Kirsanov
a5d2a1003f
[FunC] Enrich and refactor testing framework, add negative tests
* fully refactor run_tests.py, make it extensible for the future
* an ability to write @compilation_should_fail tests
* an ability to launch run_tests.py for a single .fc file
* keep run_tests.js in sync with run_tests.py
* extract legacy_tests names/hashes to a separate file
  shared between legacy_tester.py and legacy_tester.js
2024-06-14 15:22:56 +03:00
Aleksandr Kirsanov
0bc6305f96
[FunC] Change some fields to enums instead of integers
It makes it easier to understand/debug
Also, drop some unused enum values from that cases
2024-06-14 15:22:56 +03:00
EmelyanenkoK
5c392e0f2d
Merge pull request #1016 from ton-blockchain/testnet
Merge developer branch
2024-06-09 20:42:35 +03:00
EmelyanenkoK
7841d751c0 Add changelog 2024-06-08 17:57:38 +03:00
neodix42
ec00ccc482
Add github actions for macOS 14 (arm64, shared and portable) (#1001)
* add github action for macOS 14 (arm64, M1)

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

* rename macOS arm64 output artifact
2024-06-07 18:52:43 +03:00
neodix42
0a0a92c6b0
Use jemalloc in portable artifacts (#1003)
* use jemalloc in portable builds;
also avoid mixing musl with glibc artifacts in nix builds;

* minor fix for ubuntu arm nix build
2024-06-07 18:52:11 +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
f9b6d21620
Update validator list on each keyblock 2024-06-04 13:09:06 +03:00
EmelyanenkoK
0301e9fbb7
Fix loading key block config in FullNodeImpl (#1013)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-06-04 13:03:58 +03:00
EmelyanenkoK
3d7e85bafd
Rollback celldb default flag values and decrease default TTLs (#1012)
* Rollback celldb default flag values and decrease default TTLs

* Fix description
2024-06-02 13:41:02 +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
229d6a8ee9
Fix TL scheme for liteServer.nonfinal.getValidatorGroups (#1008)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-29 15:11:09 +03:00
EmelyanenkoK
8a4d44de1e
Compress block candidate broadcasts (#1007)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-29 15:10:42 +03:00
EmelyanenkoK
ceefac74cf
Limit checked external messages per address (#1005)
* Limit checked external messages per address

* Change max_ext_msg_per_addr_time_window; cleanup mempool by timer

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-28 13:31:13 +03:00
EmelyanenkoK
d80ce8d3eb
Fix choosing neighbours in private overlays (#1004)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-27 17:32:11 +03:00
neodix42
db505f45b2 Use jemalloc (#987)
* use jemalloc

* install system jemalloc in github action

* check if jemalloc is actually used

---------

Co-authored-by: neodiX <neodix42@ton.org>
2024-05-25 12:32:25 +03:00
EmelyanenkoK
539d5dd2de
Add candidates cache (#1000)
* Broadcast shardchain block candidates in private overlays, generate proof links from candidates

* Disable shardchain block broadcasts in private overlays

* Send block candidate broadcasts to custom overlays, allow non-validators to receive candidates

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-24 09:58:07 +03:00
EmelyanenkoK
7a74888d2f
Automatically disable celldb direct I/O if cache is small (#997)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-15 16:06:25 +03:00
EmelyanenkoK
3827409957
Change default values for celldb flags (#996)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-14 20:33:53 +03:00
EmelyanenkoK
3a802fa67a
Blockchain explorer: use liteServer.runSmcMethod (#994)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-14 17:11:01 +03:00
EmelyanenkoK
561f342639
Add --celldb-direct-io and --celldb-preload-all (#993)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-14 16:05:29 +03:00
EmelyanenkoK
816dd9cf2d
Add option --catchain-max-block-delay (#990)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-05-13 14:55:32 +03:00