Skip to content
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

KIP-0029: Proposal of new guard type: Constant boolean guard #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CryptoPascal31
Copy link

@CryptoPascal31 CryptoPascal31 commented Feb 14, 2024

The idea is to propose a new guard, the most simple as possible, the easiest to understand.

But it's currently missing, and would be very useful, and would improve the clarity.
Nothing revolutionary.

https://github.com/CryptoPascal31/KIPs/blob/119fe2df7df6a42bba7f46c406ca631aec95e99a/kip-0029.md


@daplcor
Copy link

daplcor commented Feb 14, 2024

This seems extremely useful, I assume it would help with things like the function below. You can type specify bool, arrays, objects, strings, but not guards that I am aware of. So we end up having to add extra helper functions which serve no real purpose.
(defcap USERPAY (account:string)
(with-default-read taxes account {'guard: (create-null-guard) } {'guard:=guard}
(if (!= guard (create-null-guard))
(enforce-guard (at 'guard (coin.details account)))
(enforce-guard guard)
)
)
)

(defun enforce-null:bool
()
false)

(defun create-null-guard:guard
()
(create-user-guard (enforce-null)))

@jmcardon
Copy link
Member

jmcardon commented Feb 11, 2025

Apologies for the late reply on this one, but this one is achievable with userland code.

(module m g (defcap g () true)
  (defun enforce-bool (b:bool) (enforce b "boolean guard failed"))
  (defun create-boolean-guard:guard (b:bool) (create-user-guard (enforce-bool b)))

@CryptoPascal31
Copy link
Author

Apologies for the late reply on this one, but this one is achievable with userland code.

(module m g (defcap g () true)
  (defun enforce-bool (b:bool) (enforce b "boolean guard failed"))
  (defun create-boolean-guard:guard (b:bool) (create-user-guard (enforce-bool b)))

Yes of course it is.
But IMHO, such a common and simple need should be handled and guaranteed by the language itself.

Plus, having an associated clean principal (as I propose) would improve a lot of transparency and security for non-technical users. Everybody should be able to identify quickly Burn / "Free to use" accounts.

Because with a userland workaround, anybody who wants to verify what's going on:

  • need to check the associated userland function,
  • check the code of the function.
  • check the governance and upgrade conditions of the module...

I can give you an example:
Everybody thinks that the free namespace is "free"... But everybody is wrong, In fact:

  • It's guard given by describe-namespace is a user guard to ns.success
  • While the function ns.success is correct, the module ns can be upgraded by ns-admin-keyset (probably Kadena 😉)
  • Basically, it means that the owners of these keys could revoke the authorization of the free userspace at anytime. => I believe this is obviously not considered... 😃

Having a constant boolean guard, managed by Pact, would allow fulfilling such use-cases more easily and without any possible ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants