Document constructor auth recording in tests - #2677
Closed
leighmcculloch wants to merge 1 commit into
Closed
Conversation
|
Preview is available here: |
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.
What
Add a section to the "Test Authorization" guide explaining that
registerandregister_atrun a contract's constructor under a recording auth manager, so arequire_auth()call inside a constructor is automatically authorized without callingmock_all_auths()/mock_auths()just to register the contract.Why
This behavior has never been documented anywhere in stellar-docs, for either Wasm or native contracts, even though it's been true for Wasm contracts registered with
registerfor a while. It's worth documenting now because rs-soroban-sdk just closed out the remaining inconsistencies: PR #1933 fixedregister_atto record auth for Wasm constructors, and PR #1943 fixed native (non-Wasm, directly-registered#[contract]struct) constructors for bothregisterandregister_at, closing rs-soroban-sdk#1738. With those merged, the behavior is now uniform across register vs register_at and Wasm vs native contracts, so this is a good time to document it correctly rather than continue leaving it as tribal knowledge. The native contract fix hasn't shipped in a published release yet, so the doc avoids naming a specific future version number.Note
#2666 is an existing draft covering similar ground, opened before rs-soroban-sdk#1943 (the native-contract fix) merged. Left a comment there with the details; happy to close this in favor of an update to #2666, or the reverse, whichever is preferred.