Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae3edac53e | |||
| acec32e744 | |||
| 5784f074a6 | |||
| d07b321b25 | |||
| 2e6c01cb75 | |||
| b22eeffc3d | |||
| b366bed24b | |||
| 1975ccf804 | |||
| 4f68729631 | |||
| 10c845d3cf | |||
| 393d7710c1 | |||
| 37e5a92b2e | |||
| cb9c9df103 | |||
| c09313a92c | |||
| 75b2d6981f | |||
| 78d94786b6 | |||
| 216f7f8a25 | |||
| 254172e3a3 | |||
| eadb4e8c83 | |||
| 3996b6a711 |
@@ -21,3 +21,4 @@ rebar3.crashdump
|
|||||||
aesophia
|
aesophia
|
||||||
.qcci
|
.qcci
|
||||||
current_counterexample.eqc
|
current_counterexample.eqc
|
||||||
|
test/contracts/test.aes
|
||||||
|
|||||||
+14
-1
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
### Removed
|
### 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
|
||||||
|
- Fixed a missing `include` in the `Frac` standard library
|
||||||
|
|
||||||
## [6.0.0] 2021-05-26
|
## [6.0.0] 2021-05-26
|
||||||
### Added
|
### Added
|
||||||
- Child contracts
|
- Child contracts
|
||||||
@@ -298,7 +309,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Simplify calldata creation - instead of passing a compiled contract, simply
|
- Simplify calldata creation - instead of passing a compiled contract, simply
|
||||||
pass a (stubbed) contract string.
|
pass a (stubbed) contract string.
|
||||||
|
|
||||||
[Unreleased]: https://github.com/aeternity/aesophia/compare/v6.0.0...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
|
[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
|
[5.0.0]: https://github.com/aeternity/aesophia/compare/v4.3.0...v5.0.0
|
||||||
[4.3.0]: https://github.com/aeternity/aesophia/compare/v4.2.0...v4.3.0
|
[4.3.0]: https://github.com/aeternity/aesophia/compare/v4.2.0...v4.3.0
|
||||||
|
|||||||
+3
-3
@@ -194,7 +194,7 @@ contract IntHolder =
|
|||||||
entrypoint get() = state
|
entrypoint get() = state
|
||||||
|
|
||||||
main contract IntHolderFactory =
|
main contract IntHolderFactory =
|
||||||
entrypoint new(x : int) : IntHolder =
|
stateful entrypoint new(x : int) : IntHolder =
|
||||||
let ih = Chain.create(x) : IntHolder
|
let ih = Chain.create(x) : IntHolder
|
||||||
ih
|
ih
|
||||||
```
|
```
|
||||||
@@ -802,8 +802,8 @@ will emit one Event of each kind in the example.
|
|||||||
|
|
||||||
```sophia
|
```sophia
|
||||||
entrypoint emit_events() : () =
|
entrypoint emit_events() : () =
|
||||||
Chain.event(TheFirstEvent(42))
|
Chain.event(Event1(42, 34, "foo"))
|
||||||
Chain.event(AnotherEvent(Contract.address, "This is not indexed"))
|
Chain.event(Event2("This is not indexed", Contract.address))
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Argument order
|
#### Argument order
|
||||||
|
|||||||
+12
-4
@@ -645,7 +645,7 @@ Call.value : int
|
|||||||
The amount of coins transferred to the contract in the call.
|
The amount of coins transferred to the contract in the call.
|
||||||
|
|
||||||
|
|
||||||
#### gas
|
#### gas_price
|
||||||
```
|
```
|
||||||
Call.gas_price : int
|
Call.gas_price : int
|
||||||
```
|
```
|
||||||
@@ -653,7 +653,15 @@ Call.gas_price : int
|
|||||||
The gas price of the current call.
|
The gas price of the current call.
|
||||||
|
|
||||||
|
|
||||||
#### gas
|
#### fee
|
||||||
|
```
|
||||||
|
Call.fee : int
|
||||||
|
```
|
||||||
|
|
||||||
|
The fee of the current call.
|
||||||
|
|
||||||
|
|
||||||
|
#### gas_left
|
||||||
```
|
```
|
||||||
Call.gas_left() : int
|
Call.gas_left() : int
|
||||||
```
|
```
|
||||||
@@ -1208,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.
|
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)
|
List.merge(lesser_cmp : ('a, 'a) => bool, l1 : list('a), l2 : list('a)) : list('a)
|
||||||
```
|
```
|
||||||
@@ -1216,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))
|
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)
|
List.sort(lesser_cmp : ('a, 'a) => bool, l : list('a)) : list('a)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
include "String.aes"
|
||||||
|
|
||||||
namespace Frac =
|
namespace Frac =
|
||||||
|
|
||||||
private function gcd(a : int, b : int) =
|
private function gcd(a : int, b : int) =
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ namespace List =
|
|||||||
* `b` only if `(b - a) mod step == 0`. `step` should be bigger than 0.
|
* `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) =
|
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, [])
|
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) =
|
private function from_to_step_(a : int, b : int, s : int, acc : list(int)) : list(int) =
|
||||||
if(b < a) acc
|
if(b < a) acc
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
{base_plt_apps, [erts, kernel, stdlib, crypto, mnesia]}
|
{base_plt_apps, [erts, kernel, stdlib, crypto, mnesia]}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{relx, [{release, {aesophia, "6.0.0"},
|
{relx, [{release, {aesophia, "6.0.2"},
|
||||||
[aesophia, aebytecode, getopt]},
|
[aesophia, aebytecode, getopt]},
|
||||||
|
|
||||||
{dev_mode, true},
|
{dev_mode, true},
|
||||||
|
|||||||
@@ -330,10 +330,11 @@ to_fcode(Env, [{Contract, Attrs, Con = {con, _, Name}, Decls}|Rest])
|
|||||||
case Contract =:= contract_interface of
|
case Contract =:= contract_interface of
|
||||||
false ->
|
false ->
|
||||||
#{ builtins := Builtins } = Env,
|
#{ 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},
|
builtins => Builtins#{[Name, "state"] => {get_state, none},
|
||||||
[Name, "put"] => {set_state, 1},
|
[Name, "put"] => {set_state, 1},
|
||||||
[Name, "Chain", "event"] => {chain_event, 1}} },
|
[Name, "Chain", "event"] => {chain_event, 1}} }),
|
||||||
#{ functions := PrevFuns } = ConEnv,
|
#{ functions := PrevFuns } = ConEnv,
|
||||||
#{ functions := Funs } = Env1 =
|
#{ functions := Funs } = Env1 =
|
||||||
decls_to_fcode(ConEnv, Decls),
|
decls_to_fcode(ConEnv, Decls),
|
||||||
|
|||||||
@@ -244,8 +244,9 @@ check_call1(ContractString0, FunName, Args, Options) ->
|
|||||||
fate ->
|
fate ->
|
||||||
%% First check the contract without the __call function
|
%% First check the contract without the __call function
|
||||||
#{ fcode := OrgFcode
|
#{ fcode := OrgFcode
|
||||||
|
, fcode_env := #{child_con_env := ChildContracts}
|
||||||
, ast := Ast } = string_to_code(ContractString0, Options),
|
, ast := Ast } = string_to_code(ContractString0, Options),
|
||||||
FateCode = aeso_fcode_to_fate:compile(OrgFcode, []),
|
FateCode = aeso_fcode_to_fate:compile(ChildContracts, OrgFcode, []),
|
||||||
%% collect all hashes and compute the first name without hash collision to
|
%% collect all hashes and compute the first name without hash collision to
|
||||||
SymbolHashes = maps:keys(aeb_fate_code:symbols(FateCode)),
|
SymbolHashes = maps:keys(aeb_fate_code:symbols(FateCode)),
|
||||||
CallName = first_none_match(?CALL_NAME, SymbolHashes,
|
CallName = first_none_match(?CALL_NAME, SymbolHashes,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{application, aesophia,
|
{application, aesophia,
|
||||||
[{description, "Contract Language for aeternity"},
|
[{description, "Compiler for Aeternity Sophia language"},
|
||||||
{vsn, "6.0.0"},
|
{vsn, "6.0.2"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications,
|
{applications,
|
||||||
[kernel,
|
[kernel,
|
||||||
|
|||||||
@@ -90,6 +90,23 @@ simple_compile_test_() ->
|
|||||||
end} || Backend <- [aevm, fate] ] ++
|
end} || Backend <- [aevm, fate] ] ++
|
||||||
[].
|
[].
|
||||||
|
|
||||||
|
%% Check if all modules in the standard library compile
|
||||||
|
stdlib_test_() ->
|
||||||
|
{ok, Files} = file:list_dir(aeso_stdlib:stdlib_include_path()),
|
||||||
|
[ { "Testing " ++ File ++ " from the stdlib",
|
||||||
|
fun() ->
|
||||||
|
String = "include \"" ++ File ++ "\"\nmain contract Test =\n entrypoint f(x) = x",
|
||||||
|
Options = [{src_file, File}, {backend, fate}],
|
||||||
|
case aeso_compiler:from_string(String, Options) of
|
||||||
|
{ok, #{fate_code := Code}} ->
|
||||||
|
Code1 = aeb_fate_code:deserialize(aeb_fate_code:serialize(Code)),
|
||||||
|
?assertMatch({X, X}, {Code1, Code});
|
||||||
|
{error, Error} -> io:format("\n\n~p\n\n", [Error]), print_and_throw(Error)
|
||||||
|
end
|
||||||
|
end} || File <- Files,
|
||||||
|
lists:suffix(".aes", File)
|
||||||
|
].
|
||||||
|
|
||||||
check_errors(no_error, Actual) -> ?assertMatch(#{}, Actual);
|
check_errors(no_error, Actual) -> ?assertMatch(#{}, Actual);
|
||||||
check_errors(Expect, #{}) ->
|
check_errors(Expect, #{}) ->
|
||||||
?assertEqual({error, Expect}, ok);
|
?assertEqual({error, Expect}, ok);
|
||||||
@@ -182,6 +199,7 @@ compilable_contracts() ->
|
|||||||
"clone",
|
"clone",
|
||||||
"clone_simple",
|
"clone_simple",
|
||||||
"create",
|
"create",
|
||||||
|
"child_contract_init_bug",
|
||||||
"test" % Custom general-purpose test file. Keep it last on the list.
|
"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()
|
||||||
Reference in New Issue
Block a user