Compare commits

...

11 Commits

Author SHA1 Message Date
radrow 0320ac959b CHANGELOG update 2021-07-15 20:43:11 +02:00
radrow dcef89b486 Add Option.force_msg 2021-07-15 20:41:38 +02:00
Hans Svensson 4957d01e9e Merge pull request #327 from aeternity/fix_doc
Fix stdlib doc
2021-07-13 20:40:49 +02:00
Hans Svensson 9d76e6186a Fix stdlib doc 2021-07-13 20:01:54 +02:00
Radosław Rowicki ae3edac53e Prepare 6.0.2 (#326)
* Prepare 6.0.2

* Minor note
2021-07-06 17:31:35 +02:00
Ulf Norell acec32e744 Merge pull request #325 from aeternity/issue324
Fix #324: bug when compiling default init in the presence of child contracts
2021-07-05 10:33:26 +02:00
Hans Svensson 5784f074a6 Merge pull request #323 from aeternity/fromtostep
Add check in from_to_step
2021-07-05 09:39:32 +02:00
Ulf Norell d07b321b25 Fix #324: bug when compiling default init in the presence of child contracts 2021-07-05 09:29:43 +02:00
radrow 2e6c01cb75 Fix var 2021-06-26 19:10:49 +02:00
radrow b22eeffc3d Formatting in stdlib doc 2021-06-26 19:10:15 +02:00
radrow b366bed24b Add check in from_to_step 2021-06-25 11:19:19 +02:00
9 changed files with 46 additions and 11 deletions
+9 -1
View File
@@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- `Option.force_msg`
### Changed
### Removed
## [6.0.2] 2021-07-05
### Changed
- `List.from_to_step` now forbids non-positive step (this change does
*not* alter the behavior of the previously deployed contracts)
- Fixed leaking state between contracts
## [6.0.1] 2021-06-24
### Changed
- Fixed a bug in calldata encoding for contracts containing multiple contracts
@@ -303,7 +310,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Simplify calldata creation - instead of passing a compiled contract, simply
pass a (stubbed) contract string.
[Unreleased]: https://github.com/aeternity/aesophia/compare/v6.0.1...HEAD
[Unreleased]: https://github.com/aeternity/aesophia/compare/v6.0.2...HEAD
[6.0.2]: https://github.com/aeternity/aesophia/compare/v6.0.1...v6.0.2
[6.0.1]: https://github.com/aeternity/aesophia/compare/v6.0.0...v6.0.1
[6.0.0]: https://github.com/aeternity/aesophia/compare/v5.0.0...v6.0.0
[5.0.0]: https://github.com/aeternity/aesophia/compare/v4.3.0...v5.0.0
+16 -6
View File
@@ -362,7 +362,7 @@ namespace Chain =
#### tx_hash
```
Auth.tx_hash : option(Chain.tx)
Auth.tx_hash : option(hash)
```
Gets the transaction hash during authentication.
@@ -824,7 +824,7 @@ payable contract Auction =
stateful entrypoint sell(amount) =
require(amount >= 0, "negative_amount")
...
main contract Market =
type state = list(Auction)
entrypoint init() = []
@@ -876,7 +876,7 @@ payable contract interface Auction =
entrypoint init : (int, string) => void
stateful payable entrypoint buy : (int) => ()
stateful entrypoint sell : (int) => ()
main contract Market =
type state = list(Auction)
entrypoint init() = []
@@ -1216,7 +1216,7 @@ List.unzip(l : list('a * 'b)) : list('a) * list('b)
Opposite to the `zip` operation. Takes a list of pairs and returns pair of lists with respective elements on same indices.
### merge
#### merge
```
List.merge(lesser_cmp : ('a, 'a) => bool, l1 : list('a), l2 : list('a)) : list('a)
```
@@ -1224,7 +1224,7 @@ List.merge(lesser_cmp : ('a, 'a) => bool, l1 : list('a), l2 : list('a)) : list('
Merges two sorted lists into a single sorted list. O(length(l1) + length(l2))
### sort
#### sort
```
List.sort(lesser_cmp : ('a, 'a) => bool, l : list('a)) : list('a)
```
@@ -1293,7 +1293,17 @@ Escapes `option` wrapping by providing default value for `None`.
Option.force(o : option('a)) : 'a
```
Forcefully escapes `option` wrapping assuming it is `Some`. Throws error on `None`.
Forcefully escapes the `option` wrapping assuming it is `Some`.
Aborts on `None`.
#### force_msg
```
Option.force_msg(o : option('a), err : string) : 'a
```
Forcefully escapes the `option` wrapping assuming it is `Some`.
Aborts with `err` error message on `None`.
#### contains
+1
View File
@@ -80,6 +80,7 @@ namespace List =
* `b` only if `(b - a) mod step == 0`. `step` should be bigger than 0.
*/
function from_to_step(a : int, b : int, s : int) : list(int) =
require(s > 0, "List.from_to_step: non-positive step")
from_to_step_(a, b - (b-a) mod s, s, [])
private function from_to_step_(a : int, b : int, s : int, acc : list(int)) : list(int) =
if(b < a) acc
+6
View File
@@ -26,6 +26,12 @@ namespace Option =
None => abort("Forced None value")
Some(x) => x
/** Assume it is `Some` with custom error message
*/
function force_msg(o : option('a), err : string) : 'a = switch(o)
None => abort(err)
Some(x) => x
function contains(e : 'a, o : option('a)) = o == Some(e)
function on_elem(o : option('a), f : 'a => unit) : unit = match((), f, o)
+1 -1
View File
@@ -15,7 +15,7 @@
{base_plt_apps, [erts, kernel, stdlib, crypto, mnesia]}
]}.
{relx, [{release, {aesophia, "6.0.1"},
{relx, [{release, {aesophia, "6.0.2"},
[aesophia, aebytecode, getopt]},
{dev_mode, true},
+3 -2
View File
@@ -330,10 +330,11 @@ to_fcode(Env, [{Contract, Attrs, Con = {con, _, Name}, Decls}|Rest])
case Contract =:= contract_interface of
false ->
#{ builtins := Builtins } = Env,
ConEnv = Env#{ context => {contract_def, Name},
ConEnv = maps:remove(state_layout,
Env#{ context => {contract_def, Name},
builtins => Builtins#{[Name, "state"] => {get_state, none},
[Name, "put"] => {set_state, 1},
[Name, "Chain", "event"] => {chain_event, 1}} },
[Name, "Chain", "event"] => {chain_event, 1}} }),
#{ functions := PrevFuns } = ConEnv,
#{ functions := Funs } = Env1 =
decls_to_fcode(ConEnv, Decls),
+1 -1
View File
@@ -1,6 +1,6 @@
{application, aesophia,
[{description, "Compiler for Aeternity Sophia language"},
{vsn, "6.0.1"},
{vsn, "6.0.2"},
{registered, []},
{applications,
[kernel,
+1
View File
@@ -199,6 +199,7 @@ compilable_contracts() ->
"clone",
"clone_simple",
"create",
"child_contract_init_bug",
"test" % Custom general-purpose test file. Keep it last on the list.
].
@@ -0,0 +1,8 @@
contract Identity =
record state = {foo: int, bar: string}
entrypoint init() = {foo = 0, bar = ""}
main contract IdentityService =
stateful entrypoint createNewIdentity() : Identity =
put(())
Chain.create()