Skip to content

Implement On-Chain Role Delegation with Expiration (Time-Bound Roles) #99

@thlpkee20-wq

Description

@thlpkee20-wq

Description
Extend access control roles to support time-bound delegation (e.g., grant Reporter role to an address until a given period end or timestamp).

Requirements and context

  • Must allow granting roles with an expiration (e.g., block height, ledger sequence, or logical period).
  • Must ensure expired roles are treated as inactive in all auth checks.
  • Must emit events when roles are granted, renewed, or naturally expire (if possible).

Suggested execution

  • Branch: git checkout -b feature/time-bound-role-delegation.
  • Extend role storage to include an expiration field; design how time/period is measured (e.g., period_id, block timestamp if available).
  • Update auth checks to reject expired roles.
  • Add methods to renew or revoke roles explicitly.
  • Add tests in src/test.rs to verify expiration and renewal behavior, including boundary conditions.

Test and commit

  • Run cargo test.
  • Cover edge cases: role granted without expiration, expiration at current period, expired role used after threshold.
  • Include test output and document how off-chain systems should reason about role expiry.

Example commit message
feat(contracts): add time-bound role delegation for offerings

Guidelines

  • Minimum 95 percent test coverage.
  • Clear documentation about the time/period source used for role expiry.
  • Timeframe: 96 hours.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions