Repository navigation
Conversation
Author
|
@ReinaMaze Documentation for the public mutating endpoints in
Verification caveat, stated plainly: Also worth flagging: this is a fresh change against current |
psalmuel3
force-pushed
the
docs/document-mutating-endpoints-355
branch
from
October 12, 2026 19:24
67c4caf to
ead1fcd
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
dongle-smartcontract/src/lib.rsdeclares 464 publicDongleContractfunctions; only 252 of them carried a doc comment, and none of the core flows named in the issue (register_project,update_project,add_review,request_verification,set_fee,pay_fee) did. BecauseCONTRACT_INTERFACE.mdis maintained by hand in a separate file, every undocumented entry point is a place where the contract can drift away from its published interface.This PR adds
///doc comments to 107 public endpoints — the complete mutating/state-changing surface — with 868 added lines and 0 removed. Each comment documents what the function does, its parameters, its preconditions, the authorization the body actually enforces, the state it writes, and the errors/panics it can raise (traced to concreteContractErrorvariants). No executable code, no existing comment, and no existing formatting was touched.Notable endpoints now documented, with their auth model
register_projectparams.ownermust sign (self-auth); owner must be under the active-project cap; not pausedupdate_projectadd_reviewrequest_verificationrequestermust sign and equal the project owner (maintainers and admins cannot request)set_feerequire_admin_auth); rejected withUnauthorizedwhile the admin approval threshold is > 1pay_feepayermust sign and equal the project owner; token must match the configured fee tokencreate_proposalproposermust sign and be a registered admin; recorded as first approval; auto-approved at threshold 1schedule_*/ timelock opsadd_ccol_curator,remove_ccol_curator, …)require_self_auth, with curator/creator roles distinguishedprocess_verification_expiry,process_expiry_notificationAddressargument, norequire_auth, not pause-gatedrecord_expiry_notification_sentrequire_admin_auth)Two categories worth calling out, because they are exactly the "non-obvious auth semantics" the issue asks for:
ContractError::Unauthorized) whileadmin_approval_threshold > 1, directing the caller throughcreate_proposal→approve_proposal→execute_proposalinstead.require_auth. A few helpers (for examplecancel_fee_paymentandapprove_contract_claim) compare an explicitly suppliedcaller/payeragainst stored state but never callrequire_authon that address. Rather than invent an auth rule, the doc comment states the comparison that is actually performed and flags that the address is not signature-checked. This is existing behaviour, not a change made here.Note on the earlier attempt
An earlier PR from the same contributor, #457 ("docs: document public mutation endpoints", +216 lines), was closed unmerged on 2026-09-23 without review comments. The documentation is still missing on
main, so this is a fresh change written directly against currentmain— not a rebase or resurrection of that branch — and it covers a substantially larger part of the surface (107 endpoints / 868 lines).Verification
Toolchain:
cargo 1.99.0(rustuptoolchain1.99.0-x86_64-apple-darwin) andrustfmt 1.8.0-stable, both viaexport PATH="$HOME/.cargo/bin:$PATH", run from the workspace root.cargo +1.99.0 check -p dongle-contract— exit 101, 334 errors on this branch, and 334 errors on a pristine upstreammaincheckout. Normalising both logs to(error code, message)and sorting by frequency, the signature sets are identical; both also produce zero warnings. The pre-existing parse diagnostic is the same message ("expected;, found keywordpub") at the same source position, and the edited file does not shift it.cargo check -p dongle-contract(active toolchain1.85.0) — same picture: exit 101, 335 errors on both the branch and pristinemain, with identical normalised signature sets.cargo fmt --check --all— fails, but with the same pre-existing parse error onlib.rs(expected;, found keywordpub``), so rustfmt cannot lint this crate at all onmaineither. To verify the additions themselves are format-clean I ran `rustfmt --edition 2021 --check` on a synthetic file holding real doc blocks from this change attached to stub functions: exit 0, no diff.Diff-is-comment-only proof — a
difflibunified diff of the pristinelib.rs(fetched from upstreammain) against this branch reports 868 added, 0 removed, and every added line matches^\s*//. Stripping every comment line from both files yields identical line sequences, which proves no executable line and no existing comment was modified or reordered.Caveats
cargo checkcannot pass on this repository (upstreammainitself is broken), so the change is validated by differential diagnostics under two toolchains (1.99.0 and 1.85.0) rather than a green build; identical error and warning sets across both are the strongest available evidence that comment-only edits changed nothing semantically.get_*,is_*,list_*,has_*,compare_*,export_*), so they are outside the "mutating endpoints" scope of the issue. A follow-up could cover the read surface.[Bracketed]reference links entirely, so no new rustdoc warnings are introduced.Closes #355