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

Namespaces or so for naming constraints, constants and shorthands #247

Open
OlivierBBB opened this issue Aug 5, 2024 · 0 comments
Open

Comments

@OlivierBBB
Copy link
Collaborator

OlivierBBB commented Aug 5, 2024

Main point

Our constraints are complex and unreadable because we lack a name space mechanism (or whatever the right terminology would apply.) Constraints, shorthands, constants etc ... are unaware of where they live. This point was raised early on but never resolved, for intrinsic lisp reasons IIRC. However this question arises anew (for me at least) as our current format will make constraint reading unbelievably tedious and complex for auditors. What can be done about this ?

Some acceptable workarounds would be for instance to have some numerical types with special syntax highlighting e.g.

AccountRowOffset          ;; int, make it red
ContextRowOffset          ;; int, make it yellow
StorageRowOffset          ;; int, make it green
MiscellaneousRowOffset    ;; int, make it orange
TransactionRowOffset      ;; int, make it blue

E.g. they could be declared with aliases of (defconst ... e.g. (defAccountRowOffset ... and maybe use the syntax highlighting tools to colour names accordingly in the text.

Illustrations

  • Constraints are unaware of the folder structure so in order to disambiguate we give them long names (this is particularly true in the hub)
image
  • we need precise names for various numerical constants as many constants will coincide numerically but not semantically
image
  • this complexity is reflected in our constraints but the constraints are unaware of types etc ... making them very hard to read e.g. below the first and only argument of
(weighted-MISC-flag-sum    precompile-processing---BLAKE2f---misc-row-offset---BLAKE-parameter-extraction)
image

Similarly the boolean preceing the MISC_WEIGHT_MMU is preceded by manually added namespace stuff

(precompile-processing---BLAKE2f---OOB-hub-success)
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

No branches or pull requests

1 participant