diff --git a/.circleci/config.yml b/.circleci/config.yml index 770b4ec..d4b400a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 executors: aebuilder: docker: - - image: aeternity/builder:xenial-otp21 + - image: aeternity/builder:bionic-otp24 user: builder working_directory: ~/aesophia aerelease: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b085c2..af73b04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug in calldata encoding - the input was not properly UTF8 encoded. ### Removed +## [7.0.0] +### Changed +- Updated to [Sophia 7.0.0](https://github.com/aeternity/aesophia/blob/master/CHANGELOG.md#700---2021-10-20) +### Removed +- Support for AEVM backend +- `-b` option to set backend (now only FATE is supported) +- `decode_data` feature, as it worked only on AEVM + ## [6.1.0] ### Changed - Updated to [Sophia 6.1.0](https://github.com/aeternity/aesophia/blob/master/CHANGELOG.md#610---2021-10-20) @@ -69,7 +77,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix bug with standard library includes. ### Removed -[Unreleased]: https://github.com/aeternity/aesophia_cli/compare/v6.1.0...HEAD +[Unreleased]: https://github.com/aeternity/aesophia_cli/compare/v7.0.0...HEAD +[7.0.0]: https://github.com/aeternity/aesophia_cli/compare/v6.1.0...v7.0.0 [6.1.0]: https://github.com/aeternity/aesophia_cli/compare/v6.0.2...v6.1.0 [6.0.2]: https://github.com/aeternity/aesophia_cli/compare/v6.0.1...v6.0.2 [6.0.1]: https://github.com/aeternity/aesophia_cli/compare/v6.0.0...v6.0.1 diff --git a/aesophia_cli b/aesophia_cli index 9fe8699..327aeef 100755 Binary files a/aesophia_cli and b/aesophia_cli differ diff --git a/priv/bin/v7.0.0/aesophia_cli b/priv/bin/v7.0.0/aesophia_cli new file mode 100755 index 0000000..c7db6c1 Binary files /dev/null and b/priv/bin/v7.0.0/aesophia_cli differ diff --git a/rebar.config b/rebar.config index bcb1b25..c900383 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ {erl_opts, [no_debug_info]}. -{deps, [ {aesophia, {git, "https://github.com/aeternity/aesophia.git", {ref, "c5bfcd3"}}} - , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", {ref, "58e34ae"}}} +{deps, [ {aesophia, {git, "https://github.com/aeternity/aesophia.git", {tag, "v7.0.0"}}} + , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", {ref, "eb68fe3"}}} , {eblake2, "1.0.0"}]}. {escript_incl_apps, [aeserialization]}. diff --git a/rebar.lock b/rebar.lock index 2bb33b7..8fa44ff 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,15 +1,15 @@ {"1.2.0", [{<<"aebytecode">>, {git,"https://github.com/aeternity/aebytecode.git", - {ref,"0699f35b0398bac6cd4468da654d608375bd853d"}}, + {ref,"8269dbd71e9011921c60141636f1baa270a0e784"}}, 1}, {<<"aeserialization">>, {git,"https://github.com/aeternity/aeserialization.git", - {ref,"58e34ae7b5abfcc54f505ea8d57183d04f67120e"}}, + {ref,"eb68fe331bd476910394966b7f5ede7a74d37e35"}}, 0}, {<<"aesophia">>, {git,"https://github.com/aeternity/aesophia.git", - {ref,"c5bfcd3bdc7152e3ba9e822e730fe065bab9f136"}}, + {ref,"f84242af6b1867fdada96c5f2ef86cf79589d237"}}, 0}, {<<"base58">>, {git,"https://github.com/aeternity/erl-base58.git", @@ -18,7 +18,7 @@ {<<"eblake2">>,{pkg,<<"eblake2">>,<<"1.0.0">>},0}, {<<"enacl">>, {git,"https://github.com/aeternity/enacl.git", - {ref,"26180f42c0b3a450905d2efd8bc7fd5fd9cece75"}}, + {ref,"793ddb502f7fe081302e1c42227dca70b09f8e17"}}, 1}, {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},1}, {<<"jsx">>, diff --git a/rebar3 b/rebar3 index 54a3005..a83d554 100755 Binary files a/rebar3 and b/rebar3 differ diff --git a/src/aesophia_cli.app.src b/src/aesophia_cli.app.src index 2cb19f2..3619c00 100644 --- a/src/aesophia_cli.app.src +++ b/src/aesophia_cli.app.src @@ -1,6 +1,6 @@ {application, aesophia_cli, [{description, "CLI for Sophia compiler"}, - {vsn, "6.1.0"}, + {vsn, "7.0.0"}, {registered, []}, {applications, [kernel, diff --git a/src/aesophia_cli.erl b/src/aesophia_cli.erl index 86566d6..b4d0577 100644 --- a/src/aesophia_cli.erl +++ b/src/aesophia_cli.erl @@ -24,7 +24,6 @@ , {decode_call_fun, undefined, "call_result_fun", string, "Decode contract call result - function name"} , {include_path, $i, "include_path", string, "Explicit include path"} - , {backend, $b, "backend", {string, "fate"}, "Compiler backend; fate | aevm"} , {no_warning, $w, "no_warning", string, "Disabled warnings; " ++ string:join([W || {W, _} <- all_warnings()], " | ")} , {error_warning, $e, "error_warning", undefined, "Report warnings as errors"} @@ -42,10 +41,8 @@ usage() -> getopt:usage(?OPT_SPEC, "aesophia_cli"), timer:sleep(10), io:format("EXAMPLES:\n" - "[compile (for default FATE backend)] :\n" + "[compile] :\n" " aesophia_cli identity.aes -o identity.aeb\n" - "[compile (for AEVM)] :\n" - " aesophia_cli identity.aes -b aevm -o identity.aeb\n" "[compile (with unused functions and shadowing warnings disabled)] :\n" " aesophia_cli -wunused_functions -wshadowing identity.aes\n" "[compile with explicit include path] :\n" @@ -57,11 +54,7 @@ usage() -> "[create aci JSON] : \n" " aesophia_cli --create_json_aci identity.aes -o identity.json\n" "[create calldata] :\n" - " aesophia_cli --create_calldata identity.aes --call \"main_(42)\"\n" - "[decode call result] : \n" - " aesophia_cli identity.aes -b aevm --call_result cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACr8s/aY --call_result_fun main_\n" - "[decode data] :\n" - " aesophia_cli -b aevm --decode_data cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACr8s/aY --decode_type int\n\n"), + " aesophia_cli --create_calldata identity.aes --call \"main_(42)\"\n"), error. main(Args) -> @@ -76,7 +69,6 @@ main1(Args) -> IsHelp = proplists:get_value(help, Opts, false), IsVersion = proplists:get_value(version, Opts, false), CreateCallData = proplists:get_value(create_calldata, Opts, undefined), - DecodeData = proplists:get_value(decode_data, Opts, undefined), DecodeCall = proplists:get_value(decode_call_val, Opts, undefined), CreateACIJSON = proplists:get_value(create_json_aci, Opts, undefined), CreateACIStub = proplists:get_value(create_stub_aci, Opts, undefined), @@ -88,8 +80,6 @@ main1(Args) -> create_calldata(CreateCallData, Opts); DecodeCall /= undefined -> decode_call_res(DecodeCall, Opts); - DecodeData /= undefined -> - decode_data(DecodeData, Opts); CreateACIJSON /= undefined -> create_aci(json, CreateACIJSON, Opts); CreateACIStub /= undefined -> @@ -231,9 +221,8 @@ create_calldata_(Contract, Opts, COpts) -> create_calldata(Contract, CallFun, CallArgs, Opts, COpts) -> OutFile = proplists:get_value(outfile, Opts, undefined), - Backend = get_backend(Opts), - case aeso_compiler:create_calldata(Contract, CallFun, CallArgs, COpts ++ Backend) of + case aeso_compiler:create_calldata(Contract, CallFun, CallArgs, COpts) of {ok, CallData} -> write_calldata(OutFile, CallData); {error, Reasons} -> @@ -250,8 +239,7 @@ decode_call_res(EncValue, Opts) -> case file:read_file(File) of {ok, Bin} -> Code = binary_to_list(Bin), - Backend = get_backend(Opts), - decode_call_res(EncValue, Code, Opts, Backend ++ get_inc_path(File, Opts)); + decode_call_res(EncValue, Code, Opts, get_inc_path(File, Opts)); {error, _} -> io:format(standard_error, "Error: Could not find file ~s\n", [File]) end @@ -282,47 +270,6 @@ decode_call_res(Source, FunName, CallRes0, CallValue, Opts, COpts) -> {error, Reasons} end. -decode_data(EncData, Opts) -> - case proplists:get_value(backend, Opts, "fate") of - "aevm" -> - case aeser_api_encoder:safe_decode(contract_bytearray, list_to_binary(EncData)) of - {ok, Data} -> - decode_data_(Data, Opts); - Err = {error, Reason} -> - io:format(standard_error, "Error: Bad data - ~p\n", [Reason]), - Err - end; - _ -> - io:format(standard_error, "Error: decode_data only supported for AEVM data\n", []), - {error, decode_data_for_fate_not_supported} - end. - -decode_data_(Data, Opts) -> - case proplists:get_value(decode_data_type, Opts, undefined) of - undefined -> - io:format(standard_error, "Error: Missing 'decode_type` parameter\n", []); - SophiaType -> - decode_data_(Data, SophiaType, Opts) - end. - -decode_data_(Data, SophiaType, _Opts) -> - case aeso_compiler:sophia_type_to_typerep(SophiaType) of - {ok, TypeRep} -> - try aeb_heap:from_binary(TypeRep, Data) of - {ok, Term} -> - io:format("Decoded data:\n~p\n", [Term]); - Err = {error, Reason} -> - io:format(standard_error, "Error: Failed to decode data - ~p\n", [Reason]), - Err - catch _T:Reason -> - io:format(standard_error, "Error: Failed to decode data - ~p\n", [Reason]), - {error, bad_type_or_data} - end; - Err = {error, Reason} -> - io:format(standard_error, "Error: Bad type - ~p\n", [Reason]), - Err - end. - write_calldata(OutFile, CallData) -> EncCallData = aeser_api_encoder:encode(contract_bytearray, CallData), case OutFile of @@ -367,7 +314,7 @@ write_aci(OutFile, ACI) -> %% Maybe better to do on the compiler side... prepare_call(Call) -> try aeso_parser:string("main contract C =\n function foo() = " ++ aeso_scan:utf8_encode(Call)) of - [{contract_main, _, _, [{letfun, _, _, _, _, [{guarded, _, [], {app, _, Fun0, Args0}}]}]}] -> + [{contract_main, _, _, _, [{letfun, _, _, _, _, [{guarded, _, [], {app, _, Fun0, Args0}}]}]}] -> {id, _, Fun} = Fun0, Args = [prepare_arg(Arg) || Arg <- Args0], {ok, Fun, Args}; @@ -385,11 +332,10 @@ no_nl(Str) -> lists:flatten(string:replace(Str, "\n", "", all)). get_compiler_opts(Opts) -> IncludePath = get_inc_path(Opts), - Backend = get_backend(Opts), Verbose = get_verbose(Opts), PPAsm = get_pp_asm(Opts), Warnings = get_warnings(Opts), - Verbose ++ IncludePath ++ Backend ++ PPAsm ++ Warnings. + Verbose ++ IncludePath ++ PPAsm ++ Warnings. get_inc_path(File, Opts) -> aeso_compiler:add_include_path(File, get_inc_path(Opts)). @@ -406,12 +352,6 @@ get_verbose(Opts) -> true -> [pp_ast] end. -get_backend(Opts) -> - case proplists:get_value(backend, Opts, "fate") of - "aevm" -> [{backend, aevm}]; - _fate -> [{backend, fate}] - end. - get_pp_asm(Opts) -> case proplists:get_value(pp_asm, Opts, false) of false -> []; diff --git a/test/test_cli.sh b/test/test_cli.sh index 2f9c91e..0075482 100755 --- a/test/test_cli.sh +++ b/test/test_cli.sh @@ -13,7 +13,7 @@ else fi ## Compile -./aesophia_cli test/contracts/identity.aes -b aevm -o ${TMPFILE}.aeb +./aesophia_cli test/contracts/identity.aes -o ${TMPFILE}.aeb if [ ! -f ${TMPFILE}.aeb ]; then echo -e "Test FAILED: compile\\n" STATUS=1 @@ -97,28 +97,6 @@ else echo -e "Test PASSED: create calldata 3\\n" fi -## Decode data -RES=`./aesophia_cli -b aevm --decode_data cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACr8s/aY --decode_type int` -echo -e "${RES}" -RES=`echo "${RES}" | tail -n1` -if [ "${RES}" != "42" ]; then - echo -e "Test FAILED: decode data\\n" - STATUS=1 -else - echo -e "Test PASSED: decode data\\n" -fi - -## Decode data -RES=`./aesophia_cli -b aevm test/contracts/identity.aes --call_result cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACr8s/aY --call_result_fun main_` -echo -e "${RES}" -RES=`echo "${RES}" | tail -n1` -if [ "${RES}" != "42" ]; then - echo -e "Test FAILED: decode call result" - STATUS=1 -else - echo -e "Test PASSED: decode call result" -fi - rm -rf ${TMPFILE} ${TMPFILE}.* exit ${STATUS}