This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 112
Principal namespaces #1507
Merged
Merged
Principal namespaces #1507
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
9ca72b6
update pact for pact-4.4
emilypi 7fb035d
update warp tls
jmcardon 878cf4b
Merge branch 'master' into feat/integrate-pact44
edmundnoble 34ad004
set up initial gas environment
jmcardon 3f485e6
fix merge conflicts
jmcardon 76d5ae6
wip fix tests
jmcardon 9f51bc1
fix rosetta gas bound
jmcardon 6a052aa
update pin to latest master
jmcardon ea2c899
Fix spcae mistake in ns.pact
jmcardon 01b5778
merge master
emilypi fab4b49
merge master
emilypi 3ac3196
get started on pactinprocapi test
emilypi 7ea8f31
wip tests to pre/post fork conditions in define-keyset
jmcardon 12914a2
all tests pre-post fork
jmcardon f3c7ec2
update pin with latest master
jmcardon ab14aa9
Remove now nonexistent flag
edmundnoble 98d29e9
initial rewrite
emilypi 5736a63
remove unnecessary flag
emilypi 1e502f0
parser fixes
jmcardon 463c780
kludgy first implementation
emilypi a0e104f
WIP repl tests
emilypi 0deff95
Add initial coverage, get code working
emilypi 405d35a
latest pact master
jmcardon 6688d46
bless old contract
emilypi dab259b
Merge branch 'feat/integrate-pact44' into feat/principal-namespaces
emilypi 7d96a95
add ns-v2.yaml
emilypi e980f22
hook up repl tests to pact tests for ns (v1 and v2)
emilypi 58c8789
Merge branch 'master' into feat/principal-namespaces
emilypi eccced7
undo checkpointer change
emilypi 6547c57
move stale logic out of contract defn
emilypi e21f1d3
Merge branch 'master' into feat/principal-namespaces
emilypi 1b9a00f
Merge branch 'master' into feat/principal-namespaces
sirlensalot b836725
Principal namespaces: use hashes, rework upgrade methodology (#1534)
sirlensalot f2f09cc
Merge branch 'master' into feat/principal-namespaces
emilypi 1cb0e16
Merge branch 'master' into feat/principal-namespaces
emilypi 3378b52
add typecheck for principal type + test
emilypi f7c83af
Merge branch 'master' into feat/principal-namespaces
emilypi 2a7b1ae
Merge branch 'master' into feat/principal-namespaces
emilypi 3320655
Merge branch 'feat/principal-namespaces' of github.com:kadena-io/chai…
emilypi 7ebe5a7
Merge branch 'master' into feat/principal-namespaces
emilypi 0516230
add (wip) test for failed upgrade + comments
emilypi a7b8f9f
purge pact history
emilypi 272cdb4
add weird test for upgrades
emilypi 9b1eb09
stuarts comments
emilypi 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| codeFile: ../../namespaces/ns.pact | ||
| codeFile: ../../namespaces/v1/ns.pact | ||
| data: | ||
| ns-admin-keyset: | ||
| keys: | ||
|
|
||
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,92 @@ | ||
|
|
||
| (define-keyset 'ns-admin-keyset (read-keyset 'ns-admin-keyset)) | ||
| (define-keyset 'ns-operate-keyset (read-keyset 'ns-genesis-keyset)) | ||
|
|
||
| (module ns GOVERNANCE | ||
| "Administers definition of new namespaces in Chainweb." | ||
|
|
||
| (defschema reg-entry | ||
| admin-guard:guard | ||
| active:bool) | ||
|
|
||
| (deftable registry:{reg-entry}) | ||
|
|
||
| (defcap GOVERNANCE () | ||
| (enforce-keyset 'ns-admin-keyset)) | ||
|
|
||
| (defcap OPERATE () | ||
| (enforce-keyset 'ns-operate-keyset)) | ||
|
|
||
| (defconst GUARD_SUCCESS (create-user-guard (success))) | ||
| (defconst GUARD_FAILURE (create-user-guard (failure))) | ||
|
|
||
| (defun success () | ||
| true) | ||
| (defun failure () | ||
| (enforce false "Disabled")) | ||
|
|
||
| (defun validate-name (name) | ||
| (enforce (!= "" name) "Empty name not allowed") | ||
| (enforce (< (length name) 64) "Name must be less than 64 characters long") | ||
| (enforce (is-charset CHARSET_LATIN1 name) | ||
| "Name must be in latin1 charset")) | ||
|
|
||
| (defun validate:bool | ||
| ( ns-name:string | ||
| ns-admin:guard | ||
| ) | ||
| " Manages namespace install for Chainweb. Requires active row in registry \ | ||
| \ for NS-NAME with guard matching NS-ADMIN." | ||
|
|
||
| (validate-name ns-name) | ||
|
|
||
| (with-default-read registry ns-name | ||
| { 'admin-guard : ns-admin | ||
| , 'active : false } | ||
| { 'admin-guard := ag | ||
| , 'active := is-active } | ||
|
|
||
| (enforce is-active "Inactive or unregistered namespace") | ||
| (enforce (= ns-admin ag) "Admin guard must match guard in registry") | ||
|
|
||
| true)) | ||
|
|
||
| (defun write-registry:string | ||
| ( ns-name:string | ||
| guard:guard | ||
| active:bool | ||
| ) | ||
| " Write entry with GUARD and ACTIVE into registry for NAME. \ | ||
| \ Guarded by operate keyset. " | ||
|
|
||
| (with-capability (OPERATE) | ||
|
|
||
| (validate-name ns-name) | ||
|
|
||
| (write registry ns-name | ||
| { 'admin-guard: guard | ||
| , 'active: active }) | ||
|
|
||
| "Register entry written")) | ||
|
|
||
| (defun query:object{reg-entry} | ||
| ( ns-name:string ) | ||
| (read registry ns-name)) | ||
|
|
||
| ) | ||
|
|
||
| (create-table registry) | ||
|
|
||
| (write-registry "kadena" | ||
| (keyset-ref-guard 'ns-operate-keyset) true) | ||
| (write-registry "user" GUARD_FAILURE true) | ||
| (write-registry "free" GUARD_FAILURE true) | ||
|
|
||
| (define-namespace "kadena" | ||
| (keyset-ref-guard 'ns-operate-keyset) | ||
| (keyset-ref-guard 'ns-operate-keyset)) | ||
|
|
||
| (define-namespace "user" GUARD_SUCCESS GUARD_FAILURE) | ||
| (define-namespace "free" GUARD_SUCCESS GUARD_FAILURE) | ||
| ;;rotate to real operate keyset | ||
| (define-keyset 'ns-operate-keyset (read-keyset 'ns-operate-keyset)) |
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.
Uh oh!
There was an error while loading. Please reload this page.