Description
callora-vault currently does not compile. cargo check -p callora-vault fails with 11 errors that all trace back to two copy-paste regressions in contracts/vault/src/lib.rs. Because the crate is broken, the entire cargo test --workspace, WASM size, and coverage gates cannot run, so CI is effectively red across the board. This issue restores a clean build.
The two root causes are: (1) the VaultError enum declares DuplicateRequestId = 29 twice (contracts/vault/src/lib.rs:91 and :105), and (2) two traits — Settlement (:159) and SettlementTrait (:188) — are both annotated with #[contractclient(name = "SettlementClient")], generating the SettlementClient type twice.
Requirements and context
Functional
- Remove the duplicate
DuplicateRequestId = 29 enum arm. Keep exactly one variant. Resolves error[E0428] (name defined multiple times) and error[E0081] (discriminant 29 assigned more than once).
- Fix the misleading doc comment on the surviving variant: line 90 currently reads
/// Duplicate request ID detected (code 23). but the discriminant is 29. The comment must state code 29.
- Remove the redundant second settlement client. The file defines
#[contractclient(name = "SettlementClient")] trait Settlement at contracts/vault/src/lib.rs:159 and #[soroban_sdk::contractclient(name = "SettlementClient")] trait SettlementTrait at :188. Keep one; deleting the duplicate resolves error[E0428], the error[E0592] duplicate new / receive_payment / try_receive_payment definitions, and the error[E0034] ambiguity at the SettlementClient::new(...) call sites (:676, :781).
- After the fixes,
error[E0004] (non-exhaustive match generated by the #[contracterror] macro) must also clear, since it is a downstream symptom of the duplicate discriminant.
Non-functional / repo conventions
- No behavioral change:
deduct / batch_deduct must continue to call settlement_client.receive_payment(..., to_pool=true, developer=None) exactly as today (contracts/vault/src/lib.rs:677 and :782).
- Keep the
DuplicateRequestId error code stable at 29 so existing integrators and the idempotency tests in contracts/vault/src/test_idempotency.rs keep passing.
- Do not renumber any other
VaultError codes; docs/interfaces/vault.json enumerates codes 1–28 and must be extended (not reshuffled) to add code 29.
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch
git checkout -b fix/vault-duplicate-symbols
2. Implement changes
contracts/vault/src/lib.rs — delete the duplicate DuplicateRequestId = 29 arm (:105) and fix the doc comment on the remaining one; delete one of the two duplicate settlement client trait declarations (Settlement at :159 or SettlementTrait at :188) so a single SettlementClient is generated.
docs/interfaces/vault.json — append error code 29.
3. Write/extend tests
- Confirm
contracts/vault/src/test_idempotency.rs still exercises the duplicate-request_id path returning VaultError::DuplicateRequestId; add an assertion that pins the numeric code to 29 (e.g. assert_eq!(VaultError::DuplicateRequestId as u32, 29)) so a future renumber regression is caught.
4. Test and commit
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --workspace
./scripts/check-wasm-size.sh
./scripts/coverage.sh
Example commit message
fix(vault): remove duplicate DuplicateRequestId variant and SettlementClient
The VaultError enum declared DuplicateRequestId = 29 twice and two traits
both generated a SettlementClient, breaking compilation (E0428/E0081/E0592/
E0034/E0004). Collapse to a single definition each; error code stays 29.
Guidelines
- Coverage must stay >= 95% (
scripts/coverage.sh), CI-enforced via .github/workflows/coverage.yml.
- Keep NatSpec-style
/// docs accurate; update docs/interfaces/vault.json to reflect error code 29.
- Verify
EVENT_SCHEMA.md still matches the unchanged deduct event shape.
- Timeframe: 96 hours.
Description
callora-vaultcurrently does not compile.cargo check -p callora-vaultfails with 11 errors that all trace back to two copy-paste regressions incontracts/vault/src/lib.rs. Because the crate is broken, the entirecargo test --workspace, WASM size, and coverage gates cannot run, so CI is effectively red across the board. This issue restores a clean build.The two root causes are: (1) the
VaultErrorenum declaresDuplicateRequestId = 29twice (contracts/vault/src/lib.rs:91and:105), and (2) two traits —Settlement(:159) andSettlementTrait(:188) — are both annotated with#[contractclient(name = "SettlementClient")], generating theSettlementClienttype twice.Requirements and context
Functional
DuplicateRequestId = 29enum arm. Keep exactly one variant. Resolveserror[E0428](name defined multiple times) anderror[E0081](discriminant29assigned more than once)./// Duplicate request ID detected (code 23).but the discriminant is29. The comment must state code 29.#[contractclient(name = "SettlementClient")] trait Settlementatcontracts/vault/src/lib.rs:159and#[soroban_sdk::contractclient(name = "SettlementClient")] trait SettlementTraitat:188. Keep one; deleting the duplicate resolveserror[E0428], theerror[E0592]duplicatenew/receive_payment/try_receive_paymentdefinitions, and theerror[E0034]ambiguity at theSettlementClient::new(...)call sites (:676,:781).error[E0004](non-exhaustive match generated by the#[contracterror]macro) must also clear, since it is a downstream symptom of the duplicate discriminant.Non-functional / repo conventions
deduct/batch_deductmust continue to callsettlement_client.receive_payment(..., to_pool=true, developer=None)exactly as today (contracts/vault/src/lib.rs:677and:782).DuplicateRequestIderror code stable at 29 so existing integrators and the idempotency tests incontracts/vault/src/test_idempotency.rskeep passing.VaultErrorcodes;docs/interfaces/vault.jsonenumerates codes 1–28 and must be extended (not reshuffled) to add code 29.Acceptance criteria
cargo check -p callora-vaultandcargo build --workspacesucceed with zero errors.VaultErrorcontains exactly oneDuplicateRequestId = 29arm with a correct/// ... (code 29)doc comment.SettlementClientis generated;SettlementClient::new(...)compiles withoutE0034ambiguity.cargo test --workspacepasses, includingcontracts/vault/src/test_idempotency.rs.cargo clippy --all-targets --all-features -- -D warningsis clean (the two pre-existingunreachable patternwarnings are gone).docs/interfaces/vault.jsonadds{ "code": 29, "name": "DuplicateRequestId", ... }to theerrors.codesarray.Suggested execution
1. Fork the repo and create a branch
2. Implement changes
contracts/vault/src/lib.rs— delete the duplicateDuplicateRequestId = 29arm (:105) and fix the doc comment on the remaining one; delete one of the two duplicate settlement client trait declarations (Settlementat:159orSettlementTraitat:188) so a singleSettlementClientis generated.docs/interfaces/vault.json— append error code 29.3. Write/extend tests
contracts/vault/src/test_idempotency.rsstill exercises the duplicate-request_idpath returningVaultError::DuplicateRequestId; add an assertion that pins the numeric code to29(e.g.assert_eq!(VaultError::DuplicateRequestId as u32, 29)) so a future renumber regression is caught.4. Test and commit
cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo test --workspace ./scripts/check-wasm-size.sh ./scripts/coverage.shExample commit message
Guidelines
scripts/coverage.sh), CI-enforced via.github/workflows/coverage.yml.///docs accurate; updatedocs/interfaces/vault.jsonto reflect error code 29.EVENT_SCHEMA.mdstill matches the unchangeddeductevent shape.