-
Notifications
You must be signed in to change notification settings - Fork 81
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
SIP - Contract Documentation Standard #32
base: main
Are you sure you want to change the base?
Conversation
Agree with this. Arkadiko is following this convention on all their public functions. |
The sip should contain a specification about documenting a minified contract, in particular about adding a reference to a fully documented version of the contract. That would imply a standardization of minification. Is that out of scope? |
I agree this would be very valuable. I'd love to see something included that would allow wallets and explorers to show details about errors as well. For example, something like:
This could then be used to show "Error: Balance too low" instead of just showing "(err u67)". |
Instead of storing this data on-chain, a
would be more efficient, and would better support localization. |
I do like the idea of having the contract point off-chain for detailed documentation, but what would be the argument for having some structured on-chain documentation and some off-chain? Is that because we could consider the description, parameter explanation, and post conditions vital to the security, but the error message as just a convenience? |
If the documentation is stored to a link off-chain, the documentation can change independently of the contract. |
The hash(es) of the documentation could be stored on-chain if this is a concern. |
We should consider this topic together with the suggestion in stacks-network/stacks-core#2926 which discusses storing a minified version of the contract. If we decide to do that, then it would reduce the cost of including significant amounts of comments directly in the contract. |
We'd be very interested in leveraging the data that conforms to such a standard in the Hiro Wallet during transaction signing to better present and explain the contract being signed. Currently, the contract name and arguments alone can be quite cryptic for non-technical users. |
To be clear, stacks-network/stacks-core#2926 refers to compression, not minification. I want to emphasize that the compression algorithm will not attempt to parse the contract code body. |
I suggest that we use a specific notation for doc comments (such as Just like JSDoc uses |
We had a discussion about |
I think I could find some use case where it would be useful to have it on mainnet. But yes, if deployment costs are an important consideration, we could have an option to remove docs comment on deploy |
I am all for a reasonable documentation on-chain. How to represent
|
@friedger I see, I didn't consider "off-chain docs, including docs not for doc-gen" Anyway, I'm in favor of using a special comment notation for |
Ludo suggested keywords starting with Combined with |
yeah that could work but I'm not sure it would be perfect. I think it would be easier to have the discussion on a PR comments or on Discord rather than in the PR main thread |
Noting some discussion items here from the Clarity WG call:
|
…e more readable, Changed documentation to fit this SIP stacksgov/sips#32
Creating this SIP as a draft to collect ideas and feedbacks.
What's our take on standardizing contract documentation?
If we were sharing a standard (a la doxygen or something), like:
Then I think that the overall experience for users interacting with contracts could be enhanced, by explaining what will be done with args and post conditions.
Ideally, if we can converge on a convention, then the
stacks-api
could handle the mapping, and expose a documented ABI, that wallet can consume.Thoughts?