Update compiler frontend (from original version 0.6.3 to 0.8.17):
- Breaking changes:
block.timestampreturns opcodeNOWinstead of opcodeBLOCKLT.block.logicaltimereturns opcodeBLOCKLT.- Type
byteis deleted. Usebytes1. - And another breaking changes from original compiler.
- Files are imported according this. Use cmd options
--base-path,--include-pathand another options. - Downloading files in import section from the Internet is forbidden. Use remapping.
- Update NatSpec, code analyzer, etc.
Bugfixes:
- Fixed problem with getting inherited function
afterSignatureCheck. - Support overloading for function
onCodeUpgrade.
Breaking change:
- Function
onCodeUpgradehad function id = 2. Now, it has another id, but you can setfunctionID(2)in new contracts to upgrade old ones.
Compiler features:
- Supported
deleteand binary operators forvarUintN/varIntNtypes. - Supported function references for library function, e.g.
function(int, int) internal returns (int) op = Math.add; - Supported
goshfunctions:applyBinPatch/applyBinPatchQ/applyZipBinPatch/applyZipBinPatchQ. - Supported conversion
uint32to private function, e.g.function(uint, uint) internal pure returns (uint) fun = uint32(123456). - Support command line option
--private-function-idsfor printing private function ids. - Support
pragma upgrade func/oldsol;to upgrade old contracts.
Fixed build sold for Windows and macOS.
Compiler features:
- Supported ABI v2.3.
- Supported try-catch (experimental feature).
- Supported type
variant.
Typo:
- Rename function
storeZeros->storeZeroes.
Compiler features:
- Supported operator
!=forbytes. - Added
valueToGas/gasToValuewithoutwid. - Supported
tvm.buyGas().
Bugfixes:
- Fixed compilation issue with inline arrays in inline arrays.
- Fixed compilation failure caused by such expressions:
<struct>.libFunc. - Fixed compilation issue with comparison
bytesand string literals. - Fixed problem with wrong encoding/decoding structures with optional types in arrays.
Compiler features:
- Supported
<string>.toUpperCase()and<string>.toLowerCase(). - Supported function overloading for private/internal functions.
Bugfixes:
- Fixed mutability for public functions: it didn't respect function modifiers.
- Fixed compilation issue with inline arrays, e.g.
byte[] barr = [byte('a'), 'A'];.
Gas optimizations:
- Assorted stack optimizations.
Bugfixes:
- Optimizer: fix bug that caused generating bad code.
Added sold sources.
Fix problem of using mapping(string => ValueType) map in loop for ((uint k, ValueType v) : map).
Use bytes instead of TvmCell in gosh functions.
Compiler features:
- Supported experimental functions
gosh.diff,gosh.applyPatch,gosh.applyPatchQ,gosh.zip,gosh.unzip,gosh.zipDiff,gosh.applyZipPatchandgosh.applyZipPatchQ. - Supported experimental
tx.storageFee.
Gas optimizations:
- Use opcode
MYCODEfor Solidity functiontvm.code(). - Assorted stack optimizations.
Solidity compilation driver:
- Added new sold tool which combines Solidity compiler with linker library into a standalone compiler driver able to produce tvc out of sol in one pass.
Compiler features:
- Supported
pragma copyleft <type>, <wallet_address>;. - Supported explicit conversion from
bytesNtobytes. - Supported
<TvmSlice>.decodeforenumtype. - Supported
<TvmSlice>.decodeQ. - Supported
<map>.keys()and<map>.values().
Bugfixes:
- Fixed problem with fetching
varIntfrom mappings that usevarIntas value. - Fixed problem with control flow in
do{ ...} while(...)construction.
Breaking change:
value,bounceandflagoptions in return statement ofresponsiblefunction must be explicitly defined.
Gas optimizations:
- Peephole optimizations: use
PUSHPOW2,PUSHPOW2DEC,PUSHNEGPOW2opcodes instead ofPUSHINTin same cases.
Compiler features:
- Supported
<TvmSlice>.decodeStateVars(...). - Added
tvm.initCodeHash.
Bugfixes:
- Fixed
rawReserve()mutability to pure. - Fixed issue with explicit conversion in return statement.
Delete warnings about options callbackId, onErrorId.
Use pragma ever-solidity instead of pragma ton-solidity.
Bugfixes:
- Type checker: fix wrong conversion from
byte1[]tobytes.
Bugfixes:
- Optimizer: fix bug that caused generating bad code.
Bugfixes:
- Peephole optimizer: fix bug that caused infinitive loops.
- Type checker: fix bug that caused compilation fail if you define a recursive struct.
Bugfixes:
- Code size optimizer: fix bug that caused compilation error.
- Fix bug that caused compilation error if some arguments of
store[Unsigned|signed]were not constants.
Assorted peephole stack optimizations.
Bugfixes:
- Code optimizer: fix bug that caused swapping some opcodes.
Compiler features:
- Added
--include-pathoption to support import from different folders. - Supported
msg.hasStateInit.
Bugfix:
- Fixed
<string>.substr(),bytes[x:y]that threw an exception if the length is equal to127,2*127,3*127...,startIndexis equal tostring/byteslength and length of substring is equal to zero.
Code size optimization. Assorted peephole stack optimizations.
Bugfix:
- Fixed issue with using recursion in libraries that causes tvm-linker fault.
Compiler features:
- Supported
abi.encode()/abi.decode(). - Supported keyword
emptyMap.
Breaking change:
- Supported
mapping's in constructor of structures.
Bugfix:
- Fixed issue with optional type that caused compilation fail.
- Fixed issue with implicit conversion of optional types.
- Fixed issue with optimizer.
Bugfixes:
- Fix issue when it was impossible to import 2 files from each other.
Breaking change:
- Output AST JSON as pure json without
====separators or something else. - Deleted option "abiVer" from
tvm.buildExtMsg()and sending external inbound message for debots.
Compiler features:
- Supported
varInt/varInt16/varInt32andvarUint/varUint16/varUint32types. - Supported
everunits.
Gas optimizations:
- Assorted stack optimizations.
Compiler features:
- Supported
continue/break/returninside ofrepeat(n) { /*...*/ }block. - Supported
uintXin steps of1:uint1,uint2,uint3...uint256. - Supported
intXin steps of1:int1,int2,int3...int256. - Supported
tvm.setGasLimit(uint). - Supported constant arrays, e.g.
uint[] public constant fib = [uint(2), 3, 5, 8, 12, 20, 32];.
Breaking change:
- Changed
stoi()return type tooptional(int). - Output AST JSON to the file instead of standard output.
Gas optimizations:
- Optimized gas consumption of
viewandpurefunctions. - Assorted stack optimizations.
Compiler features:
- Supported function identifier instead of uint32 for
callbackIdoronErrorIdin expressionstvm.buildExtMsg(...)andContractName.funcName().extMsg. - Supported ABI 2.2.
- Checked if
stateInitis valid before deploying. - Supported tvm.buildDataInit().
Breaking change:
- Deleted
tvm.buildEmptyData(). Usetvm.buildDataInit().
Gas optimizations:
- Assorted stack optimizations.
Compiler features:
- Added the option
stateInitfortvm.buildIntMsgand\<address\>.transfer(). - Added function
tvm.stateInitHash()to calculate stateInit hash based on code and data cells. - Added keyword
null. - Supported concatenation
stringandbytesNtypes.
Breaking change:
- Deleted
\<TvmSlice\>.bitsAndRefs(). Please, use\<TvmSlice\>.size(). - Renamed
\<TvmBuilder\>.bitsAndRefs()->\<TvmSlice\>.size(). - Deleted
tvm.deploy(). Please, use\<address\>.transfer({stateInit: ..., ...}). - Changed
TvmSlice,TvmCellandTvmBuilder.depth()method return type fromuint64touint16.
Gas optimizations:
- Assorted stack optimizations.
Compiler features:
- Added string search methods:
<string>.find()and<string>.findLast(). - Added
<TvmSlice\>.bitsAndRefs(). - Added
bitSize()anduBitSize()for computing bit length of an integer.
Gas optimizations:
- Assorted stack optimizations.
Compiler features:
- Added
tvm.setData()andtvm.getData()builtins for accessing raw content ofC4register. - Added support of
bytestobytesNconversion.
Support ABI 2.1:
- Field
fieldsappeared in abi file. You can parse state variable. Seetonos-cli decode account --help. - Supported
stringtype in abi.
Bugfixes:
- Fixed an issue when a function can be called but constructor hasn't been called yet.
Breaking change:
- Syntax of creating and sending of an external inbound message changed from option
{extMsg: true}to suffix.extMsg. - Rename
_answer_idtoanswerIdfor responsible functions. - Removed syntax
.value()and.flag()for remote call customizing.
Compiler features:
- Added support for byte arrays slices ("bytes" type).
- Added serialization to builder and deserialization from slice for "enum" type values.
- Support synchronous calls with
.awaitsuffix.
Breaking change:
- Throw exception with code 72 on external message invocations for the functions with modifier
internalMsg.
Bugfixes:
- Fixed an issue with generating source files in JSON format.
- Fixed conversion of integer to the fixed point type.
Gas optimizations:
- Optimize away, if unused, deployed contract address returned by expression
new Contr{...}(...). - Assorted peephole stack optimizations.
Compiler features:
- Support
internalMsg/externalMsgspecifiers for public and external functions. - Support
msg.isInternal,msg.isExternalandmsg.isTickTock. - Support
storeOnesandstoreZeroesforTvmBuilder.
Breaking change:
- Change behavior of function
<string>.substr(). - Use
{dest: ...}instead of.extAddr(...)in emit statement to set destination address.
Gas optimizations.
Compiler features:
- Compiler version is added in the contract's code.
- Decoding struct type from
TvmSlice. - Added new container type
vector.
Bugfixes:
- Fixed segmentation fault when using format function
- Fixed problem with comparisons
==and!=forTvmCelltypes. - Fixed bugs in TypeChecker.
Gas optimizations: encoding parameters to builders.
Compiler features:
- Support
<array>.empty(),<bytes>.empty()and<string>.empty(). - Support self deploying of a contract (see sample #21).
- Support
tvm.buildIntMsg()to generate cell, that contains an internal message. - Support
tvm.sendrawmsg()to send internal/external messages. - Support command line option
--function-idsfor printing function ids.
Bugfixes:
- Public functions (that return public state variables) emited an external message (which is paid by the contract). Now these functions emit external messages only on external messages.
- Fix problem with generating inbound external messages (for debots) and responsible functions.
In message body there wasn't
_answer_id. Now it's added. - TypeChecker checks
callparameter oftvm.buildExtMsg(). - Fix problem (what caused underflow exception) with encoding/decoding of state variables.
Compiler features:
- Support mappings/arrays containing big structs (or another structs) as input/output parameters of public/external functions.
- Support
tvm.code(),tvm.codeSalt()andtvm.setCodeSalt.
Some gas optimizations.
Changes:
selfdestructappends 0 tons to the internal message (instead of 1000 nanotons).
Breaking change:
- Calling a fallback function (instead of throwing error) in cases:
- Bit length of the internal input message is between 1 and 31.
- The message has zero bit size and not zero count of references.
Compiler features:
- Added ability to import files via net link.
Compiler features:
- Support indices > 127 for
bytes. - Support iteration over
bytesusingforloop. For example:for (byte b : byteArray) { ... }.
Bugfixes:
- Fixed minor bugs in TypeChecker.
- Fixed segmentation fault on using library functions.
Improvements:
- '--tvm-optimize' option is now enabled by default.
- Debot feature
signBoxHandleis supported intvm.buildExtMsg()andextMsgcall.
Compiler features:
- Support
tvm.setPubkey(...); - Support command line option
--debugfor generating debug info.
Some gas optimizations and bugfixes.
Compiler Features:
- Gas consumption optimizations
- Support
sha256forstringandbytestypes - Support applying twice the modifier with parameter(s) for the function.
- Delete restriction about function id of public functions.
Bugfixes:
- Fixed minor bugs in TypeChecker.
Bugfixes:
- Fix contract execution fail on internal message if the function returns some value.
Breaking changes:
- Default value of parameter
flagis equal to0. The parameter is used fortvm.transferand external function calls. - Introduce keyword
responsibleused to mark functions that can call a callback function. - Change behavior for command line option
-o [ --output-dir ] path/to/dirand introduce option-f [ --file ] prefixName.
Bugfixes:
- Fixed minor bugs in TypeChecker that cause fails of the compiler.
Use another opcodes for working with mapping(KeyType => TvmSlice) map; So if you used it then be
sure that sum of bit length of KeyType and bit length of TvmSlice is less than 1023 bit.
Documentation:
- Write about parameter
flagused fortvm.transferand external function calls. Add sample offlagusage.
Compiler Features:
- Support fixed point numbers (
fixed/ufixed). - Support functions to convert gas to tons (
gasToValue()) and vice versa (valueToGas()). - Support
stringmethodsbyteLength()andsubstr()to work with long strings (which are stored in more than one cell). - Add methods
skip(),compare(),hasNBits(),hasNRefs()andhasNBitsAndRefs()for TvmSlice type. - Support proper
stringtype comparison which works right with long strings. - Removed deprecated function
hexstring()and explicit int to string conversion.
Bugfixes:
- Fixed a bug with slices comparison.
Assorted features requested by DeBot support:
formatfunction now can create long strings (which does not fit one cell), can take string arguments and format integers width and fill settings.- Some additional parameters were added for
tvm.buildExtMsg()andextMsgcall to support DeBot external function calls and deploy.
Compiler Features:
- Support callback functions used for intercontract communication.
- Added string type method
appendthat allows to concatenate long strings. - Support function
sha256(TvmSlice slice) returns (uint256) - Added api function
tvm.buildExtMsg()to generate an external inbound message to call contract function. - Support constant variables of address type.
Breaking changes:
- Use
pragma ton-solidity ...;instead ofpragma solidity ...;to restrict compiler version
Bugfixes:
- Fixed an issue with modifier.
- Fixed a function type issue.
Compiler Features:
- Struct type can be used as a key of a mapping. Some restrictions are imposed on such structs.
- Support
bounceandcurrenciesoptions to deploy contact via new. - Support range-based for loop
for ( range_declaration : range_expression ) loop_statementwhererange_expressionis array or mapping type - Expanded api function
tvm.buildStateInit()to generate aStateInitof the contract with arbitrary parameters.
Breaking changes:
- fallback function is not called on plain tons transfers if there is no receive function in the contract. In this case default receive function is called.
Bugfixes:
- Fixed an issue with generating
*.abi.jsonfile.
Compiler Features:
- Support
varInitandpubkeyoptions innewexpression. - Support optional type in complex lvalue expressions. e.g.
m[11].get()[22] = 33wheremismapping(uint => optional(uint[])). - Support option
splitDepthinnewexpression and intvm.buildStateInit(...).
Breaking changes:
publicstate variable don't create record in *.abi.json in sectiondata. Use keywordstaticfor that goal. Forpublicstate variable, getter function is automatically generated. That function can be called locally only.- Change function interface for
tvm.deploy
Bugfixes:
- Code Generator: Fixed a runtime fail if
receiveorfallbackfunctions are declared aspureorview. - Type checker: Compiler failed during parsing wrong parameter names.
Compiler Features:
- Support some math function:
math.divc()andmath.divr(). - Support
tvm.exit()andtvm.exit1(). - Support
bytes.toSlice(). - Support
tvm.functionIdandtvm.decodeFunctionParamsfor contract constructor. - Support
mapping.at. - Support api for SmartContractInfo:
tx.timestamp,block.timestamp. - Support api for getting info about size of DAG:
cell.dataSize,slice.dataSizeand another. - Support api functions for converting integer or address to a string:
format(),string(int)andhexstring. - Support api for pseudo-random number generator:
rnd.next(),rnd.shuffle()and another. - Support function library calls via library name and object.
- Support pragma to specify default message value:
pragma msgValue. - Support api function for converting string into an integer
stoi(). - Support control structure
repeatwhich repeats block of code arbitrary amount of times. - Changed mapping api function
delMinto return optional.
Some little gas optimizations.
Breaking changes:
- The
nowreturnsuint32value, notuint256 - The
msg.valuereturnsuint128value, notuint256 - Change round mode for
math.muldiv()
Compiler Features:
- Optimize runtime code (delete duplicate code and useless checks)
- Add new math operations:
math.muldivr()andmath.muldivc() - Support setting workchain id for deploying contracts via
new - Support
tvm.buildEmptyData(publicKey)used for deploying contracts
Bugfixes:
- fixed an issue with overridden functionID
- fixed an issue with inline function
APIs for common TON-specific functionality:
- Supported tick and tock transactions. See onTickTock function. Bug fixes.
APIs for common TON-specific functionality:
- Supported optional type
- Added methods for optional type: set, hasValue, get
Changed APIs to handle mappings: fetch, min, max, prev, next and ect.
APIs for common TON-specific functionality:
-
Migrated frontend to 0.6.3
-
Native types support
- TvmCell: toSlice()
- TvmSlice: decode(), size(), loadRef(), loadRefAsSlice()
-
Native TVM operations as tvm member functions
- Custom message builders: sendMsg(), sendRawMsg()
- Account state access: setCode(), setCurrentCode(), commit(), resetStorage()
- Misc: cdatasize(), transLT(), configParam()
-
Multiple stability fixes
-
Gas consumption optimizations
APIs for common TON-specific functionality:
- Address constructors and accessors
- Extended address format that includes workchain ID
- Members for workchain ID and the actual address part
- isZero() and unpack() functions
- External addresses support
New APIs to handle mappings:
- next(), exists(), min(), empty(), fetch(), delMin()
Optimizations:
- Smarter parsing of inbound messages to build SmartContractInfo
- Reduced gas consumption when working with smart-contract persistent memory
Enum support