Releases: aeternity/aesophia
v7.0.0
Added
- Added support for
EXIT
opcode viaexit : (string) => 'a
function (behaves same asABORT
, but consumes all gas). - Compiler warnings for the following: shadowing, negative spends, division by zero, unused functions, unused includes, unused stateful annotations, unused variables, unused parameters, unused user-defined type, dead return value.
- The pipe operator |>
[1, 2, 3] |> List.first |> Option.is_some // Option.is_some(List.first([1, 2, 3]))
- Allow binary operators to be used as lambdas
function sum(l : list(int)) : int = foldl((+), 0, l) function logical_and(x, y) = (&&)(x, y)
- Contract interfaces polymorphism
Changed
- Error messages have been restructured (less newlines) to provide more unified errors. Also
pp_oneline/1
has been added. - Ban empty record definitions (e.g.
record r = {}
would give an error).
Removed
- Support for AEVM has been entirely wiped
v6.1.0
Added
Bitwise
stdlibSet
stdlibOption.force_msg
- Loading namespaces into the current scope (e.g.
using Pair
) - Assign patterns to variables (e.g.
let x::(t = y::_) = [1, 2, 3, 4]
wheret == [2, 3, 4]
) - Add builtin types (
AENS.name, AENS.pointee, Chain.ttl, Chain.base_tx, Chain.ga_meta_tx, Chain.paying_for_tx
) to
the calldata and result decoder - Patterns guards
switch(x) a::[] | a > 10 => 1 _ => 2
function f(a::[]) | a > 10 = 1 f(_) = 2
Changed
- Fixed the ACI renderer, it shouldn't drop the
stateful
modifier
v6.0.2
v6.0.1
v6.0.0
Added
- Child contracts
Chain.clone
Chain.create
Chain.bytecode_hash
- Minor support for variadic functions
void
type that represents an empty typeCall.fee
builtin
Changed
- Contract interfaces must be now invocated by
contract interface
keywords main
keyword to indicate the main contract in case there are child contracts aroundList.sum
andList.product
no longer useList.foldl
Removed
v5.0.0
Version 5.0.0 of the Sophia compiler produces code for FATE v2/Iris (and for supported instructions will also produce code for the deprecated AEVM)
Added
-
A new and improved
String
standard library
has been added. Use it byinclude "String.aes"
. It includes functions for
turning strings into lists of characters for detailed manipulation. For
example:include "String.aes" contract C = entrypoint filter_all_a(s: string) : string = String.from_list(List.filter((c : char) => c != 'a', String.to_list(s)))
will return a list with all
a
's removed.There are also convenience functions
split
,concat
,to_upper
,
to_lower
, etc.All String functions in FATEv2 operate on unicode code points.
-
Operations for pairing-based cryptography has been added the operations
are in the standard library BLS12_381.
With these operations it is possible to do Zero Knowledge-proofs, etc.
The operations are for the BLS12-381 curve (as the name suggests). -
Calls to functions in other contracts (i.e. remote calls) can now be
protected
.
If a contract call fails for any reason (for instance, the remote contract
crashes or runs out of gas, or the entrypoint doesn't exist or has the
wrong type) the parent call also fails. To make it possible to recover
from failures, contract calls takes a named argumentprotected : bool
(defaultfalse
).If
protected = true
the result of the contract call is wrapped in an
option
, andSome(value)
indicates a succesful execution andNone
indicates that the contract call failed. Note: any gas consumed until
the failure is still charged, but all side effects in the remote
contract are rolled back on failure. -
A new chain operation
AENS.update
is supported. -
New chain exploring operations
AENS.lookup
andOracle.expiry
to
look up an AENS record and the expiry of an Oracle respectively, are added. -
Transaction introspection (
Auth.tx
) has been added. When a Generalized
account is authorized, the authorization function needs access to the
transaction (and the transaction hash) for the wrapped transaction. The
transaction and the transaction hash is availableAuth.tx
, it is only
available during authentication if invoked by a normal contract call
it returnsNone
. Example:switch(Auth.tx) None => abort("Not in Auth context") Some(tx0) => switch(tx0.tx) Chain.SpendTx(_, amount, _) => amount > 400 Chain.ContractCallTx(_, _) => true _ => false
-
A debug mode is a added to the compiler. Right now its only use is to
turn off hermetization.
Changed
- The function
Chain.block_hash(height)
is now (in FATEv2) defined for
the current height - this used to be an error. - Standard library: Sort is optimized to do
mergesort
and acontains
function is added. - Improved type errors and explicit errors for some syntax errors (empty code
blocks, etc.). - Compiler optimization: The ACI is generated alongside bytecode. This means
that multiple compiler passes can be avoided. - Compiler optimization: Improved parsing (less stack used when transpiled).
- A bug where constraints were handled out of order fixed.
- Fixed calldata decoding for singleton records.
- Improved the documentation w.r.t. signatures, especially stressing the fact that
the network ID is a part of what is signed.
v4.3.0
Added
- Added documentation (moved from
protocol
) Frac.aes
– library for rational numbers- Added some more meaningful error messages
- Exported several parsing functionalities
- With option
keep_included
it is possible to see which files were included during the parse - There is a function
run_parser
that be used to evaluate any parsing rule - Exported parsers:
body
,type
anddecl
Changed
- Performance improvements in the standard library
- Fixed ACI encoder to handle
-
unary operator - Fixed including by absolute path
- Fixed variant type printing in the ACI error messages
- Fixed pretty printing of combined function clauses
Removed
let
definitions are no longer supported in the toplevel of the contract- type declarations are no longer supported
v4.2.0
Added
- Allow separate entrypoint/function type signature and definition, and pattern
matching in left-hand sides:function length : list('a) => int length([]) = 0 length(x :: xs) = 1 + length(xs)
- Allow pattern matching in list comprehension generators (filtering out match
failures):function somes(xs : list(option('a))) : list('a) = [ x | Some(x) <- xs ]
- Allow pattern matching in let-bindings (aborting on match failures):
function test(m : map(int, int)) = let Some(x) = Map.lookup(m, 0) x
Changed
- FATE code generator improvements.
- Bug fix: Handle qualified constructors in patterns.
- Bug fix: Allow switching also on negative numbers.
v4.1.0
Sophia - Roma
The purpose of this release is to provide a standalone compiler - corresponding to the compiler that is provided in the latest ROMA release of the aeternity node
.
NOTE: The main usage of this at this point is for regression testing in aeternity/aeternity
project.