Skip to content

Add regression test for set_operator(operator) where operator equals the current admin address #133

Description

@Jagadeeshftw

📌 Description

set_operator accepts any Address with no check against the current admin. If the admin appoints itself as operator (set_operator(admin_address)), require_admin_or_operator's is_admin || is_operator check becomes trivially true either way, but it is worth confirming this dual-role configuration behaves correctly and doesn't, for example, produce confusing event data or double-count in any future operator-scoped view.

🧩 Requirements and context

  • Add a regression test appointing the current admin as its own operator via set_operator(admin_address).
  • Assert is_operator(admin_address) returns true and pause/unpause/extend_instance_ttl still succeed when authorized as that address.
  • Assert require_admin-only entrypoints are unaffected (the admin retains full authority independent of also holding the operator role).

🛠️ Suggested execution

  • Add the test to src/test.rs alongside existing operator-role coverage.
  • No production code changes expected unless the test surfaces an actual bug in is_operator/require_admin_or_operator.
  • Document that a dual admin/operator role is a supported (if redundant) configuration in the README's operator section.

✅ Acceptance criteria

  • A regression test confirms set_operator(admin_address) succeeds and leaves both admin and operator authority intact for that address.
  • The test would catch any future regression that assumes admin and operator are always distinct addresses.
  • README documents the dual-role configuration as intentionally supported.

🔒 Security notes

Assuming admin and operator are always distinct addresses in future code (e.g. an event or audit-log design that dedupes by role) could silently drop information about a legitimate dual-role configuration; this test guards the current, permissive behavior explicitly.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuesecuritySecurity hardening / audittestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions