File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ module Applib.Show;
2
+
3
+ import Stdlib.Prelude open;
4
+ import Stdlib.Math open;
5
+
6
+ --- non-builtin equivalent of ;natToString;
7
+ terminating
8
+ recursiveNatToString (n : Nat) : String :=
9
+ let
10
+ showDigit (d : Nat) : String :=
11
+ if
12
+ | d == 0 := "0"
13
+ | d == 1 := "1"
14
+ | d == 2 := "2"
15
+ | d == 3 := "3"
16
+ | d == 4 := "4"
17
+ | d == 5 := "5"
18
+ | d == 6 := "6"
19
+ | d == 7 := "7"
20
+ | d == 8 := "8"
21
+ | d == 9 := "9"
22
+ | else := "impossible";
23
+ in if
24
+ | n < 10 := showDigit n
25
+ | else := recursiveNatToString (div n 10) ++ showDigit (mod n 10);
Original file line number Diff line number Diff line change 1
1
module BaseLayer.ResourceMachine;
2
2
3
3
import BaseLayer.AnomaAtom open public;
4
+ import Applib.Show open;
4
5
import Anoma.Encode open;
5
6
import Stdlib.Debug open;
6
7
import Anoma.Builtin.System open;
@@ -215,7 +216,10 @@ with
215
216
| else :=
216
217
trace "bytearraysize: "
217
218
>-> trace (ByteArray.size b)
218
- >-> failwith "Nonce.fromByteArray incorrect size";
219
+ >-> failwith
220
+ ("Nonce.fromByteArray incorrect size. Was passed a bytearray with size "
221
+ ++ recursiveNatToString (ByteArray.size b)
222
+ ++ ".");
219
223
220
224
from32SizedByteArray : ByteArray -> Nonce := fromByteArray;
221
225
You can’t perform that action at this time.
0 commit comments