-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strip ALL pact value infos, recursively as well, add tests #1287
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,22 @@ | |
|
||
(begin-tx) | ||
(env-exec-config ["DisablePact48"]) | ||
(interface iface | ||
(defun f:bool (a:module{iface})) | ||
) | ||
|
||
(module my-mod G | ||
(defcap G() true) | ||
|
||
(defschema hashes h:string) | ||
(deftable hashes-table:{hashes}) | ||
(implements iface) | ||
|
||
(defun get-hash (k:string) | ||
(at "h" (read hashes-table k))) | ||
|
||
(defun f:bool (a:module{iface}) true) | ||
|
||
(defun insert-hash (k:string h:string) | ||
(write hashes-table k {"h":h}) | ||
(concat ["added hash ", h, " to table"]) | ||
|
@@ -25,27 +31,39 @@ | |
; pre fork module hashing | ||
(insert-hash "a" (hash my-mod)) | ||
(insert-hash "b" (hash my-mod)) | ||
(insert-hash "c" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this covers all cases recursively for
Literals cannot contain any pactvalues, so it's just the other 3 cases we must check. |
||
(insert-hash "d" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) | ||
(let* | ||
( (h1 (get-hash "a")) | ||
(h2 (get-hash "b")) | ||
(h3 (get-hash "c")) | ||
(h4 (get-hash "d")) | ||
) | ||
(enforce (= h1 "eU1QsrHzLyYN9620ongvIlpxzzX1KiVGbTDBT6zbh14") "h1 does not match expected value") | ||
(enforce (= h2 "q9JZXDohMARxsVUtQWCiK7APdaiYpvqfJyq-aF3LhAA") "h2 does not match expected value") | ||
(expect-failure "hashes do not match pre-fork" (enforce (= h1 h2) "boom")) | ||
(enforce (= h1 "orgMn9G2BN4Mvq4IX7XbF016YdAhoLLtEIpUPglM3-c") "h1 does not match expected value") | ||
(enforce (= h2 "A7RKCqSxlJMPSoZshF2Rviny30yVUXK6CDnjfwKc-dU") "h2 does not match expected value") | ||
(enforce (= h3 "2Hic2Iy60yTYtCn1Ih6J7X359KAjPjdOkyEUGbR9pa8") "h3 does not match expected value") | ||
(enforce (= h4 "ltxrif1Y_w9qg2pM-V93lMjU15HIA48WBqp3RzlZ0cU") "h4 does not match expected value") | ||
(expect-failure "hashes do not match pre-fork - simple case" (enforce (= h1 h2) "boom")) | ||
(expect-failure "hashes do not match pre-fork - recursive case" (enforce (= h3 h4) "boom")) | ||
) | ||
|
||
|
||
(env-exec-config []) | ||
; post fork module hashing | ||
(insert-hash "a" (hash my-mod)) | ||
(insert-hash "b" (hash my-mod)) | ||
|
||
(insert-hash "c" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) | ||
(insert-hash "d" (hash [my-mod, {'a:my-mod}, (create-user-guard (f my-mod))])) | ||
|
||
(let* | ||
( (h1 (get-hash "a")) | ||
(h2 (get-hash "b")) | ||
(h3 (get-hash "c")) | ||
(h4 (get-hash "d")) | ||
) | ||
(enforce (= h1 "0j95GFheG-uAWbGAjvTqV4QSGE74ZY38jxnNuHJ2p8A") "h1 does not match expected value") | ||
(expect "hashes match post-fork" true (enforce (= h1 h2) "boom")) | ||
(enforce (= h1 "vediBPdnKkzahPDZY2UF_hkS8i7pIXqwsCj925gLng8") "h1 does not match expected value") | ||
(enforce (= h3 "_c98nMfdnxKUdjoE7EQR9RUHfqJDJjlljL2JGGwUqiA") "h3 does not match expected value") | ||
(expect "hashes match post-fork - simple case" true (enforce (= h1 h2) "boom")) | ||
(expect "hashes match post-fork - recursive case" true (enforce (= h1 h2) "boom")) | ||
) | ||
(commit-tx) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note:
stripPactValueInfo
above isn't even enough, the author of that code did not coverPGuard
which can recursively contain pact values, the tests in this PR inhash.repl
have a case with a user guard which does indeed fail if not stripped recursively.