Add bytes(int) as type + ecverify_secp256k1
This commit is contained in:
parent
a6a2686d53
commit
230e2187ce
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,3 +24,5 @@ doc
|
|||||||
cover
|
cover
|
||||||
aefate
|
aefate
|
||||||
current_counterexample.eqc
|
current_counterexample.eqc
|
||||||
|
.rebar3
|
||||||
|
ebin
|
||||||
|
@ -189,6 +189,7 @@
|
|||||||
-define(PRIM_CALL_CRYPTO_BLAKE2B, 403).
|
-define(PRIM_CALL_CRYPTO_BLAKE2B, 403).
|
||||||
-define(PRIM_CALL_CRYPTO_SHA256_STRING, 404).
|
-define(PRIM_CALL_CRYPTO_SHA256_STRING, 404).
|
||||||
-define(PRIM_CALL_CRYPTO_BLAKE2B_STRING, 405).
|
-define(PRIM_CALL_CRYPTO_BLAKE2B_STRING, 405).
|
||||||
|
-define(PRIM_CALL_CRYPTO_ECVERIFY_SECP256K1, 410).
|
||||||
|
|
||||||
-define(PRIM_CALL_IN_AUTH_RANGE(__TTYPE__), (((__TTYPE__) > 499) andalso ((__TTYPE__) < 600))).
|
-define(PRIM_CALL_IN_AUTH_RANGE(__TTYPE__), (((__TTYPE__) > 499) andalso ((__TTYPE__) < 600))).
|
||||||
-define(PRIM_CALL_AUTH_TX_HASH, 500).
|
-define(PRIM_CALL_AUTH_TX_HASH, 500).
|
||||||
|
@ -9,3 +9,4 @@
|
|||||||
-define(TYPEREP_TYPEREP_TAG, 5).
|
-define(TYPEREP_TYPEREP_TAG, 5).
|
||||||
-define(TYPEREP_MAP_TAG, 6).
|
-define(TYPEREP_MAP_TAG, 6).
|
||||||
-define(TYPEREP_FUN_TAG, 7).
|
-define(TYPEREP_FUN_TAG, 7).
|
||||||
|
-define(TYPEREP_BYTES_TAG, 8).
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
| {list, type()}
|
| {list, type()}
|
||||||
| {option, type()}
|
| {option, type()}
|
||||||
| {tuple, [type()]}
|
| {tuple, [type()]}
|
||||||
|
| {bytes, non_neg_integer()}
|
||||||
| {variant, [[type()]]}.
|
| {variant, [[type()]]}.
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ to_binary1(function, Address) -> to_binary1({?TYPEREP_FUN_TAG}, Address);
|
|||||||
to_binary1({list, T}, Address) -> to_binary1({?TYPEREP_LIST_TAG, T}, Address);
|
to_binary1({list, T}, Address) -> to_binary1({?TYPEREP_LIST_TAG, T}, Address);
|
||||||
to_binary1({option, T}, Address) -> to_binary1({variant, [[], [T]]}, Address);
|
to_binary1({option, T}, Address) -> to_binary1({variant, [[], [T]]}, Address);
|
||||||
to_binary1({tuple, Ts}, Address) -> to_binary1({?TYPEREP_TUPLE_TAG, Ts}, Address);
|
to_binary1({tuple, Ts}, Address) -> to_binary1({?TYPEREP_TUPLE_TAG, Ts}, Address);
|
||||||
|
to_binary1({bytes, Len}, Address) -> to_binary1({?TYPEREP_BYTES_TAG, Len}, Address);
|
||||||
to_binary1({variant, Cons}, Address) -> to_binary1({?TYPEREP_VARIANT_TAG, Cons}, Address);
|
to_binary1({variant, Cons}, Address) -> to_binary1({?TYPEREP_VARIANT_TAG, Cons}, Address);
|
||||||
to_binary1({map, K, V}, Address) -> to_binary1({?TYPEREP_MAP_TAG, K, V}, Address);
|
to_binary1({map, K, V}, Address) -> to_binary1({?TYPEREP_MAP_TAG, K, V}, Address);
|
||||||
to_binary1({variant, Tag, Args}, Address) ->
|
to_binary1({variant, Tag, Args}, Address) ->
|
||||||
@ -187,6 +188,11 @@ from_binary(_, bool, _, V) ->
|
|||||||
0 -> false;
|
0 -> false;
|
||||||
1 -> true
|
1 -> true
|
||||||
end;
|
end;
|
||||||
|
from_binary(_, {bytes, Len}, _Heap, V) when Len =< 32 ->
|
||||||
|
V;
|
||||||
|
from_binary(Visited, {bytes, Len}, Heap, V) ->
|
||||||
|
Words = (31 + Len) div 32,
|
||||||
|
from_binary(Visited, {tuple, lists:duplicate(Words, word)}, Heap, V);
|
||||||
from_binary(_, string, Heap, V) ->
|
from_binary(_, string, Heap, V) ->
|
||||||
StringSize = heap_word(Heap,V),
|
StringSize = heap_word(Heap,V),
|
||||||
BitAddr = 8*(V+32),
|
BitAddr = 8*(V+32),
|
||||||
@ -248,7 +254,8 @@ from_binary(Visited, typerep, Heap, V) ->
|
|||||||
?TYPEREP_TUPLE_TAG -> {tuple, Arg({list, typerep})};
|
?TYPEREP_TUPLE_TAG -> {tuple, Arg({list, typerep})};
|
||||||
?TYPEREP_VARIANT_TAG -> {variant, Arg({list, {list, typerep}})};
|
?TYPEREP_VARIANT_TAG -> {variant, Arg({list, {list, typerep}})};
|
||||||
?TYPEREP_MAP_TAG -> {map, Arg(typerep), Arg1(typerep, 2)};
|
?TYPEREP_MAP_TAG -> {map, Arg(typerep), Arg1(typerep, 2)};
|
||||||
?TYPEREP_FUN_TAG -> function
|
?TYPEREP_FUN_TAG -> function;
|
||||||
|
?TYPEREP_BYTES_TAG -> {bytes, Arg(word)}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
map_binary_to_value(KeyType, ValType, N, Bin, Ptr) ->
|
map_binary_to_value(KeyType, ValType, N, Bin, Ptr) ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user