Skip to content

test(resource-token): prove mint/burn reject unauthorized calls (#4)#46

Merged
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
real-venus:fix/mint-auth-enforcement-tests
Jun 25, 2026
Merged

test(resource-token): prove mint/burn reject unauthorized calls (#4)#46
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
real-venus:fix/mint-auth-enforcement-tests

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

test(resource-token): prove mint/burn reject unauthorized calls

Closes #4

Changes

  • contracts/resource-token/src/test.rs
    • test_mint_rejected_without_authorizationenv.set_auths(&[]); mint
      must panic (admin has not authorized).
    • test_burn_rejected_without_authorization — same, for burn.
    • test_mint_rejected_without_auth_leaves_state_unchangedtry_mint
      returns Err, and balance + total supply remain 0.
  • contracts/docs/security/macro-auth.md — documents the real auth model and
    invariant, the scope correction, and a flagged follow-up.

…ity-Protocol#4)

The issue describes a #[requires_role] proc-macro auth bypass. No such macro
(or Role enum) exists in this codebase; mint/burn are gated by
authorize_mint/authorize_burn -> admin.require_auth(), which is sound and not
bypassable.

The real gap: every existing test uses env.mock_all_auths(), which
auto-approves all authorization, so the gate is never exercised — a
regression removing authorize_mint() from mint() would pass the whole suite.

- test.rs: add negative-auth tests using env.set_auths(&[]) (empty auth set)
  proving mint and burn panic when the admin has not authorized, and that a
  rejected mint leaves balance and total_supply unchanged (try_mint -> Err)
- docs/security/macro-auth.md: documents the actual authorization model and
  invariant, the scope correction (no macro exists), and a flagged follow-up:
  the operator-delegation path is not honored by mint/burn (admin-only),
  whose proper fix needs a breaking caller-Address signature change

No contract behaviour changes; this hardens test coverage of the
'every mint/burn is authorized' invariant.
@elizabetheonoja-art elizabetheonoja-art merged commit e66bac8 into Utility-Protocol:main Jun 25, 2026
2 checks passed
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.

Custom Validation Macro Override in Resource Tokenization Authorization

2 participants