From 1688f85f2bbe86bb516fed55f064b9a0f3f09986 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Thu, 22 Jun 2023 08:35:32 +0200 Subject: [PATCH 1/3] Add NETWORK_ID and push DBG_* to higher opcodes --- src/aeb_fate_generate_ops.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index ff501e6..70d1aca 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -246,11 +246,12 @@ ops_defs() -> , { '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."} + , { 'NETWORK_ID', 16#b6, false, true, true, ?GAS(10), [a], network_id, {}, string, "Arg0 := The network_id of the chain."} - , { '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}"} + , { 'DBG_LOC', 16#f0, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } + , { 'DBG_DEF', 16#f1, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } + , { 'DBG_UNDEF', 16#f2, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } + , { 'DBG_CONTRACT', 16#f3, false, true, true, ?GAS(0), [a], dbg_contract, {string}, none, "Debug Op: Name the current contract. Args: {contract_name}"} , { '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."} From f4c378288836ba74c96d196ba4fe93bcd966b1a6 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Thu, 22 Jun 2023 10:08:41 +0200 Subject: [PATCH 2/3] Patch check_numbering to allow for DBG_ at end --- src/aeb_fate_generate_ops.erl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 70d1aca..d71ef72 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -32,6 +32,7 @@ check_numbering(N, [T|Rest]) -> OpCode = element(2, T), case OpCode of N -> check_numbering(N+1, Rest); + 16#f0 -> check_numbering(16#f0+1, Rest); 16#fa -> check_numbering(16#fa+1, Rest); _ when OpCode < N -> {duplicate_opcode, OpCode}; _ when OpCode > N -> {missing_opcode, N} From 37808419a8b754c5322ff0ffa02db6ef304d2487 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Thu, 22 Jun 2023 10:12:46 +0200 Subject: [PATCH 3/3] Bump version to 3.4.0 --- rebar.config | 2 +- src/aebytecode.app.src | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 5d0abd5..7caf807 100644 --- a/rebar.config +++ b/rebar.config @@ -29,7 +29,7 @@ ]}. -{relx, [{release, {aebytecode, "3.3.0"}, +{relx, [{release, {aebytecode, "3.4.0"}, [aebytecode, eblake2, getopt]}, {dev_mode, true}, diff --git a/src/aebytecode.app.src b/src/aebytecode.app.src index f4b4af1..e91bfd0 100644 --- a/src/aebytecode.app.src +++ b/src/aebytecode.app.src @@ -1,6 +1,6 @@ {application, aebytecode, [{description, "Bytecode definitions, serialization and deserialization for aeternity."}, - {vsn, "3.3.0"}, + {vsn, "3.4.0"}, {registered, []}, {applications, [kernel,