Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 02a6731f58 | |||
| 6ca65805bd |
@@ -0,0 +1,15 @@
|
||||
{application,aebytecode,
|
||||
[{description,"A library and stand alone assembler for aeternity bytecode. This version supports AEVM bytecode and FATE bytecode."},
|
||||
{registered,[]},
|
||||
{included_applications,[]},
|
||||
{applications,[stdlib,kernel]},
|
||||
{vsn,"3.2.0"},
|
||||
{modules,[aeb_fate_code_tests,aeb_fate_data_tests,
|
||||
aeb_fate_encoding_tests,aefate_code_eqc,aefate_eqc,
|
||||
aefate_type_eqc,aeb_aevm_abi,aeb_aevm_data,aeb_asm,
|
||||
aeb_disassemble,aeb_fate_abi,aeb_fate_asm,
|
||||
aeb_fate_code,aeb_fate_data,aeb_fate_encoding,
|
||||
aeb_fate_generate_docs,aeb_fate_generate_ops,
|
||||
aeb_fate_maps,aeb_heap,aeb_memory,aeb_opcodes,
|
||||
aeb_primops,aefateasm,aeb_data_test,aeb_fate_asm_test,
|
||||
aeb_serialize_test,aebytecode_SUITE]}]}.
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
|
||||
{deps, [ {eblake2, "1.0.0"}
|
||||
, {aeserialization, {git, "https://github.com/aeternity/aeserialization.git",
|
||||
{tag, "v1.0.0"}}}
|
||||
{ref, "eb68fe3"}}}
|
||||
, {getopt, "1.0.1"}
|
||||
]}.
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
]}.
|
||||
|
||||
|
||||
{relx, [{release, {aebytecode, "3.3.0"},
|
||||
{relx, [{release, {aebytecode, "3.2.0"},
|
||||
[aebytecode, eblake2, getopt]},
|
||||
|
||||
{dev_mode, true},
|
||||
@@ -40,7 +40,7 @@
|
||||
{profiles, [{binary, [
|
||||
{deps, [ {eblake2, "1.0.0"}
|
||||
, {aeserialization, {git, "https://github.com/aeternity/aeserialization.git",
|
||||
{tag, "v1.0.0"}}}
|
||||
{ref, "47aaa8f"}}}
|
||||
, {getopt, "1.0.1"}
|
||||
]},
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{"1.2.0",
|
||||
[{<<"aeserialization">>,
|
||||
{git,"https://github.com/aeternity/aeserialization.git",
|
||||
{ref,"177bf604b2a05e940f92cf00e96e6e269e708245"}},
|
||||
{ref,"eb68fe331bd476910394966b7f5ede7a74d37e35"}},
|
||||
0},
|
||||
{<<"base58">>,
|
||||
{git,"https://github.com/aeternity/erl-base58.git",
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
, to_hexstring/1
|
||||
]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_opcodes.hrl").
|
||||
-include("aeb_opcodes.hrl").
|
||||
|
||||
|
||||
pp(Asm) ->
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
format_address/1
|
||||
]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_opcodes.hrl").
|
||||
-include("aeb_opcodes.hrl").
|
||||
|
||||
|
||||
pp(Binary) ->
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
, get_function_type_from_function_hash/2
|
||||
, abi_version/0 ]).
|
||||
|
||||
-include("../include/aeb_fate_data.hrl").
|
||||
-include("aeb_fate_data.hrl").
|
||||
|
||||
%%%===================================================================
|
||||
%%% API
|
||||
|
||||
@@ -94,8 +94,8 @@
|
||||
, to_asm/1
|
||||
]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_fate_opcodes.hrl").
|
||||
-include_lib("aebytecode/include/aeb_fate_data.hrl").
|
||||
-include("aeb_fate_opcodes.hrl").
|
||||
-include("aeb_fate_data.hrl").
|
||||
-define(HASH_BYTES, 32).
|
||||
|
||||
assemble_file(InFile, OutFile, Options) ->
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
, symbols/1
|
||||
]).
|
||||
|
||||
-include("../include/aeb_fate_opcodes.hrl").
|
||||
-include("../include/aeb_fate_data.hrl").
|
||||
-include("aeb_fate_opcodes.hrl").
|
||||
-include("aeb_fate_data.hrl").
|
||||
|
||||
-export([ update_annotations/2
|
||||
, update_functions/2
|
||||
|
||||
@@ -238,8 +238,6 @@ serialize_type({tuple, Ts}) ->
|
||||
N when N =< 255 ->
|
||||
[?TYPE_TUPLE, N | [serialize_type(T) || T <- Ts]]
|
||||
end;
|
||||
serialize_type({bytes, any}) ->
|
||||
[?TYPE_BYTES | binary_to_list(serialize_integer(-1))];
|
||||
serialize_type({bytes, N}) when 0 =< N ->
|
||||
[?TYPE_BYTES | binary_to_list(serialize_integer(N))];
|
||||
serialize_type(address) -> [?TYPE_OBJECT, ?OTYPE_ADDRESS];
|
||||
@@ -272,12 +270,8 @@ deserialize_type(<<?TYPE_TUPLE, N, Rest/binary>>) ->
|
||||
{{tuple, Ts}, Rest2};
|
||||
deserialize_type(<<?TYPE_BYTES, Rest/binary>>) ->
|
||||
{N, Rest2} = deserialize_one(Rest),
|
||||
true = is_integer(N),
|
||||
if N == -1 ->
|
||||
{{bytes, any}, Rest2};
|
||||
0 =< N ->
|
||||
{{bytes, N}, Rest2}
|
||||
end;
|
||||
true = is_integer(N) andalso N >= 0,
|
||||
{{bytes, N}, Rest2};
|
||||
deserialize_type(<<?TYPE_OBJECT, ObjectType, Rest/binary>>) ->
|
||||
case ObjectType of
|
||||
?OTYPE_ADDRESS -> {address, Rest};
|
||||
|
||||
@@ -232,25 +232,15 @@ ops_defs() ->
|
||||
|
||||
, { 'FEE', 16#a7, false, true, true, ?GAS(10), [a], fee, {}, integer, "Arg0 := The fee for the current call tx."}
|
||||
|
||||
, { 'ADDRESS_TO_BYTES', 16#a8, false, true, true, ?GAS(10), [a, a], addr_to_bytes, {address}, bytes, "Arg0 := the byte representation of the address"}
|
||||
, { 'POSEIDON', 16#a9, false, true, true, ?GAS(6000), [a, a, a], poseidon, {integer, integer}, integer, "Arg0 := the Poseidon hash of Arg1 and Arg2 - all integers in the BLS12-381 scalar field"}
|
||||
, { 'MULMOD', 16#aa, false, true, true, ?GAS(10), [a, a, a, a], mulmod, {integer, integer, integer}, integer, "Arg0 := (Arg1 * Arg2) mod Arg3"}
|
||||
, { 'BAND', 16#ab, false, true, true, ?GAS(10), [a, a, a], bin_and, {integer, integer}, integer, "Arg0 := Arg1 & Arg2"}
|
||||
, { 'BOR', 16#ac, false, true, true, ?GAS(10), [a, a, a], bin_or, {integer, integer}, integer, "Arg0 := Arg1 | Arg2"}
|
||||
, { 'BXOR', 16#ad, false, true, true, ?GAS(10), [a, a, a], bin_xor, {integer, integer}, integer, "Arg0 := Arg1 ^ Arg2"}
|
||||
, { 'BNOT', 16#ae, false, true, true, ?GAS(10), [a, a], bin_not, {integer}, integer, "Arg0 := ~Arg1"}
|
||||
, { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"}
|
||||
, { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"}
|
||||
, { 'BYTES_SPLIT_ANY', 16#b1, false, true, true, ?GAS(10), [a, a, a], bytes_split_any, {bytes, integer}, variant, "Arg0 := bytes_split_any(Arg1, Arg2), where a positive Arg2 is the length of the first chunk, and a negative Arg2 is the length of the second chunk. Returns None if byte array is not long enough."}
|
||||
, { 'BYTES_SIZE', 16#b2, false, true, true, ?GAS(10), [a, a], bytes_size, {bytes}, integer, "Arg0 := bytes_size(Arg1), returns the number of bytes in the byte array."}
|
||||
, { 'BYTES_TO_FIXED_SIZE', 16#b3, false, true, true, ?GAS(10), [a, a, a], bytes_to_fixed_size, {bytes, integer}, variant, "Arg0 := bytes_to_fixed_size(Arg1, Arg2), returns Some(Arg1') if byte_size(Arg1) == Arg2, None otherwise. The type of Arg1' is bytes(Arg2) but the value is unchanged"}
|
||||
, { 'INT_TO_BYTES', 16#b4, false, true, true, ?GAS(10), [a, a, a], int_to_bytes, {integer, integer}, bytes, "Arg0 := turn integer Arg1 into a byte array (big endian) length Arg2 (truncating if not fit)."}
|
||||
, { 'STR_TO_BYTES', 16#b5, false, true, true, ?GAS(10), [a, a], str_to_bytes, {integer}, bytes, "Arg0 := turn string Arg1 into the corresponding byte array."}
|
||||
|
||||
, { 'DBG_LOC', 16#b6, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" }
|
||||
, { 'DBG_DEF', 16#b7, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" }
|
||||
, { 'DBG_UNDEF', 16#b8, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" }
|
||||
, { 'DBG_CONTRACT', 16#b9, false, true, true, ?GAS(0), [a], dbg_contract, {string}, none, "Debug Op: Name the current contract. Args: {contract_name}"}
|
||||
, { 'ADDRESS_TO_BYTES', 16#a8, false, true, true, ?GAS(10), [a, a], addr_to_bytes, {address}, bytes, "Arg0 := the byte representation of the address"}
|
||||
, { 'POSEIDON', 16#a9, false, true, true, ?GAS(6000), [a, a, a], poseidon, {integer, integer}, integer, "Arg0 := the Poseidon hash of Arg1 and Arg2 - all integers in the BLS12-381 scalar field"}
|
||||
, { 'MULMOD', 16#aa, false, true, true, ?GAS(10), [a, a, a, a], mulmod, {integer, integer, integer}, integer, "Arg0 := (Arg1 * Arg2) mod Arg3"}
|
||||
, { 'BAND', 16#ab, false, true, true, ?GAS(10), [a, a, a], bin_and, {integer, integer}, integer, "Arg0 := Arg1 & Arg2"}
|
||||
, { 'BOR', 16#ac, false, true, true, ?GAS(10), [a, a, a], bin_or, {integer, integer}, integer, "Arg0 := Arg1 | Arg2"}
|
||||
, { 'BXOR', 16#ad, false, true, true, ?GAS(10), [a, a, a], bin_xor, {integer, integer}, integer, "Arg0 := Arg1 ^ Arg2"}
|
||||
, { 'BNOT', 16#ae, false, true, true, ?GAS(10), [a, a], bin_not, {integer}, integer, "Arg0 := ~Arg1"}
|
||||
, { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"}
|
||||
, { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"}
|
||||
|
||||
, { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."}
|
||||
, { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."}
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@
|
||||
|
||||
-export_type([binary_value/0, heap_value/0, offset/0, heap_fragment/0]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_typerep_def.hrl").
|
||||
-include_lib("aebytecode/include/aeb_heap.hrl").
|
||||
-include("aeb_typerep_def.hrl").
|
||||
-include("aeb_heap.hrl").
|
||||
|
||||
-type word() :: non_neg_integer().
|
||||
-type pointer() :: word().
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
, swap/1
|
||||
]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_opcodes.hrl").
|
||||
-include("aeb_opcodes.hrl").
|
||||
|
||||
|
||||
%%====================================================================
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{application, aebytecode,
|
||||
[{description, "Bytecode definitions, serialization and deserialization for aeternity."},
|
||||
{vsn, "3.3.0"},
|
||||
{vsn, "3.2.0"},
|
||||
{registered, []},
|
||||
{applications,
|
||||
[kernel,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{a_email,[]}.
|
||||
{author,"Aeternity Authors"}.
|
||||
{c_email,[]}.
|
||||
{copyright,"Aeternity Authors"}.
|
||||
{deps,[{"otpr","aeserialization",{0,1,0}},
|
||||
{"otpr","eblake2",{1,0,0}},
|
||||
{"otpr","getopt",{1,0,2}}]}.
|
||||
{desc,"A library and stand alone assembler for aeternity bytecode. This version supports AEVM bytecode and FATE bytecode."}.
|
||||
{file_exts,[]}.
|
||||
{key_name,none}.
|
||||
{license,skip}.
|
||||
{modules,[]}.
|
||||
{name,"AE Bytecode"}.
|
||||
{package_id,{"otpr","aebytecode",{3,2,0}}}.
|
||||
{prefix,none}.
|
||||
{repo_url,"https://github.com/aeternity/aebytecode"}.
|
||||
{tags,["aeternity","blockchain","fate","bytecode","crypto","ae"]}.
|
||||
{type,lib}.
|
||||
{ws_url,[]}.
|
||||
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
|
||||
# This is a small pre-packaging source generation and include correction script that should be
|
||||
# run before packaging this project for use with ZX/Zomp.
|
||||
|
||||
rm -rf _build
|
||||
rm -f src/aeb_fate_opcodes.erl src/aeb_fate_ops.erl include/aeb_fate_opcodes.hrl src/aeb_fate_asm_scan.xrl src/aeb_fate_pp.erl
|
||||
make sources
|
||||
cd src
|
||||
for f in $(ls --ignore=aeb_fate_generate_ops.erl | grep erl)
|
||||
do
|
||||
echo "Updating includes in: $f"
|
||||
sed -i 's/aebytecode\/include\///g' "$f"
|
||||
sed -i 's/\.\.\/include\///g' "$f"
|
||||
sed -i 's/include_lib/include/g' "$f"
|
||||
done
|
||||
rm -f ebin/*.beam
|
||||
cp aebytecode.app ebin/
|
||||
Reference in New Issue
Block a user