Commit f312342
authored
Document constructor auth mocking on register (#1950)
### What
Document on the contract registration functions (`register`,
`register_at`, and the deprecated `register_contract` and
`register_contract_wasm`) that a contract's constructor is invoked with
authorization mocked during registration, and direct callers who need to
test constructor authorization to deploy the contract through the
deployer instead.
### Why
Following #1738, `register` and `register_at` switch the environment to
recording auth for the constructor call, so any `require_auth` a
constructor makes is automatically authorized and cannot be exercised
through registration. That behavior was undocumented, leaving no
guidance that constructor authorization must instead be tested by
deploying the contract the way it is deployed on-chain, via
`env.deployer().with_address(...)` and `deploy_v2`, which runs the
constructor subject to the environment's authorization.
### Known limitations
The documentation on the Stellar Asset Contract registration functions
(`register_stellar_asset_contract_v2` and
`register_stellar_asset_contract`) is intentionally left unchanged, as
those functions register a built-in contract with no user-defined
constructor and the deploy-to-test-auth guidance does not apply to them.
Close #17381 parent 014a940 commit f312342
1 file changed
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
792 | 808 | | |
793 | 809 | | |
794 | 810 | | |
| |||
853 | 869 | | |
854 | 870 | | |
855 | 871 | | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
856 | 888 | | |
857 | 889 | | |
858 | 890 | | |
| |||
914 | 946 | | |
915 | 947 | | |
916 | 948 | | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
917 | 953 | | |
918 | 954 | | |
919 | 955 | | |
| |||
1033 | 1069 | | |
1034 | 1070 | | |
1035 | 1071 | | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
1036 | 1076 | | |
1037 | 1077 | | |
1038 | 1078 | | |
| |||
0 commit comments