Skip to content

Add tests for ServiceMetadata round-trip and registered/disabled slot independence #41

Description

@mikewheeleer

Test service metadata storage and slot independence

Description

set_service_metadata / get_service_metadata and the independent ServiceRegistered and ServiceDisabled slots in contracts/escrow/src/lib.rs are uncovered by contracts/escrow/src/test.rs. The contract documents that these are distinct slots — a service can be registered but not disabled, disabled but still registered with metadata preserved — yet nothing proves that toggling one leaves the others intact. This issue adds coverage for the metadata round-trip and the slot-independence invariant.

Requirements and context

  • Repository scope: Agentpay-Org/Agentpay-contracts only.
  • Cover: set_service_metadata then get_service_metadata returns the exact description + owner; never-set service returns None.
  • Cover: registering a service does not set its disabled flag; disabling a service preserves ServiceRegistered and ServiceMetadata; unregistering does not clear metadata or the disabled flag.
  • Assert is_service_registered and is_service_disabled round-trips across the toggle matrix.
  • Test-only change unless a genuine bug surfaces.

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b test/contracts-metadata-slot-independence
  • Implement changes
    • Write code in: contracts/escrow/src/lib.rs — no changes expected.
    • Write comprehensive tests in: contracts/escrow/src/test.rs — the metadata and slot-independence scenarios above.
    • Add documentation: note covered invariants in the test module header.
    • Include NatSpec-style doc comments (///) on any test helpers.
    • Validate security: state slots cannot bleed into one another.
  • Test and commit

Test and commit

  • Run cargo fmt --all -- --check, cargo build, and cargo test.
  • Cover edge cases: overwrite metadata, disable an unregistered service, register-disable-unregister sequence.
  • Include the full cargo test output and a short security notes section in the PR description.

Example commit message

test: cover service metadata round-trip and slot independence

Guidelines

  • Minimum 95 percent test coverage for impacted modules.
  • Clear, reviewer-focused documentation.
  • Timeframe: 96 hours.

Community & contribution rewards

  • 💬 Join the AgentPay community on Discord for questions, reviews, and faster merges: https://discord.gg/eXvRKkgcv
  • ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions