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.
Test service metadata storage and slot independence
Description
set_service_metadata/get_service_metadataand the independentServiceRegisteredandServiceDisabledslots incontracts/escrow/src/lib.rsare uncovered bycontracts/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
Agentpay-Org/Agentpay-contractsonly.set_service_metadatathenget_service_metadatareturns the exactdescription+owner; never-set service returnsNone.ServiceRegisteredandServiceMetadata; unregistering does not clear metadata or the disabled flag.is_service_registeredandis_service_disabledround-trips across the toggle matrix.Suggested execution
git checkout -b test/contracts-metadata-slot-independencecontracts/escrow/src/lib.rs— no changes expected.contracts/escrow/src/test.rs— the metadata and slot-independence scenarios above.///) on any test helpers.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.cargo testoutput and a short security notes section in the PR description.Example commit message
test: cover service metadata round-trip and slot independenceGuidelines
Community & contribution rewards