Merge pull request #89 from aeternity/PT-164629640-auth_tx_hash_for_fatge
Pt 164629640 auth tx hash for FATE
This commit is contained in:
commit
fc82b1646c
@ -2,7 +2,7 @@
|
||||
|
||||
{erl_opts, [debug_info]}.
|
||||
|
||||
{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref, "7dd9c29"}}}
|
||||
{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref, "506f9ca"}}}
|
||||
, {getopt, "1.0.1"}
|
||||
, {jsx, {git, "https://github.com/talentdeficit/jsx.git",
|
||||
{tag, "2.8.0"}}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{"1.1.0",
|
||||
[{<<"aebytecode">>,
|
||||
{git,"https://github.com/aeternity/aebytecode.git",
|
||||
{ref,"7dd9c29cc075b52c8f966696e88c8a29fc296240"}},
|
||||
{ref,"506f9ca72ea5df5fb2abd3aaddcbf9d58423e556"}},
|
||||
0},
|
||||
{<<"aeserialization">>,
|
||||
{git,"https://github.com/aeternity/aeserialization.git",
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
-type flit() :: {int, integer()}
|
||||
| {string, binary()}
|
||||
| {hash, binary()}
|
||||
| {signature, binary()}
|
||||
| {account_pubkey, binary()}
|
||||
| {contract_pubkey, binary()}
|
||||
| {oracle_pubkey, binary()}
|
||||
@ -365,6 +367,8 @@ expr_to_fcode(_Env, _Type, {contract_pubkey, _, K}) -> {lit, {contract_pubkey, K
|
||||
expr_to_fcode(_Env, _Type, {oracle_pubkey, _, K}) -> {lit, {oracle_pubkey, K}};
|
||||
expr_to_fcode(_Env, _Type, {oracle_query_id, _, K}) -> {lit, {oracle_query_id, K}};
|
||||
|
||||
expr_to_fcode(_Env, _Type, {bytes, _, Bin = <<_:32/binary>>}) -> {lit, {hash, Bin}};
|
||||
expr_to_fcode(_Env, _Type, {bytes, _, Bin = <<_:64/binary>>}) -> {lit, {signature, Bin}};
|
||||
expr_to_fcode(_Env, _Type, {bytes, _, Bin}) -> {lit, {string, Bin}};
|
||||
|
||||
%% Variables
|
||||
|
@ -101,6 +101,7 @@
|
||||
Op =:= 'ECVERIFY' orelse
|
||||
Op =:= 'ECVERIFY_SECP256K1' orelse
|
||||
Op =:= 'CONTRACT_TO_ADDRESS' orelse
|
||||
Op =:= 'AUTH_TX_HASH' orelse
|
||||
false)).
|
||||
|
||||
-record(env, { contract, vars = [], locals = [], tailpos = true }).
|
||||
@ -235,6 +236,8 @@ lit_to_fate(L) ->
|
||||
case L of
|
||||
{int, N} -> aeb_fate_data:make_integer(N);
|
||||
{string, S} -> aeb_fate_data:make_string(S);
|
||||
{hash, H} -> aeb_fate_data:make_hash(H);
|
||||
{signature, S} -> aeb_fate_data:make_signature(S);
|
||||
{bool, B} -> aeb_fate_data:make_boolean(B);
|
||||
{account_pubkey, K} -> aeb_fate_data:make_address(K);
|
||||
{contract_pubkey, K} -> aeb_fate_data:make_contract(K);
|
||||
@ -256,8 +259,16 @@ term_to_fate({tuple, As}) ->
|
||||
aeb_fate_data:make_tuple(list_to_tuple([ term_to_fate(A) || A<-As]));
|
||||
term_to_fate({con, Ar, I, As}) ->
|
||||
FateAs = [ term_to_fate(A) || A <- As ],
|
||||
aeb_fate_data:make_variant(Ar, I, list_to_tuple(FateAs)).
|
||||
aeb_fate_data:make_variant(Ar, I, list_to_tuple(FateAs));
|
||||
term_to_fate({builtin, map_empty, []}) ->
|
||||
aeb_fate_data:make_map(#{});
|
||||
term_to_fate({'let', _, {builtin, map_empty, []}, Set}) ->
|
||||
aeb_fate_data:make_map(map_to_fate(Set)).
|
||||
|
||||
map_to_fate({op, map_set, [{var, _}, K, V]}) ->
|
||||
#{term_to_fate(K) => term_to_fate(V)};
|
||||
map_to_fate({op, map_set, [Set, K, V]}) ->
|
||||
Map = map_to_fate(Set), Map#{term_to_fate(K) => term_to_fate(V)}.
|
||||
|
||||
to_scode(_Env, {lit, L}) ->
|
||||
[push(?i(lit_to_fate(L)))];
|
||||
@ -518,7 +529,7 @@ builtin_to_scode(_Env, aens_transfer, [_, _, _, _] = _Args) ->
|
||||
builtin_to_scode(_Env, aens_revoke, [_, _, _] = _Args) ->
|
||||
?TODO(fate_aens_revoke_instruction);
|
||||
builtin_to_scode(_Env, auth_tx_hash, []) ->
|
||||
?TODO(fate_auth_tx_hash_instruction).
|
||||
[aeb_fate_ops:auth_tx_hash(?a)].
|
||||
|
||||
%% -- Operators --
|
||||
|
||||
@ -789,6 +800,7 @@ attributes(I) ->
|
||||
{'ECVERIFY', A, B, C, D} -> Pure(A, [B, C, D]);
|
||||
{'ECVERIFY_SECP256K1', A, B, C, D} -> Pure(A, [B, C, D]);
|
||||
{'CONTRACT_TO_ADDRESS', A, B} -> Pure(A, [B]);
|
||||
{'AUTH_TX_HASH', A} -> Pure(A, []);
|
||||
{'ADDRESS', A} -> Pure(A, []);
|
||||
{'BALANCE', A} -> Impure(A, []);
|
||||
{'BALANCE_OTHER', A, B} -> Impure(A, [B]);
|
||||
@ -824,10 +836,6 @@ attributes(I) ->
|
||||
'AENS_UPDATE' -> Impure(?a, []); %% TODO
|
||||
'AENS_TRANSFER' -> Impure(?a, []); %% TODO
|
||||
'AENS_REVOKE' -> Impure(?a, []); %% TODO
|
||||
'ECVERIFY' -> Pure(?a, []); %% TODO
|
||||
'SHA3' -> Pure(?a, []); %% TODO
|
||||
'SHA256' -> Pure(?a, []); %% TODO
|
||||
'BLAKE2B' -> Pure(?a, []); %% TODO
|
||||
{'ABORT', A} -> Impure(pc, A);
|
||||
{'EXIT', A} -> Impure(pc, A);
|
||||
'NOP' -> Pure(none, [])
|
||||
|
@ -57,20 +57,22 @@ compilable_contracts() ->
|
||||
["ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt", "200000", "1000"]},
|
||||
{"maps", "fromlist_i",
|
||||
["[(1, {x = 1, y = 2}), (2, {x = 3, y = 4}), (3, {x = 4, y = 4})]"]},
|
||||
{"maps", "get_i", ["1", "{}"]},
|
||||
{"maps", "get_i", ["1", "{[1] = {x = 3, y = 4}}"]},
|
||||
{"maps", "get_i", ["1", "{[1] = {x = 3, y = 4}, [2] = {x = 4, y = 5}}"]},
|
||||
{"maps", "get_i", ["1", "{[1] = {x = 3, y = 4}, [2] = {x = 4, y = 5}, [3] = {x = 5, y = 6}}"]},
|
||||
{"strings", "str_concat", ["\"test\"","\"me\""]},
|
||||
{"complex_types", "filter_some", ["[Some(1), Some(2), None]"]},
|
||||
{"complex_types", "init", ["ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ"]},
|
||||
{"__call" "init", []},
|
||||
{"bitcoin_auth", "init",
|
||||
["#0102030405060708090a0b0c0d0e0f1017181920212223242526272829303132"
|
||||
"33343536373839401a1b1c1d1e1f202122232425262728293031323334353637"]}
|
||||
{"bitcoin_auth", "authorize", ["1", "#0102030405060708090a0b0c0d0e0f101718192021222324252627282930313233343536373839401a1b1c1d1e1f202122232425262728293031323334353637"]},
|
||||
{"bitcoin_auth", "to_sign", ["#0102030405060708090a0b0c0d0e0f1017181920212223242526272829303132", "2"]}
|
||||
|
||||
].
|
||||
|
||||
not_yet_compilable(fate) ->
|
||||
["oracles", %% Oracle.register
|
||||
"events",
|
||||
"basic_auth", %% auth_tx_hash instruction
|
||||
"bitcoin_auth", %% fate_auth_tx_hash_instruction
|
||||
"address_literals", %% oracle_query_id literals
|
||||
"address_chain" %% Oracle.check_query
|
||||
];
|
||||
|
@ -120,8 +120,6 @@ compilable_contracts() ->
|
||||
not_yet_compilable(fate) ->
|
||||
["oracles", %% Oracle.register
|
||||
"events", %% events
|
||||
"basic_auth", %% auth_tx_hash instruction
|
||||
"bitcoin_auth", %% auth_tx_hash instruction
|
||||
"address_literals", %% oracle_query_id literals
|
||||
"address_chain" %% Oracle.check_query
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user