Skip to content

Commit

Permalink
Merge pull request #148 from tonlabs/0.72.0
Browse files Browse the repository at this point in the history
0.72.0
  • Loading branch information
BorisI authored Oct 27, 2023
2 parents 53686a3 + cd88e2d commit 9741c57
Show file tree
Hide file tree
Showing 44 changed files with 5,117 additions and 4,970 deletions.
460 changes: 323 additions & 137 deletions API.md

Large diffs are not rendered by default.

698 changes: 233 additions & 465 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
### 0.72.0 (2023-??-??)

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.

Breaking changes:
* The conversion for integer type is only allowed when there is at most one change in sign, width or type-category (`int`, `address`, `bytesNN`, etc.). To perform multiple changes, use multiple conversions. See [Solidity v0.8.0 Breaking Changes](https://docs.soliditylang.org/en/v0.8.17/080-breaking-changes.html#new-restrictions). For example, to convert `int8 x;` to `uint` you can use at least two ways: 1) `uint(uint8(x))`, 2) `uint(int(x))`.
* Deleted `ExtraCurrencyCollection` type. Use `mapping(uint32 => varUint32)` instead of it.

Bugfixes:
* Fixed bug when recursive calling of library function via object corrupted the stack.
* Fixed minor bug that caused compilation failure.
* Fixed bug when you use string literals for `bytesN constant`.

Compiler features:
* Supported [unchecked blocks](API.md#unchecked-block).
* Supported defining events in libraries.
* Supported [require(bool condition, string text)](API.md#require).
* Supported functions for working with exotic cells:
* [\<TvmCell\>.exoticToSlice()](API.md#tvmcellexotictoslice)
* [\<TvmCell\>.loadExoticCell() and \<TvmCell\>.loadExoticCellQ()](API.md#tvmcellloadexoticcell-and-tvmcellloadexoticcellq)
* [\<TvmBuilder\>.toExoticCell()](API.md#tvmbuildertoexoticcell)
* Supported command line option `--overwrite` that is used together with `--ast-compact-json -o` options.
* Warning about storing too big structs via `<TvmBuilder>.store()`.
* Change function signature `<TvmSlice>.skip(uint10 bits, uint2 refs)` -> `<TvmSlice>.skip(uint10 bits, uint3 refs)` to allow to skip 4 references.

### 0.71.0 (2023-07-20)

Bugfixes:
Expand Down
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta name="description" content="Solidity compiler for TVM">
<meta name='keywords' content='compiler, smart-contracts, blockchain, solidity, tvm, everscale, everos, venom-blockchain, venom-developer-program'>

# the TVM Solidity compiler
# The TVM Solidity compiler

[![GitHub](https://img.shields.io/github/license/tonlabs/TON-Solidity-Compiler?style=for-the-badge)](./LICENSE)
[![Everscale](https://custom-icon-badges.demolab.com/badge/-everscale-13173e?style=for-the-badge&logoColor=yellow&logo=everscale)](https://everscale.network/)
Expand All @@ -22,14 +22,14 @@ Port of the Solidity smart-contract [compiler](https://github.com/ethereum/solid

## Build and Install

Original Instructions about how to build and install the Solidity compiler can be found in the [Solidity documentation](https://solidity.readthedocs.io/en/latest/installing-solidity.html#building-from-source).

### Sold driver

Documentation is available at [README.md](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/sold/README.md) (RECOMMENDED).
We recommend using `sold` to compile smart-contracts. Documentation is available at [README.md](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/sold/README.md).

### Building compiler

Original Instructions about how to build and install the Solidity compiler can be found in the [Solidity documentation](https://solidity.readthedocs.io/en/latest/installing-solidity.html#building-from-source).

#### Ubuntu Linux

```shell
Expand All @@ -42,12 +42,6 @@ cmake ../compiler/ -DCMAKE_BUILD_TYPE=Release
cmake --build . -- -j8
```

Make other toolchain utilities aware of the language runtime library location via an environment variable: specify path to `stdlib_sol.tvm`.

```shell
sh ./compiler/scripts/install_lib_variable.sh
```

#### Windows 10

Install Visual Studio Build Tools 2019, Git bash, cmake.
Expand All @@ -63,14 +57,12 @@ cmake -DBoost_DIR="..\compiler\deps\boost\lib\cmake\Boost-1.77.0" -DCMAKE_MSVC_R
cmake --build . --config Release -- /m
```

To facilitate work with other toolchain utilities add path to `stdlib_sol.tvm` into environment variable `TVM_LINKER_LIB_PATH`.

## Links

* [Ever assembler and disassembler](https://github.com/tonlabs/ever-assembler)
* [Code samples](https://github.com/tonlabs/samples/tree/master/solidity) in TVM Solidity
* [TVM linker repository](https://github.com/tonlabs/TVM-linker)
* [tonos-cli](https://github.com/tonlabs/tonos-cli) command line interface for TVM compatible blockchains
* Example of usage `tonos-cli` for working (deploying, calling and etc.) with TVM compatible blockchains can be found there: [Write smart contract in Solidity](https://docs.ton.dev/86757ecb2/p/950f8a-write-smart-contract-in-solidity)
* Example of usage `tonos-cli` for working (deploying, calling etc.) with TVM compatible blockchains can be found there: [Write smart contract in Solidity](https://docs.ton.dev/86757ecb2/p/950f8a-write-smart-contract-in-solidity)
* [Changelog](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/Changelog_TON.md)

## License
Expand Down
2 changes: 1 addition & 1 deletion compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include(EthPolicy)
eth_policy()

# project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.71.0")
set(PROJECT_VERSION "0.72.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 Down
1 change: 0 additions & 1 deletion compiler/liblangutil/Token.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ namespace solidity::langutil
K(TvmCell, "TvmCell", 0) \
K(TvmSlice, "TvmSlice", 0) \
K(TvmBuilder, "TvmBuilder", 0) \
K(ExtraCurrencyCollection, "ExtraCurrencyCollection", 0) \
K(Variant, "variant", 0) \
K(Fixed, "fixed", 0) \
K(UFixed, "ufixed", 0) \
Expand Down
4 changes: 2 additions & 2 deletions compiler/libsolidity/analysis/ContractLevelChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void ContractLevelChecker::checkDuplicateFunctions(ContractDefinition const& _co
{
if (onBounce)
m_errorReporter.declarationError(
228_error,
9645_error,
function->location(),
SecondarySourceLocation().append("Another declaration is here:", onBounce->location()),
"Only one onBounce function is allowed."
Expand All @@ -157,7 +157,7 @@ void ContractLevelChecker::checkDuplicateFunctions(ContractDefinition const& _co
{
if (onTickTock) {
m_errorReporter.declarationError(
228_error,
2306_error,
function->location(),
SecondarySourceLocation().append("Another declaration is here:", receive->location()),
"Only one onTickTock function is allowed."
Expand Down
18 changes: 9 additions & 9 deletions compiler/libsolidity/analysis/SyntaxChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
solAssert(m_sourceUnit, "");

if (_pragma.literals().size() >= 2) {
m_errorReporter.warning(228_error, _pragma.location(), "Has no effect. Delete this.");
m_errorReporter.warning(9089_error, _pragma.location(), "Has no effect. Delete this.");
}

vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end());
Expand Down Expand Up @@ -154,13 +154,13 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
to_string(recommendedVersion.patch()) +
string(";\"") +
" to set a version of the compiler.";
m_errorReporter.warning(228_error, _pragma.location(), errorString);
m_errorReporter.warning(6413_error, _pragma.location(), errorString);
}
else if (_pragma.literals()[0] == "ever" || _pragma.literals()[0] == "ton") // ever-solidity
{
if (m_versionPragma.has_value()) {
m_errorReporter.fatalTypeError(
228_error,
8884_error,
_pragma.location(),
SecondarySourceLocation().append("Previous definition:", *m_versionPragma.value()),
"Compiler version is defined more than once.");
Expand All @@ -186,7 +186,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
const std::string base = "Correct format: pragma AbiHeader [pubkey|expire|notime]";
if (_pragma.literals().size() != 2) {
auto err = "Empty pragma. " + base;
m_errorReporter.syntaxError(228_error, _pragma.location(), err);
m_errorReporter.syntaxError(1112_error, _pragma.location(), err);
} else {
auto literal = _pragma.literals()[1];
if (literal != "pubkey" && literal != "expire" && literal != "notime") {
Expand All @@ -195,14 +195,14 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
err += "\nNote: timestamp in header of external message "
"is on by default, so delete this pragma.";
}
m_errorReporter.syntaxError(228_error, _pragma.location(), err);
m_errorReporter.syntaxError(2632_error, _pragma.location(), err);
}
}
}
else if (_pragma.literals()[0] == "upgrade")
{
if (_pragma.literals().size() != 2 || (_pragma.literals()[1] != "func" && _pragma.literals()[1] != "oldsol")) {
m_errorReporter.syntaxError(228_error, _pragma.location(), R"(Unknown pragma. Use: "pragma upgrade func;" or "pragma upgrade oldsol;")");
m_errorReporter.syntaxError(3323_error, _pragma.location(), R"(Unknown pragma. Use: "pragma upgrade func;" or "pragma upgrade oldsol;")");
}
}
else if (_pragma.literals()[0] == "ignoreIntOverflow")
Expand All @@ -212,18 +212,18 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
else if (_pragma.literals()[0] == "msgValue")
{
if (m_msgValuePragmaFound) {
m_errorReporter.syntaxError(228_error, _pragma.location(), "msgValue pragma shouldn't be specified more than once.");
m_errorReporter.syntaxError(2995_error, _pragma.location(), "msgValue pragma shouldn't be specified more than once.");
}
if (_pragma.parameter().empty()) {
m_errorReporter.syntaxError(228_error, _pragma.location(), "Correct format: pragma msgValue <value_in_nanoevers>");
m_errorReporter.syntaxError(6562_error, _pragma.location(), "Correct format: pragma msgValue <value_in_nanoevers>");
}
m_msgValuePragmaFound = true;
}
else if (_pragma.literals()[0] == "copyleft")
{
if (m_FirstCopyleft) {
m_errorReporter.declarationError(
228_error,
1595_error,
_pragma.location(),
SecondarySourceLocation().append("The previous declaration is here:", *m_FirstCopyleft),
"Pragma already defined."
Expand Down
Loading

0 comments on commit 9741c57

Please sign in to comment.