Skip to content

fix: resolve issues #342 #343 #344 #345#369

Open
abrak01 wants to merge 1 commit into
Healthy-Stellar:mainfrom
abrak01:fix/issues-342-343-344-345
Open

fix: resolve issues #342 #343 #344 #345#369
abrak01 wants to merge 1 commit into
Healthy-Stellar:mainfrom
abrak01:fix/issues-342-343-344-345

Conversation

@abrak01
Copy link
Copy Markdown

@abrak01 abrak01 commented May 29, 2026

close #342
close #343
close #344
close #345
#369

Summary

This PR fixes four issues across four contracts.


#342 — hospital-registry: before/after audit events on admin functions

Problem: Admin mutation functions emitted only a generic success event with no record of what changed.

Fix:

  • Added AuditEvent struct containing caller, timestamp, field, old_value, new_value.
  • Added emit_audit() helper that publishes the event under the audit topic.
  • Wired into all nine admin functions: set_hospital_config, update_departments, update_locations, update_equipment, update_policies, update_alerts, update_insurance_providers, update_billing, update_emergency_protocols.

#343 — multisig-governance: clean up expired proposals from storage

Problem: Expired proposals were never deleted, causing unbounded storage growth.

Fix:

  • Added ProposalIds DataKey storing a Vec<Symbol> catalog of all proposal IDs.
  • propose_multisig_action now appends each new ID to the catalog.
  • Added cleanup_expired_proposals(env) callable by anyone: iterates the catalog, removes proposals past their TTL from persistent storage, prunes the catalog, emits a cleanup event, and returns the count of removed entries.

#344 — access-control: rate limiting for consent grant/revoke

Problem: A single caller could spam thousands of consent records in one block.

Fix:

  • Added RateLimitExceeded error (code 23).
  • Added RateLimit(Address, u32) DataKey keyed by (caller, ledger_sequence).
  • Added check_rate_limit() helper that reads/increments the per-block counter and returns RateLimitExceeded once it exceeds 10.
  • Wired into grant_consent and revoke_consent immediately after require_auth.

#345 — prescription-management: cross-contract provider verification

Problem: issue_prescription accepted any provider_id without verifying it against the provider-registry.

Fix:

  • Added #[contractclient] trait ProviderRegistryInterface exposing is_provider().
  • Added ProviderRegistry DataKey to store the registry contract address.
  • Added ProviderNotRegistered error (code 23).
  • Added initialize(env, provider_registry: Address) to store the registry address once.
  • In issue_prescription, when the registry address is set, calls ProviderRegistryClient::is_provider() and returns ProviderNotRegistered if the check fails.

Testing

Cargo is not available in this environment. All changes follow existing patterns in the codebase (e.g., contractclient usage mirrors contracts/medical-claims). Tests should be run in a Rust-enabled CI environment.

…tellar#344 Healthy-Stellar#345

Healthy-Stellar#342 hospital-registry: add before/after audit events to admin functions
- Add AuditEvent struct (caller, timestamp, field, old_value, new_value)
- Add emit_audit() helper that publishes the event under 'audit' topic
- Wire into set_hospital_config, update_departments, update_locations,
  update_equipment, update_policies, update_alerts,
  update_insurance_providers, update_billing, update_emergency_protocols

Healthy-Stellar#343 multisig-governance: clean up expired proposals from storage
- Add ProposalIds DataKey to catalog all proposal IDs at propose time
- Add cleanup_expired_proposals() callable by anyone; iterates the
  catalog, removes entries past their TTL, and returns the count removed

Healthy-Stellar#344 access-control: rate-limit consent grant/revoke per block
- Add RateLimitExceeded error (code 23)
- Add RateLimit(Address, u32) DataKey keyed by (caller, ledger_sequence)
- Add check_rate_limit() helper enforcing MAX 10 ops per address per block
- Wire into grant_consent and revoke_consent

Healthy-Stellar#345 prescription-management: verify provider against provider-registry
- Add contractclient trait ProviderRegistryInterface / ProviderRegistryClient
- Add ProviderRegistry DataKey to store the registry contract address
- Add ProviderNotRegistered error (code 23)
- Add initialize(env, provider_registry) to store the registry address
- In issue_prescription, call client.is_provider() when registry is set
  and return ProviderNotRegistered if the check fails
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@abrak01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant