All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
4.2.0 - 2020-01-15
- 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
- FATE code generator improvements.
- Bug fix: Handle qualified constructors in patterns.
- Bug fix: Allow switching also on negative numbers.
4.1.0 - 2019-11-26
- Support encoding and decoding bit fields in call arguments and results.
- Various improvements to FATE code generator.
4.0.0 - 2019-10-11
Address.to_contract
- casts an address to a (any) contract type.- Pragma to check compiler version, e.g.
@compiler >= 4.0
. - Handle numeric escapes, i.e.
"\x19Ethereum Signed Message:\n"
, and similar strings. Bytes.concat
andBytes.split
are added to be able to (de-)construct byte arrays.[a..b]
language construct, returning the list of numbers betweena
andb
(inclusive). Returns the empty list ifa
>b
.- [Standard libraries] (https://github.com/aeternity/protocol/blob/master/contracts/sophia_stdlib.md)
- Checks that
init
is not called from other functions. - FATE backend - the compiler is able to produce VM code for both
AEVM
andFATE
. Many of the APIs now take{backend, aevm | fate}
to decide wich backend to produce artifacts for. - New builtin functions
Crypto.ecrecover_secp256k1: (hash, bytes(65)) => option(bytes(20))
andCrypto.ecverify_secp256k1 : (hash, bytes(20), bytes(65)) => bool
for recovering and verifying an Ethereum address for a message hash and a signature. - Sophia supports list comprehensions known from languages like Python, Haskell or Erlang. Example syntax:
[x + y | x <- [1,2,3,4,5], let k = x*x, if (k > 5), y <- [k, k+1, k+2]]
// yields [12,13,14,20,21,22,30,31,32]
- A new contract, and endpoint, modifier
payable
is introduced. Contracts, and enpoints, that shall be able to receive funds should be marked as payable.Address.is_payable(a)
can be used to check if an (contract) address is payable or not.
- Nice type error if contract function is called as from a namespace.
- Fail on function definitions in contracts other than the main contract.
- Bug fix in variable optimization - don't discard writes to the store/state.
- Bug fixes in error reporting.
- Bug fix in variable liveness analysis for FATE.
- Error messages are changed into a uniform format, and more helpful messages have been added.
Crypto.<hash_fun>
andString.<hash_fun>
for byte arrays now only hash the actual byte array - not the internal ABI format.- More strict checks for polymorphic oracles and higher order oracles and entrypoints.
AENS.claim
is updated with aNameFee
field - to be able to do name auctions within contracts.- Fixed a bug in
Bytes.to_str
for AEVM. - New syntax for tuple types. Now 0-tuple type is encoded as
unit
instead of()
and regular tuples are encoded by interspersing inner types with*
, for instanceint * string
. Parens are not necessary. Note it only affects the types, values remain as their were before, so(1, "a") : int * string
- The
AENS.transfer
andAENS.revoke
functions have been updated to take a namestring
instead of a namehash
. - Fixed a bug where the
AEVM
backend complained about a missinginit
function when trying to generate calldata from an ACI-generated interface. - Compiler now returns the ABI-version in the compiler result map.
- Renamed
Crypto.ecverify
andCrypto.ecverify_secp256k1
intoCrypto.verify_sig
andCrypto.verify_sig_secp256k1
respectively.
3.2.0 - 2019-06-28
- New builtin function
require : (bool, string) => ()
. Defined asfunction require(b, err) = if(!b) abort(err)
- New builtin functions
for converting a byte array to a hex string and interpreting it as a big-endian encoded integer respectively.
Bytes.to_str : bytes(_) => string Bytes.to_int : bytes(_) => int
- Public contract functions must now be declared as entrypoints:
Functions in namespaces still use
contract Example = // Exported entrypoint exported_fun(x) = local_fun(x) // Not exported function local_fun(x) = x
function
(andprivate function
for private functions). - The return type of
Chain.block_hash(height)
has changed, it used to beint
, where0
denoted an incorrect height. New return type isoption(hash)
, whereNone
represents an incorrect height. - Event name hashes now use BLAKE2b instead of Keccak256.
- Fixed bugs when defining record types in namespaces.
- Fixed a bug in include path handling when passing options to the compiler.
3.1.0 - 2019-06-03
- Keyword
indexed
is now optional for word typed (bool
,int
,address
, ...) event arguments. - State variable pretty printing now produce
'a, 'b, ...
instead of'1, '2, ...
. - ACI is restructured and improved:
state
andevent
types (if present) now appear at the top level.- Namespaces and remote interfaces are no longer ignored.
- All type definitions are included in the interface rendering.
- API functions are renamed, new functions are
contract_interface
andrender_aci_json
.
- Fixed a bug in
create_calldata
/to_sophia_value
- it can now handle negative literals.
3.0.0 - 2019-05-21
stateful
annotations are now properly enforced. Functions must be marked stateful in order to update the state or spend tokens.- Primitives
Contract.creator
,Address.is_contract
,Address.is_oracle
,Oracle.check
andOracle.check_query
has been added to Sophia. - A byte array type
bytes(N)
has been added to generalizehash (== bytes(32))
andsignature (== bytes(64))
and allow for byte arrays of arbitrary fixed length. Crypto.ecverify_secp256k1
has been added.
- Address literals (+ Oracle, Oracle query and remote contracts) have been changed
from
#<hex>
to address asak_<base58check>
, oracleok_<base58check>
, oracle queryoq_<base58check>
and remote contractct_<base58check>
. - The compilation and typechecking of
letfun
(e.g.let m(f, xs) = map(f, xs)
) was not working properly and has been fixed.
let rec
has been removed from the language, it has never worked.- The standalone CLI compiler is served in the repo
aeternity/aesophia_cli
and has been completely removed fromaesophia
.
2.1.0 - 2019-04-11
- Stubs (not yet wired up) for compilation to FATE
- Add functions specific for Calldata decoding
- Support for
Auth.tx_hash
, not available in AEVM until Fortuna release
- Improvements to the ACI generator
2.0.0 - 2019-03-11
- Add
Crypto.ecverify
to the compiler. - Add
Crypto.sha3
,Crypto.blake2
,Crypto.sha256
,String.blake2
andString.sha256
to the compiler. - Add the
bits
type for working with bit fields in Sophia. - Add Namespaces to Sophia in order to simplify using library contracts, etc.
- Add a missig type check on the
init
function - detects programmer errors earlier. - Add the ACI (Aeternity Contract Interface) generator.
- Use native bit shift operations in builtin functions, reducing gas cost.
- Improve type checking of
record
fields - generates more understandable error messages. - Improved, more coherent, error messages.
- Simplify calldata creation - instead of passing a compiled contract, simply pass a (stubbed) contract string.