test(hub): cover all auth calls with unit tests - #830
Open
MukeshVermaLegit wants to merge 1 commit into
Open
Conversation
Adds the missing unauthorized-caller assertions for every `auth`-gated entrypoint on the hub, taking coverage from 27/37 to 37/37. `ShareClassManager` (the contract the issue names, formerly `SingleShareClass`) had no auth assertions at all, despite its test constructing it with `address(this)` as the ward: - ShareClassManager: addShareClass, updateSharePrice, updateMetadata, updateShares (0/4 -> 4/4) - Holdings: setSnapshotHook, setSnapshot, callOnSyncSnapshot, callOnTransferSnapshot (7/11 -> 11/11) - HubRegistry: registerAsset, setHubRequestManager (5/7 -> 7/7) - Hub: updateAccountingAmount, updateAccountingValue (2/4 -> 4/4) Each new assertion was mutation-tested: removing the `auth` modifier from the corresponding function makes it fail, so none pass vacuously. Before this change, stripping all four `auth` modifiers from ShareClassManager left the hub unit suite fully green. Tests only, no source changes. Follows each file's existing convention (grouped `testErrNotAuthorized` where one exists, per-function contracts in Holdings.t.sol). Closes centrifuge#126
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.
Adds the missing unauthorized-caller assertions for every
auth-gated entrypoint on the hub, taking coverage from 27/37 to 37/37.ShareClassManager(the contract the issue names, formerlySingleShareClass) had no auth assertions at all, despite its test constructing it withaddress(this)as the ward:Each new assertion was mutation-tested: removing the
authmodifier from the corresponding function makes it fail, so none pass vacuously. Before this change, stripping all fourauthmodifiers from ShareClassManager left the hub unit suite fully green.Tests only, no source changes. Follows each file's existing convention (grouped
testErrNotAuthorizedwhere one exists, per-function contracts in Holdings.t.sol).Closes #126