Skip to content

test(hub): cover all auth calls with unit tests - #830

Open
MukeshVermaLegit wants to merge 1 commit into
centrifuge:mainfrom
MukeshVermaLegit:test/hub-auth-coverage-126
Open

test(hub): cover all auth calls with unit tests#830
MukeshVermaLegit wants to merge 1 commit into
centrifuge:mainfrom
MukeshVermaLegit:test/hub-auth-coverage-126

Conversation

@MukeshVermaLegit

Copy link
Copy Markdown

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 #126

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
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.

CP: Add missing tests for auth calls

1 participant