From f92e23c9557137e2e0061920a2ed5bf6b2d4855c Mon Sep 17 00:00:00 2001 From: Tobias Lindahl Date: Wed, 19 Jun 2019 12:11:22 +0200 Subject: [PATCH] Add oracle types to some oracle instructions --- src/aeb_fate_generate_ops.erl | 8 ++++---- test/asm_code/oracles.fate | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index eb3c47b..5adb95c 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -143,11 +143,11 @@ ops_defs() -> %% Transaction ops , { 'SPEND', 16#60, false, 3, [a,a], spend, {address, integer}, none, "Transfer Arg1 tokens to account Arg0. (If the contract account has at least that many tokens."} , { 'ORACLE_REGISTER', 16#61, false, 3, [a,a,a,a,a,a,a], oracle_register, {signature, address, integer, variant, typerep, typerep}, oracle, "Arg0 := New oracle with address Arg2, query fee Arg3, TTL Arg4, query type Arg5 and response type Arg6. Arg0 contains delegation signature."} - , { 'ORACLE_QUERY', 16#62, false, 3, [a,a,a,a,a,a], oracle_query, {oracle, any, integer, variant, variant}, oracle_query, "Arg0 := New oracle query for oracle Arg1, question in Arg2, query fee in Arg3, query TTL in Arg4, response TTL in Arg5"} - , { 'ORACLE_RESPOND', 16#63, false, 3, [a,a,a,a], oracle_respond, {signature, oracle, oracle_query,any}, none, "Respond as oracle Arg1 to query in Arg2 with response Arg3. Arg0 contains delegation signature."} + , { 'ORACLE_QUERY', 16#62, false, 3, [a,a,a,a,a,a,a,a], oracle_query, {oracle, any, integer, variant, variant, typerep, typerep}, oracle_query, "Arg0 := New oracle query for oracle Arg1, question in Arg2, query fee in Arg3, query TTL in Arg4, response TTL in Arg5. Typereps for checking oracle type is in Arg6 and Arg7."} + , { 'ORACLE_RESPOND', 16#63, false, 3, [a,a,a,a,a,a], oracle_respond, {signature, oracle, oracle_query,any, typerep, typerep}, none, "Respond as oracle Arg1 to query in Arg2 with response Arg3. Arg0 contains delegation signature. Typereps for checking oracle type is in Arg4 and Arg5."} , { 'ORACLE_EXTEND', 16#64, false, 3, [a,a,a], oracle_extend, {signature, oracle, variant}, none, "Extend oracle in Arg1 with TTL in Arg2. Arg0 contains delegation signature."} - , { 'ORACLE_GET_ANSWER', 16#65, false, 3, [a,a,a], oracle_get_answer, {oracle, oracle_query}, any, "Arg0 := option variant with answer (if any) from oracle query in Arg1 given by oracle Arg0"} - , { 'ORACLE_GET_QUESTION', 16#66, false, 3, [a,a,a], oracle_get_question, {oracle, oracle_query}, any, "Arg0 := question in oracle query Arg2 given to oracle Arg1"} + , { 'ORACLE_GET_ANSWER', 16#65, false, 3, [a,a,a,a,a], oracle_get_answer, {oracle, oracle_query, typerep, typerep}, any, "Arg0 := option variant with answer (if any) from oracle query in Arg1 given by oracle Arg0. Typereps for checking oracle type is in Arg3 and Arg4."} + , { 'ORACLE_GET_QUESTION', 16#66, false, 3, [a,a,a,a,a], oracle_get_question, {oracle, oracle_query, typerep, typerep}, any, "Arg0 := question in oracle query Arg2 given to oracle Arg1. Typereps for checking oracle type is in Arg3 and Arg4."} , { 'ORACLE_QUERY_FEE', 16#67, false, 3, [a,a], oracle_query_fee, {oracle}, integer, "Arg0 := query fee for oracle Arg1"} , { 'AENS_RESOLVE', 16#68, false, 3, [], aens_resolve, {}, none, "NYI"} , { 'AENS_PRECLAIM', 16#69, false, 3, [], aens_preclaim, {}, none, "NYI"} diff --git a/test/asm_code/oracles.fate b/test/asm_code/oracles.fate index 6e5a953..81da73a 100644 --- a/test/asm_code/oracles.fate +++ b/test/asm_code/oracles.fate @@ -5,14 +5,14 @@ FUNCTION register (address, integer, {variant, [{tuple, [integer]}, {tuple, [int RETURN FUNCTION query (oracle, integer, string) : oracle_query - ORACLE_QUERY a arg0 arg1 arg2 (| [1,1] | 0 | (100) |) (| [1,1] | 0 | (100) |) + ORACLE_QUERY a arg0 arg1 arg2 (| [1,1] | 0 | (100) |) (| [1,1] | 0 | (100) |) 'string '{variant, [{tuple, []}, {tuple, [integer]}]} RETURN FUNCTION bogus_query () : oracle_query RETURNR @oq_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv FUNCTION respond (oracle, integer, string) : {tuple, []} - ORACLE_RESPOND $sg_11111111111111111111111111111111111111111111111111111111111111116oUsJe arg0 arg1 arg2 + ORACLE_RESPOND $sg_11111111111111111111111111111111111111111111111111111111111111116oUsJe arg0 arg1 arg2 'string '{variant, [{tuple, []}, {tuple, [integer]}]} RETURNR {} FUNCTION extend (oracle, {variant, [{tuple, [integer]}, {tuple, [integer]}]}) : {tuple, []} @@ -20,13 +20,13 @@ FUNCTION extend (oracle, {variant, [{tuple, [integer]}, {tuple, [integer]}]}) : RETURNR {} FUNCTION get_question (oracle, oracle_query) : string - ORACLE_GET_QUESTION arg0 arg1 + ORACLE_GET_QUESTION a arg0 arg1 'string '{variant, [{tuple, []}, {tuple, [integer]}]} RETURN FUNCTION get_answer (oracle, oracle_query) : {variant, [{tuple, []}, {tuple, [string]}]} - ORACLE_GET_ANSWER arg0 arg1 + ORACLE_GET_ANSWER a arg1 arg2 'string '{variant, [{tuple, []}, {tuple, [integer]}]} RETURN FUNCTION query_fee (oracle) : integer - ORACLE_QUERY_FEE arg0 + ORACLE_QUERY_FEE a arg0 RETURN -- 2.30.2