Skip to content

Document constructor auth recording in tests - #2677

Closed
leighmcculloch wants to merge 1 commit into
mainfrom
docs-test-contract-constructor-auth
Closed

Document constructor auth recording in tests#2677
leighmcculloch wants to merge 1 commit into
mainfrom
docs-test-contract-constructor-auth

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Jul 22, 2026

Copy link
Copy Markdown
Member

What

Add a section to the "Test Authorization" guide explaining that register and register_at run a contract's constructor under a recording auth manager, so a require_auth() call inside a constructor is automatically authorized without calling mock_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 register for a while. It's worth documenting now because rs-soroban-sdk just closed out the remaining inconsistencies: PR #1933 fixed register_at to record auth for Wasm constructors, and PR #1943 fixed native (non-Wasm, directly-registered #[contract] struct) constructors for both register and register_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.

@stellar-jenkins-ci

Copy link
Copy Markdown

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.

1 participant