Skip to content

Add parameter bounds validation in update_config #604

Description

@Levi-Ojukwu

Description:

The update_config function in config.rs:33-122 validates some parameters but leaves others unchecked:

  • decay_rate_bps — not bounded; could be set to 10000 (100%), instantly zeroing all reputation scores
  • decay_period_ledgers — not bounded; could be set to 0, causing division-by-zero in invoice.rs:324
  • dispute_timeout_ledgers — not bounded; could be set to 0, allowing instant auto-resolution of disputes before the payer can respond
  • high_rep_threshold — no bounds; could be set to 0, making all LPs "high reputation"

Why it matters: Malicious or misconfigured governance calls could break the reputation system, dispute resolution, or LP prioritization.

Acceptance Criteria:

  • Add min/max bounds for decay_rate_bps (e.g., 1–5000 bps)
  • Add min bound for decay_period_ledgers (e.g., ≥ 100 ledgers)
  • Add min bound for dispute_timeout_ledgers (e.g., ≥ 1440 ledgers / ~1 day)
  • Add validation that high_rep_threshold > 0
  • Return specific error codes for each validation failure
  • Add tests for each boundary condition

Relevant Files: contracts/invoice_liquidity/src/config.rs:33-122


Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions