Skip to content

Commit

Permalink
Merge pull request #150 from tonlabs/0.73.0
Browse files Browse the repository at this point in the history
0.73.0
  • Loading branch information
IgorKoval authored Feb 21, 2024
2 parents e6cd720 + ed82b96 commit 5bc2796
Show file tree
Hide file tree
Showing 4,621 changed files with 230,193 additions and 22,538 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1,206 changes: 649 additions & 557 deletions API.md

Large diffs are not rendered by default.

413 changes: 220 additions & 193 deletions Cargo.lock

Large diffs are not rendered by default.

55 changes: 54 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
### 0.72.0 (2023-??-??)
### 0.73.0 (2024-02-12)

Update compiler frontend (from original version 0.8.17 to 0.8.24). Full changelog can be found [here](./compiler/Changelog.md).

Breaking changes:
* Supported [ABI 2.4](https://github.com/tonlabs/ever-abi/blob/master/CHANGELOG.md#version-240).
* Deleted `tvm.insertPubkey()` function.
* Deleted `address.makeAddrNone()` function. Use [address.addrNone](./API.md#addressaddrnone).
* Default value for `address` type was `address(0)` but now it is [address.addrNone](./API.md#addressaddrnone).
* `byteN` in `*abi.json` file marked as `fixedbytesN`. See [ABI.md](https://github.com/tonlabs/ever-abi/blob/master/docs/ABI.md#fixedbytesn).
* [abi.encodeStateInit()](./API.md#abiencodestateinit), [abi.encodeData()](./API.md#abiencodedata) functions and [Deploy via new](./API.md#deploy-via-new) generate contract's data in the new format. To deploy old contracts (with version < 0.72.0) from new ones (with version >= 0.72.0) use [abi.encodeOldDataInit()](./API.md#abiencodeolddatainit).
* [format()](API.md#format) no longer throws an exception if formatted value exceeds the specified width. E.g. `format("{:1d}", 10) == "10"` now is correct, no exception.
* Functions and constructions previously working with `uint128` value, now using `varUint16`:
* [\<address\>.transfer()](API.md#addresstransfer)
* [deploy via **new**](API.md#deploy-via-new)
* [external function calls](API.md#external-function-calls)
* [\<address\>.balance](API.md#addressbalance)
* [msg.value](API.md#msgvalue)
* [abi.encodeIntMsg()](API.md#abiencodeintmsg)
* [return](API.md#return)
* Control construction [repeat](API.md#repeat) takes `uint31` instead of `uint256`.
* Supported [\<Integer\>.cast()](API.md#integercast) and changed conversion.

Bugfixes:
* Fixed compiler assert fault that occurred in the case of using [user-defined value types](https://docs.soliditylang.org/en/latest/types.html#user-defined-value-types) as return parameter of public/external function.
* Fixed segmentation fault of the compiler that could occur in some cases of using invalid rational number (too large or division by zero), e.g. `math.muldiv(2**500, 1, 1);`.
* Now [\<string\>.substr()](API.md#stringsubstr) does not throw an exception if `pos + count > string.byteLength()`.
* Fixed minor bugs in TypeChecker.

Compiler features:
* Supported defining operators for a [user-defined type](API.md#user-defined-type).
* Supported [keyword nostorage](API.md#keyword-nostorage).
* Now you can use the keyword [coins](API.md#varint-and-varuint) as an alias for `varUint16`

Gas optimizations:
* Optimized functions that work with strings: concatenation, substring, format etc.
* Assorted stack optimizations.

Other changes:
* Renamed some functions. Old functions are available and marked as deprecated. Renaming:
* `tvm.buildDataInit()` -> `abi.encodeData()`
* `<TvmSlice>.loadStateVars()` -> `abi.decodeData()`
* `tvm.buildStateInit()` -> `abi.encodeStateInit()`
* `tvm.stateInitHash()` -> `abi.stateInitHash()`
* `tvm.codeSalt()` -> `abi.codeSalt()`
* `tvm.setCodeSalt()` -> `abi.setCodeSalt()`
* `tvm.functionId()` -> `abi.functionId()`
* `tvm.buildExtMsg()` -> `abi.encodeExtMsg()`
* `tvm.buildIntMsg()` -> `abi.encodeIntMsg()`
* `tvm.encodeBody()` -> `abi.encodeBody()`
* `<TvmSlice>.loadFunctionParams()` -> `abi.decodeFunctionParams()`
* Marked functions `<TvmSlice>.loadTons()` and `<TvmBuilder>.storeTons()` as deprecated. Use `<TvmSlice>.load()` and `<TvmBuilder>.store()` that take `varUint16` type.

### 0.72.0 (2023-10-31)

Use [sold](https://github.com/tonlabs/TON-Solidity-Compiler/tree/master/sold) to compile contracts. If you used `solc`+`tvm_linker`, then use `solc`+[asm](https://github.com/tonlabs/ever-assembler). Generated `*.code` files have some another format.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cd TON-Solidity-Compiler
compiler\scripts\install_deps.ps1
mkdir build
cd build
cmake -DBoost_DIR="..\compiler\deps\boost\lib\cmake\Boost-1.77.0" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ..\compiler
cmake -DBOOST_ROOT="..\compiler\deps\boost\" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ..\compiler
cmake --build . --config Release -- /m
```
Expand Down
2 changes: 1 addition & 1 deletion compiler/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignEscapedNewlinesLeft: true
AlignEscapedNewlines: Left
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
Expand Down
4 changes: 4 additions & 0 deletions compiler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ __pycache__
*.a
*.lib

# ignore git mergetool backup files
*.orig

# Executables
*.exe
*.out
Expand All @@ -38,6 +41,7 @@ emscripten_build/
/docs/_build
/docs/_static/robots.txt
/deps
/reports

# vim stuff
[._]*.sw[a-p]
Expand Down
18 changes: 18 additions & 0 deletions compiler/.readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
builder: html
configuration: docs/conf.py

formats:
- pdf
- epub

python:
install:
- requirements: docs/requirements.txt
19 changes: 12 additions & 7 deletions compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.13.0)

set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The the path to the cmake directory")
set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The path to the cmake directory")
list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR})

# Set the build type, if none was specified.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
else()
set(DEFAULT_BUILD_TYPE "Release")
Expand All @@ -21,7 +21,7 @@ include(EthPolicy)
eth_policy()

# project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.72.0")
set(PROJECT_VERSION "0.73.0")
# OSX target needed in order to support std::visit
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
Expand All @@ -37,6 +37,7 @@ option(WITH_TESTS "Run solc tests" OFF)
option(SOLC_STATIC_STDLIBS "Link solc against static versions of libgcc and libstdc++ on supported platforms" OFF)
option(STRICT_Z3_VERSION "Use the latest version of Z3" ON)
option(PEDANTIC "Enable extra warnings and pedantic build flags. Treat all warnings as errors." ON)
option(PROFILE_OPTIMIZER_STEPS "Output performance metrics for the optimiser steps." OFF)

# Setup cccache.
include(EthCcache)
Expand All @@ -53,6 +54,11 @@ find_package(Threads)
if(NOT PEDANTIC)
message(WARNING "-- Pedantic build flags turned off. Warnings will not make compilation fail. This is NOT recommended in development builds.")
endif()

if (PROFILE_OPTIMIZER_STEPS)
add_definitions(-DPROFILE_OPTIMIZER_STEPS)
endif()

# Figure out what compiler and system are we using
include(EthCompilerSettings)

Expand All @@ -61,22 +67,21 @@ include(EthUtils)

# Create license.h from LICENSE.txt and template
# Converting to char array is required due to MSVC's string size limit.
file(READ ${CMAKE_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT HEX)
file(READ ${PROJECT_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT HEX)
string(REGEX MATCHALL ".." LICENSE_TEXT "${LICENSE_TEXT}")
string(REGEX REPLACE ";" ",\n\t0x" LICENSE_TEXT "${LICENSE_TEXT}")
set(LICENSE_TEXT "0x${LICENSE_TEXT}")

configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/license.h.in" include/license.h)
configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/license.h.in" include/license.h)

include(EthOptions)
configure_project(TESTS)
set(LATEST_Z3_VERSION "4.11.0")
set(MINIMUM_Z3_VERSION "4.8.0")

add_subdirectory(libsolutil)
add_subdirectory(liblangutil)
add_subdirectory(libsolidity)
add_subdirectory(libsolc)
add_subdirectory(libstdlib)
if (WITH_TESTS)
add_subdirectory(test2)
endif()
Expand Down
6 changes: 2 additions & 4 deletions compiler/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at chris@ethereum.org which only goes to
Christian Reitwiessner or axic@ethereum.org which only goes to Alex Beregszaszi.
To report an issue involving either of them please email Hudson Jameson at
hudson@ethereum.org.
reported by contacting the project team at solidity@ethereum.org.
To report an issue involving the Solidity team please email José Pedro Cabrita at zepedro@ethereum.org.
All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
23 changes: 7 additions & 16 deletions compiler/CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ To set indentation and tab width settings uniformly, the repository contains an
## 1. Namespaces
1. No `using namespace` declarations in header files.
2. Use `using namespace std;` in cpp files, but avoid importing namespaces from boost and others.
3. All symbols should be declared in a namespace except for final applications.
4. Use anonymous namespaces for helpers whose scope is a cpp file only.
5. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
2. `using namespace solidity;` and other project local namespaces is fine in cpp files, and generally encouraged.
3. Avoid `using namespace` at file level for third party libraries, such as boost, ranges, etc.
4. All symbols should be declared in a namespace except for final applications.
5. Use anonymous namespaces for helpers whose scope is a cpp file only.
6. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
Only in the header:
```cpp
Expand All @@ -65,16 +66,6 @@ std::tuple<float, float> meanAndSigma(std::vector<float> const& _v);
}
```

Only in the cpp file:
```cpp
#include <cassert>
using namespace std;
tuple<float, float> myNamespace::meanAndSigma(vector<float> const& _v)
{
// ...
}
```
## 2. Preprocessor

1. File comment is always at top, and includes:
Expand Down Expand Up @@ -116,7 +107,7 @@ Use `solAssert` and `solUnimplementedAssert` generously to check assumptions tha
1. {Typename} + {qualifiers} + {name}.
2. Only one per line.
3. Associate */& with type, not variable (at ends with parser, but more readable, and safe if in conjunction with (b)).
4. Favour declarations close to use; don't habitually declare at top of scope ala C.
4. Favour declarations close to use; do not habitually declare at top of scope ala C.
5. Pass non-trivial parameters as const reference, unless the data is to be copied into the function, then either pass by const reference or by value and use std::move.
6. If a function returns multiple values, use std::tuple (std::pair acceptable) or better introduce a struct type. Do not use */& arguments.
7. Use parameters of pointer type only if ``nullptr`` is a valid argument, use references otherwise. Often, ``std::optional`` is better suited than a raw pointer.
Expand Down Expand Up @@ -179,7 +170,7 @@ for (map<ComplexTypeOne, ComplexTypeTwo>::iterator i = l.begin(); i != l.end();

## 9. Naming

1. Avoid unpronouncable names.
1. Avoid unpronounceable names.
2. Names should be shortened only if they are extremely common, but shortening should be generally avoided
3. Avoid prefixes of initials (e.g. do not use `IMyInterface`, `CMyImplementation`)
4. Find short, memorable & (at least semi-) descriptive names for commonly used classes or name-fragments:
Expand Down
Loading

0 comments on commit 5bc2796

Please sign in to comment.