Skip to content

security: compliance contract admin rotation + events for set_pools/set_disclosure_vk #60

Description

@tech-adrian

Area
contracts/compliance/src/lib.rs (admin, set_pools, set_disclosure_vk)

Problem
Two gaps in the compliance contract's admin model:

  1. admin is stored once at construction (lib.rs:141-158) and every privileged call does admin.require_auth() against that fixed address — there is no set_admin/transfer_admin anywhere. A lost admin key permanently bricks set_pools, register_kyc, and set_disclosure_vk; a compromised one can never be replaced.
  2. set_pools (lib.rs:162-172) and set_disclosure_vk (lib.rs:282-299) mutate state silently — no event is emitted, unlike register_kyc/verify_compliance/verify_disclosure, which all emit events. These are the two admin actions with the highest blast radius (set_pools changes which pools' roots/amounts are trusted for AmountMismatch/ThresholdNotMet checks; set_disclosure_vk changes the entire disclosure verification key), yet produce no monitorable trail.

Proposed change
Add a two-step propose_admin/accept_admin (or at minimum a same-tx set_admin requiring current-admin auth) for admin rotation. Add PoolsUpdatedEvent/DisclosureVkUpdatedEvent alongside the existing bump_instance calls in set_pools/set_disclosure_vk.

Acceptance Criteria

  • Admin rotation function added and tested (old admin loses access after rotation, new admin gains it)
  • PoolsUpdatedEvent and DisclosureVkUpdatedEvent emitted and tested
  • Relevant tests (just test, pnpm test, cargo test, or nargo test as applicable) pass locally and in CI
  • A screenshot or short screen recording is attached to the PR showing the change working (cargo test output covering admin rotation and the new events) — required before this can be merged.

Open your PR against the dev branch, not main. All active development merges into dev.

Discuss this issue / coordinate work: join the DShield contributor Telegram group: https://t.me/+SiGHH24No9U2MDJk

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions