This repository was archived by the owner on Jan 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Magic caps for authorization natives #1302
Open
sirlensalot
wants to merge
9
commits into
master
Choose a base branch
from
slp/magic-caps
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
35670b2
Magic caps for authorizing natives
sirlensalot 9abdc41
add cont test yamls
sirlensalot 0364de0
refactor magic cap
sirlensalot 3f17303
add DEFINE_NAMESPACE cap
sirlensalot 2eca40d
DEFINE_NAMESPACE complete
sirlensalot 919f5f2
NAMESPACE cap, coverage for define-keyset ns entry
sirlensalot 4917ce5
NAMESPACE cap for module, iface definition
sirlensalot 0f221b8
MODULE_KEYSET magic cap done
sirlensalot e7d4741
properly acquire module governance caps at upgrade
sirlensalot 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| nonce: keyset-fail | ||
| code: |- | ||
| (define-keyset 'ks (read-keyset 'ks)) | ||
| data: | ||
| ks: ["7d0c9ba189927df85c8c54f8b5c8acd76c1d27e923abbf25a957afdf25550804"] | ||
| keyPairs: | ||
| - public: 7d0c9ba189927df85c8c54f8b5c8acd76c1d27e923abbf25a957afdf25550804 | ||
| secret: 2e8c91521479537221576a7c3c80c46d0fa3fc663804117f0c7011366dec35de | ||
| caps: | ||
| - name: pact.DEFINE_KEYSET | ||
| args: [ "other" ] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| nonce: keyset-success | ||
| code: |- | ||
| (define-keyset 'ks (read-keyset 'ks)) | ||
| data: | ||
| ks: ["7d0c9ba189927df85c8c54f8b5c8acd76c1d27e923abbf25a957afdf25550804"] | ||
| keyPairs: | ||
| - public: 7d0c9ba189927df85c8c54f8b5c8acd76c1d27e923abbf25a957afdf25550804 | ||
| secret: 2e8c91521479537221576a7c3c80c46d0fa3fc663804117f0c7011366dec35de | ||
| caps: | ||
| - name: pact.DEFINE_KEYSET | ||
| args: [ "ks" ] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| nonce: setup | ||
| code: |- | ||
| (define-namespace 'ns (read-keyset 'ks) (read-keyset 'ks)) | ||
| (namespace 'ns) | ||
| (define-keyset 'ks (read-keyset 'ks)) | ||
| data: | ||
| ks: ["7d0c9ba189927df85c8c54f8b5c8acd76c1d27e923abbf25a957afdf25550804"] | ||
| keyPairs: | ||
| - public: 7d0c9ba189927df85c8c54f8b5c8acd76c1d27e923abbf25a957afdf25550804 | ||
| secret: 2e8c91521479537221576a7c3c80c46d0fa3fc663804117f0c7011366dec35de |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| ;; ======== test governance cap acquire ======== | ||
|
|
||
| (begin-tx) | ||
| (env-data { 'k: ['ns], 'gov: ['gov] }) | ||
| (define-namespace 'ns (read-keyset 'k) (read-keyset 'k)) | ||
| (namespace 'ns) | ||
| (env-keys ['ns]) | ||
| (module govcap-acquire GOV | ||
| (defcap GOV () | ||
| (enforce-guard (read-keyset 'gov))) | ||
| (defcap OTHER () true)) | ||
| (commit-tx) | ||
|
|
||
| (begin-tx) | ||
| (env-sigs | ||
| [ { 'key: 'gov | ||
| , 'caps: [ (ns.govcap-acquire.OTHER) ] } ]) | ||
| (namespace 'ns) | ||
| ;; failure because wrong cap scoped | ||
| (module govcap-acquire GOV | ||
| (defcap GOV () true)) | ||
| (rollback-tx) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| (begin-tx "setup magic") | ||
| ;; repl tests need pseudomodule for 'env-sigs' | ||
| (module pact GOV | ||
| (defcap GOV () true) | ||
| (defcap NAMESPACE (name:string) | ||
| (enforce false "Never called")) | ||
| (defcap MODULE_KEYSET (name:string) | ||
| (enforce false "Never called")) | ||
| ) | ||
| (env-data { 'k: [ 'magic ] }) | ||
| (define-namespace 'ns (read-keyset 'k) (read-keyset 'k)) | ||
| (env-keys ['magic]) | ||
| (namespace 'ns) | ||
| (define-keyset "ns.magic" (read-keyset 'k)) | ||
| (commit-tx) | ||
|
|
||
| (begin-tx) | ||
| (namespace 'ns) | ||
| (env-sigs | ||
| [ { 'key: 'magic | ||
| , 'caps: [ (pact.MODULE_KEYSET "other") | ||
| , (pact.NAMESPACE "ns") ] | ||
| } ] ) | ||
| ;; keyset enforced on install | ||
| (module magic-module "ns.magic" | ||
| (defun f () 1)) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| (begin-tx "setup magic") | ||
| ;; repl tests need pseudomodule for 'env-sigs' | ||
| (module pact GOV | ||
| (defcap GOV () true) | ||
| (defcap MODULE_KEYSET (name:string) | ||
| (enforce false "Never called")) | ||
| ) | ||
| (env-data { 'k: [ 'magic ] }) | ||
| (define-namespace 'ns (read-keyset 'k) (read-keyset 'k)) | ||
| (env-keys ['magic]) | ||
| (namespace 'ns) | ||
| (define-keyset "ns.magic" (read-keyset 'k)) | ||
| (env-keys ['magic]) | ||
| (module magic-module "ns.magic" | ||
| (defun f () 1)) | ||
| (commit-tx) | ||
|
|
||
| (begin-tx) | ||
| (namespace 'ns) | ||
| (env-sigs | ||
| [ { 'key: 'magic | ||
| , 'caps: [(pact.MODULE_KEYSET "other")] | ||
| } ] ) | ||
| (module magic-module GOV | ||
| (defcap GOV () true)) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| (begin-tx "setup magic") | ||
| ;; repl tests need pseudomodule for 'env-sigs' | ||
| (module pact GOV | ||
| (defcap GOV () true) | ||
| (defcap NAMESPACE (name:string) | ||
| (enforce false "Never called")) | ||
| ) | ||
| (env-data { 'k: ['magic] }) | ||
| (env-keys ['magic]) | ||
| (define-namespace 'magic (read-keyset 'k) (read-keyset 'k)) | ||
| (commit-tx) | ||
|
|
||
| (begin-tx) | ||
| (namespace 'magic) | ||
| (env-sigs | ||
| [ { 'key: 'magic | ||
| , 'caps: [(pact.NAMESPACE 'other)] | ||
| } ] ) | ||
| (interface boom | ||
| (defun f ())) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| (begin-tx "setup magic") | ||
| ;; repl tests need pseudomodule for 'env-sigs' | ||
| (module pact GOV | ||
| (defcap GOV () true) | ||
| (defcap NAMESPACE (name:string) | ||
| (enforce false "Never called")) | ||
| ) | ||
| (env-data { 'k: ['magic] }) | ||
| (env-keys ['magic]) | ||
| (define-namespace 'magic (read-keyset 'k) (read-keyset 'k)) | ||
| (commit-tx) | ||
|
|
||
| (begin-tx) | ||
| (namespace 'magic) | ||
| (env-sigs | ||
| [ { 'key: 'magic | ||
| , 'caps: [(pact.NAMESPACE 'other)] | ||
| } ] ) | ||
| (module boom GOV | ||
| (defcap GOV () true)) |
Oops, something went wrong.
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.
Shouldnt this be a Fork on
FlagDiasablePact49?