Skip to content

Cap allowed_tokens list length #233

Description

@kilodesodiq-arch

Problem Statement. Config.allowed_tokens is unbounded. A repeated invocation of
set_config with thousands of distinct addresses bloats the wasm instance storage
permanently.

Why it matters. Soroban host costs grow with storage footprint. The contract should
self-protect.

Technical Context. set_config writes the entire Vec<Address> each call.

Expected Outcome. A new MAX_ALLOWED_TOKENS constant (default 32) enforced in
set_config returning a new error variant Error::TooManyAllowedTokens.

Acceptance Criteria.

  • Test attempts set_config with allowed_tokens: vec[0..=MAX = 33] returns error.
  • All existing tests pass.

Files or modules likely to be affected. src/lib.rs, tests/aid_escrow_tests.rs.

Difficulty. Easy
Estimated effort. S



Backlog item #25 from `docs/maintainer-issue-backlog.md.

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions