Description
If the same Address appears more than once in the recipients list supplied at invoice creation, the contract silently assigns it multiple shares, resulting in double (or triple) payout to that address and a corresponding deficit for others. The contract must reject any initialize() call where the recipient list contains duplicate addresses before any storage is written.
Technical Context
contracts/split/src/lib.rs — initialize() entry point, which currently iterates recipients: Vec<RecipientShare> without uniqueness enforcement; contracts/split/src/validation.rs — add assert_unique_recipients(env: &Env, recipients: &[RecipientShare]) using a soroban_sdk::Map<Address, bool> for O(n log n) membership tracking; contracts/split/src/error.rs — add Error::DuplicateRecipient variant; the existing split_ratio_sum_validation logic in the same file serves as a structural reference for chaining validation guards.
Acceptance Criteria
Description
If the same
Addressappears more than once in therecipientslist supplied at invoice creation, the contract silently assigns it multiple shares, resulting in double (or triple) payout to that address and a corresponding deficit for others. The contract must reject anyinitialize()call where the recipient list contains duplicate addresses before any storage is written.Technical Context
contracts/split/src/lib.rs—initialize()entry point, which currently iteratesrecipients: Vec<RecipientShare>without uniqueness enforcement;contracts/split/src/validation.rs— addassert_unique_recipients(env: &Env, recipients: &[RecipientShare])using asoroban_sdk::Map<Address, bool>for O(n log n) membership tracking;contracts/split/src/error.rs— addError::DuplicateRecipientvariant; the existingsplit_ratio_sum_validationlogic in the same file serves as a structural reference for chaining validation guards.Acceptance Criteria
initialize()callsassert_unique_recipients()before writing anyDataKeyentry and returnsError::DuplicateRecipienton the first duplicate foundErrorvariants and is documented incontracts/split/src/error.rscontracts/split/src/tests/validation_tests.rsverifies that a recipient list with two identical addresses is rejected at the correct call site