kadena-io / pact

The Pact Smart Contract Language
https://docs.kadena.io/build/pact
BSD 3-Clause "New" or "Revised" License
579 stars 100 forks source link

Creating a principal namespace does nothing. #1283

Closed mvaljento closed 1 year ago

mvaljento commented 1 year ago

Issue description

Steps to reproduce

  1. Install a local Pact environment.
  2. Run the ns.create-principal-namespace command, which will return the newly created namespace identifier (for example "n_da02e06d11b85816fad4867966078855999cc56e").
  3. Check the database or try to use the namespace.

Expected Behavior

The namespace should appear in the SYS_namespaces_DATA table and be accessible in the subsequent Pact commands, for example "define-keyset". However, only the "free" namespace is available. Attempting to use the created namespace will result in "namespace: 'n_da02e06d11b85816fad4867966078855999cc56e' not defined" error. Also no other namespaces appear in the database.

Debug Information

MacOS 13.5.1 (22G90). Pact version 4.7.1.

trendzetter commented 1 year ago

https://pact-language.readthedocs.io/en/stable/pact-functions.html#define-namespace is what you want.

(define-namespace (ns.create-principal-namespace (read-keyset "ks")) (read-keyset "ks") (read-keyset "ks"))

trendzetter commented 1 year ago

afbeelding

ns.create-principal-namespace doc is somewhat implicit but it only formats the name, it doesn't actually define it on-chain.

mvaljento commented 1 year ago

Thanks for the quick and helpful answer. That worked perfectly.

The function name is somewhat misleading, but makes sense now why nothing happened. :)