From d8fff8f20f955591f6cc37cf71e30714a7945f9d Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Mon, 21 Jan 2019 14:20:15 +0100 Subject: [PATCH 1/2] Add Crypto.ecverify --- src/aeso_ast_infer_types.erl | 6 ++++-- src/aeso_ast_to_icode.erl | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index e4dd957..97ce45e 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -148,12 +148,14 @@ global_env() -> {["Map", "delete"], Fun([K, Map(K, V)], Map(K, V))}, {["Map", "member"], Fun([K, Map(K, V)], Bool)}, {["Map", "size"], Fun1(Map(K, V), Int)}, + %% Crypto/Curve operations + {["Crypto", "ecverify"], Fun([Hash, Address, SignId], Bool)}, %% Strings {["String", "length"], Fun1(String, Int)}, {["String", "concat"], Fun([String, String], String)}, - {["String", "sha3"], Fun1(String, Int)}, + {["String", "sha3"], Fun1(String, Hash)}, %% Conversion - {["Int", "to_str"], Fun1(Int, String)}, + {["Int", "to_str"], Fun1(Int, String)}, {["Address", "to_str"], Fun1(Address, String)} ]. diff --git a/src/aeso_ast_to_icode.erl b/src/aeso_ast_to_icode.erl index 77508c0..2a0321f 100644 --- a/src/aeso_ast_to_icode.erl +++ b/src/aeso_ast_to_icode.erl @@ -316,6 +316,12 @@ ast_body({map, _, Map, [Upd]}, Icode) -> ast_body({map, Ann, Map, [Upd | Upds]}, Icode) -> ast_body({map, Ann, {map, Ann, Map, [Upd]}, Upds}, Icode); +%% Crypto +ast_body(?qid_app(["Crypto", "ecverify"], [Msg, PK, Sig], _, _), Icode) -> + prim_call(?PRIM_CALL_CRYPTO_ECVERIFY, #integer{value = 0}, + [ast_body(Msg, Icode), ast_body(PK, Icode), ast_body(Sig, Icode)], + [word, word, sign_t()], word); + %% Strings %% -- String length ast_body(?qid_app(["String", "length"], [String], _, _), Icode) -> -- 2.30.2 From e4c46ee16fa7b17ef0a0a534b5823a28896360f5 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Mon, 21 Jan 2019 20:14:04 +0100 Subject: [PATCH 2/2] Bump aebytecode dependency --- rebar.config | 2 +- rebar.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 66e9732..c86a69c 100644 --- a/rebar.config +++ b/rebar.config @@ -2,7 +2,7 @@ %% NOTE: When possible deps are referenced by Git ref to ensure consistency between builds. {deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", - {ref,"99bf097"}}} + {ref,"19d0e3e"}}} ]}. diff --git a/rebar.lock b/rebar.lock index 34aa736..46b23b6 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,4 +1,4 @@ [{<<"aebytecode">>, {git,"https://github.com/aeternity/aebytecode.git", - {ref,"99bf097759dedbe7553f87a796bc7e1c7322e64b"}}, + {ref,"19d0e3ee8493ac2a8f041636445734bade45d65f"}}, 0}]. -- 2.30.2