|
4 | 4 |
|
5 | 5 | (begin-tx)
|
6 | 6 | (env-exec-config ["DisablePact48"])
|
| 7 | +(interface iface |
| 8 | + (defun f:bool (a:module{iface})) |
| 9 | + ) |
7 | 10 |
|
8 | 11 | (module my-mod G
|
9 | 12 | (defcap G() true)
|
10 | 13 |
|
11 | 14 | (defschema hashes h:string)
|
12 | 15 | (deftable hashes-table:{hashes})
|
| 16 | + (implements iface) |
13 | 17 |
|
14 | 18 | (defun get-hash (k:string)
|
15 | 19 | (at "h" (read hashes-table k)))
|
16 | 20 |
|
| 21 | + (defun f:bool (a:module{iface}) true) |
| 22 | + |
17 | 23 | (defun insert-hash (k:string h:string)
|
18 | 24 | (write hashes-table k {"h":h})
|
19 | 25 | (concat ["added hash ", h, " to table"])
|
|
25 | 31 | ; pre fork module hashing
|
26 | 32 | (insert-hash "a" (hash my-mod))
|
27 | 33 | (insert-hash "b" (hash my-mod))
|
| 34 | +(insert-hash "c" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) |
| 35 | +(insert-hash "d" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) |
28 | 36 | (let*
|
29 | 37 | ( (h1 (get-hash "a"))
|
30 | 38 | (h2 (get-hash "b"))
|
| 39 | + (h3 (get-hash "c")) |
| 40 | + (h4 (get-hash "d")) |
31 | 41 | )
|
32 |
| - (enforce (= h1 "eU1QsrHzLyYN9620ongvIlpxzzX1KiVGbTDBT6zbh14") "h1 does not match expected value") |
33 |
| - (enforce (= h2 "q9JZXDohMARxsVUtQWCiK7APdaiYpvqfJyq-aF3LhAA") "h2 does not match expected value") |
34 |
| - (expect-failure "hashes do not match pre-fork" (enforce (= h1 h2) "boom")) |
| 42 | + (enforce (= h1 "orgMn9G2BN4Mvq4IX7XbF016YdAhoLLtEIpUPglM3-c") "h1 does not match expected value") |
| 43 | + (enforce (= h2 "A7RKCqSxlJMPSoZshF2Rviny30yVUXK6CDnjfwKc-dU") "h2 does not match expected value") |
| 44 | + (enforce (= h3 "2Hic2Iy60yTYtCn1Ih6J7X359KAjPjdOkyEUGbR9pa8") "h3 does not match expected value") |
| 45 | + (enforce (= h4 "ltxrif1Y_w9qg2pM-V93lMjU15HIA48WBqp3RzlZ0cU") "h4 does not match expected value") |
| 46 | + (expect-failure "hashes do not match pre-fork - simple case" (enforce (= h1 h2) "boom")) |
| 47 | + (expect-failure "hashes do not match pre-fork - recursive case" (enforce (= h3 h4) "boom")) |
35 | 48 | )
|
36 | 49 |
|
37 | 50 |
|
38 | 51 | (env-exec-config [])
|
39 | 52 | ; post fork module hashing
|
40 | 53 | (insert-hash "a" (hash my-mod))
|
41 | 54 | (insert-hash "b" (hash my-mod))
|
42 |
| - |
| 55 | +(insert-hash "c" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) |
| 56 | +(insert-hash "d" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) |
43 | 57 |
|
44 | 58 | (let*
|
45 | 59 | ( (h1 (get-hash "a"))
|
46 | 60 | (h2 (get-hash "b"))
|
| 61 | + (h3 (get-hash "c")) |
| 62 | + (h4 (get-hash "d")) |
47 | 63 | )
|
48 |
| - (enforce (= h1 "0j95GFheG-uAWbGAjvTqV4QSGE74ZY38jxnNuHJ2p8A") "h1 does not match expected value") |
49 |
| - (expect "hashes match post-fork" true (enforce (= h1 h2) "boom")) |
| 64 | + (enforce (= h1 "vediBPdnKkzahPDZY2UF_hkS8i7pIXqwsCj925gLng8") "h1 does not match expected value") |
| 65 | + (enforce (= h3 "_c98nMfdnxKUdjoE7EQR9RUHfqJDJjlljL2JGGwUqiA") "h3 does not match expected value") |
| 66 | + (expect "hashes match post-fork - simple case" true (enforce (= h1 h2) "boom")) |
| 67 | + (expect "hashes match post-fork - recursive case" true (enforce (= h1 h2) "boom")) |
50 | 68 | )
|
51 | 69 | (commit-tx)
|
0 commit comments